convert more structs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Animancer;
|
||||
using BrewMonster;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -11,7 +12,7 @@ public class PlayerVisual : MonoBehaviour
|
||||
|
||||
private void PlayActionEventHandler(PlayActionEvent @event)
|
||||
{
|
||||
BrewMonster.BMLogger.Log("PlayActionEventHandler : "+@event.AnimationName);
|
||||
BMLogger.Log("PlayActionEventHandler : "+@event.AnimationName);
|
||||
animancer.TryPlay(@event.AnimationName);
|
||||
}
|
||||
|
||||
@@ -20,13 +21,13 @@ public class PlayerVisual : MonoBehaviour
|
||||
animancer = GetComponentInChildren<NamedAnimancerComponent>();
|
||||
if(animancer == null)
|
||||
{
|
||||
BrewMonster.BMLogger.LogError("animancer == null");
|
||||
BMLogger.LogError("animancer == null");
|
||||
return;
|
||||
}
|
||||
var player = GetComponentInParent<EC_Player>();
|
||||
if(player == null)
|
||||
{
|
||||
BrewMonster.BMLogger.LogError("player == null");
|
||||
BMLogger.LogError("player == null");
|
||||
return;
|
||||
}
|
||||
_playerInfo = player.GetPlayInfo();
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace PerfectWorld.Scripts.Task
|
||||
if (pTask.m_FixedData.m_bSkillTask) m_SkillTaskLst.Add(pTask);
|
||||
|
||||
//todo: recheck m_DynTaskType type
|
||||
if (!string.IsNullOrEmpty(pTask.m_FixedData.m_DynTaskType))
|
||||
if (pTask.m_FixedData.m_DynTaskType != '\0')
|
||||
{
|
||||
if (m_DynTaskMap.TryGetValue(pTask.m_FixedData.m_ID, out ATaskTempl task))
|
||||
{
|
||||
|
||||
@@ -4,6 +4,159 @@ using UnityEngine;
|
||||
|
||||
namespace PerfectWorld.Scripts.Task
|
||||
{
|
||||
public class TaskInterfaceConstants
|
||||
{
|
||||
// Task Prerequisite Error Code
|
||||
public const int TASK_PREREQU_FAIL_INDETERMINATE = 1;
|
||||
public const int TASK_PREREQU_FAIL_NOT_ROOT = 2;
|
||||
public const int TASK_PREREQU_FAIL_SAME_TASK = 3;
|
||||
public const int TASK_PREREQU_FAIL_NO_SPACE = 4;
|
||||
public const int TASK_PREREQU_FAIL_FULL = 5;
|
||||
public const int TASK_PREREQU_FAIL_CANT_REDO = 6;
|
||||
public const int TASK_PREREQU_FAIL_BELOW_LEVEL = 7;
|
||||
public const int TASK_PREREQU_FAIL_ABOVE_LEVEL = 8;
|
||||
public const int TASK_PREREQU_FAIL_NO_ITEM = 9;
|
||||
public const int TASK_PREREQU_FAIL_BELOW_REPU = 10;
|
||||
public const int TASK_PREREQU_FAIL_CLAN = 11;
|
||||
public const int TASK_PREREQU_FAIL_WRONG_GENDER = 12;
|
||||
public const int TASK_PREREQU_FAIL_NOT_IN_OCCU = 13;
|
||||
public const int TASK_PREREQU_FAIL_WRONG_PERIOD = 14;
|
||||
public const int TASK_PREREQU_FAIL_PREV_TASK = 15;
|
||||
public const int TASK_PREREQU_FAIL_MAX_RCV = 16;
|
||||
public const int TASK_PREREQU_FAIL_NO_DEPOSIT = 17;
|
||||
public const int TASK_PREREQU_FAIL_NO_TASK = 18;
|
||||
public const int TASK_PREREQU_FAIL_NOT_CAPTAIN = 19;
|
||||
public const int TASK_PREREQU_FAIL_ILLEGAL_MEM = 20;
|
||||
public const int TASK_PREREQU_FAIL_WRONG_TIME = 21;
|
||||
public const int TASK_PREREQU_FAIL_NO_SUCH_SUB = 22;
|
||||
public const int TASK_PREREQU_FAIL_MUTEX_TASK = 23;
|
||||
public const int TASK_PREREQU_FAIL_NOT_IN_ZONE = 24;
|
||||
public const int TASK_PREREQU_FAIL_WRONG_SUB = 25;
|
||||
public const int TASK_PREREQU_FAIL_OUTOF_DIST = 26;
|
||||
public const int TASK_PREREQU_FAIL_GIVEN_ITEM = 27;
|
||||
public const int TASK_PREREQU_FAIL_LIVING_SKILL = 28;
|
||||
public const int TASK_PREREQU_FAIL_SPECIAL_AWARD = 29;
|
||||
public const int TASK_PREREQU_FAIL_GM = 30;
|
||||
public const int TASK_PREREQU_FAIL_GLOBAL_KEYVAL = 31;
|
||||
public const int TASK_PREREQU_FAIL_SHIELD_USER = 32;
|
||||
public const int TASK_PREREQU_FAIL_ALREADY_HAS_PQ = 33;
|
||||
public const int TASK_PREREQU_FAIL_MAX_ACC_CNT = 34;
|
||||
public const int TASK_PREREQU_FAIL_RMB_NOT_ENOUGH = 35;
|
||||
public const int TASK_PREREQU_FAIL_NOT_COUPLE = 36;
|
||||
public const int TASK_PREREQU_FAIL_ERR_CHAR_TIME = 37;
|
||||
public const int TASK_PREREQU_FAIL_NOT_IVTRSLOTNUM = 38; // version 81
|
||||
public const int TASK_PREREQU_FAIL_BELOW_FACTION_CONTRIB = 39; // version 87
|
||||
public const int TASK_PREREQU_FAIL_BELOW_RECORD_TASKS_NUM = 40; // version 91
|
||||
public const int TASK_PREREQU_FAIL_OVER_RECEIVE_PER_DAY = 41;
|
||||
public const int TASK_PREREQU_FAIL_TRANSFORM_MASK = 42;
|
||||
public const int TASK_PREREQU_FAIL_FORCE = 43;
|
||||
public const int TASK_PREREQU_FAIL_FORCE_REPUTATION = 44;
|
||||
public const int TASK_PREREQU_FAIL_FORCE_CONTRIBUTION = 45;
|
||||
public const int TASK_PREREQU_FAIL_EXP = 46;
|
||||
public const int TASK_PREREQU_FAIL_SP = 47;
|
||||
public const int TASK_PREREQU_FAIL_FORCE_AL = 48;
|
||||
public const int TASK_PREREQU_FAIL_WEDDING_OWNER = 49;
|
||||
public const int TASK_PREREQU_FAIL_CROSSSERVER_NO_ACOUNT_LIMIT = 50;
|
||||
public const int TASK_PREREQU_FAIL_CROSSSERVER_NO_MARRIAGE = 51;
|
||||
public const int TASK_PREREQU_FAIL_CROSSSERVER_NO_FORCE = 52;
|
||||
public const int TASK_PREREQU_FAIL_KING = 53;
|
||||
public const int TASK_PREREQU_FAIL_IN_TEAM = 54;
|
||||
public const int TASK_PREREQU_FAIL_TITLE = 55;
|
||||
public const int TASK_PREREQU_FAIL_HISTORYSTAGE = 56;
|
||||
public const int TASK_PREREQU_FAIL_NO_GIFTCARD_TASK = 57;
|
||||
public const int TASK_PREREQU_FAIL_BELOW_REINCARNATION = 57;
|
||||
public const int TASK_PREREQU_FAIL_ABOVE_REINCARNATION = 58;
|
||||
public const int TASK_PREREQU_FAIL_BELOW_REALMLEVEL = 59;
|
||||
public const int TASK_PREREQU_FAIL_ABOVE_REALMLEVEL = 60;
|
||||
public const int TASK_PREREQU_FAIL_REALM_EXP_FULL = 61;
|
||||
public const int TASK_PREREQU_FAIL_CARD_COUNT_COLLECTION = 62;
|
||||
public const int TASK_PREREQU_FAIL_MAX_ROLE_CNT = 63;
|
||||
public const int TASK_PREREQU_FAIL_CARD_COUNT_RANK = 64;
|
||||
public const int TASK_PREREQU_FAIL_TASK_FORBID = 65;
|
||||
public const int TASK_PREREQU_FAIL_NO_NAVIGATE_INSHPAED = 66;
|
||||
|
||||
public const int TASK_AWARD_FAIL_GIVEN_ITEM = 150;
|
||||
public const int TASK_AWARD_FAIL_NEW_TASK = 151;
|
||||
public const int TASK_AWARD_FAIL_REPUTATION = 152;
|
||||
public const int TASK_AWARD_FAIL_GLOBAL_KEYVAL = 153;
|
||||
public const int TASK_AWARD_FAIL_CROSSSERVER_NO_ACOUNT_LIMIT = 154;
|
||||
public const int TASK_AWARD_FAIL_CROSSSERVER_NO_ACOUNT_STORAGE = 155;
|
||||
public const int TASK_AWARD_FAIL_CROSSSERVER_NO_DIVORCE = 156;
|
||||
public const int TASK_AWARD_FAIL_CROSSSERVER_NO_FACTION_RALATED = 157;
|
||||
public const int TASK_AWARD_FAIL_CROSSSERVER_NO_FORCE_RALATED = 158;
|
||||
public const int TASK_AWARD_FAIL_CROSSSERVER_NO_DIVIEND = 159;
|
||||
public const int TASK_AWARD_FAIL_LEVEL_CHECK = 160;
|
||||
|
||||
|
||||
// Task messages
|
||||
public const int TASK_MSG_NEW = 1;
|
||||
public const int TASK_MSG_SUCCESS = 2;
|
||||
public const int TASK_MSG_FAIL = 3;
|
||||
|
||||
public const int TASK_ACTIVE_LIST_HEADER_LEN = 8;
|
||||
public const int TASK_ACTIVE_LIST_MAX_LEN = 175;
|
||||
public const int TASK_FINISHED_LIST_MAX_LEN = 2040;
|
||||
public const int TASK_DATA_BUF_MAX_LEN = 32;
|
||||
public const int TASK_FINISH_TIME_MAX_LEN = 1700;
|
||||
public const int TASK_FINISH_COUNT_MAX_LEN = 730;
|
||||
|
||||
// 库任务 // Library tasks
|
||||
public const int TASK_MAX_DELIVER_COUNT = 5;
|
||||
public const int TASK_STORAGE_COUNT = 32;
|
||||
public const int TASK_STORAGE_LEN = 10;
|
||||
public const int TASK_STORAGE_WHELL_SCALE = 10000; // 10000.f originally
|
||||
|
||||
// 当前激活的任务列表缓冲区大小 // Current active task list buffer size
|
||||
public const int TASK_ACTIVE_LIST_BUF_SIZE = (TASK_ACTIVE_LIST_MAX_LEN * TASK_DATA_BUF_MAX_LEN + TASK_ACTIVE_LIST_HEADER_LEN);
|
||||
// 已完成的任务列表缓冲区大小 // Completed task list buffer size
|
||||
public const int TASK_FINISHED_LIST_BUF_SIZE = 8192;
|
||||
public const int TASK_FINISHED_LIST_BUF_SIZE_OLD = 4096;
|
||||
// 任务全局数据大小 // Task global data size
|
||||
public const int TASK_GLOBAL_DATA_SIZE = 256;
|
||||
// 任务完成时间 // Task completion time
|
||||
public const int TASK_FINISH_TIME_LIST_BUF_SIZE = 10240;
|
||||
//任务完成次数 // Task completion count
|
||||
public const int TASK_FINISH_COUNT_LIST_BUF_SIZE = 10240;
|
||||
// 库任务 // Library tasks
|
||||
public const int TASK_STORAGE_LIST_BUF_SIZE = 1024;
|
||||
|
||||
|
||||
// Masks
|
||||
public const int TASK_MASK_KILL_MONSTER = 0x00000001;
|
||||
public const int TASK_MASK_COLLECT_ITEM = 0x00000002;
|
||||
public const int TASK_MASK_TALK_TO_NPC = 0x00000004;
|
||||
public const int TASK_MASK_REACH_SITE = 0x00000008;
|
||||
public const int TASK_MASK_ANSWER_QUESTION = 0x00000010;
|
||||
public const int TASK_MASK_TINY_GAME = 0x00000020;
|
||||
public const int TASK_MASK_KILL_PQ_MONSTER = 0x00000040;
|
||||
public const int TASK_MASK_KILL_PLAYER = 0x00000080;
|
||||
|
||||
|
||||
public const int MAX_MONSTER_WANTED = 3; // 受ActiveTaskEntry大小限制,最大3 // Limited by ActiveTaskEntry size, max 3
|
||||
public const int MAX_PLAYER_WANTED = MAX_MONSTER_WANTED;
|
||||
public const int MAX_ITEM_WANTED = 10;
|
||||
public const int MAX_ITEM_AWARD = 64;
|
||||
public const int MAX_MONSTER_SUMMONED = 32; // 最大召唤出的怪物数量 // Maximum number of summoned monsters
|
||||
|
||||
public const int MAX_OCCUPATIONS = 12; // 职业 // Occupations
|
||||
|
||||
public const int TASK_MSG_CHANNEL_LOCAL = 0;
|
||||
public const int TASK_MSG_CHANNEL_WORLD = 1;
|
||||
public const int TASK_MSG_CHANNEL_BROADCAST = 9;
|
||||
|
||||
public const int TASK_TEAM_RELATION_MARRIAGE = 1;
|
||||
|
||||
public const int TASK_AWARD_MAX_CHANGE_VALUE = 255;
|
||||
public const int TASK_AWARD_MAX_DISPLAY_VALUE = 64;
|
||||
|
||||
public const int TASK_AWARD_MAX_DISPLAY_EXP_CNT = 32; // 表达式的个数 // Number of expressions
|
||||
public const int TASK_AWARD_MAX_DISPLAY_CHAR_LEN = 64; // 表达式的长度 // Length of expression
|
||||
|
||||
public const int TASK_WORLD_CONTRIBUTION_SPEND_PER_DAY = 30; // 免费玩家每日消费贡献度上限 // Daily contribution spend cap for free players
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class CECTaskInterface : TaskInterface
|
||||
{
|
||||
public const int TASK_MAX_DELIVER_COUNT = 5;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace PerfectWorld.Scripts.Task
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace PerfectWorld.Scripts.Task
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct TASK_EXPRESSION
|
||||
{
|
||||
public int type;
|
||||
@@ -9,5 +12,24 @@
|
||||
{
|
||||
return (type == src.type && value == src.value);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is TASK_EXPRESSION other)
|
||||
{
|
||||
return Equals(other);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool operator ==(TASK_EXPRESSION lhs, TASK_EXPRESSION rhs)
|
||||
{
|
||||
return lhs.Equals(rhs);
|
||||
}
|
||||
|
||||
public static bool operator !=(TASK_EXPRESSION lhs, TASK_EXPRESSION rhs)
|
||||
{
|
||||
return !lhs.Equals(rhs);
|
||||
}
|
||||
}
|
||||
}
|
||||
+164
-161
@@ -3,174 +3,177 @@ using System.Runtime.InteropServices;
|
||||
using PerfectWorld.Scripts.Task;
|
||||
using UnityEngine;
|
||||
|
||||
public class TaskProcess
|
||||
namespace PerfectWorld.Scripts.Task
|
||||
{
|
||||
|
||||
}
|
||||
[Flags]
|
||||
public enum TaskState : byte
|
||||
{
|
||||
TASK_STATE_FINISHED = 0x01, // Is finished
|
||||
TASK_STATE_SUCCESS = 0x02, // Is successful
|
||||
TASK_STATE_GIVEUP = 0x04, // Is given up
|
||||
TASK_STATE_ERR_REPORTED = 0x08, // Error has been reported to client
|
||||
TASK_STATE_AWARD_NOTIFY_TEAM = 0x10, // Award has been notified to team
|
||||
TASK_STATE_CONTRIBUTION_FINISH = 0x20 // Contribution finished
|
||||
}
|
||||
|
||||
// Cur Size 21 bytes
|
||||
public class TASK_ENTRY_FIXED_DATA
|
||||
{
|
||||
public ushort m_ID; // ID
|
||||
public char m_ParentIndex; // Parent node index
|
||||
public char m_PrevSblIndex; // Previous sibling node index
|
||||
public char m_NextSblIndex; // Next sibling node index
|
||||
public char m_ChildIndex; // Child node index
|
||||
public char m_uState; // Task state
|
||||
public ulong m_ulTaskTime; // Timestamp
|
||||
public ushort m_uCapTaskId; // Captain task ID
|
||||
public ulong m_ulTemplAddr; // Template address
|
||||
public ulong m_ulCapTemplAddr; // Captain task template address
|
||||
};
|
||||
|
||||
// ´óСΪTASK_DATA_BUF_MAX_LEN
|
||||
public class ActiveTaskEntry : TASK_ENTRY_FIXED_DATA
|
||||
{
|
||||
// Buffer union simplified (C# does not support union directly)
|
||||
public byte[] m_BufData; // Raw data buffer
|
||||
public ushort[] m_wMonsterNum; // Monster numbers
|
||||
public int m_iUsefulData1;
|
||||
public char m_iUsefulData2;
|
||||
|
||||
// bool IsFinished() const { return (m_uState & TASK_STATE_FINISHED) != 0; }
|
||||
// bool IsSuccess() const { return (m_uState & TASK_STATE_SUCCESS) != 0; }
|
||||
// bool IsGiveUp() const { return (m_uState & TASK_STATE_GIVEUP) != 0; }
|
||||
// bool IsErrReported() const { return (m_uState & TASK_STATE_ERR_REPORTED) != 0; }
|
||||
// bool IsAwardNotifyTeam() const { return (m_uState & TASK_STATE_AWARD_NOTIFY_TEAM) != 0; }
|
||||
// bool IsContributionFinish() const { return (m_uState & TASK_STATE_CONTRIBUTION_FINISH) != 0; }
|
||||
// --- State check methods ---
|
||||
public bool IsFinished() => (m_uState & (byte)TaskState.TASK_STATE_FINISHED) != 0;
|
||||
public bool IsSuccess() => (m_uState & (byte)TaskState.TASK_STATE_SUCCESS) != 0;
|
||||
public bool IsGiveUp() => (m_uState & (byte)TaskState.TASK_STATE_GIVEUP) != 0;
|
||||
public bool IsErrReported() => (m_uState & (byte)TaskState.TASK_STATE_ERR_REPORTED) != 0;
|
||||
public bool IsAwardNotifyTeam() => (m_uState & (byte)TaskState.TASK_STATE_AWARD_NOTIFY_TEAM) != 0;
|
||||
public bool IsContributionFinish() => (m_uState & (byte)TaskState.TASK_STATE_CONTRIBUTION_FINISH) != 0;
|
||||
|
||||
// void SetFinished() { m_uState |= TASK_STATE_FINISHED; }
|
||||
// void ClearFinished() { m_uState &= ~TASK_STATE_FINISHED; }
|
||||
// void SetSuccess() { m_uState |= TASK_STATE_SUCCESS; }
|
||||
// void ClearSuccess() { m_uState &= ~TASK_STATE_SUCCESS; }
|
||||
// void SetGiveUp() { m_uState |= TASK_STATE_GIVEUP; }
|
||||
// void ClearGiveUp() { m_uState &= ~TASK_STATE_GIVEUP; }
|
||||
// void SetErrReported() { m_uState |= TASK_STATE_ERR_REPORTED; }
|
||||
// void ClearErrReported() { m_uState &= ~TASK_STATE_ERR_REPORTED; }
|
||||
// void SetAwardNotifyTeam() { m_uState |= TASK_STATE_AWARD_NOTIFY_TEAM; }
|
||||
// void ClearAwardNotifyTeam() { m_uState &= ~TASK_STATE_AWARD_NOTIFY_TEAM; }
|
||||
// void SetContributionFinish() { m_uState |= TASK_STATE_CONTRIBUTION_FINISH; }
|
||||
// void ClearContributionFinish() { m_uState &= ~TASK_STATE_CONTRIBUTION_FINISH; }
|
||||
//
|
||||
public ATaskTempl GetTempl()
|
||||
public class TaskProcess
|
||||
{
|
||||
if (m_ulTemplAddr == 0) return null;
|
||||
return Marshal.PtrToStructure<ATaskTempl>(
|
||||
new IntPtr(unchecked((long)m_ulTemplAddr))
|
||||
);
|
||||
// return reinterpret_cast<const ATaskTempl*>(m_ulTemplAddr);
|
||||
|
||||
}
|
||||
// const ATaskTempl* GetCap() const { return reinterpret_cast<const ATaskTempl*>(m_ulCapTemplAddr); }
|
||||
// const ATaskTempl* GetCapOrSelf() const
|
||||
// {
|
||||
// if (m_ulCapTemplAddr) return GetCap();
|
||||
// else return GetTempl();
|
||||
// }
|
||||
// bool HasParent() const { return m_ParentIndex != 0xff; }
|
||||
// bool HasChildren() const { return m_ChildIndex != 0xff; }
|
||||
// bool IsValid(unsigned char uIndex, unsigned char uMaxCount) const
|
||||
// {
|
||||
// if (m_ParentIndex != 0xff)
|
||||
// {
|
||||
// if (m_ParentIndex >= uIndex || m_ParentIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_PrevSblIndex != 0xff)
|
||||
// {
|
||||
// if (m_PrevSblIndex >= uIndex || m_PrevSblIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_NextSblIndex != 0xff)
|
||||
// {
|
||||
// if (m_NextSblIndex <= uIndex || m_NextSblIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_ChildIndex != 0xff)
|
||||
// {
|
||||
// if (m_ChildIndex <= uIndex || m_ChildIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
};
|
||||
|
||||
public class ActiveTaskList
|
||||
{
|
||||
// --- Header Fields ---
|
||||
public byte[] header = new byte[CECTaskInterface.TASK_ACTIVE_LIST_HEADER_LEN];
|
||||
|
||||
public byte m_uTaskCount; // number of tasks
|
||||
public byte m_uUsedCount; // used count
|
||||
public ushort m_Version; // version
|
||||
public byte m_uTopShowTaskCount; // top show task count
|
||||
public byte m_uListState; // list state
|
||||
public byte m_uTopHideTaskCount; // top hide task count
|
||||
|
||||
private byte _flags; // simulate bitfield (1 bit + 7 bits)
|
||||
|
||||
public bool m_uMaxSimultaneousCount
|
||||
[Flags]
|
||||
public enum TaskState : byte
|
||||
{
|
||||
get => (_flags & 0x01) != 0;
|
||||
set
|
||||
TASK_STATE_FINISHED = 0x01, // Is finished
|
||||
TASK_STATE_SUCCESS = 0x02, // Is successful
|
||||
TASK_STATE_GIVEUP = 0x04, // Is given up
|
||||
TASK_STATE_ERR_REPORTED = 0x08, // Error has been reported to client
|
||||
TASK_STATE_AWARD_NOTIFY_TEAM = 0x10, // Award has been notified to team
|
||||
TASK_STATE_CONTRIBUTION_FINISH = 0x20 // Contribution finished
|
||||
}
|
||||
|
||||
// Cur Size 21 bytes
|
||||
public class TASK_ENTRY_FIXED_DATA
|
||||
{
|
||||
public ushort m_ID; // ID
|
||||
public char m_ParentIndex; // Parent node index
|
||||
public char m_PrevSblIndex; // Previous sibling node index
|
||||
public char m_NextSblIndex; // Next sibling node index
|
||||
public char m_ChildIndex; // Child node index
|
||||
public char m_uState; // Task state
|
||||
public ulong m_ulTaskTime; // Timestamp
|
||||
public ushort m_uCapTaskId; // Captain task ID
|
||||
public ulong m_ulTemplAddr; // Template address
|
||||
public ulong m_ulCapTemplAddr; // Captain task template address
|
||||
};
|
||||
|
||||
// ´óСΪTASK_DATA_BUF_MAX_LEN
|
||||
public class ActiveTaskEntry : TASK_ENTRY_FIXED_DATA
|
||||
{
|
||||
// Buffer union simplified (C# does not support union directly)
|
||||
public byte[] m_BufData; // Raw data buffer
|
||||
public ushort[] m_wMonsterNum; // Monster numbers
|
||||
public int m_iUsefulData1;
|
||||
public char m_iUsefulData2;
|
||||
|
||||
// bool IsFinished() const { return (m_uState & TASK_STATE_FINISHED) != 0; }
|
||||
// bool IsSuccess() const { return (m_uState & TASK_STATE_SUCCESS) != 0; }
|
||||
// bool IsGiveUp() const { return (m_uState & TASK_STATE_GIVEUP) != 0; }
|
||||
// bool IsErrReported() const { return (m_uState & TASK_STATE_ERR_REPORTED) != 0; }
|
||||
// bool IsAwardNotifyTeam() const { return (m_uState & TASK_STATE_AWARD_NOTIFY_TEAM) != 0; }
|
||||
// bool IsContributionFinish() const { return (m_uState & TASK_STATE_CONTRIBUTION_FINISH) != 0; }
|
||||
// --- State check methods ---
|
||||
public bool IsFinished() => (m_uState & (byte)TaskState.TASK_STATE_FINISHED) != 0;
|
||||
public bool IsSuccess() => (m_uState & (byte)TaskState.TASK_STATE_SUCCESS) != 0;
|
||||
public bool IsGiveUp() => (m_uState & (byte)TaskState.TASK_STATE_GIVEUP) != 0;
|
||||
public bool IsErrReported() => (m_uState & (byte)TaskState.TASK_STATE_ERR_REPORTED) != 0;
|
||||
public bool IsAwardNotifyTeam() => (m_uState & (byte)TaskState.TASK_STATE_AWARD_NOTIFY_TEAM) != 0;
|
||||
public bool IsContributionFinish() => (m_uState & (byte)TaskState.TASK_STATE_CONTRIBUTION_FINISH) != 0;
|
||||
|
||||
// void SetFinished() { m_uState |= TASK_STATE_FINISHED; }
|
||||
// void ClearFinished() { m_uState &= ~TASK_STATE_FINISHED; }
|
||||
// void SetSuccess() { m_uState |= TASK_STATE_SUCCESS; }
|
||||
// void ClearSuccess() { m_uState &= ~TASK_STATE_SUCCESS; }
|
||||
// void SetGiveUp() { m_uState |= TASK_STATE_GIVEUP; }
|
||||
// void ClearGiveUp() { m_uState &= ~TASK_STATE_GIVEUP; }
|
||||
// void SetErrReported() { m_uState |= TASK_STATE_ERR_REPORTED; }
|
||||
// void ClearErrReported() { m_uState &= ~TASK_STATE_ERR_REPORTED; }
|
||||
// void SetAwardNotifyTeam() { m_uState |= TASK_STATE_AWARD_NOTIFY_TEAM; }
|
||||
// void ClearAwardNotifyTeam() { m_uState &= ~TASK_STATE_AWARD_NOTIFY_TEAM; }
|
||||
// void SetContributionFinish() { m_uState |= TASK_STATE_CONTRIBUTION_FINISH; }
|
||||
// void ClearContributionFinish() { m_uState &= ~TASK_STATE_CONTRIBUTION_FINISH; }
|
||||
//
|
||||
public ATaskTempl GetTempl()
|
||||
{
|
||||
if (value) _flags |= 0x01;
|
||||
else _flags &= unchecked((byte)~0x01);
|
||||
if (m_ulTemplAddr == 0) return null;
|
||||
return Marshal.PtrToStructure<ATaskTempl>(
|
||||
new IntPtr(unchecked((long)m_ulTemplAddr))
|
||||
);
|
||||
// return reinterpret_cast<const ATaskTempl*>(m_ulTemplAddr);
|
||||
}
|
||||
}
|
||||
// const ATaskTempl* GetCap() const { return reinterpret_cast<const ATaskTempl*>(m_ulCapTemplAddr); }
|
||||
// const ATaskTempl* GetCapOrSelf() const
|
||||
// {
|
||||
// if (m_ulCapTemplAddr) return GetCap();
|
||||
// else return GetTempl();
|
||||
// }
|
||||
// bool HasParent() const { return m_ParentIndex != 0xff; }
|
||||
// bool HasChildren() const { return m_ChildIndex != 0xff; }
|
||||
// bool IsValid(unsigned char uIndex, unsigned char uMaxCount) const
|
||||
// {
|
||||
// if (m_ParentIndex != 0xff)
|
||||
// {
|
||||
// if (m_ParentIndex >= uIndex || m_ParentIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_PrevSblIndex != 0xff)
|
||||
// {
|
||||
// if (m_PrevSblIndex >= uIndex || m_PrevSblIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_NextSblIndex != 0xff)
|
||||
// {
|
||||
// if (m_NextSblIndex <= uIndex || m_NextSblIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_ChildIndex != 0xff)
|
||||
// {
|
||||
// if (m_ChildIndex <= uIndex || m_ChildIndex >= uMaxCount)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
};
|
||||
|
||||
public byte m_uTitleTaskCount
|
||||
public class ActiveTaskList
|
||||
{
|
||||
get => (byte)((_flags & 0xFE) >> 1);
|
||||
set => _flags = (byte)((_flags & 0x01) | ((value & 0x7F) << 1));
|
||||
}
|
||||
// --- Header Fields ---
|
||||
public byte[] header = new byte[CECTaskInterface.TASK_ACTIVE_LIST_HEADER_LEN];
|
||||
|
||||
public ActiveTaskEntry[] m_TaskEntries = new ActiveTaskEntry[CECTaskInterface.TASK_ACTIVE_LIST_MAX_LEN];
|
||||
public byte m_uTaskCount; // number of tasks
|
||||
public byte m_uUsedCount; // used count
|
||||
public ushort m_Version; // version
|
||||
public byte m_uTopShowTaskCount; // top show task count
|
||||
public byte m_uListState; // list state
|
||||
public byte m_uTopHideTaskCount; // top hide task count
|
||||
|
||||
// void UpdateTaskMask(unsigned long& ulMask) const;
|
||||
// void UpdateUsedCount();
|
||||
// void RealignTask(ActiveTaskEntry* pEntry, unsigned char uReserve);
|
||||
// void ClearTask(TaskInterface* pTask, ActiveTaskEntry* pEntry, bool bRemoveItem);
|
||||
// void RecursiveClearTask(TaskInterface* pTask, ActiveTaskEntry* pEntry, bool bRemoveItem, bool bRemoveAcquired, bool bClearTask);
|
||||
// void ClearChildrenOf(TaskInterface* pTask, ActiveTaskEntry* pParent, bool bRemoveItem = true);
|
||||
// ActiveTaskEntry* GetEntry(unsigned long ulId)
|
||||
// {
|
||||
// for (unsigned char i = 0; i < m_uTaskCount; i++)
|
||||
// if (m_TaskEntries[i].m_ID == ulId)
|
||||
// return &m_TaskEntries[i];
|
||||
//
|
||||
// return NULL;
|
||||
// }
|
||||
// void RemoveAll()
|
||||
// {
|
||||
// unsigned short ver = m_Version;
|
||||
// memset(this, 0, sizeof(*this));
|
||||
// m_Version = ver;
|
||||
// }
|
||||
// bool IsValid() const { return m_uTaskCount <= TASK_ACTIVE_LIST_MAX_LEN; }
|
||||
// bool IsTimeMarkUpdate() const { return (m_uListState & TLIST_STATE_UPDATE_TIME_MARK) != 0; }
|
||||
// void SetTimeMarkUpdate() { m_uListState |= TLIST_STATE_UPDATE_TIME_MARK; }
|
||||
// void ClearTimeMarkUpdate() { m_uListState &= ~TLIST_STATE_UPDATE_TIME_MARK; }
|
||||
// int GetMaxSimultaneousCount() {return m_uMaxSimultaneousCount ? TASK_MAX_SIMULTANEOUS_COUT : TASK_DEFAULT_MAX_SIMULTANEOUS_COUT;}
|
||||
// void ExpandMaxSimultaneousCount() {m_uMaxSimultaneousCount = 1;}
|
||||
};
|
||||
private byte _flags; // simulate bitfield (1 bit + 7 bits)
|
||||
|
||||
public bool m_uMaxSimultaneousCount
|
||||
{
|
||||
get => (_flags & 0x01) != 0;
|
||||
set
|
||||
{
|
||||
if (value) _flags |= 0x01;
|
||||
else _flags &= unchecked((byte)~0x01);
|
||||
}
|
||||
}
|
||||
|
||||
public byte m_uTitleTaskCount
|
||||
{
|
||||
get => (byte)((_flags & 0xFE) >> 1);
|
||||
set => _flags = (byte)((_flags & 0x01) | ((value & 0x7F) << 1));
|
||||
}
|
||||
|
||||
public ActiveTaskEntry[] m_TaskEntries = new ActiveTaskEntry[CECTaskInterface.TASK_ACTIVE_LIST_MAX_LEN];
|
||||
|
||||
// void UpdateTaskMask(unsigned long& ulMask) const;
|
||||
// void UpdateUsedCount();
|
||||
// void RealignTask(ActiveTaskEntry* pEntry, unsigned char uReserve);
|
||||
// void ClearTask(TaskInterface* pTask, ActiveTaskEntry* pEntry, bool bRemoveItem);
|
||||
// void RecursiveClearTask(TaskInterface* pTask, ActiveTaskEntry* pEntry, bool bRemoveItem, bool bRemoveAcquired, bool bClearTask);
|
||||
// void ClearChildrenOf(TaskInterface* pTask, ActiveTaskEntry* pParent, bool bRemoveItem = true);
|
||||
// ActiveTaskEntry* GetEntry(unsigned long ulId)
|
||||
// {
|
||||
// for (unsigned char i = 0; i < m_uTaskCount; i++)
|
||||
// if (m_TaskEntries[i].m_ID == ulId)
|
||||
// return &m_TaskEntries[i];
|
||||
//
|
||||
// return NULL;
|
||||
// }
|
||||
// void RemoveAll()
|
||||
// {
|
||||
// unsigned short ver = m_Version;
|
||||
// memset(this, 0, sizeof(*this));
|
||||
// m_Version = ver;
|
||||
// }
|
||||
// bool IsValid() const { return m_uTaskCount <= TASK_ACTIVE_LIST_MAX_LEN; }
|
||||
// bool IsTimeMarkUpdate() const { return (m_uListState & TLIST_STATE_UPDATE_TIME_MARK) != 0; }
|
||||
// void SetTimeMarkUpdate() { m_uListState |= TLIST_STATE_UPDATE_TIME_MARK; }
|
||||
// void ClearTimeMarkUpdate() { m_uListState &= ~TLIST_STATE_UPDATE_TIME_MARK; }
|
||||
// int GetMaxSimultaneousCount() {return m_uMaxSimultaneousCount ? TASK_MAX_SIMULTANEOUS_COUT : TASK_DEFAULT_MAX_SIMULTANEOUS_COUT;}
|
||||
// void ExpandMaxSimultaneousCount() {m_uMaxSimultaneousCount = 1;}
|
||||
};
|
||||
}
|
||||
+1792
-111
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user