3542 lines
146 KiB
C#
3542 lines
146 KiB
C#
using UnityEngine;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
using System;
|
|
using BrewMonster;
|
|
using ModelRenderer.Scripts.Common;
|
|
|
|
|
|
namespace PerfectWorld.Scripts.Task
|
|
{
|
|
public class TaskTemplConstants
|
|
{
|
|
public const int MAX_TASK_NAME_LEN = 30;
|
|
public const int MAX_AWARD_NPC_NUM = 8;
|
|
public const int MAX_PREM_TASK_COUNT = 20;
|
|
public const int MAX_MUTEX_TASK_COUNT = 5;
|
|
public const int MAX_OCCUPATIONS = 12; // 职业 // Occupations
|
|
public const int MAX_TEAM_MEM_WANTED = MAX_OCCUPATIONS;
|
|
public const int MAX_TIMETABLE_SIZE = 24;
|
|
public const int TASK_AWARD_MAX_DISPLAY_CHAR_LEN = 64;
|
|
public const int MAX_ITEM_WANTED = 10;
|
|
public const int MAX_AWARD_SCALES = 5;
|
|
public const int MAX_AWARD_CANDIDATES = 12;
|
|
public const int MAX_LIVING_SKILLS = 4;
|
|
public const int MAX_CONTRIB_MONSTERS = 100; // PQ子任务贡献度最大怪物种类 // Maximum monster types for PQ subtask contribution
|
|
public const int MAX_AWARD_PQ_RANKING = 32; // PQ子任务奖励最大排名数 // Maximum ranking count for PQ subtask rewards
|
|
public const int MAX_TITLE_NUM = 10;
|
|
|
|
public const int MAX_TASKREGION = 8; // 最大区域个数 // Maximum number of regions
|
|
|
|
public const int TASK_GENDER_NONE = 0;
|
|
public const int TASK_GENDER_MALE = 1;
|
|
public const int TASK_GENDER_FEMALE = 2;
|
|
|
|
public const int TASK_MAX_PATH = 260;
|
|
|
|
public const uint INVALID_VAL = uint.MaxValue;
|
|
|
|
public const int TASK_MAX_LINE_LEN = TASK_MAX_PATH;
|
|
|
|
public const int TASK_MAX_VALID_COUNT = 6;
|
|
|
|
public const int TASK_TREASURE_MAP_SIDE_MULTIPLE = 30; // 藏宝图边长与小区域边长的比 // Ratio of treasure map side length to small region side length
|
|
|
|
public const int NUM_SPECIAL_AWARD = 2;
|
|
public static readonly int[] TASK_SPECIAL_AWARD = new int[NUM_SPECIAL_AWARD] { 26969, 26970 };
|
|
|
|
public const uint TASK_PACK_MAGIC = 0x93858361;
|
|
|
|
// Race-occupation mapping array
|
|
public static readonly uint[] _race_occ_map = new uint[MAX_OCCUPATIONS];
|
|
}
|
|
|
|
public enum DynTaskType
|
|
{
|
|
enumDTTNone = 0,
|
|
enumDTTSpecialAward,
|
|
enumDTTNormal,
|
|
enumDTTGiftCard,
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct NPC_INFO
|
|
{
|
|
public uint id;
|
|
public short x;
|
|
public short y;
|
|
public short z;
|
|
}
|
|
|
|
public class ServerNotificationConstants
|
|
{
|
|
// 新任务发放 // New task issued
|
|
public const int TASK_SVR_NOTIFY_NEW = 1;
|
|
|
|
// 任务完毕 // Task completed
|
|
public const int TASK_SVR_NOTIFY_COMPLETE = 2;
|
|
|
|
// 任务放弃 // Task abandoned
|
|
public const int TASK_SVR_NOTIFY_GIVE_UP = 3;
|
|
|
|
// 杀怪数量 // Monster kill count
|
|
public const int TASK_SVR_NOTIFY_MONSTER_KILLED = 4;
|
|
|
|
// 处于得到奖励状态 // In reward receiving state
|
|
public const int TASK_SVR_NOTIFY_FINISHED = 5;
|
|
|
|
// 错误码 // Error code
|
|
public const int TASK_SVR_NOTIFY_ERROR_CODE = 6;
|
|
|
|
// 遗忘生活技能 // Forget life skill
|
|
public const int TASK_SVR_NOTIFY_FORGET_SKILL = 7;
|
|
|
|
// 动态任务时间标记 // Dynamic task time mark
|
|
public const int TASK_SVR_NOTIFY_DYN_TIME_MARK = 8;
|
|
|
|
// 动态任务数据 // Dynamic task data
|
|
public const int TASK_SVR_NOTIFY_DYN_DATA = 9;
|
|
|
|
// 特殊奖励信息 // Special reward info
|
|
public const int TASK_SVR_NOTIFY_SPECIAL_AWARD = 10;
|
|
|
|
// 仓库数据 // Storage data
|
|
public const int TASK_SVR_NOTIFY_STORAGE = 11;
|
|
|
|
// 显示全局变量 // Display global variables
|
|
public const int TASK_SVR_NOTIFY_DIS_GLOBAL_VAL = 12;
|
|
|
|
// 藏宝位置 // Treasure location
|
|
public const int TASK_SVR_NOTIFY_TREASURE_MAP = 13;
|
|
|
|
// 设置任务列表上限 // Set task list limit
|
|
public const int TASK_SVR_NOTIFY_SET_TASK_LIMIT = 14;
|
|
|
|
// 杀人数量 // Player kill count
|
|
public const int TASK_SVR_NOTIFY_PLAYER_KILLED = 15;
|
|
}
|
|
|
|
public class ClientNotificationConstants
|
|
{
|
|
// 检查完成 // Check completion
|
|
public const int TASK_CLT_NOTIFY_CHECK_FINISH = 1;
|
|
|
|
// 检查放弃 // Check abandonment
|
|
public const int TASK_CLT_NOTIFY_CHECK_GIVEUP = 2;
|
|
|
|
// 到达地点 // Reach location
|
|
public const int TASK_CLT_NOTIFY_REACH_SITE = 3;
|
|
|
|
// 自动交付 // Auto delivery
|
|
public const int TASK_CLT_NOTIFY_AUTO_DELV = 4;
|
|
|
|
// 手动触发 // Manual trigger
|
|
public const int TASK_CLT_NOTIFY_MANUAL_TRIG = 5;
|
|
|
|
// 强制放弃 // Force abandon
|
|
public const int TASK_CLT_NOTIFY_FORCE_GIVEUP = 6;
|
|
|
|
// 动态任务时间标记 // Dynamic task time mark
|
|
public const int TASK_CLT_NOTIFY_DYN_TIMEMARK = 7;
|
|
|
|
// 动态任务数据 // Dynamic task data
|
|
public const int TASK_CLT_NOTIFY_DYN_DATA = 8;
|
|
|
|
// 特殊奖励 // Special reward
|
|
public const int TASK_CLT_NOTIFY_SPECIAL_AWARD = 9;
|
|
|
|
// 离开地点 // Leave location
|
|
public const int TASK_CLT_NOTIFY_LEAVE_SITE = 10;
|
|
|
|
// PQ检查初始化 // PQ check initialization
|
|
public const int TASK_CLT_NOTIFY_PQ_CHECK_INIT = 11;
|
|
|
|
// 仓库 // Storage
|
|
public const int TASK_CLT_NOTIFY_STORAGE = 12;
|
|
|
|
// 请求宝藏索引 // Request treasure index
|
|
public const int TASK_CLT_NOTIFY_REQUEST_TREASURE_INDEX = 14;
|
|
|
|
// 15天未登录 // 15 days no login
|
|
public const int TASK_CLT_NOTIFY_15DAYS_NOLOGIN = 15;
|
|
|
|
// 特殊奖励掩码 // Special reward mask
|
|
public const int TASK_CLT_NOTIFY_SPECIAL_AWARD_MASK = 16;
|
|
|
|
// 称号任务 // Title task
|
|
public const int TASK_CLT_NOTIFY_TITLE_TASK = 17;
|
|
|
|
// 选择奖励 // Choose reward
|
|
public const int TASK_CLT_NOTIFY_CHOOSE_AWARD = 18;
|
|
|
|
// 购买代币商店物品 // Buy token shop item
|
|
public const int TASK_CLT_NOTIFY_BUY_TOKENSHOP_ITEM = 20;
|
|
|
|
// 通过世界贡献完成任务 // Complete task by world contribution
|
|
public const int TASK_CLT_NOTIFY_FINISH_TASK_BY_WORLD_CONTRIBUTION = 21;
|
|
|
|
// 移除完成任务 // Remove completed task
|
|
public const int TASK_CLT_NOTIFY_RM_FINISH_TASK = 150;
|
|
}
|
|
|
|
|
|
public static class PlayerNotificationConstants
|
|
{
|
|
// Notify receiving team member task // 通知接收队员任务
|
|
public const int TASK_PLY_NOTIFY_NEW_MEM_TASK = 1;
|
|
|
|
// Whole team fails // 全队失败
|
|
public const int TASK_PLY_NOTIFY_FORCE_FAIL = 2;
|
|
|
|
// Whole team succeeds // 全队成功
|
|
public const int TASK_PLY_NOTIFY_FORCE_SUCC = 3;
|
|
}
|
|
|
|
public static class GlobalDataReasonConstants
|
|
{
|
|
public const int TASK_GLOBAL_CHECK_RCV_NUM = 1;
|
|
public const int TASK_GLOBAL_CHECK_COTASK = 2;
|
|
public const int TASK_GLOBAL_CHECK_ADD_MEM = 3;
|
|
public const int TASK_GLOBAL_NPC_KILLED_TIME = 4;
|
|
public const int TASK_GLOBAL_ADD_TIME_MARK = 5;
|
|
public const int TASK_GLOBAL_DEL_TIME_MARK = 6;
|
|
public const int TASK_GLOBAL_PROTECT_NPC = 7;
|
|
}
|
|
|
|
public static class CotaskConditionConstants
|
|
{
|
|
public const int COTASK_CORRESPOND = 0;
|
|
public const int COTASK_ONCE = 1;
|
|
}
|
|
|
|
// 任务类型 // Task types
|
|
public enum ENUM_TASK_TYPE
|
|
{
|
|
enumTTDaily = 100, // 每日 // Daily
|
|
enumTTLevel2, // 修真 // Cultivation
|
|
enumTTMajor, // 主线 // Main quest
|
|
enumTTBranch, // 支线 // Branch quest
|
|
enumTTEvent, // 活动 // Event
|
|
enumTTQiShaList, // 七杀榜 // Seven Killers List
|
|
enumTTFaction, // 帮派 // Faction
|
|
enumTTFunction, // 经营 // Management
|
|
enumTTLegend, // 传奇 // Legend
|
|
enumTTQuestion, // 答题 // Quiz
|
|
|
|
enumTTEnd,
|
|
}
|
|
|
|
// 完成方式 // Completion methods
|
|
public enum TaskCompletionMethod
|
|
{
|
|
enumTMNone = 0, // 无 // None
|
|
enumTMKillNumMonster, // 杀数量怪 // Kill specific number of monsters
|
|
enumTMCollectNumArticle, // 获得数量道具 // Collect specific number of items
|
|
enumTMTalkToNPC, // 与特定NPC对话 // Talk to specific NPC
|
|
enumTMReachSite, // 到达特定地点 // Reach specific location
|
|
enumTMWaitTime, // 等待特定时间 // Wait for specific time
|
|
enumTMAnswerQuestion, // 选择问答 // Answer questions
|
|
enumTMTinyGame, // 小游戏 // Mini game
|
|
enumTMProtectNPC, // 保护特定NPC // Protect specific NPC
|
|
enumTMNPCReachSite, // NPC到达特定地点 // NPC reaches specific location
|
|
enumTMGlobalValOK, // 全局变量满足条件 // Global variable meets condition
|
|
enumTMLeaveSite, // 离开特定地点 // Leave specific location
|
|
enumTMReachTreasureZone, // 达到藏宝区域 // Reach treasure zone
|
|
enumTMKillPlayer, // 杀死玩家 // Kill player
|
|
enumTMTransform, // 变身状态 // Transform state
|
|
enumTMReachLevel, // 检查等级:普通等级,转生次数,境界等级 // Check level: normal level, reincarnation count, realm level
|
|
enumTMSimpleClientTask, // 简单任务,只做客户端验证,目前只验证表情动作 // Simple task, client-side verification only, currently only verifies emote actions
|
|
enumTMSimpleClientTaskForceNavi, // 强制移动 // Force movement
|
|
}
|
|
|
|
// 完成条件 // Completion conditions
|
|
public enum TaskFinishType
|
|
{
|
|
enumTFTDirect = 0, // 直接完成 // Direct completion
|
|
enumTFTNPC, // NPC完成 // NPC completion
|
|
enumTFTConfirm // 需要确认完成 // Need confirmation to complete
|
|
}
|
|
|
|
// 奖励方式 // Reward methods
|
|
public enum TaskAwardType
|
|
{
|
|
enumTATNormal = 0, // 普通 // Normal
|
|
enumTATEach, // 按杀怪数目、获得物品乘 // Multiply by monster kills, items obtained
|
|
enumTATRatio, // 按时间比例 // By time ratio
|
|
enumTATItemCount // 按获得物品个数分不同档次 // Different tiers based on number of items obtained
|
|
}
|
|
|
|
// 任务重复间隔 // Task repeat interval
|
|
public enum TaskAwardFreq
|
|
{
|
|
enumTAFNormal = 0, // 普通 // Normal
|
|
enumTAFEachDay, // 每天 // Daily
|
|
enumTAFEachWeek, // 每周 // Weekly
|
|
enumTAFEachMonth, // 每月 // Monthly
|
|
enumTAFEachYear // 每年 // Yearly
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct TASK_PACK_HEADER
|
|
{
|
|
public uint magic;
|
|
public uint version;
|
|
public uint item_count;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct ZONE_VERT
|
|
{
|
|
public float x;
|
|
public float y;
|
|
public float z;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct PLAYER_WANTED
|
|
{
|
|
public uint m_ulTemplID; // Player Template ID
|
|
public uint m_ulCount; // Count
|
|
public uint m_ulLevel; // Level
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct MONSTER_WANTED
|
|
{
|
|
public uint m_ulMonsterTemplId; // Monster template ID
|
|
public uint m_ulMonsterNum; // Number of monsters
|
|
public uint m_ulDropItemId; // Drop item ID
|
|
public uint m_ulDropItemCount; // Drop item count
|
|
public bool m_bDropCmnItem; // Is common item drop
|
|
public float m_fDropProb; // Drop probability
|
|
public bool m_bKillerLev; // Killer level flag
|
|
public int m_iDPH; // Damage per hit
|
|
public int m_iDPS; // Damage per second
|
|
|
|
public bool Equals(MONSTER_WANTED src)
|
|
{
|
|
return (m_ulMonsterTemplId == src.m_ulMonsterTemplId &&
|
|
m_ulMonsterNum == src.m_ulMonsterNum &&
|
|
m_ulDropItemId == src.m_ulDropItemId &&
|
|
m_ulDropItemCount == src.m_ulDropItemCount &&
|
|
m_bDropCmnItem == src.m_bDropCmnItem &&
|
|
m_fDropProb == src.m_fDropProb &&
|
|
m_bKillerLev == src.m_bKillerLev);
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct ITEM_WANTED
|
|
{
|
|
public uint m_ulItemTemplId;
|
|
public bool m_bCommonItem;
|
|
public uint m_ulItemNum;
|
|
public float m_fProb;
|
|
public int m_lPeriod;
|
|
|
|
public bool Equals(ITEM_WANTED src)
|
|
{
|
|
return (m_ulItemTemplId == src.m_ulItemTemplId &&
|
|
m_bCommonItem == src.m_bCommonItem &&
|
|
m_ulItemNum == src.m_ulItemNum &&
|
|
m_lPeriod == src.m_lPeriod);
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct TITLE_AWARD
|
|
{
|
|
public uint m_ulTitleID;
|
|
public int m_lPeriod;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct TEAM_MEM_ITEM_WANTED
|
|
{
|
|
public uint m_ulItemTemplId;
|
|
public bool m_bCommonItem;
|
|
public uint m_ulItemNum;
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct MONSTERS_SUMMONED
|
|
{
|
|
public uint m_ulMonsterTemplId;
|
|
public uint m_ulMonsterNum;
|
|
public float m_fSummonProb;
|
|
public int m_lPeriod;
|
|
|
|
public bool Equals(MONSTERS_SUMMONED src)
|
|
{
|
|
return (m_ulMonsterTemplId == src.m_ulMonsterTemplId &&
|
|
m_ulMonsterNum == src.m_ulMonsterNum &&
|
|
m_fSummonProb == src.m_fSummonProb &&
|
|
m_lPeriod == src.m_lPeriod);
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct MONSTERS_CONTRIB
|
|
{
|
|
public uint m_ulMonsterTemplId; // Monster ID // 怪物ID
|
|
public int m_iWholeContrib; // Team exclusive contribution // 组队间独享贡献度
|
|
public int m_iShareContrib; // Team shared contribution // 组队间共享贡献度
|
|
public int m_iPersonalWholeContrib; // Personal exclusive contribution // 个人独享贡献度
|
|
|
|
public bool Equals(MONSTERS_CONTRIB src)
|
|
{
|
|
return (m_ulMonsterTemplId == src.m_ulMonsterTemplId &&
|
|
m_iWholeContrib == src.m_iWholeContrib &&
|
|
m_iShareContrib == src.m_iShareContrib &&
|
|
m_iPersonalWholeContrib == src.m_iPersonalWholeContrib);
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct RANKING_AWARD
|
|
{
|
|
public uint m_iRankingStart;
|
|
public uint m_iRankingEnd;
|
|
public bool m_bCommonItem;
|
|
public ulong m_ulAwardItemId;
|
|
public ulong m_ulAwardItemNum;
|
|
public long m_lPeriod;
|
|
|
|
public bool Equals(RANKING_AWARD src)
|
|
{
|
|
return (m_iRankingStart == src.m_iRankingStart &&
|
|
m_iRankingEnd == src.m_iRankingEnd &&
|
|
m_bCommonItem == src.m_bCommonItem &&
|
|
m_ulAwardItemId == src.m_ulAwardItemId &&
|
|
m_ulAwardItemNum == src.m_ulAwardItemNum &&
|
|
m_lPeriod == src.m_lPeriod);
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct AWARD_MONSTERS_SUMMONED
|
|
{
|
|
public uint m_ulMonsterNum;
|
|
public bool m_bRandChoose;
|
|
public uint m_ulSummonRadius;
|
|
public bool m_bDeathDisappear;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.MAX_MONSTER_SUMMONED)]
|
|
public MONSTERS_SUMMONED[] m_Monsters;
|
|
|
|
public int MarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
pData[offset] = m_bRandChoose ? (byte)1 : (byte)0;
|
|
offset++;
|
|
|
|
pData[offset] = (byte)m_ulSummonRadius;
|
|
offset++;
|
|
|
|
pData[offset] = (byte)m_ulMonsterNum;
|
|
offset++;
|
|
|
|
pData[offset] = m_bDeathDisappear ? (byte)1 : (byte)0;
|
|
offset++;
|
|
|
|
int sz = Marshal.SizeOf(typeof(MONSTERS_SUMMONED)) * (int)m_ulMonsterNum;
|
|
if (sz > 0)
|
|
{
|
|
// Copy MONSTERS_SUMMONED array to byte array
|
|
GCHandle handle = GCHandle.Alloc(m_Monsters, GCHandleType.Pinned);
|
|
try
|
|
{
|
|
IntPtr ptr = handle.AddrOfPinnedObject();
|
|
Marshal.Copy(ptr, pData, offset, sz);
|
|
}
|
|
finally
|
|
{
|
|
handle.Free();
|
|
}
|
|
offset += sz;
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public int UnmarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
m_bRandChoose = pData[offset] != 0;
|
|
offset++;
|
|
|
|
m_ulSummonRadius = pData[offset];
|
|
offset++;
|
|
|
|
m_ulMonsterNum = pData[offset];
|
|
offset++;
|
|
|
|
m_bDeathDisappear = pData[offset] != 0;
|
|
offset++;
|
|
|
|
if (m_ulMonsterNum > 0)
|
|
{
|
|
m_Monsters = new MONSTERS_SUMMONED[m_ulMonsterNum];
|
|
|
|
int sz = Marshal.SizeOf(typeof(MONSTERS_SUMMONED)) * (int)m_ulMonsterNum;
|
|
// Copy byte array to MONSTERS_SUMMONED array
|
|
for (uint i = 0; i < m_ulMonsterNum; i++)
|
|
{
|
|
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MONSTERS_SUMMONED)));
|
|
try
|
|
{
|
|
Marshal.Copy(pData, offset, ptr, Marshal.SizeOf(typeof(MONSTERS_SUMMONED)));
|
|
m_Monsters[i] = (MONSTERS_SUMMONED)Marshal.PtrToStructure(ptr, typeof(MONSTERS_SUMMONED));
|
|
}
|
|
finally
|
|
{
|
|
Marshal.FreeHGlobal(ptr);
|
|
}
|
|
offset += Marshal.SizeOf(typeof(MONSTERS_SUMMONED));
|
|
}
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public static bool operator ==(AWARD_MONSTERS_SUMMONED a, AWARD_MONSTERS_SUMMONED b)
|
|
{
|
|
if (a.m_ulMonsterNum != b.m_ulMonsterNum)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulMonsterNum; ++i)
|
|
{
|
|
if (!(a.m_Monsters[i].Equals(b.m_Monsters[i])))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return (a.m_bRandChoose == b.m_bRandChoose &&
|
|
a.m_ulSummonRadius == b.m_ulSummonRadius &&
|
|
a.m_bDeathDisappear == b.m_bDeathDisappear);
|
|
}
|
|
|
|
public static bool operator !=(AWARD_MONSTERS_SUMMONED a, AWARD_MONSTERS_SUMMONED b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is AWARD_MONSTERS_SUMMONED)
|
|
return this == (AWARD_MONSTERS_SUMMONED)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_ulMonsterNum.GetHashCode() ^
|
|
m_bRandChoose.GetHashCode() ^
|
|
m_ulSummonRadius.GetHashCode() ^
|
|
m_bDeathDisappear.GetHashCode();
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct AWARD_PQ_RANKING
|
|
{
|
|
public bool m_bAwardByProf;
|
|
public uint m_ulRankingAwardNum;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskTemplConstants.MAX_AWARD_PQ_RANKING)]
|
|
public RANKING_AWARD[] m_RankingAward;
|
|
|
|
public int MarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
pData[offset] = m_bAwardByProf ? (byte)1 : (byte)0;
|
|
offset++;
|
|
|
|
pData[offset] = (byte)m_ulRankingAwardNum;
|
|
offset++;
|
|
|
|
int sz = Marshal.SizeOf(typeof(RANKING_AWARD)) * (int)m_ulRankingAwardNum;
|
|
if (sz > 0)
|
|
{
|
|
// Copy RANKING_AWARD array to byte array
|
|
GCHandle handle = GCHandle.Alloc(m_RankingAward, GCHandleType.Pinned);
|
|
try
|
|
{
|
|
IntPtr ptr = handle.AddrOfPinnedObject();
|
|
Marshal.Copy(ptr, pData, offset, sz);
|
|
}
|
|
finally
|
|
{
|
|
handle.Free();
|
|
}
|
|
offset += sz;
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public int UnmarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
m_bAwardByProf = pData[offset] != 0;
|
|
offset++;
|
|
|
|
m_ulRankingAwardNum = pData[offset];
|
|
offset++;
|
|
|
|
if (m_ulRankingAwardNum > 0)
|
|
{
|
|
m_RankingAward = new RANKING_AWARD[m_ulRankingAwardNum];
|
|
|
|
int sz = Marshal.SizeOf(typeof(RANKING_AWARD)) * (int)m_ulRankingAwardNum;
|
|
// Copy byte array to RANKING_AWARD array
|
|
for (uint i = 0; i < m_ulRankingAwardNum; i++)
|
|
{
|
|
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RANKING_AWARD)));
|
|
try
|
|
{
|
|
Marshal.Copy(pData, offset, ptr, Marshal.SizeOf(typeof(RANKING_AWARD)));
|
|
m_RankingAward[i] = (RANKING_AWARD)Marshal.PtrToStructure(ptr, typeof(RANKING_AWARD));
|
|
}
|
|
finally
|
|
{
|
|
Marshal.FreeHGlobal(ptr);
|
|
}
|
|
offset += Marshal.SizeOf(typeof(RANKING_AWARD));
|
|
}
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public static bool operator ==(AWARD_PQ_RANKING a, AWARD_PQ_RANKING b)
|
|
{
|
|
if (a.m_bAwardByProf != b.m_bAwardByProf)
|
|
{
|
|
return false;
|
|
}
|
|
if (a.m_ulRankingAwardNum != b.m_ulRankingAwardNum)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulRankingAwardNum; ++i)
|
|
{
|
|
if (!(a.m_RankingAward[i].Equals(b.m_RankingAward[i])))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static bool operator !=(AWARD_PQ_RANKING a, AWARD_PQ_RANKING b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is AWARD_PQ_RANKING)
|
|
return this == (AWARD_PQ_RANKING)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_bAwardByProf.GetHashCode() ^ m_ulRankingAwardNum.GetHashCode();
|
|
}
|
|
}
|
|
|
|
public class TaskTemplUtils
|
|
{
|
|
/// <summary>
|
|
/// 必须定义operator == // Must define operator ==
|
|
/// </summary>
|
|
/// <typeparam name="T_NAME">The type of the objects to compare</typeparam>
|
|
/// <param name="p1">First object to compare</param>
|
|
/// <param name="p2">Second object to compare</param>
|
|
/// <returns>True if both objects are equal or both are null</returns>
|
|
public static bool CompareTwoPointer<T_NAME>(T_NAME p1, T_NAME p2)
|
|
{
|
|
if (p1 == null && p2 == null)
|
|
{
|
|
return true;
|
|
}
|
|
else if (p1 != null && p2 != null)
|
|
{
|
|
return p1.Equals(p2);
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
public static ushort uint_to_ushort(uint id)
|
|
{
|
|
return (ushort)(id & 0xFF);
|
|
}
|
|
|
|
public static void convert_txt(ref ushort[] str, int len, ushort code)
|
|
{
|
|
for (int i = 0; i < len; i++)
|
|
{
|
|
str[i] ^= code;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct task_tm
|
|
{
|
|
public int year;
|
|
public int month;
|
|
public int day;
|
|
public int hour;
|
|
public int min;
|
|
public int wday;
|
|
|
|
public string GetLog()
|
|
{
|
|
return string.Format("{0}-{1}-{2} {3}:{4} (wday:{5})", year, month, day, hour, min, wday);
|
|
}
|
|
}
|
|
|
|
// Define task_team_member_info struct required by TEAM_MEM_WANTED
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct task_team_member_info
|
|
{
|
|
public uint m_ulLevel;
|
|
public uint m_ulOccupation;
|
|
public int m_iForce;
|
|
public bool m_bMale;
|
|
}
|
|
|
|
// Race-occupation mapping array
|
|
public static class TaskTemplMapping
|
|
{
|
|
public static readonly uint[] _race_occ_map = new uint[TaskTemplConstants.MAX_OCCUPATIONS];
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct TEAM_MEM_WANTED
|
|
{
|
|
public uint m_ulLevelMin;
|
|
public uint m_ulLevelMax;
|
|
public uint m_ulRace;
|
|
public uint m_ulOccupation;
|
|
public uint m_ulGender;
|
|
public uint m_ulMinCount;
|
|
public uint m_ulMaxCount;
|
|
public uint m_ulTask;
|
|
public int m_iForce;
|
|
// public uint m_ulTeamMemsItemWanted;
|
|
// public TEAM_MEM_ITEM_WANTED[] m_TeamMemItemWanted; //[MAX_ITEM_WANTED];
|
|
// public bool m_bJustCheck;
|
|
|
|
// Initialize fields with default values to avoid constructor issues
|
|
public static TEAM_MEM_WANTED Create()
|
|
{
|
|
TEAM_MEM_WANTED result = new TEAM_MEM_WANTED();
|
|
result.Init();
|
|
return result;
|
|
}
|
|
|
|
public bool IsMeetBaseInfo(task_team_member_info pInfo)
|
|
{
|
|
if (m_ulLevelMin != 0 && pInfo.m_ulLevel < m_ulLevelMin) return false;
|
|
|
|
if (m_ulLevelMax != 0 && pInfo.m_ulLevel > m_ulLevelMax) return false;
|
|
|
|
if (m_ulRace != 0)
|
|
{
|
|
if (pInfo.m_ulOccupation >= TaskTemplConstants.MAX_OCCUPATIONS) return false;
|
|
if (TaskTemplMapping._race_occ_map[pInfo.m_ulOccupation] != m_ulRace) return false;
|
|
}
|
|
else if (m_ulOccupation != TaskTemplConstants.INVALID_VAL && pInfo.m_ulOccupation != m_ulOccupation)
|
|
return false;
|
|
|
|
if (m_iForce != 0)
|
|
{
|
|
if (m_iForce == -1)
|
|
{
|
|
if (pInfo.m_iForce == 0)
|
|
return false;
|
|
}
|
|
else if (pInfo.m_iForce != m_iForce) return false;
|
|
}
|
|
|
|
#if !_TASK_CLIENT
|
|
if (m_ulGender == TaskTemplConstants.TASK_GENDER_MALE && !pInfo.m_bMale
|
|
|| m_ulGender == TaskTemplConstants.TASK_GENDER_FEMALE && pInfo.m_bMale)
|
|
return false;
|
|
#endif
|
|
|
|
return true;
|
|
}
|
|
|
|
public bool IsMeetCount(uint ulCount)
|
|
{
|
|
if (m_ulMinCount != 0 && ulCount < m_ulMinCount) return false;
|
|
|
|
if (m_ulMaxCount != 0 && ulCount > m_ulMaxCount) return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
m_ulLevelMin = 0;
|
|
m_ulLevelMax = 0;
|
|
m_ulRace = 0;
|
|
m_ulOccupation = TaskTemplConstants.INVALID_VAL;
|
|
m_ulGender = 0;
|
|
m_ulMinCount = 0;
|
|
m_ulMaxCount = 0;
|
|
m_ulTask = 0;
|
|
m_iForce = 0;
|
|
// m_ulTeamMemsItemWanted = 0;
|
|
// m_TeamMemItemWanted = null;
|
|
// m_bJustCheck = false;
|
|
}
|
|
|
|
public bool IsValid()
|
|
{
|
|
return !(
|
|
m_ulLevelMin == 0 &&
|
|
m_ulLevelMax == 0 &&
|
|
m_ulRace == 0 &&
|
|
m_ulOccupation == TaskTemplConstants.INVALID_VAL &&
|
|
m_ulGender == 0 &&
|
|
m_ulMinCount == 0 &&
|
|
m_ulMaxCount == 0 &&
|
|
m_ulTask == 0 // &&
|
|
// m_ulTeamMemsItemWanted == 0 &&
|
|
// m_TeamMemItemWanted == null &&
|
|
// m_bJustCheck == false
|
|
);
|
|
}
|
|
|
|
public static bool operator ==(TEAM_MEM_WANTED a, TEAM_MEM_WANTED b)
|
|
{
|
|
return (
|
|
a.m_ulLevelMin == b.m_ulLevelMin &&
|
|
a.m_ulLevelMax == b.m_ulLevelMax &&
|
|
a.m_ulRace == b.m_ulRace &&
|
|
a.m_ulOccupation == b.m_ulOccupation &&
|
|
a.m_ulGender == b.m_ulGender &&
|
|
a.m_ulMinCount == b.m_ulMinCount &&
|
|
a.m_ulMaxCount == b.m_ulMaxCount &&
|
|
a.m_ulTask == b.m_ulTask // &&
|
|
// a.m_ulTeamMemsItemWanted == b.m_ulTeamMemsItemWanted &&
|
|
// *a.m_TeamMemItemWanted == *(b.m_TeamMemItemWanted) &&
|
|
// a.m_bJustCheck == b.m_bJustCheck
|
|
);
|
|
}
|
|
|
|
public static bool operator !=(TEAM_MEM_WANTED a, TEAM_MEM_WANTED b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is TEAM_MEM_WANTED)
|
|
return this == (TEAM_MEM_WANTED)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_ulLevelMin.GetHashCode() ^ m_ulLevelMax.GetHashCode() ^ m_ulRace.GetHashCode() ^ m_ulOccupation.GetHashCode();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct AWARD_ITEMS_CAND
|
|
{
|
|
public uint m_ulAwardItems;
|
|
public uint m_ulAwardCmnItems;
|
|
public uint m_ulAwardTskItems;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.MAX_ITEM_AWARD)]
|
|
public ITEM_WANTED[] m_AwardItems;
|
|
public bool m_bRandChoose;
|
|
|
|
public int MarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
pData[offset] = m_bRandChoose ? (byte)1 : (byte)0;
|
|
offset++;
|
|
|
|
pData[offset] = (byte)m_ulAwardItems;
|
|
offset++;
|
|
|
|
int sz = Marshal.SizeOf(typeof(ITEM_WANTED)) * (int)m_ulAwardItems;
|
|
if (sz > 0)
|
|
{
|
|
// Copy ITEM_WANTED array data
|
|
for (int i = 0; i < m_ulAwardItems; i++)
|
|
{
|
|
// Would need to implement proper marshaling here
|
|
// For now, just increase offset by appropriate size
|
|
offset += Marshal.SizeOf(typeof(ITEM_WANTED));
|
|
}
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public int UnmarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
m_bRandChoose = pData[offset] != 0;
|
|
offset++;
|
|
|
|
m_ulAwardItems = pData[offset];
|
|
offset++;
|
|
|
|
if (m_ulAwardItems > 0)
|
|
{
|
|
m_AwardItems = new ITEM_WANTED[m_ulAwardItems];
|
|
|
|
// Copy ITEM_WANTED array data
|
|
for (uint i = 0; i < m_ulAwardItems; i++)
|
|
{
|
|
// Would need to implement proper unmarshaling here
|
|
// For now, just increase offset by appropriate size
|
|
offset += Marshal.SizeOf(typeof(ITEM_WANTED));
|
|
|
|
if (m_AwardItems[i].m_bCommonItem)
|
|
m_ulAwardCmnItems++;
|
|
else
|
|
m_ulAwardTskItems++;
|
|
}
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public static bool operator ==(AWARD_ITEMS_CAND a, AWARD_ITEMS_CAND b)
|
|
{
|
|
if (a.m_ulAwardItems != b.m_ulAwardItems)
|
|
return false;
|
|
|
|
for (uint i = 0; i < a.m_ulAwardItems; ++i)
|
|
{
|
|
if (!(a.m_AwardItems[i].Equals(b.m_AwardItems[i])))
|
|
return false;
|
|
}
|
|
|
|
return (a.m_ulAwardCmnItems == b.m_ulAwardCmnItems &&
|
|
a.m_ulAwardTskItems == b.m_ulAwardTskItems &&
|
|
a.m_bRandChoose == b.m_bRandChoose);
|
|
}
|
|
|
|
public static bool operator !=(AWARD_ITEMS_CAND a, AWARD_ITEMS_CAND b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is AWARD_ITEMS_CAND)
|
|
return this == (AWARD_ITEMS_CAND)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_ulAwardItems.GetHashCode() ^
|
|
m_ulAwardCmnItems.GetHashCode() ^
|
|
m_ulAwardTskItems.GetHashCode() ^
|
|
m_bRandChoose.GetHashCode();
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct AWARD_RATIO_SCALE
|
|
{
|
|
static uint g_ulNewCount; // Static counter for memory tracking
|
|
|
|
// Default constructor not available in C# 9.0, fields are initialized directly
|
|
public uint m_ulScales;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskTemplConstants.MAX_AWARD_SCALES)]
|
|
public float[] m_Ratios;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskTemplConstants.MAX_AWARD_SCALES)]
|
|
public AWARD_DATA[] m_Awards; //[MAX_AWARD_SCALES];
|
|
|
|
// Initialize method instead of constructor
|
|
public void Initialize()
|
|
{
|
|
m_ulScales = 0;
|
|
m_Ratios = new float[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
m_Awards = null;
|
|
|
|
#if TASK_TEMPL_EDITOR
|
|
m_Awards = new AWARD_DATA[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
g_ulNewCount++;
|
|
#endif
|
|
}
|
|
|
|
public static bool operator ==(AWARD_RATIO_SCALE a, AWARD_RATIO_SCALE b)
|
|
{
|
|
if (a.m_ulScales != b.m_ulScales)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulScales; ++i)
|
|
{
|
|
// Add null check
|
|
if (a.m_Ratios[i] != b.m_Ratios[i] ||
|
|
(a.m_Awards != null && b.m_Awards != null && i < a.m_Awards.Length && i < b.m_Awards.Length &&
|
|
!(a.m_Awards[i] == b.m_Awards[i])))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static bool operator !=(AWARD_RATIO_SCALE a, AWARD_RATIO_SCALE b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is AWARD_RATIO_SCALE)
|
|
return this == (AWARD_RATIO_SCALE)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_ulScales.GetHashCode();
|
|
}
|
|
|
|
// Copy constructor equivalent method
|
|
public static AWARD_RATIO_SCALE CreateCopy(AWARD_RATIO_SCALE src)
|
|
{
|
|
AWARD_RATIO_SCALE result = new AWARD_RATIO_SCALE();
|
|
result.m_ulScales = src.m_ulScales;
|
|
result.m_Ratios = new float[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
|
|
// Copy the ratios array
|
|
for (int i = 0; i < src.m_Ratios.Length && i < TaskTemplConstants.MAX_AWARD_SCALES; i++)
|
|
{
|
|
result.m_Ratios[i] = src.m_Ratios[i];
|
|
}
|
|
|
|
#if !TASK_TEMPL_EDITOR
|
|
if (src.m_ulScales > 0)
|
|
{
|
|
result.m_Awards = new AWARD_DATA[src.m_ulScales];
|
|
g_ulNewCount++;
|
|
}
|
|
#else
|
|
result.m_Awards = new AWARD_DATA[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
g_ulNewCount++;
|
|
#endif
|
|
|
|
// Copy awards if available
|
|
if (src.m_Awards != null && result.m_Awards != null)
|
|
{
|
|
for (uint i = 0; i < src.m_ulScales && i < result.m_Awards.Length && i < src.m_Awards.Length; i++)
|
|
{
|
|
result.m_Awards[i] = src.m_Awards[i];
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public bool HasAward()
|
|
{
|
|
if (m_Awards == null)
|
|
return false;
|
|
|
|
for (uint i = 0; i < m_ulScales && i < m_Awards.Length; i++)
|
|
if (m_Awards[i].HasAward())
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct AWARD_ITEMS_SCALE
|
|
{
|
|
static uint g_ulNewCount; // Static counter for memory tracking
|
|
|
|
// Default constructor not available in C# 9.0, fields are initialized directly
|
|
public uint m_ulScales;
|
|
public uint m_ulItemId;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskTemplConstants.MAX_AWARD_SCALES)]
|
|
public uint[] m_Counts;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskTemplConstants.MAX_AWARD_SCALES)]
|
|
public AWARD_DATA[] m_Awards; //[MAX_AWARD_SCALES];
|
|
|
|
// Initialize method instead of constructor
|
|
public void Initialize()
|
|
{
|
|
m_ulScales = 0;
|
|
m_ulItemId = 0;
|
|
m_Counts = new uint[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
m_Awards = null;
|
|
|
|
#if TASK_TEMPL_EDITOR
|
|
m_Awards = new AWARD_DATA[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
g_ulNewCount++;
|
|
#endif
|
|
}
|
|
|
|
public static bool operator ==(AWARD_ITEMS_SCALE a, AWARD_ITEMS_SCALE b)
|
|
{
|
|
if (a.m_ulScales != b.m_ulScales)
|
|
{
|
|
return false;
|
|
}
|
|
for (uint i = 0; i < a.m_ulScales; ++i)
|
|
{
|
|
// Add null check
|
|
if (a.m_Counts[i] != b.m_Counts[i] ||
|
|
(a.m_Awards != null && b.m_Awards != null && i < a.m_Awards.Length && i < b.m_Awards.Length &&
|
|
!(a.m_Awards[i] == b.m_Awards[i])))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return a.m_ulItemId == b.m_ulItemId;
|
|
}
|
|
|
|
public static bool operator !=(AWARD_ITEMS_SCALE a, AWARD_ITEMS_SCALE b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is AWARD_ITEMS_SCALE)
|
|
return this == (AWARD_ITEMS_SCALE)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_ulScales.GetHashCode() ^ m_ulItemId.GetHashCode();
|
|
}
|
|
|
|
// Copy constructor equivalent method
|
|
public static AWARD_ITEMS_SCALE CreateCopy(AWARD_ITEMS_SCALE src)
|
|
{
|
|
AWARD_ITEMS_SCALE result = new AWARD_ITEMS_SCALE();
|
|
result.m_ulScales = src.m_ulScales;
|
|
result.m_ulItemId = src.m_ulItemId;
|
|
result.m_Counts = new uint[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
|
|
// Copy the counts array
|
|
for (int i = 0; i < src.m_Counts.Length && i < TaskTemplConstants.MAX_AWARD_SCALES; i++)
|
|
{
|
|
result.m_Counts[i] = src.m_Counts[i];
|
|
}
|
|
|
|
#if !TASK_TEMPL_EDITOR
|
|
if (src.m_ulScales > 0)
|
|
{
|
|
result.m_Awards = new AWARD_DATA[src.m_ulScales];
|
|
g_ulNewCount++;
|
|
}
|
|
#else
|
|
result.m_Awards = new AWARD_DATA[TaskTemplConstants.MAX_AWARD_SCALES];
|
|
g_ulNewCount++;
|
|
#endif
|
|
|
|
// Copy awards if available
|
|
if (src.m_Awards != null && result.m_Awards != null)
|
|
{
|
|
for (uint i = 0; i < src.m_ulScales && i < result.m_Awards.Length && i < src.m_Awards.Length; i++)
|
|
{
|
|
result.m_Awards[i] = src.m_Awards[i];
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public bool HasAward()
|
|
{
|
|
if (m_Awards == null)
|
|
return false;
|
|
|
|
for (uint i = 0; i < m_ulScales && i < m_Awards.Length; i++)
|
|
if (m_Awards[i].HasAward())
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct AWARD_DATA
|
|
{
|
|
/*/
|
|
public AWARD_DATA(bool initialize = true)
|
|
{
|
|
m_ulGoldNum = 0;
|
|
m_ulExp = 0;
|
|
m_ulRealmExp = 0;
|
|
m_bExpandRealmLevelMax = false;
|
|
m_ulNewTask = 0;
|
|
m_ulSP = 0;
|
|
m_lReputation = 0;
|
|
m_ulNewPeriod = 0;
|
|
m_ulNewRelayStation = 0;
|
|
m_ulStorehouseSize = 0;
|
|
m_ulStorehouseSize2 = 0;
|
|
m_ulStorehouseSize3 = 0;
|
|
m_ulStorehouseSize4 = 0;
|
|
m_lInventorySize = 0;
|
|
m_ulPetInventorySize = 0;
|
|
m_ulFuryULimit = 0;
|
|
m_ulTransWldId = 0;
|
|
m_TransPt = new ZONE_VERT();
|
|
m_lMonsCtrl = 0;
|
|
m_bTrigCtrl = false;
|
|
m_bUseLevCo = false;
|
|
m_bDivorce = false;
|
|
m_bSendMsg = false;
|
|
m_nMsgChannel = 0;
|
|
m_ulCandItems = 0;
|
|
m_CandItems = null;
|
|
m_ulSummonedMonsters = 0;
|
|
m_SummonedMonsters = new AWARD_MONSTERS_SUMMONED();
|
|
m_bAwardDeath = false;
|
|
m_bAwardDeathWithLoss = false;
|
|
m_ulDividend = 0;
|
|
m_bAwardSkill = false;
|
|
m_iAwardSkillID = 0;
|
|
m_iAwardSkillLevel = 0;
|
|
m_ulSpecifyContribTaskID = 0;
|
|
m_ulSpecifyContribSubTaskID = 0;
|
|
m_ulSpecifyContrib = 0;
|
|
m_ulContrib = 0;
|
|
m_ulRandContrib = 0;
|
|
m_ulLowestcontrib = 0;
|
|
m_iFactionContrib = 0;
|
|
m_iFactionExpContrib = 0;
|
|
m_ulPQRankingAwardCnt = 0;
|
|
m_PQRankingAward = new AWARD_PQ_RANKING();
|
|
m_bMulti = false;
|
|
m_nNumType = 0;
|
|
m_lNum = 0;
|
|
m_ulChangeKeyCnt = 0;
|
|
m_plChangeKey = null;
|
|
m_plChangeKeyValue = null;
|
|
m_pbChangeType = null;
|
|
m_ulHistoryChangeCnt = 0;
|
|
m_plHistoryChangeKey = null;
|
|
m_plHistoryChangeKeyValue = null;
|
|
m_pbHistoryChangeType = null;
|
|
m_ulDisplayKeyCnt = 0;
|
|
m_plDisplayKey = null;
|
|
m_ulExpCnt = 0;
|
|
m_pszExp = null;
|
|
m_pExpArr = null;
|
|
m_ulTaskCharCnt = 0;
|
|
m_pTaskChar = null;
|
|
m_iForceContribution = 0;
|
|
m_iForceReputation = 0;
|
|
m_iForceActivity = 0;
|
|
m_iForceSetRepu = 0;
|
|
m_iTaskLimit = 0;
|
|
m_ulTitleNum = 0;
|
|
m_pTitleAward = null;
|
|
m_iLeaderShip = 0;
|
|
m_iWorldContribution = 0;
|
|
|
|
#if TASK_TEMPL_EDITOR
|
|
m_CandItems = new AWARD_ITEMS_CAND[TaskTemplConstants.MAX_AWARD_CANDIDATES];
|
|
|
|
m_SummonedMonsters = new AWARD_MONSTERS_SUMMONED();
|
|
|
|
m_PQRankingAward = new AWARD_PQ_RANKING();
|
|
|
|
m_pTitleAward = new TITLE_AWARD[TaskTemplConstants.MAX_TITLE_NUM];
|
|
#endif
|
|
}
|
|
//*/
|
|
|
|
public uint m_ulGoldNum;
|
|
public uint m_ulExp;
|
|
public uint m_ulRealmExp; // 境界经验 // Realm experience
|
|
public bool m_bExpandRealmLevelMax; // 境界等级10整级时提升境界等级上限 // Increase realm level upper limit when realm level is at level 10
|
|
public uint m_ulNewTask;
|
|
public uint m_ulSP;
|
|
public int m_lReputation;
|
|
public uint m_ulNewPeriod;
|
|
public uint m_ulNewRelayStation;
|
|
public uint m_ulStorehouseSize;
|
|
public uint m_ulStorehouseSize2;
|
|
public uint m_ulStorehouseSize3;
|
|
public uint m_ulStorehouseSize4; // 账号仓库 // Account warehouse
|
|
public int m_lInventorySize;
|
|
public uint m_ulPetInventorySize;
|
|
public uint m_ulFuryULimit;
|
|
public uint m_ulTransWldId;
|
|
public ZONE_VERT m_TransPt;
|
|
public int m_lMonsCtrl;
|
|
public bool m_bTrigCtrl;
|
|
public bool m_bUseLevCo;
|
|
public bool m_bDivorce;
|
|
public bool m_bSendMsg;
|
|
public int m_nMsgChannel;
|
|
public uint m_ulCandItems;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0)]
|
|
public AWARD_ITEMS_CAND[] m_CandItems; //[MAX_AWARD_CANDIDATES];
|
|
public uint m_CandItems_ptr;
|
|
public uint m_ulSummonedMonsters;
|
|
[MarshalAs(UnmanagedType.SysInt)]
|
|
public AWARD_MONSTERS_SUMMONED m_SummonedMonsters;
|
|
public bool m_bAwardDeath;
|
|
public bool m_bAwardDeathWithLoss;
|
|
public uint m_ulDividend; // 鸿利值 // Dividend value
|
|
|
|
public bool m_bAwardSkill; // 是否奖励技能 // Whether to reward skill [Yongdong, 2010-1-6]
|
|
public int m_iAwardSkillID; // 技能ID // Skill ID
|
|
public int m_iAwardSkillLevel;// 技能等级 // Skill level
|
|
|
|
//////////////////////////////////////////////////// PQ任务奖励 start // PQ task reward start
|
|
|
|
public uint m_ulSpecifyContribTaskID; // 指定任务贡献度的任务id // Task ID for specified contribution
|
|
public uint m_ulSpecifyContribSubTaskID; // 指定任务贡献度的子任务ID // Subtask ID for specified contribution
|
|
public uint m_ulSpecifyContrib; // 指定任务贡献度 // Specified task contribution
|
|
|
|
// 仅PQ子任务专用 // Only for PQ subtasks
|
|
public uint m_ulContrib; // 贡献度 // Contribution
|
|
public uint m_ulRandContrib; // 随机贡献度 // Random contribution
|
|
public uint m_ulLowestcontrib; // 最低贡献度 // Minimum contribution
|
|
|
|
// 帮派贡献度 // Faction contribution
|
|
public int m_iFactionContrib;
|
|
public int m_iFactionExpContrib;
|
|
|
|
public uint m_ulPQRankingAwardCnt;
|
|
[MarshalAs(UnmanagedType.SysInt)]
|
|
public AWARD_PQ_RANKING m_PQRankingAward;
|
|
|
|
//////////////////////////////////////////////////// PQ任务奖励 end // PQ task reward end
|
|
|
|
// 改变全局key/value // Change global key/value
|
|
public uint m_ulChangeKeyCnt;
|
|
// [MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.TASK_AWARD_MAX_CHANGE_VALUE)]
|
|
[NonSerialized]
|
|
public int[] m_plChangeKey;
|
|
public uint m_plChangeKey_ptr;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
// [NonSerialized]
|
|
public int[] m_plChangeKeyValue;
|
|
public uint m_plChangeKeyValue_ptr;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
// [NonSerialized]
|
|
public bool[] m_pbChangeType;
|
|
public uint m_pbChangeType_ptr;
|
|
|
|
// 修改历史进度 // Modify historical progress
|
|
public uint m_ulHistoryChangeCnt;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
public int[] m_plHistoryChangeKey;
|
|
public uint m_plHistoryChangeKey_ptr;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
public int[] m_plHistoryChangeKeyValue;
|
|
public uint m_plHistoryChangeKeyValue_ptr;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
public bool[] m_pbHistoryChangeType;
|
|
public uint m_pbHistoryChangeType_ptr;
|
|
|
|
// 倍率 // Multiplier
|
|
public bool m_bMulti;
|
|
public int m_nNumType;
|
|
public int m_lNum;
|
|
|
|
// 显示全局key/value // Display global key/value
|
|
public uint m_ulDisplayKeyCnt;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
public int[] m_plDisplayKey;
|
|
public uint m_plDisplayKey_ptr;
|
|
|
|
// 显示全局变量表达式 // Display global variable expressions
|
|
public uint m_ulExpCnt;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
public byte[] m_pszExp;
|
|
public byte m_pszExp_ptr;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0)]
|
|
public TASK_EXPRESSION[] m_pExpArr;
|
|
public uint m_pExpArr_ptr;
|
|
|
|
// 显示全局变量表达式提示字符串 // Display global variable expression prompt strings
|
|
public uint m_ulTaskCharCnt;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
|
public ushort[] m_pTaskChar;
|
|
public ushort m_pTaskChar_ptr;
|
|
|
|
// 势力相关 // Force-related
|
|
public int m_iForceContribution;
|
|
public int m_iForceReputation;
|
|
public int m_iForceActivity;
|
|
public int m_iForceSetRepu;
|
|
|
|
public int m_iTaskLimit;
|
|
public uint m_ulTitleNum;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0)]
|
|
public TITLE_AWARD[] m_pTitleAward;
|
|
public uint m_pTitleAward_ptr;
|
|
public int m_iLeaderShip;
|
|
|
|
public int m_iWorldContribution; // 世界贡献度 // World contribution
|
|
|
|
public bool HasAward()
|
|
{
|
|
return m_ulGoldNum != 0
|
|
|| m_ulExp != 0
|
|
|| m_ulNewTask != 0
|
|
|| m_ulSP != 0
|
|
|| m_lReputation != 0
|
|
|| m_ulNewPeriod != 0
|
|
|| m_ulNewRelayStation != 0
|
|
|| m_ulStorehouseSize != 0
|
|
|| m_ulStorehouseSize2 != 0
|
|
|| m_ulStorehouseSize3 != 0
|
|
|| m_ulStorehouseSize4 != 0
|
|
|| m_lInventorySize != 0
|
|
|| m_ulPetInventorySize != 0
|
|
|| m_ulFuryULimit != 0
|
|
|| m_bDivorce
|
|
|| m_bSendMsg
|
|
|| m_bAwardDeath
|
|
|| m_ulCandItems != 0
|
|
|| m_ulSummonedMonsters != 0
|
|
|| m_ulSpecifyContrib != 0
|
|
|| m_ulSpecifyContribTaskID != 0
|
|
|| m_ulContrib != 0
|
|
|| m_ulRandContrib != 0
|
|
|| m_ulDividend != 0
|
|
|| m_ulPQRankingAwardCnt != 0
|
|
|| m_ulSpecifyContribSubTaskID != 0
|
|
|| m_bAwardSkill
|
|
|| m_iFactionContrib != 0
|
|
|| m_iFactionExpContrib != 0
|
|
|| m_iForceActivity != 0
|
|
|| m_iForceContribution != 0
|
|
|| m_iForceReputation != 0
|
|
|| m_iForceSetRepu != 0
|
|
|| m_iTaskLimit != 0
|
|
|| m_ulRealmExp != 0
|
|
|| m_bExpandRealmLevelMax;
|
|
}
|
|
|
|
public int MarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
int mask = 0;
|
|
BitConverter.GetBytes(mask).CopyTo(pData, offset);
|
|
offset += 4;
|
|
|
|
if (m_ulGoldNum != 0)
|
|
{
|
|
mask |= 1;
|
|
BitConverter.GetBytes((int)m_ulGoldNum).CopyTo(pData, offset);
|
|
offset += sizeof(int);
|
|
}
|
|
|
|
if (m_ulExp != 0)
|
|
{
|
|
mask |= 1 << 1;
|
|
BitConverter.GetBytes((int)m_ulExp).CopyTo(pData, offset);
|
|
offset += sizeof(int);
|
|
}
|
|
|
|
if (m_ulSP != 0)
|
|
{
|
|
mask |= 1 << 2;
|
|
BitConverter.GetBytes((int)m_ulSP).CopyTo(pData, offset);
|
|
offset += sizeof(int);
|
|
}
|
|
|
|
if (m_lReputation != 0)
|
|
{
|
|
mask |= 1 << 3;
|
|
BitConverter.GetBytes(m_lReputation).CopyTo(pData, offset);
|
|
offset += sizeof(int);
|
|
}
|
|
|
|
if (m_ulCandItems != 0)
|
|
{
|
|
mask |= 1 << 4;
|
|
|
|
pData[offset] = (byte)m_ulCandItems;
|
|
offset++;
|
|
|
|
for (int i = 0; i < m_ulCandItems; i++)
|
|
{
|
|
offset += m_CandItems[i].MarshalBasicData(pData.AsSpan(offset).ToArray());
|
|
}
|
|
}
|
|
|
|
if (m_ulSummonedMonsters != 0)
|
|
{
|
|
mask |= 1 << 5;
|
|
|
|
pData[offset] = (byte)m_ulSummonedMonsters;
|
|
offset++;
|
|
|
|
offset += m_SummonedMonsters.MarshalBasicData(pData.AsSpan(offset).ToArray());
|
|
}
|
|
|
|
if (m_ulPQRankingAwardCnt != 0)
|
|
{
|
|
mask |= 1 << 6;
|
|
|
|
pData[offset] = (byte)m_ulPQRankingAwardCnt;
|
|
offset++;
|
|
|
|
offset += m_PQRankingAward.MarshalBasicData(pData.AsSpan(offset).ToArray());
|
|
}
|
|
|
|
// Update the mask
|
|
BitConverter.GetBytes(mask).CopyTo(pData, 0);
|
|
|
|
return offset;
|
|
}
|
|
|
|
public int UnmarshalBasicData(byte[] pData)
|
|
{
|
|
int offset = 0;
|
|
|
|
int mask = BitConverter.ToInt32(pData, offset);
|
|
offset += sizeof(int);
|
|
|
|
if ((mask & 1) != 0)
|
|
{
|
|
m_ulGoldNum = (uint)BitConverter.ToInt32(pData, offset);
|
|
offset += 4;
|
|
}
|
|
|
|
if ((mask & (1 << 1)) != 0)
|
|
{
|
|
m_ulExp = (uint)BitConverter.ToInt32(pData, offset);
|
|
offset += 4;
|
|
}
|
|
|
|
if ((mask & (1 << 2)) != 0)
|
|
{
|
|
m_ulSP = (uint)BitConverter.ToInt32(pData, offset);
|
|
offset += 4;
|
|
}
|
|
|
|
if ((mask & (1 << 3)) != 0)
|
|
{
|
|
m_lReputation = BitConverter.ToInt32(pData, offset);
|
|
offset += 4;
|
|
}
|
|
|
|
if ((mask & (1 << 4)) != 0)
|
|
{
|
|
m_ulCandItems = pData[offset];
|
|
offset++;
|
|
|
|
if (m_ulCandItems != 0)
|
|
{
|
|
#if !TASK_TEMPL_EDITOR
|
|
m_CandItems = new AWARD_ITEMS_CAND[m_ulCandItems];
|
|
#endif
|
|
|
|
for (uint i = 0; i < m_ulCandItems; i++)
|
|
{
|
|
offset += m_CandItems[i].UnmarshalBasicData(pData.AsSpan(offset).ToArray());
|
|
}
|
|
}
|
|
}
|
|
|
|
if ((mask & (1 << 5)) != 0)
|
|
{
|
|
m_ulSummonedMonsters = pData[offset];
|
|
offset++;
|
|
|
|
if (m_ulSummonedMonsters != 0)
|
|
{
|
|
#if !TASK_TEMPL_EDITOR
|
|
m_SummonedMonsters = new AWARD_MONSTERS_SUMMONED();
|
|
#endif
|
|
|
|
offset += m_SummonedMonsters.UnmarshalBasicData(pData.AsSpan(offset).ToArray());
|
|
}
|
|
}
|
|
|
|
if ((mask & (1 << 6)) != 0)
|
|
{
|
|
m_ulPQRankingAwardCnt = pData[offset];
|
|
offset++;
|
|
|
|
if (m_ulPQRankingAwardCnt != 0)
|
|
{
|
|
#if !TASK_TEMPL_EDITOR
|
|
m_PQRankingAward = new AWARD_PQ_RANKING();
|
|
#endif
|
|
|
|
offset += m_PQRankingAward.UnmarshalBasicData(pData.AsSpan(offset).ToArray());
|
|
}
|
|
}
|
|
|
|
return offset;
|
|
}
|
|
|
|
public static bool CompareTwoPointer<T>(T p1, T p2) where T : class
|
|
{
|
|
if (p1 == null && p2 == null)
|
|
{
|
|
return true;
|
|
}
|
|
else if (p1 != null && p2 != null)
|
|
{
|
|
return p1.Equals(p2);
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
public static bool operator ==(AWARD_DATA a, AWARD_DATA b)
|
|
{
|
|
if (a.m_ulCandItems != b.m_ulCandItems || a.m_ulSummonedMonsters != b.m_ulSummonedMonsters ||
|
|
a.m_ulChangeKeyCnt != b.m_ulChangeKeyCnt || a.m_ulDisplayKeyCnt != b.m_ulDisplayKeyCnt ||
|
|
a.m_ulExpCnt != b.m_ulExpCnt || a.m_ulTaskCharCnt != b.m_ulTaskCharCnt ||
|
|
a.m_ulHistoryChangeCnt != b.m_ulHistoryChangeCnt)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulCandItems; ++i)
|
|
{
|
|
if (!(a.m_CandItems[i] == b.m_CandItems[i]))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (!TaskTemplUtils.CompareTwoPointer(a.m_SummonedMonsters, b.m_SummonedMonsters))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulChangeKeyCnt; ++i)
|
|
{
|
|
if (a.m_plChangeKey[i] != b.m_plChangeKey[i] ||
|
|
a.m_plChangeKeyValue[i] != b.m_plChangeKeyValue[i] ||
|
|
a.m_pbChangeType[i] != b.m_pbChangeType[i])
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulHistoryChangeCnt; ++i)
|
|
{
|
|
if (a.m_plHistoryChangeKey[i] != b.m_plHistoryChangeKey[i] ||
|
|
a.m_plHistoryChangeKeyValue[i] != b.m_plHistoryChangeKeyValue[i] ||
|
|
a.m_pbHistoryChangeType[i] != b.m_pbHistoryChangeType[i])
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
for (uint i = 0; i < a.m_ulDisplayKeyCnt; ++i)
|
|
{
|
|
if (a.m_plDisplayKey[i] != b.m_plDisplayKey[i])
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (!TaskTemplUtils.CompareTwoPointer(a.m_PQRankingAward, b.m_PQRankingAward))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return (a.m_ulGoldNum == b.m_ulGoldNum &&
|
|
a.m_ulExp == b.m_ulExp &&
|
|
a.m_ulNewTask == b.m_ulNewTask &&
|
|
a.m_ulSP == b.m_ulSP &&
|
|
a.m_lReputation == b.m_lReputation &&
|
|
a.m_ulNewPeriod == b.m_ulNewPeriod &&
|
|
a.m_ulNewRelayStation == b.m_ulNewRelayStation &&
|
|
a.m_ulStorehouseSize == b.m_ulStorehouseSize &&
|
|
a.m_ulStorehouseSize2 == b.m_ulStorehouseSize2 &&
|
|
a.m_ulStorehouseSize3 == b.m_ulStorehouseSize3 &&
|
|
a.m_ulStorehouseSize4 == b.m_ulStorehouseSize4 &&
|
|
a.m_lInventorySize == b.m_lInventorySize &&
|
|
a.m_ulPetInventorySize == b.m_ulPetInventorySize &&
|
|
a.m_ulFuryULimit == b.m_ulFuryULimit &&
|
|
a.m_ulTransWldId == b.m_ulTransWldId &&
|
|
a.m_TransPt.Equals(b.m_TransPt) &&
|
|
a.m_lMonsCtrl == b.m_lMonsCtrl &&
|
|
a.m_bTrigCtrl == b.m_bTrigCtrl &&
|
|
a.m_bUseLevCo == b.m_bUseLevCo &&
|
|
a.m_bDivorce == b.m_bDivorce &&
|
|
a.m_bSendMsg == b.m_bSendMsg &&
|
|
a.m_nMsgChannel == b.m_nMsgChannel &&
|
|
a.m_bAwardDeath == b.m_bAwardDeath &&
|
|
a.m_bAwardDeathWithLoss == b.m_bAwardDeathWithLoss &&
|
|
a.m_ulDividend == b.m_ulDividend &&
|
|
a.m_bAwardSkill == b.m_bAwardSkill &&
|
|
a.m_iAwardSkillID == b.m_iAwardSkillID &&
|
|
a.m_iAwardSkillLevel == b.m_iAwardSkillLevel &&
|
|
a.m_ulSpecifyContribTaskID == b.m_ulSpecifyContribTaskID &&
|
|
a.m_ulSpecifyContribSubTaskID == b.m_ulSpecifyContribSubTaskID &&
|
|
a.m_ulSpecifyContrib == b.m_ulSpecifyContrib &&
|
|
a.m_ulContrib == b.m_ulContrib &&
|
|
a.m_ulRandContrib == b.m_ulRandContrib &&
|
|
a.m_ulLowestcontrib == b.m_ulLowestcontrib &&
|
|
a.m_iFactionContrib == b.m_iFactionContrib &&
|
|
a.m_iFactionExpContrib == b.m_iFactionExpContrib &&
|
|
a.m_ulPQRankingAwardCnt == b.m_ulPQRankingAwardCnt &&
|
|
a.m_bMulti == b.m_bMulti &&
|
|
a.m_nNumType == b.m_nNumType &&
|
|
a.m_lNum == b.m_lNum
|
|
);
|
|
}
|
|
|
|
public static bool operator !=(AWARD_DATA a, AWARD_DATA b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is AWARD_DATA)
|
|
{
|
|
return this == (AWARD_DATA)obj;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return m_ulGoldNum.GetHashCode() ^
|
|
m_ulExp.GetHashCode() ^
|
|
m_lReputation.GetHashCode() ^
|
|
m_ulSP.GetHashCode();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum task_tm_type
|
|
{
|
|
enumTaskTimeDate = 0,
|
|
enumTaskTimeMonth,
|
|
enumTaskTimeWeek,
|
|
enumTaskTimeDay
|
|
};
|
|
|
|
|
|
/// <summary>
|
|
/// Completion Method
|
|
/// </summary>
|
|
public enum TaskMethod
|
|
{
|
|
enumTMNone = 0, // None
|
|
enumTMKillNumMonster, // Kill a number of monsters
|
|
enumTMCollectNumArticle, // Collect a number of items
|
|
enumTMTalkToNPC, // Talk to a specific NPC
|
|
enumTMReachSite, // Reach a specific location
|
|
enumTMWaitTime, // Wait for a specified time
|
|
enumTMAnswerQuestion, // Answer a question
|
|
enumTMTinyGame, // Mini-game
|
|
enumTMProtectNPC, // Protect a specific NPC
|
|
enumTMNPCReachSite, // NPC reaches a specific location
|
|
enumTMGlobalValOK, // Global variable condition satisfied
|
|
enumTMLeaveSite, // Leave a specific location
|
|
enumTMReachTreasureZone, // Reach the treasure area
|
|
enumTMKillPlayer, // Kill another player
|
|
enumTMTransform, // Transform state
|
|
enumTMReachLevel, // Check level: normal level, rebirth count, realm level
|
|
enumTMSimpleClientTask, // Simple client task (only client-side validation, currently just checks UI triggers)
|
|
enumTMSimpleClientTaskForceNavi // Force navigation
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct COMPARE_KEY_VALUE
|
|
{
|
|
public int nLeftType;
|
|
public int lLeftNum;
|
|
public int nCompOper;
|
|
public int nRightType;
|
|
public int lRightNum;
|
|
|
|
public static bool operator ==(COMPARE_KEY_VALUE a, COMPARE_KEY_VALUE b)
|
|
{
|
|
return (a.nLeftType == b.nLeftType && a.lLeftNum == b.lLeftNum &&
|
|
a.nCompOper == b.nCompOper && a.nRightType == b.nRightType &&
|
|
a.lRightNum == b.lRightNum);
|
|
}
|
|
|
|
public static bool operator !=(COMPARE_KEY_VALUE a, COMPARE_KEY_VALUE b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is COMPARE_KEY_VALUE)
|
|
return this == (COMPARE_KEY_VALUE)obj;
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return nLeftType.GetHashCode() ^ lLeftNum.GetHashCode() ^ nCompOper.GetHashCode() ^
|
|
nRightType.GetHashCode() ^ lRightNum.GetHashCode();
|
|
}
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
public struct Task_Region
|
|
{
|
|
public ZONE_VERT zvMin;
|
|
public ZONE_VERT zvMax;
|
|
|
|
public bool Equals(Task_Region src)
|
|
{
|
|
return (zvMin.x == src.zvMin.x && zvMin.y == src.zvMin.y && zvMin.z == src.zvMin.z &&
|
|
zvMax.x == src.zvMax.x && zvMax.y == src.zvMax.y && zvMax.z == src.zvMax.z);
|
|
}
|
|
|
|
public static bool operator ==(Task_Region a, Task_Region b)
|
|
{
|
|
return a.Equals(b);
|
|
}
|
|
|
|
public static bool operator !=(Task_Region a, Task_Region b)
|
|
{
|
|
return !a.Equals(b);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is Task_Region)
|
|
return Equals((Task_Region)obj);
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return zvMin.GetHashCode() ^ zvMax.GetHashCode();
|
|
}
|
|
|
|
public string GetLog()
|
|
{
|
|
return $"Min({zvMin.x}, {zvMin.y}, {zvMin.z}) - Max({zvMax.x}, {zvMax.y}, {zvMax.z})";
|
|
}
|
|
}
|
|
|
|
public class ATaskTempl
|
|
{
|
|
public ATaskTemplFixedData m_FixedData;
|
|
|
|
//Hierarchy
|
|
public ATaskTempl m_pParent;
|
|
public ATaskTempl m_pPrevSibling;
|
|
public ATaskTempl m_pNextSibling;
|
|
public ATaskTempl m_pFirstChild;
|
|
|
|
const int MAX_TASK_NAME_LEN = 30;
|
|
const int TASK_AWARD_MAX_CHANGE_VALUE = 255;
|
|
|
|
public byte m_uValidCount;
|
|
public bool LoadFromBinFile(FileStream fp)
|
|
{
|
|
LoadBinary(fp);
|
|
// CheckDepth();
|
|
return true;
|
|
}
|
|
private void LoadBinary(FileStream fp)
|
|
{
|
|
LoadFixedDataFromBinFile(fp);
|
|
// LoadDescriptionBin(fp);
|
|
// LoadTributeBin(fp);
|
|
|
|
//# ifndef _TASK_CLIENT
|
|
// CheckMask();
|
|
//#else
|
|
// SyncTaskType();
|
|
//#endif
|
|
|
|
|
|
// namechar code = (namechar)m_ID;
|
|
|
|
// m_DelvTaskTalk.load(fp);
|
|
// convert_talk_text(&m_DelvTaskTalk, code);
|
|
|
|
// m_UnqualifiedTalk.load(fp);
|
|
// convert_talk_text(&m_UnqualifiedTalk, code);
|
|
|
|
// m_DelvItemTalk.load(fp);
|
|
// convert_talk_text(&m_DelvItemTalk, code);
|
|
|
|
// m_ExeTalk.load(fp);
|
|
// convert_talk_text(&m_ExeTalk, code);
|
|
|
|
// m_AwardTalk.load(fp);
|
|
// convert_talk_text(&m_AwardTalk, code);
|
|
|
|
// fread(&m_nSubCount, sizeof(m_nSubCount), 1, fp);
|
|
|
|
// for (int i = 0; i < m_nSubCount; i++)
|
|
// {
|
|
// ATaskTempl* pSub = new ATaskTempl;
|
|
// g_ulNewCount++;
|
|
// AddSubTaskTempl(pSub);
|
|
// pSub->LoadBinary(fp);
|
|
// }
|
|
|
|
// SynchID();
|
|
//return true;
|
|
}
|
|
private bool LoadFixedDataFromBinFile(FileStream fp)
|
|
{
|
|
// for (int j = 1; j <= 20; j++)
|
|
// {
|
|
// Debug.LogError($"==== {j} ===");
|
|
// ConvertFixedData(fp, j);
|
|
// Debug.LogError($"==========");
|
|
// }
|
|
ConvertFixedData(fp, 1);
|
|
return true;
|
|
}
|
|
|
|
public void convert_txt(char[] buffer, int len, char code)
|
|
{
|
|
if (buffer == null) return;
|
|
if (len < 0) len = 0;
|
|
if (len > buffer.Length) len = buffer.Length;
|
|
|
|
for (int i = 0; i < len; i++)
|
|
{
|
|
buffer[i] = (char)(buffer[i] ^ code);
|
|
}
|
|
}
|
|
|
|
public void convert_txt(ushort[] buffer, int len, char code)
|
|
{
|
|
if (buffer == null) return;
|
|
if (len < 0) len = 0;
|
|
if (len > buffer.Length) len = buffer.Length;
|
|
|
|
for (int i = 0; i < len; i++)
|
|
{
|
|
buffer[i] = (ushort)(buffer[i] ^ code);
|
|
}
|
|
}
|
|
|
|
private void ConvertFixedData(FileStream fp, int x2)
|
|
{
|
|
long readBytes = 0;
|
|
BMLogger.Log($"LoadFixedDataFromBinFile: {fp.Length}");
|
|
ATaskTemplFixedData fixedData = new ATaskTemplFixedData();
|
|
string logContent = "";
|
|
|
|
var originalPos = fp.Position;
|
|
|
|
// Task ID
|
|
fixedData.m_ID = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes); // unsigned long m_ID;
|
|
logContent += $"m_ID: {fixedData.m_ID} \n";
|
|
|
|
// Task Name (task_char m_szName[MAX_TASK_NAME_LEN];)
|
|
fixedData.m_szName = AAssit.ReadArrayFromBinary<ushort>(fp, TaskTemplConstants.MAX_TASK_NAME_LEN, ref readBytes); //64
|
|
convert_txt(fixedData.m_szName, TaskTemplConstants.MAX_TASK_NAME_LEN, (char)(fixedData.m_ID));
|
|
logContent += $"m_szName: {ByteToStringUtils.UshortArrayToUnicodeString(fixedData.m_szName)}\n"; //68
|
|
|
|
// Has Signature (bool m_bHasSign;)
|
|
fixedData.m_bHasSign = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bHasSign: {fixedData.m_bHasSign}\n"; //68
|
|
|
|
// Signature pointer (task_char* m_pszSignature;)
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pszSignature: ushort[] and skip 4 bytes \n";
|
|
|
|
|
|
// Task Type (unsigned long m_ulType;)
|
|
fixedData.m_ulType = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);//value 103
|
|
logContent += $"Type: {fixedData.m_ulType}\n";
|
|
|
|
// Time Limit (unsigned long m_ulTimeLimit;)
|
|
fixedData.m_ulTimeLimit = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulTimeLimit: {fixedData.m_ulTimeLimit}\n";
|
|
|
|
// Offline Fail (bool m_bOfflineFail;)
|
|
fixedData.m_bOfflineFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bOfflineFail: {fixedData.m_bOfflineFail}\n";
|
|
|
|
// Absolute Fail (bool m_bAbsFail;)
|
|
fixedData.m_bAbsFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bAbsFail: {fixedData.m_bAbsFail}\n";
|
|
|
|
// Absolute Fail Time (task_tm m_tmAbsFailTime;)
|
|
fixedData.m_tmAbsFailTime = AAssit.ReadFromBinaryOf<task_tm>(fp, ref readBytes);
|
|
logContent += $"m_tmAbsFailTime.day: {fixedData.m_tmAbsFailTime.day}\n";
|
|
|
|
|
|
// (unsigned long m_ulAbsFailTime;) // commented out in C++ source
|
|
|
|
// Item Not Take Off (bool m_bItemNotTakeOff;)
|
|
fixedData.m_bItemNotTakeOff = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bItemNotTakeOff: {fixedData.m_bItemNotTakeOff}\n";
|
|
|
|
// Absolute Time (bool m_bAbsTime;)
|
|
fixedData.m_bAbsTime = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bAbsTime: {fixedData.m_bAbsTime}\n";
|
|
|
|
// Timetable count (unsigned long m_ulTimetable;)
|
|
fixedData.m_ulTimetable = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulTimetable: {fixedData.m_ulTimetable}\n";
|
|
|
|
// Timetable type (char m_tmType[MAX_TIMETABLE_SIZE];)
|
|
fixedData.m_tmType = AAssit.ReadArrayFromBinary<byte>(fp, TaskTemplConstants.MAX_TIMETABLE_SIZE, ref readBytes);
|
|
logContent += $"m_tmType: {fixedData.m_tmType}\n";
|
|
|
|
// Start time pointer (task_tm* m_tmStart; [MAX_TIMETABLE_SIZE])
|
|
// if (m_ulTimetable)
|
|
// {
|
|
// m_tmStart = new task_tm[m_ulTimetable];
|
|
// g_ulNewCount++;
|
|
// m_tmEnd = new task_tm[m_ulTimetable];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// Start time pointer (task_tm* m_tmStart; [MAX_TIMETABLE_SIZE])
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_tmStart: task_tm[] and skip 4 bytes \n";
|
|
|
|
// End time pointer (task_tm* m_tmEnd; [MAX_TIMETABLE_SIZE])
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_tmEnd: task_tm[] and skip 4 bytes \n";
|
|
|
|
// Available frequency (long m_lAvailFrequency;)
|
|
fixedData.m_lAvailFrequency = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_lAvailFrequency: {fixedData.m_lAvailFrequency}\n";
|
|
|
|
// Period limit (long m_lPeriodLimit;)
|
|
fixedData.m_lPeriodLimit = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_lPeriodLimit: {fixedData.m_lPeriodLimit}\n";
|
|
|
|
// Choose one subtask (bool m_bChooseOne;)
|
|
fixedData.m_bChooseOne = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bChooseOne: {fixedData.m_bChooseOne}\n";
|
|
|
|
// Random one subtask (bool m_bRandOne;)
|
|
fixedData.m_bRandOne = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bRandOne: {fixedData.m_bRandOne}\n";
|
|
|
|
// bool m_bExeChildInOrder;
|
|
// Whether subtasks are executed in order
|
|
fixedData.m_bExeChildInOrder = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 是否子任务有顺序 // Whether subtasks are executed in order
|
|
logContent += $"m_bExeChildInOrder: {fixedData.m_bExeChildInOrder}\n";
|
|
|
|
// bool m_bParentAlsoFail;
|
|
// Whether the parent task fails if this one does
|
|
fixedData.m_bParentAlsoFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 失败后是否认为父任务也失败 // Whether the parent task fails if this one does
|
|
logContent += $"m_bParentAlsoFail: {fixedData.m_bParentAlsoFail}\n";
|
|
|
|
// Whether parent task succeeds after subtask succeeds
|
|
// bool m_bParentAlsoSucc;
|
|
fixedData.m_bParentAlsoSucc = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 子任务成功后父任务成功 // Whether parent task succeeds after subtask succeeds
|
|
logContent += $"m_bParentAlsoSucc: {fixedData.m_bParentAlsoSucc}\n";
|
|
|
|
// Whether this task can be abandoned
|
|
// bool m_bCanGiveUp;
|
|
fixedData.m_bCanGiveUp = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 能否放弃此任务 // Whether this task can be abandoned
|
|
logContent += $"m_bCanGiveUp: {fixedData.m_bCanGiveUp}\n";
|
|
|
|
// Whether the task can be repeated/completed again
|
|
// bool m_bCanRedo;
|
|
fixedData.m_bCanRedo = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 是否可重复完成 // Whether the task can be repeated/completed again
|
|
logContent += $"m_bCanRedo: {fixedData.m_bCanRedo}\n";
|
|
|
|
// Whether task can be repeated after failure
|
|
// bool m_bCanRedoAfterFailure;
|
|
|
|
fixedData.m_bCanRedoAfterFailure = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 失败后是否可重新完成 // Whether task can be repeated after failure
|
|
logContent += $"m_bCanRedoAfterFailure: {fixedData.m_bCanRedoAfterFailure}\n";
|
|
|
|
// Give up clears the task
|
|
// bool m_bClearAsGiveUp;
|
|
fixedData.m_bClearAsGiveUp = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 放弃清空任务 // Give up clears the task
|
|
logContent += $"m_bClearAsGiveUp: {fixedData.m_bClearAsGiveUp}\n";
|
|
|
|
// Whether recording is needed
|
|
// bool m_bNeedRecord;
|
|
fixedData.m_bNeedRecord = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 是否需要记录 // Whether recording is needed
|
|
logContent += $"m_bNeedRecord: {fixedData.m_bNeedRecord}\n";
|
|
|
|
// Player's death causes failure
|
|
// bool m_bFailAsPlayerDie;
|
|
fixedData.m_bFailAsPlayerDie = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 玩家被击杀是否认为失败 // Player's death causes failure
|
|
logContent += $"m_bFailAsPlayerDie: {fixedData.m_bFailAsPlayerDie}\n";
|
|
|
|
// Maximum number of receivers
|
|
// unsigned long m_ulMaxReceiver;
|
|
fixedData.m_ulMaxReceiver = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes); // 接受者上限 // Maximum number of receivers
|
|
logContent += $"m_ulMaxReceiver: {fixedData.m_ulMaxReceiver}\n";
|
|
|
|
// Is in delivery zone
|
|
// bool m_bDelvInZone;
|
|
fixedData.m_bDelvInZone = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 发放区域 // Is in delivery zone
|
|
logContent += $"m_bDelvInZone: {fixedData.m_bDelvInZone}\n";
|
|
|
|
// Delivery world id
|
|
// unsigned long m_ulDelvWorld;
|
|
fixedData.m_ulDelvWorld = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes); // 发放世界 // Delivery world id
|
|
logContent += $"m_ulDelvWorld: {fixedData.m_ulDelvWorld}\n";
|
|
|
|
// Number of delivery regions
|
|
// unsigned long m_ulDelvRegionCnt;
|
|
fixedData.m_ulDelvRegionCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes); // 发放区域计数 // Number of delivery regions
|
|
logContent += $"m_ulDelvRegionCnt: {fixedData.m_ulDelvRegionCnt}\n";
|
|
|
|
// Delivery regions pointer (Task_Region* m_pDelvRegion;)
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pDelvRegion: Task_Region[] and skip 4 bytes \n\n";
|
|
|
|
// Enter region fail (bool m_bEnterRegionFail;)
|
|
fixedData.m_bEnterRegionFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 进入区域任务失败 // Task fails when entering region
|
|
logContent += $"m_bEnterRegionFail: {fixedData.m_bEnterRegionFail}\n\n";
|
|
|
|
// Enter region world (unsigned long m_ulEnterRegionWorld;)
|
|
fixedData.m_ulEnterRegionWorld = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulEnterRegionWorld: {fixedData.m_ulEnterRegionWorld}\n\n";
|
|
|
|
// Enter region count (unsigned long m_ulEnterRegionCnt;)
|
|
fixedData.m_ulEnterRegionCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulEnterRegionCnt: {fixedData.m_ulEnterRegionCnt}\n\n";
|
|
|
|
// Enter region pointer (Task_Region* m_pEnterRegion;)
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pEnterRegion: Task_Region[] and skip 4 bytes \n\n";
|
|
|
|
// Leave region fail (bool m_bLeaveRegionFail;)
|
|
fixedData.m_bLeaveRegionFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 离开区域任务失败 // Task fails when leaving region
|
|
logContent += $"m_bLeaveRegionFail: {fixedData.m_bLeaveRegionFail}\n\n";
|
|
|
|
// Leave region world (unsigned long m_ulLeaveRegionWorld;)
|
|
fixedData.m_ulLeaveRegionWorld = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulLeaveRegionWorld: {fixedData.m_ulLeaveRegionWorld}\n\n";
|
|
|
|
// Leave region count (unsigned long m_ulLeaveRegionCnt;)
|
|
fixedData.m_ulLeaveRegionCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulLeaveRegionCnt: {fixedData.m_ulLeaveRegionCnt}\n\n";
|
|
|
|
// Leave region pointer (Task_Region* m_pLeaveRegion;)
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pLeaveRegion: Task_Region[] and skip 4 bytes \n\n";
|
|
|
|
// Leave force fail (bool m_bLeaveForceFail;)
|
|
fixedData.m_bLeaveForceFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 离开阵营失败 // Fails when leaving force
|
|
logContent += $"m_bLeaveForceFail: {fixedData.m_bLeaveForceFail}\n\n";
|
|
|
|
// Teleport to specific point (bool m_bTransTo;)
|
|
fixedData.m_bTransTo = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0; // 传送到特定点 // Teleport to specific point
|
|
logContent += $"m_bTransTo: {fixedData.m_bTransTo}\n\n";
|
|
|
|
// Teleport world id (unsigned long m_ulTransWldId;)
|
|
fixedData.m_ulTransWldId = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulTransWldId: {fixedData.m_ulTransWldId}\n\n";
|
|
|
|
// Teleport position (ZONE_VERT m_TransPt;)
|
|
fixedData.m_TransPt = AAssit.ReadFromBinaryOf<ZONE_VERT>(fp, ref readBytes);
|
|
logContent += $"m_TransPt: ({fixedData.m_TransPt.x}, {fixedData.m_TransPt.y}, {fixedData.m_TransPt.z})\n\n";
|
|
|
|
// Monster controller (long m_lMonsCtrl;)
|
|
fixedData.m_lMonsCtrl = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_lMonsCtrl: {fixedData.m_lMonsCtrl}\n\n";
|
|
|
|
// Trigger controller (bool m_bTrigCtrl;)
|
|
fixedData.m_bTrigCtrl = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bTrigCtrl: {fixedData.m_bTrigCtrl}\n\n";
|
|
|
|
// Auto deliver (bool m_bAutoDeliver;)
|
|
fixedData.m_bAutoDeliver = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bAutoDeliver: {fixedData.m_bAutoDeliver}\n\n";
|
|
|
|
// Display in exclusive UI (bool m_bDisplayInExclusiveUI;)
|
|
fixedData.m_bDisplayInExclusiveUI = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bDisplayInExclusiveUI: {fixedData.m_bDisplayInExclusiveUI}\n\n";
|
|
|
|
// Ready to notify server (bool m_bReadyToNotifyServer;)
|
|
fixedData.m_bReadyToNotifyServer = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bReadyToNotifyServer: {fixedData.m_bReadyToNotifyServer}\n\n";
|
|
|
|
// Used in token shop (bool m_bUsedInTokenShop;)
|
|
fixedData.m_bUsedInTokenShop = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bUsedInTokenShop: {fixedData.m_bUsedInTokenShop}\n\n";
|
|
|
|
// Death trigger (bool m_bDeathTrig;)
|
|
fixedData.m_bDeathTrig = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bDeathTrig: {fixedData.m_bDeathTrig}\n\n";
|
|
|
|
// Clear acquired (bool m_bClearAcquired;)
|
|
fixedData.m_bClearAcquired = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bClearAcquired: {fixedData.m_bClearAcquired}\n\n";
|
|
|
|
// Suitable level (uint m_ulSuitableLevel;)
|
|
fixedData.m_ulSuitableLevel = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulSuitableLevel: {fixedData.m_ulSuitableLevel}\n\n";
|
|
|
|
// Show prompt (bool m_bShowPrompt;)
|
|
fixedData.m_bShowPrompt = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowPrompt: {fixedData.m_bShowPrompt}\n\n";
|
|
|
|
// Key task (bool m_bKeyTask;)
|
|
fixedData.m_bKeyTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bKeyTask: {fixedData.m_bKeyTask}\n\n";
|
|
|
|
// Delivery NPC (uint m_ulDelvNPC;)
|
|
fixedData.m_ulDelvNPC = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulDelvNPC: {fixedData.m_ulDelvNPC}\n\n";
|
|
|
|
// Award NPC (uint m_ulAwardNPC;)
|
|
fixedData.m_ulAwardNPC = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulAwardNPC: {fixedData.m_ulAwardNPC}\n\n";
|
|
|
|
// Skill task (bool m_bSkillTask;)
|
|
fixedData.m_bSkillTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bSkillTask: {fixedData.m_bSkillTask}\n\n";
|
|
|
|
// Can seek out (bool m_bCanSeekOut;)
|
|
fixedData.m_bCanSeekOut = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCanSeekOut: {fixedData.m_bCanSeekOut}\n\n";
|
|
|
|
// Show direction (bool m_bShowDirection;)
|
|
fixedData.m_bShowDirection = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowDirection: {fixedData.m_bShowDirection}\n\n";
|
|
|
|
// Marriage (bool m_bMarriage;)
|
|
fixedData.m_bMarriage = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bMarriage: {fixedData.m_bMarriage}\n\n";
|
|
|
|
// Change global key/value count (uint m_ulChangeKeyCnt;)
|
|
fixedData.m_ulChangeKeyCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulChangeKeyCnt: {fixedData.m_ulChangeKeyCnt}\n\n";
|
|
|
|
// Pointers to basic types (int* m_plChangeKey; int* m_plChangeKeyValue; bool* m_pbChangeType;)
|
|
// Skip sizeof(int), sizeof(int), sizeof(bool) respectively per conversion rule
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_plChangeKey: int[] pointer, skip 4 bytes (sizeof(int))\n\n";
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_plChangeKeyValue: int[] pointer, skip 4 bytes (sizeof(int))\n\n";
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pbChangeType: bool[] pointer, skip 4 byte (sizeof(bool))\n\n";
|
|
|
|
// Switch scene fail (bool m_bSwitchSceneFail;)
|
|
fixedData.m_bSwitchSceneFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bSwitchSceneFail: {fixedData.m_bSwitchSceneFail}\n\n";
|
|
|
|
// Hidden (bool m_bHidden;)
|
|
fixedData.m_bHidden = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bHidden: {fixedData.m_bHidden}\n\n";
|
|
|
|
// Delivery skill (bool m_bDeliverySkill;)
|
|
fixedData.m_bDeliverySkill = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bDeliverySkill: {fixedData.m_bDeliverySkill}\n\n";
|
|
|
|
// Delivered skill ID/Level (int m_iDeliveredSkillID; int m_iDeliveredSkillLevel;)
|
|
fixedData.m_iDeliveredSkillID = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iDeliveredSkillID: {fixedData.m_iDeliveredSkillID}\n\n";
|
|
fixedData.m_iDeliveredSkillLevel = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iDeliveredSkillLevel: {fixedData.m_iDeliveredSkillLevel}\n\n";
|
|
|
|
// Show GFX finished (bool m_bShowGfxFinished;)
|
|
fixedData.m_bShowGfxFinished = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowGfxFinished: {fixedData.m_bShowGfxFinished}\n\n";
|
|
|
|
// Change PQ ranking (bool m_bChangePQRanking;)
|
|
fixedData.m_bChangePQRanking = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bChangePQRanking: {fixedData.m_bChangePQRanking}\n\n";
|
|
|
|
// Compare items and inventory (bool m_bCompareItemAndInventory;)
|
|
fixedData.m_bCompareItemAndInventory = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCompareItemAndInventory: {fixedData.m_bCompareItemAndInventory}\n\n";
|
|
|
|
// Inventory slots (uint m_ulInventorySlotNum;)
|
|
fixedData.m_ulInventorySlotNum = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulInventorySlotNum: {fixedData.m_ulInventorySlotNum}\n\n";
|
|
|
|
// PQ task (bool m_bPQTask;)
|
|
fixedData.m_bPQTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPQTask: {fixedData.m_bPQTask}\n\n";
|
|
|
|
// PQ expression count (uint m_ulPQExpCnt;)
|
|
fixedData.m_ulPQExpCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPQExpCnt: {fixedData.m_ulPQExpCnt}\n\n";
|
|
|
|
// PQ expressions pointer (byte[,] m_pszPQExp;)
|
|
// Only the pointer address is stored in the binary (skip 1 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pszPQExp: byte[,] pointer, skip 4 bytes \n\n";
|
|
|
|
// PQ expression array pointer (TASK_EXPRESSION[,] m_pPQExpArr;)
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pPQExpArr: TASK_EXPRESSION[,] pointer, skip 4 bytes \n\n";
|
|
|
|
// Is PQ subtask (bool m_bPQSubTask;)
|
|
fixedData.m_bPQSubTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPQSubTask: {fixedData.m_bPQSubTask}\n\n";
|
|
|
|
// Clear contribution on start (bool m_bClearContrib;)
|
|
fixedData.m_bClearContrib = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bClearContrib: {fixedData.m_bClearContrib}\n\n";
|
|
|
|
// Monster contribution count (uint m_ulMonsterContribCnt;)
|
|
fixedData.m_ulMonsterContribCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulMonsterContribCnt: {fixedData.m_ulMonsterContribCnt}\n\n";
|
|
|
|
// Monster contribution pointer (MONSTERS_CONTRIB[] m_MonstersContrib;)
|
|
// Only the pointer address is stored in the binary (skip 4 bytes)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_MonstersContrib: MONSTERS_CONTRIB[] pointer, skip 4 bytes \n\n";
|
|
|
|
// Account Task related
|
|
fixedData.m_iPremNeedRecordTasksNum = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremNeedRecordTasksNum: {fixedData.m_iPremNeedRecordTasksNum}\n\n";
|
|
|
|
fixedData.m_bShowByNeedRecordTasksNum = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByNeedRecordTasksNum: {fixedData.m_bShowByNeedRecordTasksNum}\n\n";
|
|
|
|
fixedData.m_iPremiseFactionContrib = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremiseFactionContrib: {fixedData.m_iPremiseFactionContrib}\n\n";
|
|
|
|
fixedData.m_bShowByFactionContrib = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByFactionContrib: {fixedData.m_bShowByFactionContrib}\n\n";
|
|
|
|
fixedData.m_bAccountTaskLimit = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bAccountTaskLimit: {fixedData.m_bAccountTaskLimit}\n\n";
|
|
|
|
fixedData.m_bRoleTaskLimit = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bRoleTaskLimit: {fixedData.m_bRoleTaskLimit}\n\n";
|
|
|
|
fixedData.m_ulAccountTaskLimitCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulAccountTaskLimitCnt: {fixedData.m_ulAccountTaskLimitCnt}\n\n";
|
|
|
|
fixedData.m_bLeaveFactionFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bLeaveFactionFail: {fixedData.m_bLeaveFactionFail}\n\n";
|
|
|
|
fixedData.m_bNotIncCntWhenFailed = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bNotIncCntWhenFailed: {fixedData.m_bNotIncCntWhenFailed}\n\n";
|
|
|
|
fixedData.m_bNotClearItemWhenFailed = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bNotClearItemWhenFailed: {fixedData.m_bNotClearItemWhenFailed}\n\n";
|
|
|
|
fixedData.m_bDisplayInTitleTaskUI = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bDisplayInTitleTaskUI: {fixedData.m_bDisplayInTitleTaskUI}\n\n";
|
|
|
|
// Opening conditions
|
|
fixedData.m_ucPremiseTransformedForm = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes);
|
|
logContent += $"m_ucPremiseTransformedForm: {fixedData.m_ucPremiseTransformedForm}\n\n";
|
|
|
|
fixedData.m_bShowByTransformed = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByTransformed: {fixedData.m_bShowByTransformed}\n\n";
|
|
|
|
fixedData.m_ulPremise_Lev_Min = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Lev_Min: {fixedData.m_ulPremise_Lev_Min}\n\n";
|
|
|
|
fixedData.m_ulPremise_Lev_Max = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Lev_Max: {fixedData.m_ulPremise_Lev_Max}\n\n";
|
|
|
|
fixedData.m_bPremCheckMaxHistoryLevel = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_bPremCheckMaxHistoryLevel: {fixedData.m_bPremCheckMaxHistoryLevel}\n\n";
|
|
|
|
fixedData.m_bShowByLev = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByLev: {fixedData.m_bShowByLev}\n\n";
|
|
|
|
fixedData.m_bPremCheckReincarnation = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremCheckReincarnation: {fixedData.m_bPremCheckReincarnation}\n\n";
|
|
|
|
fixedData.m_ulPremReincarnationMin = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremReincarnationMin: {fixedData.m_ulPremReincarnationMin}\n\n";
|
|
|
|
fixedData.m_ulPremReincarnationMax = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremReincarnationMax: {fixedData.m_ulPremReincarnationMax}\n\n";
|
|
|
|
fixedData.m_bShowByReincarnation = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByReincarnation: {fixedData.m_bShowByReincarnation}\n\n";
|
|
|
|
fixedData.m_bPremCheckRealmLevel = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremCheckRealmLevel: {fixedData.m_bPremCheckRealmLevel}\n\n";
|
|
|
|
fixedData.m_ulPremRealmLevelMin = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremRealmLevelMin: {fixedData.m_ulPremRealmLevelMin}\n\n";
|
|
|
|
fixedData.m_ulPremRealmLevelMax = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremRealmLevelMax: {fixedData.m_ulPremRealmLevelMax}\n\n";
|
|
|
|
fixedData.m_bPremCheckRealmExpFull = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremCheckRealmExpFull: {fixedData.m_bPremCheckRealmExpFull}\n\n";
|
|
|
|
fixedData.m_bShowByRealmLevel = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByRealmLevel: {fixedData.m_bShowByRealmLevel}\n\n";
|
|
|
|
fixedData.m_ulPremItems = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremItems: {fixedData.m_ulPremItems}\n\n";
|
|
|
|
// PremItems pointer (ITEM_WANTED[] m_PremItems;)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_PremItems: ITEM_WANTED[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_bShowByItems = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByItems: {fixedData.m_bShowByItems}\n\n";
|
|
|
|
fixedData.m_bPremItemsAnyOne = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremItemsAnyOne: {fixedData.m_bPremItemsAnyOne}\n\n";
|
|
|
|
fixedData.m_ulGivenItems = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulGivenItems: {fixedData.m_ulGivenItems}\n\n";
|
|
|
|
fixedData.m_ulGivenCmnCount = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulGivenCmnCount: {fixedData.m_ulGivenCmnCount}\n\n";
|
|
|
|
fixedData.m_ulGivenTskCount = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulGivenTskCount: {fixedData.m_ulGivenTskCount}\n\n";
|
|
|
|
// GivenItems pointer (ITEM_WANTED[] m_GivenItems;)
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_GivenItems: ITEM_WANTED[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_ulPremise_Deposit = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Deposit: {fixedData.m_ulPremise_Deposit}\n\n";
|
|
|
|
fixedData.m_bShowByDeposit = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByDeposit: {fixedData.m_bShowByDeposit}\n\n";
|
|
|
|
fixedData.m_lPremise_Reputation = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_lPremise_Reputation: {fixedData.m_lPremise_Reputation}\n\n";
|
|
|
|
fixedData.m_lPremise_RepuMax = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_lPremise_RepuMax: {fixedData.m_lPremise_RepuMax}\n\n";
|
|
|
|
fixedData.m_bShowByRepu = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByRepu: {fixedData.m_bShowByRepu}\n\n";
|
|
|
|
fixedData.m_ulPremise_Task_Count = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Task_Count: {fixedData.m_ulPremise_Task_Count}\n\n";
|
|
|
|
fixedData.m_ulPremise_Tasks = AAssit.ReadArrayFromBinary<uint>(fp, TaskTemplConstants.MAX_PREM_TASK_COUNT, ref readBytes);
|
|
logContent += $"m_ulPremise_Tasks[0..{TaskTemplConstants.MAX_PREM_TASK_COUNT - 1}] loaded\n\n";
|
|
|
|
fixedData.m_bShowByPreTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByPreTask: {fixedData.m_bShowByPreTask}\n\n";
|
|
|
|
fixedData.m_ulPremise_Task_Least_Num = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Task_Least_Num: {fixedData.m_ulPremise_Task_Least_Num}\n\n";
|
|
|
|
fixedData.m_ulPremise_Period = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Period: {fixedData.m_ulPremise_Period}\n\n";
|
|
|
|
fixedData.m_bShowByPeriod = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByPeriod: {fixedData.m_bShowByPeriod}\n\n";
|
|
|
|
fixedData.m_ulPremise_Faction = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Faction: {fixedData.m_ulPremise_Faction}\n\n";
|
|
|
|
fixedData.m_iPremise_FactionRole = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremise_FactionRole: {fixedData.m_iPremise_FactionRole}\n\n";
|
|
|
|
fixedData.m_bShowByFaction = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByFaction: {fixedData.m_bShowByFaction}\n\n";
|
|
|
|
// Gender and occupation restrictions
|
|
fixedData.m_ulGender = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulGender: {fixedData.m_ulGender}\n\n";
|
|
|
|
fixedData.m_bShowByGender = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByGender: {fixedData.m_bShowByGender}\n\n";
|
|
|
|
fixedData.m_ulOccupations = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulOccupations: {fixedData.m_ulOccupations}\n\n";
|
|
|
|
fixedData.m_Occupations = AAssit.ReadArrayFromBinary<uint>(fp, TaskTemplConstants.MAX_OCCUPATIONS, ref readBytes);
|
|
logContent += $"m_Occupations[0..{TaskTemplConstants.MAX_OCCUPATIONS - 1}] loaded\n\n";
|
|
|
|
fixedData.m_bShowByOccup = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByOccup: {fixedData.m_bShowByOccup}\n\n";
|
|
|
|
// Spouse related
|
|
fixedData.m_bPremise_Spouse = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremise_Spouse: {fixedData.m_bPremise_Spouse}\n\n";
|
|
|
|
fixedData.m_bShowBySpouse = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowBySpouse: {fixedData.m_bShowBySpouse}\n\n";
|
|
|
|
fixedData.m_bPremiseWeddingOwner = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremiseWeddingOwner: {fixedData.m_bPremiseWeddingOwner}\n\n";
|
|
|
|
fixedData.m_bShowByWeddingOwner = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByWeddingOwner: {fixedData.m_bShowByWeddingOwner}\n\n";
|
|
|
|
// GM and shield user
|
|
fixedData.m_bGM = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bGM: {fixedData.m_bGM}\n\n";
|
|
|
|
fixedData.m_bShieldUser = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShieldUser: {fixedData.m_bShieldUser}\n\n";
|
|
|
|
// RMB limits
|
|
fixedData.m_bShowByRMB = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByRMB: {fixedData.m_bShowByRMB}\n\n";
|
|
|
|
fixedData.m_ulPremRMBMin = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremRMBMin: {fixedData.m_ulPremRMBMin}\n\n";
|
|
|
|
fixedData.m_ulPremRMBMax = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremRMBMax: {fixedData.m_ulPremRMBMax}\n\n";
|
|
|
|
// Character time
|
|
fixedData.m_bCharTime = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCharTime: {fixedData.m_bCharTime}\n\n";
|
|
|
|
fixedData.m_bShowByCharTime = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByCharTime: {fixedData.m_bShowByCharTime}\n\n";
|
|
|
|
fixedData.m_iCharStartTime = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iCharStartTime: {fixedData.m_iCharStartTime}\n\n";
|
|
|
|
fixedData.m_iCharEndTime = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iCharEndTime: {fixedData.m_iCharEndTime}\n\n";
|
|
|
|
fixedData.m_tmCharEndTime = AAssit.ReadFromBinaryOf<task_tm>(fp, ref readBytes);
|
|
logContent += $"m_tmCharEndTime.day: {fixedData.m_tmCharEndTime.day}\n\n";
|
|
|
|
fixedData.m_ulCharTimeGreaterThan = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulCharTimeGreaterThan: {fixedData.m_ulCharTimeGreaterThan}\n\n";
|
|
|
|
// Related and mutex tasks
|
|
fixedData.m_ulPremise_Cotask = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremise_Cotask: {fixedData.m_ulPremise_Cotask}\n\n";
|
|
|
|
fixedData.m_ulCoTaskCond = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulCoTaskCond: {fixedData.m_ulCoTaskCond}\n\n";
|
|
|
|
fixedData.m_ulMutexTaskCount = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulMutexTaskCount: {fixedData.m_ulMutexTaskCount}\n\n";
|
|
|
|
fixedData.m_ulMutexTasks = AAssit.ReadArrayFromBinary<uint>(fp, TaskTemplConstants.MAX_MUTEX_TASK_COUNT, ref readBytes);
|
|
logContent += $"m_ulMutexTasks[0..{TaskTemplConstants.MAX_MUTEX_TASK_COUNT - 1}] loaded\n\n";
|
|
|
|
// Living skills levels (C++ long -> 4 bytes). Read as int and widen to long
|
|
var skillLevelsInt = AAssit.ReadArrayFromBinary<int>(fp, TaskTemplConstants.MAX_LIVING_SKILLS, ref readBytes);
|
|
fixedData.m_lSkillLev = Array.ConvertAll(skillLevelsInt, v => (long)v);
|
|
logContent += $"m_lSkillLev[0..{TaskTemplConstants.MAX_LIVING_SKILLS - 1}] loaded\n\n";
|
|
|
|
// Dynamic task type and special award
|
|
fixedData.m_DynTaskType = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes);
|
|
logContent += $"m_DynTaskType: {fixedData.m_DynTaskType}\n\n";
|
|
|
|
fixedData.m_ulSpecialAward = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulSpecialAward: {fixedData.m_ulSpecialAward}\n\n";
|
|
|
|
// Team information
|
|
fixedData.m_bTeamwork = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bTeamwork: {fixedData.m_bTeamwork}\n\n";
|
|
|
|
fixedData.m_bRcvByTeam = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bRcvByTeam: {fixedData.m_bRcvByTeam}\n\n";
|
|
|
|
fixedData.m_bSharedTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bSharedTask: {fixedData.m_bSharedTask}\n\n";
|
|
|
|
fixedData.m_bSharedAchieved = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bSharedAchieved: {fixedData.m_bSharedAchieved}\n\n";
|
|
|
|
fixedData.m_bCheckTeammate = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCheckTeammate: {fixedData.m_bCheckTeammate}\n\n";
|
|
|
|
fixedData.m_fTeammateDist = AAssit.ReadFromBinaryOf<float>(fp, ref readBytes);
|
|
logContent += $"m_fTeammateDist: {fixedData.m_fTeammateDist}\n\n";
|
|
|
|
fixedData.m_bAllFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bAllFail: {fixedData.m_bAllFail}\n\n";
|
|
|
|
fixedData.m_bCapFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCapFail: {fixedData.m_bCapFail}\n\n";
|
|
|
|
fixedData.m_bCapSucc = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCapSucc: {fixedData.m_bCapSucc}\n\n";
|
|
|
|
fixedData.m_fSuccDist = AAssit.ReadFromBinaryOf<float>(fp, ref readBytes);
|
|
logContent += $"m_fSuccDist: {fixedData.m_fSuccDist}\n\n";
|
|
|
|
fixedData.m_bDismAsSelfFail = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bDismAsSelfFail: {fixedData.m_bDismAsSelfFail}\n\n";
|
|
|
|
fixedData.m_bRcvChckMem = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bRcvChckMem: {fixedData.m_bRcvChckMem}\n\n";
|
|
|
|
fixedData.m_fRcvMemDist = AAssit.ReadFromBinaryOf<float>(fp, ref readBytes);
|
|
logContent += $"m_fRcvMemDist: {fixedData.m_fRcvMemDist}\n\n";
|
|
|
|
fixedData.m_bCntByMemPos = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCntByMemPos: {fixedData.m_bCntByMemPos}\n\n";
|
|
|
|
fixedData.m_fCntMemDist = AAssit.ReadFromBinaryOf<float>(fp, ref readBytes);
|
|
logContent += $"m_fCntMemDist: {fixedData.m_fCntMemDist}\n\n";
|
|
|
|
fixedData.m_bAllSucc = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bAllSucc: {fixedData.m_bAllSucc}\n\n";
|
|
|
|
fixedData.m_bCoupleOnly = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bCoupleOnly: {fixedData.m_bCoupleOnly}\n\n";
|
|
|
|
fixedData.m_bDistinguishedOcc = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bDistinguishedOcc: {fixedData.m_bDistinguishedOcc}\n\n";
|
|
|
|
fixedData.m_ulTeamMemsWanted = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulTeamMemsWanted: {fixedData.m_ulTeamMemsWanted}\n\n";
|
|
|
|
// TEAM_MEM_WANTED pointer array
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_TeamMemsWanted: TEAM_MEM_WANTED[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_bShowByTeam = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByTeam: {fixedData.m_bShowByTeam}\n\n";
|
|
|
|
// Premise global key/value
|
|
fixedData.m_bPremNeedComp = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremNeedComp: {fixedData.m_bPremNeedComp}\n\n";
|
|
|
|
fixedData.m_nPremExp1AndOrExp2 = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_nPremExp1AndOrExp2: {fixedData.m_nPremExp1AndOrExp2}\n\n";
|
|
|
|
fixedData.m_Prem1KeyValue = AAssit.ReadFromBinaryOf<COMPARE_KEY_VALUE>(fp, ref readBytes);
|
|
logContent += $"m_Prem1KeyValue loaded\n\n";
|
|
|
|
fixedData.m_Prem2KeyValue = AAssit.ReadFromBinaryOf<COMPARE_KEY_VALUE>(fp, ref readBytes);
|
|
logContent += $"m_Prem2KeyValue loaded\n\n";
|
|
|
|
// Force related
|
|
fixedData.m_bPremCheckForce = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremCheckForce: {fixedData.m_bPremCheckForce}\n\n";
|
|
|
|
fixedData.m_iPremForce = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremForce: {fixedData.m_iPremForce}\n\n";
|
|
|
|
fixedData.m_bShowByForce = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByForce: {fixedData.m_bShowByForce}\n\n";
|
|
|
|
fixedData.m_iPremForceReputation = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremForceReputation: {fixedData.m_iPremForceReputation}\n\n";
|
|
|
|
fixedData.m_bShowByForceReputation = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByForceReputation: {fixedData.m_bShowByForceReputation}\n\n";
|
|
|
|
fixedData.m_iPremForceContribution = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremForceContribution: {fixedData.m_iPremForceContribution}\n\n";
|
|
|
|
fixedData.m_bShowByForceContribution = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByForceContribution: {fixedData.m_bShowByForceContribution}\n\n";
|
|
|
|
fixedData.m_iPremForceExp = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremForceExp: {fixedData.m_iPremForceExp}\n\n";
|
|
|
|
fixedData.m_bShowByForceExp = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByForceExp: {fixedData.m_bShowByForceExp}\n\n";
|
|
|
|
fixedData.m_iPremForceSP = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremForceSP: {fixedData.m_iPremForceSP}\n\n";
|
|
|
|
fixedData.m_bShowByForceSP = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByForceSP: {fixedData.m_bShowByForceSP}\n\n";
|
|
|
|
fixedData.m_iPremForceActivityLevel = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremForceActivityLevel: {fixedData.m_iPremForceActivityLevel}\n\n";
|
|
|
|
fixedData.m_bShowByForceActivityLevel = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByForceActivityLevel: {fixedData.m_bShowByForceActivityLevel}\n\n";
|
|
|
|
// King / Not in team / Titles
|
|
fixedData.m_bPremIsKing = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremIsKing: {fixedData.m_bPremIsKing}\n\n";
|
|
|
|
fixedData.m_bShowByKing = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByKing: {fixedData.m_bShowByKing}\n\n";
|
|
|
|
fixedData.m_bPremNotInTeam = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bPremNotInTeam: {fixedData.m_bPremNotInTeam}\n\n";
|
|
|
|
fixedData.m_bShowByNotInTeam = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByNotInTeam: {fixedData.m_bShowByNotInTeam}\n\n";
|
|
|
|
fixedData.m_iPremTitleNumTotal = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_iPremTitleNumTotal: {fixedData.m_iPremTitleNumTotal}\n\n";
|
|
|
|
fixedData.m_iPremTitleNumRequired = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_iPremTitleNumRequired: {fixedData.m_iPremTitleNumRequired}\n\n";
|
|
|
|
// PremTitles pointer (int[])
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_PremTitles: int[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_bShowByTitle = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByTitle: {fixedData.m_bShowByTitle}\n\n";
|
|
|
|
var premHistoryIdx = AAssit.ReadArrayFromBinary<int>(fp, 2, ref readBytes);
|
|
fixedData.m_iPremHistoryStageIndex = premHistoryIdx;
|
|
logContent += $"m_iPremHistoryStageIndex[0..1] loaded\n\n";
|
|
|
|
fixedData.m_bShowByHistoryStage = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByHistoryStage: {fixedData.m_bShowByHistoryStage}\n\n";
|
|
|
|
fixedData.m_ulPremGeneralCardCount = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremGeneralCardCount: {fixedData.m_ulPremGeneralCardCount}\n\n";
|
|
|
|
fixedData.m_bShowByGeneralCard = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByGeneralCard: {fixedData.m_bShowByGeneralCard}\n\n";
|
|
|
|
fixedData.m_iPremGeneralCardRank = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iPremGeneralCardRank: {fixedData.m_iPremGeneralCardRank}\n\n";
|
|
|
|
fixedData.m_ulPremGeneralCardRankCount = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPremGeneralCardRankCount: {fixedData.m_ulPremGeneralCardRankCount}\n\n";
|
|
|
|
fixedData.m_bShowByGeneralCardRank = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bShowByGeneralCardRank: {fixedData.m_bShowByGeneralCardRank}\n\n";
|
|
|
|
// Completion methods and conditions
|
|
fixedData.m_enumMethod = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_enumMethod: {fixedData.m_enumMethod}\n\n";
|
|
|
|
fixedData.m_enumFinishType = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_enumFinishType: {fixedData.m_enumFinishType}\n\n";
|
|
|
|
// Task methods
|
|
fixedData.m_ulPlayerWanted = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPlayerWanted: {fixedData.m_ulPlayerWanted}\n\n";
|
|
|
|
// PLAYER_WANTED pointer
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_PlayerWanted: PLAYER_WANTED[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_ulMonsterWanted = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulMonsterWanted: {fixedData.m_ulMonsterWanted}\n\n";
|
|
|
|
// MONSTER_WANTED pointer
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_MonsterWanted: MONSTER_WANTED[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_ulItemsWanted = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulItemsWanted: {fixedData.m_ulItemsWanted}\n\n";
|
|
|
|
// ITEM_WANTED pointer
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_ItemsWanted: ITEM_WANTED[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_ulGoldWanted = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulGoldWanted: {fixedData.m_ulGoldWanted}\n\n";
|
|
|
|
fixedData.m_iFactionContribWanted = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iFactionContribWanted: {fixedData.m_iFactionContribWanted}\n\n";
|
|
|
|
fixedData.m_iFactionExpContribWanted = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iFactionExpContribWanted: {fixedData.m_iFactionExpContribWanted}\n\n";
|
|
|
|
fixedData.m_ulNPCToProtect = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulNPCToProtect: {fixedData.m_ulNPCToProtect}\n\n";
|
|
|
|
fixedData.m_ulProtectTimeLen = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulProtectTimeLen: {fixedData.m_ulProtectTimeLen}\n\n";
|
|
|
|
fixedData.m_ulNPCMoving = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulNPCMoving: {fixedData.m_ulNPCMoving}\n\n";
|
|
|
|
fixedData.m_ulNPCDestSite = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulNPCDestSite: {fixedData.m_ulNPCDestSite}\n\n";
|
|
|
|
// Reach site pointer and counts
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pReachSite: Task_Region[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_ulReachSiteCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulReachSiteCnt: {fixedData.m_ulReachSiteCnt}\n\n";
|
|
|
|
fixedData.m_ulReachSiteId = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulReachSiteId: {fixedData.m_ulReachSiteId}\n\n";
|
|
|
|
fixedData.m_ulWaitTime = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulWaitTime: {fixedData.m_ulWaitTime}\n\n";
|
|
|
|
// Treasure map (TREA)
|
|
fixedData.m_TreasureStartZone = AAssit.ReadFromBinaryOf<ZONE_VERT>(fp, ref readBytes);
|
|
logContent += $"m_TreasureStartZone: ({fixedData.m_TreasureStartZone.x}, {fixedData.m_TreasureStartZone.y}, {fixedData.m_TreasureStartZone.z})\n\n";
|
|
|
|
fixedData.m_ucZonesNumX = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes);
|
|
logContent += $"m_ucZonesNumX: {fixedData.m_ucZonesNumX}\n\n";
|
|
|
|
fixedData.m_ucZonesNumZ = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes);
|
|
logContent += $"m_ucZonesNumZ: {fixedData.m_ucZonesNumZ}\n\n";
|
|
|
|
fixedData.m_ucZoneSide = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes);
|
|
logContent += $"m_ucZoneSide: {fixedData.m_ucZoneSide}\n\n";
|
|
|
|
// Leave site pointer and counts
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pLeaveSite: Task_Region[] pointer, skip 4 bytes \n\n";
|
|
|
|
fixedData.m_ulLeaveSiteCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulLeaveSiteCnt: {fixedData.m_ulLeaveSiteCnt}\n\n";
|
|
|
|
fixedData.m_ulLeaveSiteId = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulLeaveSiteId: {fixedData.m_ulLeaveSiteId}\n\n";
|
|
|
|
// Finish global key/value
|
|
fixedData.m_bFinNeedComp = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bFinNeedComp: {fixedData.m_bFinNeedComp}\n\n";
|
|
|
|
fixedData.m_nFinExp1AndOrExp2 = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_nFinExp1AndOrExp2: {fixedData.m_nFinExp1AndOrExp2}\n\n";
|
|
|
|
fixedData.m_Fin1KeyValue = AAssit.ReadFromBinaryOf<COMPARE_KEY_VALUE>(fp, ref readBytes);
|
|
logContent += $"m_Fin1KeyValue loaded\n\n";
|
|
|
|
fixedData.m_Fin2KeyValue = AAssit.ReadFromBinaryOf<COMPARE_KEY_VALUE>(fp, ref readBytes);
|
|
logContent += $"m_Fin2KeyValue loaded\n\n";
|
|
|
|
// Expressions to display
|
|
fixedData.m_ulExpCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulExpCnt: {fixedData.m_ulExpCnt}\n\n";
|
|
|
|
// Pointers for expression storage
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pszExp: byte[,] pointer, skip 4 bytes \n\n";
|
|
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pExpArr: TASK_EXPRESSION[,] pointer, skip 4 bytes \n\n";
|
|
|
|
// Task char prompts
|
|
fixedData.m_ulTaskCharCnt = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulTaskCharCnt: {fixedData.m_ulTaskCharCnt}\n\n";
|
|
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_pTaskChar: ushort[,] pointer, skip 4 bytes \n\n";
|
|
|
|
// Transformation state
|
|
fixedData.m_ucTransformedForm = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes);
|
|
logContent += $"m_ucTransformedForm: {fixedData.m_ucTransformedForm}\n\n";
|
|
|
|
// Level/Reincarnation/Realm
|
|
fixedData.m_ulReachLevel = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulReachLevel: {fixedData.m_ulReachLevel}\n\n";
|
|
|
|
fixedData.m_ulReachReincarnationCount = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulReachReincarnationCount: {fixedData.m_ulReachReincarnationCount}\n\n";
|
|
|
|
fixedData.m_ulReachRealmLevel = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulReachRealmLevel: {fixedData.m_ulReachRealmLevel}\n\n";
|
|
|
|
fixedData.m_uiEmotion = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_uiEmotion: {fixedData.m_uiEmotion}\n\n";
|
|
|
|
// Award types and pointers
|
|
fixedData.m_ulAwardType_S = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulAwardType_S: {fixedData.m_ulAwardType_S}\n\n";
|
|
|
|
fixedData.m_ulAwardType_F = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulAwardType_F: {fixedData.m_ulAwardType_F}\n\n";
|
|
|
|
// AWARD_DATA pointers
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_Award_S_ptr: AWARD_DATA* pointer, skip 4 bytes \n\n";
|
|
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_Award_F_ptr: AWARD_DATA* pointer, skip 4 bytes \n\n";
|
|
|
|
// Ratio and items scale pointers
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_AwByRatio_S_ptr: AWARD_RATIO_SCALE* pointer, skip 4 bytes \n\n";
|
|
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_AwByRatio_F_ptr: AWARD_RATIO_SCALE* pointer, skip 4 bytes \n\n";
|
|
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_AwByItems_S_ptr: AWARD_ITEMS_SCALE* pointer, skip 4 bytes \n\n";
|
|
|
|
fp.Seek(4, SeekOrigin.Current);
|
|
logContent += $"m_AwByItems_F_ptr: AWARD_ITEMS_SCALE* pointer, skip 4 bytes \n\n";
|
|
|
|
// Hierarchy
|
|
fixedData.m_ulParent = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulParent: {fixedData.m_ulParent}\n\n";
|
|
|
|
fixedData.m_ulPrevSibling = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulPrevSibling: {fixedData.m_ulPrevSibling}\n\n";
|
|
|
|
fixedData.m_ulNextSibling = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulNextSibling: {fixedData.m_ulNextSibling}\n\n";
|
|
|
|
fixedData.m_ulFirstChild = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
logContent += $"m_ulFirstChild: {fixedData.m_ulFirstChild}\n\n";
|
|
|
|
// Library tasks
|
|
fixedData.m_bIsLibraryTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bIsLibraryTask: {fixedData.m_bIsLibraryTask}\n\n";
|
|
|
|
fixedData.m_fLibraryTasksProbability = AAssit.ReadFromBinaryOf<float>(fp, ref readBytes);
|
|
logContent += $"m_fLibraryTasksProbability: {fixedData.m_fLibraryTasksProbability}\n\n";
|
|
|
|
fixedData.m_bIsUniqueStorageTask = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
logContent += $"m_bIsUniqueStorageTask: {fixedData.m_bIsUniqueStorageTask}\n\n";
|
|
|
|
fixedData.m_iWorldContribution = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
logContent += $"m_iWorldContribution: {fixedData.m_iWorldContribution}\n\n";
|
|
|
|
//ConvertPointersOfFixedData(fp, ref fixedData, ref readBytes);
|
|
|
|
BMLogger.LogError($" === Task Data {fixedData.m_ID} loaded === \n {logContent} ");
|
|
//fp.Seek(originalPos, SeekOrigin.Begin);
|
|
return;
|
|
}
|
|
|
|
private void ConvertPointersOfFixedData(FileStream fp, ref ATaskTemplFixedData fixedData, ref long readBytes)
|
|
{
|
|
string logContent = "";
|
|
|
|
// C++ pointer: task_char* m_pszSignature;
|
|
/*if (m_bHasSign)
|
|
{
|
|
m_pszSignature = new task_char[MAX_TASK_NAME_LEN];
|
|
g_ulNewCount++;
|
|
fread(m_pszSignature, sizeof(task_char), MAX_TASK_NAME_LEN, fp);
|
|
convert_txt(m_pszSignature, MAX_TASK_NAME_LEN, (namechar)m_ID);
|
|
}*/
|
|
if (fixedData.m_bHasSign)
|
|
{
|
|
fixedData.m_pszSignature = AAssit.ReadArrayFromBinary<ushort>(fp, TaskTemplConstants.MAX_TASK_NAME_LEN, ref readBytes); //64
|
|
convert_txt(fixedData.m_pszSignature, TaskTemplConstants.MAX_TASK_NAME_LEN, (char)(fixedData.m_ID));
|
|
logContent += $"m_pszSignature: {ByteToStringUtils.UshortArrayToUnicodeString(fixedData.m_pszSignature)}\n"; //68
|
|
}
|
|
else
|
|
{
|
|
logContent += $"m_pszSignature: {fixedData.m_pszSignature}\n";
|
|
}
|
|
|
|
// C++ struct: task_tm* m_tmStart; task_tm* m_tmEnd;
|
|
/*if (m_ulTimetable)
|
|
{
|
|
m_tmStart = new task_tm[m_ulTimetable];
|
|
g_ulNewCount++;
|
|
m_tmEnd = new task_tm[m_ulTimetable];
|
|
g_ulNewCount++;
|
|
}
|
|
|
|
for (i = 0; i < m_ulTimetable; i++)
|
|
{
|
|
fread(&m_tmStart[i], sizeof(task_tm), 1, fp);
|
|
fread(&m_tmEnd[i], sizeof(task_tm), 1, fp);
|
|
}*/
|
|
if (fixedData.m_ulTimetable > 0)
|
|
{
|
|
fixedData.m_tmStart = new task_tm[fixedData.m_ulTimetable];
|
|
fixedData.m_tmEnd = new task_tm[fixedData.m_ulTimetable];
|
|
|
|
string tmStartLog = "";
|
|
string tmEndLog = "";
|
|
|
|
for (int i=0; i < fixedData.m_ulTimetable; i++)
|
|
{
|
|
fixedData.m_tmStart[i] = AAssit.ReadFromBinaryOf<task_tm>(fp, ref readBytes);
|
|
fixedData.m_tmEnd[i] = AAssit.ReadFromBinaryOf<task_tm>(fp, ref readBytes);
|
|
|
|
tmStartLog += $"{i} = {fixedData.m_tmStart[i].GetLog()} || ";
|
|
tmEndLog += $"{i} = {fixedData.m_tmEnd[i].GetLog()} || ";
|
|
}
|
|
|
|
logContent += $"m_tmStart: {tmStartLog} \n";
|
|
logContent += $"m_tmEnd: {tmEndLog} \n";
|
|
}
|
|
|
|
// C++ pointer arrays: long* m_plChangeKey; long* m_plChangeKeyValue; bool* m_pbChangeType;
|
|
/*if (m_ulChangeKeyCnt)
|
|
{
|
|
m_plChangeKey = new long[m_ulChangeKeyCnt];
|
|
m_plChangeKeyValue = new long[m_ulChangeKeyCnt];
|
|
m_pbChangeType = new bool[m_ulChangeKeyCnt];
|
|
}
|
|
|
|
for (i=0; i<m_ulChangeKeyCnt; i++)
|
|
{
|
|
fread(&m_plChangeKey[i], sizeof(long), 1, fp);
|
|
fread(&m_plChangeKeyValue[i], sizeof(long), 1, fp);
|
|
fread(&m_pbChangeType[i], sizeof(bool), 1, fp);
|
|
}*/
|
|
if (fixedData.m_ulChangeKeyCnt > 0)
|
|
{
|
|
fixedData.m_plChangeKey = new int[fixedData.m_ulChangeKeyCnt];
|
|
fixedData.m_plChangeKeyValue = new int[fixedData.m_ulChangeKeyCnt];
|
|
fixedData.m_pbChangeType = new bool[fixedData.m_ulChangeKeyCnt];
|
|
|
|
string changeKeyLog = "";
|
|
string changeKeyValueLog = "";
|
|
string changeTypeLog = "";
|
|
|
|
for (int i=0; i < fixedData.m_ulChangeKeyCnt; i++)
|
|
{
|
|
fixedData.m_plChangeKey[i] = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
fixedData.m_plChangeKeyValue[i] = AAssit.ReadFromBinaryOf<int>(fp, ref readBytes);
|
|
fixedData.m_pbChangeType[i] = AAssit.ReadFromBinaryOf<byte>(fp, ref readBytes) > 0;
|
|
|
|
changeKeyLog += $"{i} = {fixedData.m_plChangeKey[i]} || ";
|
|
changeKeyValueLog += $"{i} = {fixedData.m_plChangeKeyValue[i]} || ";
|
|
changeTypeLog += $"{i} = {fixedData.m_pbChangeType[i]} || ";
|
|
}
|
|
|
|
logContent += $"m_plChangeKey: {changeKeyLog} \n";
|
|
logContent += $"m_plChangeKeyValue: {changeKeyValueLog} \n";
|
|
logContent += $"m_pbChangeType: {changeTypeLog} \n";
|
|
}
|
|
else
|
|
{
|
|
logContent += $"m_plChangeKey: {fixedData.m_plChangeKey}\n";
|
|
logContent += $"m_plChangeKeyValue: {fixedData.m_plChangeKeyValue}\n";
|
|
logContent += $"m_pbChangeType: {fixedData.m_pbChangeType}\n";
|
|
}
|
|
|
|
|
|
/*if (m_ulPQExpCnt)
|
|
{
|
|
m_pszPQExp = new char[m_ulPQExpCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
memset(m_pszPQExp, 0, m_ulPQExpCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
m_pPQExpArr = new TASK_EXPRESSION[m_ulPQExpCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
memset(m_pPQExpArr, 0, sizeof(TASK_EXPRESSION)*m_ulPQExpCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
for (i=0; i<m_ulPQExpCnt; i++)
|
|
{
|
|
fread(m_pszPQExp[i], 1, TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
fread(m_pPQExpArr[i], sizeof(TASK_EXPRESSION), TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
}
|
|
}*/
|
|
if (fixedData.m_ulPQExpCnt > 0)
|
|
{
|
|
int rowCount = (int)fixedData.m_ulPQExpCnt;
|
|
int colCount = TaskTemplConstants.TASK_AWARD_MAX_DISPLAY_CHAR_LEN;
|
|
|
|
fixedData.m_pszPQExp = new byte[rowCount, colCount];
|
|
fixedData.m_pPQExpArr = new TASK_EXPRESSION[rowCount, colCount];
|
|
|
|
for (int i = 0; i < rowCount; i++)
|
|
{
|
|
// Read PQ expression display bytes (length TASK_AWARD_MAX_DISPLAY_CHAR_LEN)
|
|
byte[] expBytes = AAssit.ReadArrayFromBinary<byte>(fp, colCount, ref readBytes);
|
|
for (int j = 0; j < colCount; j++)
|
|
{
|
|
fixedData.m_pszPQExp[i, j] = expBytes[j];
|
|
}
|
|
|
|
// Read TASK_EXPRESSION array (length TASK_AWARD_MAX_DISPLAY_CHAR_LEN)
|
|
for (int j = 0; j < colCount; j++)
|
|
{
|
|
fixedData.m_pPQExpArr[i, j] = AAssit.ReadFromBinaryOf<TASK_EXPRESSION>(fp, ref readBytes);
|
|
}
|
|
}
|
|
|
|
logContent += $"m_pszPQExp and m_pPQExpArr loaded, count: {fixedData.m_ulPQExpCnt} (each {TaskTemplConstants.TASK_AWARD_MAX_DISPLAY_CHAR_LEN})\n";
|
|
}
|
|
else
|
|
{
|
|
logContent += $"m_pszPQExp: {fixedData.m_pszPQExp}\n";
|
|
logContent += $"m_pPQExpArr: {fixedData.m_pPQExpArr}\n";
|
|
}
|
|
|
|
// Convert C++ lines 3866-3896
|
|
if (fixedData.m_ulMonsterContribCnt > 0)
|
|
{
|
|
fixedData.m_MonstersContrib = new MONSTERS_CONTRIB[fixedData.m_ulMonsterContribCnt];
|
|
|
|
string mcLog = "";
|
|
for (int i = 0; i < fixedData.m_ulMonsterContribCnt; i++)
|
|
{
|
|
fixedData.m_MonstersContrib[i] = AAssit.ReadFromBinaryOf<MONSTERS_CONTRIB>(fp, ref readBytes);
|
|
mcLog += $"{i} = (MonsterId:{fixedData.m_MonstersContrib[i].m_ulMonsterTemplId}) || ";
|
|
}
|
|
logContent += $"m_MonstersContrib: {mcLog}\n";
|
|
}
|
|
else
|
|
{
|
|
logContent += $"m_MonstersContrib: {fixedData.m_MonstersContrib}\n";
|
|
}
|
|
|
|
// version 80: delivery regions
|
|
if (fixedData.m_ulDelvRegionCnt > 0)
|
|
{
|
|
fixedData.m_pDelvRegion = new Task_Region[fixedData.m_ulDelvRegionCnt];
|
|
string dLog = "";
|
|
for (int i = 0; i < fixedData.m_ulDelvRegionCnt; i++)
|
|
{
|
|
fixedData.m_pDelvRegion[i] = AAssit.ReadFromBinaryOf<Task_Region>(fp, ref readBytes);
|
|
dLog += $" {i} = (RegionId:{fixedData.m_pDelvRegion[i].GetLog()}) || ";
|
|
}
|
|
logContent += $"m_pDelvRegion: {dLog}\n";
|
|
}
|
|
else
|
|
{
|
|
fixedData.m_pDelvRegion = null;
|
|
logContent += $"m_pDelvRegion: {fixedData.m_pDelvRegion}\n";
|
|
}
|
|
|
|
|
|
if (fixedData.m_ulEnterRegionCnt > 0)
|
|
{
|
|
fixedData.m_pEnterRegion = new Task_Region[fixedData.m_ulEnterRegionCnt];
|
|
}
|
|
else
|
|
{
|
|
fixedData.m_pEnterRegion = null;
|
|
}
|
|
|
|
|
|
BMLogger.LogError($" === Task Pointer Datas {fixedData.m_ID} loaded === \n {logContent} ");
|
|
}
|
|
|
|
|
|
#region convert from c++ to cs
|
|
|
|
// private bool LoadFixedDataFromBinFile(FileStream fp)
|
|
// {
|
|
|
|
// long readBytes = 0;
|
|
// BMLogger.Log($"LoadFixedDataFromBinFile: {fp.Length}");
|
|
|
|
// ATaskTemplFixedData fixedData;
|
|
|
|
// // * Important Note:
|
|
// // + In C++: "unsigned long" → corresponds to "uint" in C#
|
|
// // + "bool" in C++ is 1 byte (while C# bool is also 1 byte in struct layout, but not in file IO)
|
|
// // + wchar_t on Windows = 2 bytes
|
|
// // + When reading binary data, we must match the original C++ memory layout exactly.
|
|
|
|
|
|
// // ------------------------------------------------------------
|
|
// // Case 1: "Normal" value type variable
|
|
// // ------------------------------------------------------------
|
|
// // These are directly stored scalar values (no arrays, no pointers, no user-defined struct).
|
|
// // Example: bool m_bHasSign; unsigned long m_ID;
|
|
// // Originally in C++: unsigned long m_ID;
|
|
// // → Read value and asign value to the field
|
|
// fixedData.m_ID = AAssist.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
|
|
|
|
// // ------------------------------------------------------------
|
|
// // Case 2: Fixed-size array (memory already allocated inline)
|
|
// // ------------------------------------------------------------
|
|
// // These have a known constant size in C++, usually defined by a macro.
|
|
// // Example: task_char m_szName[MAX_TASK_NAME_LEN];
|
|
// // char m_tmType[MAX_TIMETABLE_SIZE];
|
|
// // → request write here
|
|
// // Example usage:
|
|
// //read array from binary to assign value to the field
|
|
// fixedData.m_tmStart = AAssit.ReadArrayFromBinary<task_tm>(fp, TaskTemplConstants.MAX_TIMETABLE_SIZE, ref readBytes);
|
|
// fixedData.m_tmEnd = AAssit.ReadArrayFromBinary<task_tm>(fp, TaskTemplConstants.MAX_TIMETABLE_SIZE, ref readBytes);
|
|
|
|
|
|
// // ------------------------------------------------------------
|
|
// // Case 3: Pointer to user-defined type or string
|
|
// // ------------------------------------------------------------
|
|
// // These fields in C++ store only the pointer address, not the actual object.
|
|
// // Example: task_char* m_pszSignature;
|
|
// // originally in C++: task_char* m_pszSignature;
|
|
// // → Skip pointer size, since the content is not inlined.
|
|
// // fp.Seek(IntPtr.Size, SeekOrigin.Current);
|
|
// fp.Seek(4, SeekOrigin.Current);
|
|
|
|
// // ------------------------------------------------------------
|
|
// // Case 4: User-defined struct (not pointer)
|
|
// // ------------------------------------------------------------
|
|
// // Skip the full size of the struct in the binary stream.
|
|
// // **Important:** check the struct's internal members and padding
|
|
// // to calculate the correct size, do not rely on hardcoded numbers.
|
|
// //
|
|
// // Example:
|
|
// // task_tm m_tmAbsFailTime; // inline struct
|
|
// // → Skip sizeof(task_tm) bytes.
|
|
// fp.Seek(24, SeekOrigin.Current); // Example for Windows/MSVC
|
|
|
|
// //case pointer không được define kích thước trước và là kiểu dữ liệu cơ bản => skip tùy theo kích thước của kiểu dữ liệu cơ bản
|
|
// // ví dụ: ushort* m_pszSignature => skip 2 bytes
|
|
// //request: hoàn thiện rule
|
|
|
|
// // ------------------------------------------------------------
|
|
// // Case 5: Pointer to basic type (size not predefined)
|
|
// // ------------------------------------------------------------
|
|
// // If a field is a pointer to a basic type (e.g., ushort*, int*, float*),
|
|
// // the pointer itself is stored inline, but the pointed-to data is not.
|
|
// // When reading binary, skip the size of the basic type (not the pointer address).
|
|
// //
|
|
// // Example:
|
|
// // ushort* m_pszSignature; // skip 2 bytes (size of ushort)
|
|
// fp.Seek(2, SeekOrigin.Current); // skip 1 element of the basic type
|
|
|
|
// return true;
|
|
// }
|
|
// this convert from c++ to cs
|
|
|
|
//*important note:
|
|
// + in c++: unsigned long => will be uint in cs;
|
|
//
|
|
|
|
// Case 1: convert from "normal" variable => asign value to the field
|
|
// Excample: bool *m_pbChangeType; unsigned long m_ID;
|
|
// originally this line in c++: unsigned long m_ID;
|
|
// fixedData.m_ID = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
|
|
// Case 2: convert from variable what already defined size of memories => skip the size of the variable
|
|
// Excample: task_char m_szName[MAX_TASK_NAME_LEN]; char m_tmType[MAX_TIMETABLE_SIZE]; => in this example, MAX_TASK_NAME_LEN and MAX_TIMETABLE_SIZE are already defined size of memories.
|
|
// originally this line in c++: task_char m_szName[MAX_TASK_NAME_LEN];
|
|
// fp.Seek(TaskTemplConstants.MAX_TASK_NAME_LEN, SeekOrigin.Current);
|
|
|
|
// Case 3: convert from variable what is user defination and it is pointer => skip 2 bytes
|
|
// Excample: task_char* m_pszSignature; (task_char is defined by user)
|
|
// originally this line in c++: task_char* m_pszSignature;
|
|
// fp.Seek(2, SeekOrigin.Current);
|
|
|
|
// Case 4: convert from variable what is user defination and it is pointer => skip 4 bytes
|
|
// Excample: task_char* m_pszSignature; (task_char is defined by user)
|
|
// originally this line in c++: task_char* m_pszSignature;
|
|
// fp.Seek(4, SeekOrigin.Current);
|
|
|
|
// fixedData.m_ID = AAssit.ReadFromBinaryOf<uint>(fp, ref readBytes);
|
|
// fixedData.m_szName = AAssit.ReadArrayFromBinary<ushort>(fp, TaskTemplConstants.MAX_TASK_NAME_LEN, ref readBytes);
|
|
// TaskTemplUtils.convert_txt(ref fixedData.m_szName, TaskTemplConstants.MAX_TASK_NAME_LEN, TaskTemplUtils.uint_to_ushort(fixedData.m_ID));
|
|
// BMLogger.Log($"LoadFixedDataFromBinFile: ID {fixedData.m_ID} Name {ByteToStringUtils.UshortArrayToCP936String(fixedData.m_szName)}");
|
|
// fixedData.m_bHasSign = AAssit.ReadFromBinaryOf<bool>(fp, ref readBytes);
|
|
|
|
|
|
|
|
// ATaskTemplFixedData fixedData = AAssit.ReadFromBinaryOf<ATaskTemplFixedData>(fp, ref readBytes);
|
|
|
|
//convert_txt(m_szName, MAX_TASK_NAME_LEN, (namechar)m_ID);
|
|
|
|
// m_Award_S = new AWARD_DATA;
|
|
// g_ulNewCount++;
|
|
// m_Award_F = new AWARD_DATA;
|
|
// g_ulNewCount++;
|
|
// m_AwByRatio_S = new AWARD_RATIO_SCALE;
|
|
// g_ulNewCount++;
|
|
// m_AwByRatio_F = new AWARD_RATIO_SCALE;
|
|
// g_ulNewCount++;
|
|
// m_AwByItems_S = new AWARD_ITEMS_SCALE;
|
|
// g_ulNewCount++;
|
|
// m_AwByItems_F = new AWARD_ITEMS_SCALE;
|
|
// g_ulNewCount++;
|
|
// m_tmStart = NULL;
|
|
// m_tmEnd = NULL;
|
|
// m_plChangeKey = NULL;
|
|
// m_plChangeKeyValue = NULL;
|
|
// m_pbChangeType = NULL;
|
|
// m_PremItems = NULL;
|
|
// m_GivenItems = NULL;
|
|
// m_TeamMemsWanted= NULL;
|
|
// m_ItemsWanted = NULL;
|
|
// m_PlayerWanted = NULL;
|
|
// m_MonsterWanted = NULL;
|
|
// m_pszSignature = NULL;
|
|
// m_pszExp = NULL;
|
|
// m_pExpArr = NULL;
|
|
// m_pTaskChar = NULL;
|
|
// m_pszPQExp = NULL;
|
|
// m_pPQExpArr = NULL;
|
|
// m_MonstersContrib = NULL;
|
|
// m_PremTitles = NULL;
|
|
|
|
// if (m_bHasSign)
|
|
// {
|
|
// m_pszSignature = new task_char[MAX_TASK_NAME_LEN];
|
|
// g_ulNewCount++;
|
|
// fread(m_pszSignature, sizeof(task_char), MAX_TASK_NAME_LEN, fp);
|
|
// convert_txt(m_pszSignature, MAX_TASK_NAME_LEN, (namechar)m_ID);
|
|
// }
|
|
|
|
// if (m_ulTimetable)
|
|
// {
|
|
// m_tmStart = new task_tm[m_ulTimetable];
|
|
// g_ulNewCount++;
|
|
// m_tmEnd = new task_tm[m_ulTimetable];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulTimetable; i++)
|
|
// {
|
|
// fread(&m_tmStart[i], sizeof(task_tm), 1, fp);
|
|
// fread(&m_tmEnd[i], sizeof(task_tm), 1, fp);
|
|
// }
|
|
|
|
// if (m_ulChangeKeyCnt)
|
|
// {
|
|
// m_plChangeKey = new long[m_ulChangeKeyCnt];
|
|
// m_plChangeKeyValue = new long[m_ulChangeKeyCnt];
|
|
// m_pbChangeType = new bool[m_ulChangeKeyCnt];
|
|
// }
|
|
|
|
// for (i=0; i<m_ulChangeKeyCnt; i++)
|
|
// {
|
|
// fread(&m_plChangeKey[i], sizeof(long), 1, fp);
|
|
// fread(&m_plChangeKeyValue[i], sizeof(long), 1, fp);
|
|
// fread(&m_pbChangeType[i], sizeof(bool), 1, fp);
|
|
// }
|
|
|
|
// if (m_ulPQExpCnt)
|
|
// {
|
|
// m_pszPQExp = new char[m_ulPQExpCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
// memset(m_pszPQExp, 0, m_ulPQExpCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
// m_pPQExpArr = new TASK_EXPRESSION[m_ulPQExpCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
// memset(m_pPQExpArr, 0, sizeof(TASK_EXPRESSION)*m_ulPQExpCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
// for (i=0; i<m_ulPQExpCnt; i++)
|
|
// {
|
|
// fread(m_pszPQExp[i], 1, TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
// fread(m_pPQExpArr[i], sizeof(TASK_EXPRESSION), TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
// }
|
|
// }
|
|
|
|
// if (m_ulMonsterContribCnt)
|
|
// {
|
|
// m_MonstersContrib = new MONSTERS_CONTRIB[m_ulMonsterContribCnt];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulMonsterContribCnt; i++)
|
|
// {
|
|
// MONSTERS_CONTRIB& mc = m_MonstersContrib[i];
|
|
// fread(&mc, sizeof(mc), 1, fp);
|
|
// }
|
|
|
|
// // version 80
|
|
// if (m_ulDelvRegionCnt>0)
|
|
// {
|
|
// m_pDelvRegion = new Task_Region[m_ulDelvRegionCnt];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// else m_pDelvRegion = NULL;
|
|
|
|
// for (i=0;i<m_ulDelvRegionCnt;i++)
|
|
// {
|
|
// Task_Region& t = m_pDelvRegion[i];
|
|
// fread(&t,sizeof(Task_Region),1,fp);
|
|
// }
|
|
// if (m_ulEnterRegionCnt>0)
|
|
// {
|
|
// m_pEnterRegion = new Task_Region[m_ulEnterRegionCnt];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// else m_pEnterRegion = NULL;
|
|
|
|
// for (i=0;i<m_ulEnterRegionCnt;i++)
|
|
// {
|
|
// Task_Region& t = m_pEnterRegion[i];
|
|
// fread(&t,sizeof(Task_Region),1,fp);
|
|
// }
|
|
// if (m_ulLeaveRegionCnt>0)
|
|
// {
|
|
// m_pLeaveRegion = new Task_Region[m_ulLeaveRegionCnt];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// else m_pLeaveRegion = NULL;
|
|
|
|
// for (i=0;i<m_ulLeaveRegionCnt;i++)
|
|
// {
|
|
// Task_Region& t = m_pLeaveRegion[i];
|
|
// fread(&t,sizeof(Task_Region),1,fp);
|
|
// }
|
|
|
|
// // ÈÎÎñ¿ªÆôÌõ¼þ¼°·½Ê½
|
|
// if (m_ulPremItems)
|
|
// {
|
|
// m_PremItems = new ITEM_WANTED[m_ulPremItems];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulPremItems; i++)
|
|
// {
|
|
// ITEM_WANTED& iw = m_PremItems[i];
|
|
// fread(&iw, sizeof(iw), 1, fp);
|
|
// }
|
|
|
|
// m_ulGivenCmnCount = 0;
|
|
// m_ulGivenTskCount = 0;
|
|
|
|
// if (m_ulGivenItems)
|
|
// {
|
|
// m_GivenItems = new ITEM_WANTED[m_ulGivenItems];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulGivenItems; i++)
|
|
// {
|
|
// ITEM_WANTED& iw = m_GivenItems[i];
|
|
// fread(&iw, sizeof(iw), 1, fp);
|
|
|
|
// if (iw.m_bCommonItem) m_ulGivenCmnCount++;
|
|
// else m_ulGivenTskCount++;
|
|
// }
|
|
|
|
// if (m_bTeamwork)
|
|
// {
|
|
// if (m_ulTeamMemsWanted)
|
|
// {
|
|
// m_TeamMemsWanted = new TEAM_MEM_WANTED[m_ulTeamMemsWanted];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulTeamMemsWanted; i++)
|
|
// {
|
|
// TEAM_MEM_WANTED& tmw = m_TeamMemsWanted[i];
|
|
// fread(&tmw, sizeof(tmw), 1, fp);
|
|
// }
|
|
// }
|
|
// if (m_iPremTitleNumTotal)
|
|
// {
|
|
// m_PremTitles = new int[m_iPremTitleNumTotal];
|
|
// g_ulNewCount++;
|
|
// for (i = 0; i < m_iPremTitleNumTotal; i++)
|
|
// {
|
|
// fread(&m_PremTitles[i], sizeof(int), 1, fp);
|
|
// }
|
|
// }
|
|
|
|
// /* ÈÎÎñÍê³ÉµÄ·½Ê½¼°Ìõ¼þ */
|
|
|
|
// if (m_ulMonsterWanted)
|
|
// {
|
|
// m_MonsterWanted = new MONSTER_WANTED[m_ulMonsterWanted];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulMonsterWanted; i++)
|
|
// {
|
|
// MONSTER_WANTED& mw = m_MonsterWanted[i];
|
|
// fread(&mw, sizeof(mw), 1, fp);
|
|
// }
|
|
|
|
// if (m_ulPlayerWanted)
|
|
// {
|
|
// m_PlayerWanted = new PLAYER_WANTED[m_ulPlayerWanted];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// for (i = 0; i < m_ulPlayerWanted; ++i)
|
|
// {
|
|
// PLAYER_WANTED& pw = m_PlayerWanted[i];
|
|
// fread(&pw, sizeof(pw), 1, fp);
|
|
// }
|
|
|
|
// if (m_ulItemsWanted)
|
|
// {
|
|
// m_ItemsWanted = new ITEM_WANTED[m_ulItemsWanted];
|
|
// g_ulNewCount++;
|
|
// }
|
|
|
|
// for (i = 0; i < m_ulItemsWanted; i++)
|
|
// {
|
|
// ITEM_WANTED& iw = m_ItemsWanted[i];
|
|
// fread(&iw, sizeof(iw), 1, fp);
|
|
// }
|
|
|
|
// if (m_ulExpCnt)
|
|
// {
|
|
// m_pszExp = new char[m_ulExpCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
// memset(m_pszExp, 0, m_ulExpCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
// m_pExpArr = new TASK_EXPRESSION[m_ulExpCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
// memset(m_pExpArr, 0, sizeof(TASK_EXPRESSION)*m_ulExpCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
// for (i=0; i<m_ulExpCnt; i++)
|
|
// {
|
|
// fread(m_pszExp[i], 1, TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
// fread(m_pExpArr[i], sizeof(TASK_EXPRESSION), TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
// }
|
|
// }
|
|
|
|
// if (m_ulTaskCharCnt)
|
|
// {
|
|
// m_pTaskChar = new task_char[m_ulTaskCharCnt][TASK_AWARD_MAX_DISPLAY_CHAR_LEN];
|
|
// memset(m_pTaskChar, 0, sizeof(task_char)*m_ulTaskCharCnt*TASK_AWARD_MAX_DISPLAY_CHAR_LEN);
|
|
|
|
// for (i=0; i<m_ulTaskCharCnt; i++)
|
|
// {
|
|
// fread(m_pTaskChar[i], sizeof(task_char), TASK_AWARD_MAX_DISPLAY_CHAR_LEN, fp);
|
|
// }
|
|
// }
|
|
|
|
// // version 80
|
|
// if (m_ulReachSiteCnt>0)
|
|
// {
|
|
// m_pReachSite = new Task_Region[m_ulReachSiteCnt];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// else m_pReachSite = NULL;
|
|
|
|
// for (i=0;i<m_ulReachSiteCnt;i++)
|
|
// {
|
|
// Task_Region& t = m_pReachSite[i];
|
|
// fread(&t,sizeof(Task_Region),1,fp);
|
|
// }
|
|
// if (m_ulLeaveSiteCnt>0)
|
|
// {
|
|
// m_pLeaveSite = new Task_Region[m_ulLeaveSiteCnt];
|
|
// g_ulNewCount++;
|
|
// }
|
|
// else m_pLeaveSite = NULL;
|
|
|
|
// for (i=0;i<m_ulLeaveSiteCnt;i++)
|
|
// {
|
|
// Task_Region& t = m_pLeaveSite[i];
|
|
// fread(&t,sizeof(Task_Region),1,fp);
|
|
// }
|
|
|
|
// LoadAwardDataBin(fp, *m_Award_S, _task_templ_cur_version);
|
|
// LoadAwardDataBin(fp, *m_Award_F, _task_templ_cur_version);
|
|
|
|
// LoadAwardDataRatioScale(fp, *m_AwByRatio_S, _task_templ_cur_version);
|
|
// LoadAwardDataRatioScale(fp, *m_AwByRatio_F, _task_templ_cur_version);
|
|
|
|
// LoadAwardDataItemsScale(fp, *m_AwByItems_S, _task_templ_cur_version);
|
|
// LoadAwardDataItemsScale(fp, *m_AwByItems_F, _task_templ_cur_version);
|
|
#endregion
|
|
|
|
string convert_txt(string str, char code)
|
|
{
|
|
char[] chars = str.ToCharArray();
|
|
for (int i = 0; i < chars.Length; i++)
|
|
{
|
|
chars[i] = (char)(chars[i] ^ code);
|
|
}
|
|
return new string(chars);
|
|
}
|
|
|
|
public void IncValidCount() { m_uValidCount++; }
|
|
|
|
}
|
|
} |