diff --git a/Assets/Scripts/Task.meta b/Assets/Scripts/Task.meta new file mode 100644 index 0000000000..7e7e1064ca --- /dev/null +++ b/Assets/Scripts/Task.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7b3600ea9146f345883726da0f9c37e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Task/ATaskTemplMan.cs b/Assets/Scripts/Task/ATaskTemplMan.cs new file mode 100644 index 0000000000..b6c170ccc8 --- /dev/null +++ b/Assets/Scripts/Task/ATaskTemplMan.cs @@ -0,0 +1,242 @@ +using System.IO; +using System.Collections.Generic; +using UnityEngine; + +namespace PerfectWorld.Scripts.Task +{ + public struct TASK_PACK_HEADER + { + public ulong magic; + public ulong version; + public ulong item_count; + }; + public class ATaskTemplMan + { + public const ulong TASK_PACK_MAGIC = 0x93858361; + public const ulong _task_templ_cur_version = 121; + + + private ulong g_ulNewCount = 0;// do we need this? + private Dictionary m_TaskTemplMap = new Dictionary(); + private Dictionary m_AllTemplMap = new Dictionary(); + private Dictionary m_DynTaskMap = new Dictionary(); + private Dictionary m_TitleTaskMap = new Dictionary(); + private Dictionary m_ExlusiveAwardTaskMap = new Dictionary(); + private Dictionary m_ProtectNPCMap = new Dictionary(); + private Dictionary m_AutoDelvMap = new Dictionary(); + private Dictionary m_DeathTrigMap = new Dictionary(); + private Dictionary m_PQTemplMap = new Dictionary(); + private List m_SkillTaskLst = new List(); + +#if _TASK_CLIENT + // char m_szDynPackPath[512]; + // bool m_bDynTasksVerified; + // special_award m_SpecialAward; + private List m_TasksCanSeekOut = new List(); + // TaskTemplLst m_TasksCanDeliver; + // struct TasksSeekOutDiff + // { + // ATaskTempl* task; + // TasksSeekOutDiff():task(NULL){} + // TasksSeekOutDiff(ATaskTempl* p):task(p){} + + // bool operator < (const TasksSeekOutDiff& rhs) const; + // bool operator == (const TasksSeekOutDiff& rhs) const { return task == rhs.task; } + // }; + // typedef std::vector TasksSeekOutDiffList; + // TasksSeekOutDiffList m_TasksToPush; +#endif + + void Release() + { + + } + public bool LoadTasksFromPack(string szPackPath, bool bLoadDescript) + { + //TaskInterface::WriteLog(0, 0, 2, "LoadPack begin"); + FileStream fs = new FileStream(szPackPath, FileMode.Open, FileAccess.Read); + + if (fs == null) return false; + + TASK_PACK_HEADER tph; + + // fread(&tph, sizeof(tph), 1, fp); + tph = ReadStruct(fs); + + if (tph.magic != TASK_PACK_MAGIC + || tph.version != _task_templ_cur_version) + return false; + + if (tph.item_count == 0) return true; + + long[] pOffs = new long[tph.item_count]; + g_ulNewCount++; + + // fread(pOffs, sizeof(long), tph.item_count, fp); + // Convert fread(pOffs, sizeof(long), tph.item_count, fp); to C# + // Read tph.item_count 8-byte integers (long) from the FileStream fs into pOffs array + + byte[] offsBuffer = new byte[tph.item_count * sizeof(long)]; + int bytesRead = fs.Read(offsBuffer, 0, offsBuffer.Length); + if (bytesRead != offsBuffer.Length) + throw new EndOfStreamException("Could not read enough bytes for offsets"); + + for (ulong i = 0; i < tph.item_count; i++) + { + pOffs[i] = System.BitConverter.ToInt64(offsBuffer, (int)(i * sizeof(long))); + } + + + for (ulong i = 0; i < tph.item_count; i++) + { + // if (fseek(fp, pOffs[i], SEEK_SET) != 0) + // continue; + if (fs.Seek(pOffs[i], SeekOrigin.Begin) != 0) + continue; + + ATaskTempl pTempl = new ATaskTempl(); + g_ulNewCount++; + + if (!pTempl.LoadFromBinFile(fs)) + { + // TaskInterface::WriteLog(0, pTempl->m_ID, 0, "Cant Load Task"); + // LOG_DELETE(pTempl); + continue; + } + + AddOneTaskTempl(pTempl); + // TaskInterface::WriteLog(0, pTempl->m_ID, 2, "LoadTask"); + } + + // char log[1024]; + // sprintf(log, "LoadTask, Count = %d", m_TaskTemplMap.size()); + // TaskInterface::WriteLog(0, 0, 2, log); + + //todo: check + // LOG_DELETE_ARR(pOffs); + fs.Close(); + + //todo: check UpdateTimeLimitCheckList + // #if _TASK_CLIENT + UpdateTimeLimitCheckList(); + // #else + SortTasksCanSeekOut(); + // #endif + +#if _ELEMENTCLIENT + _task_err.Release(); + _task_err.Init("Configs\\task_err.txt", true); +#endif + + return true; + } + + // General method to read a struct from a FileStream + private T ReadStruct(FileStream stream) where T : struct + { + int size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(T)); + byte[] buffer = new byte[size]; + int bytesRead = stream.Read(buffer, 0, size); + if (bytesRead != size) + throw new EndOfStreamException("Could not read enough bytes for struct"); + var handle = System.Runtime.InteropServices.GCHandle.Alloc(buffer, System.Runtime.InteropServices.GCHandleType.Pinned); + try + { + return (T)System.Runtime.InteropServices.Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); + } + finally + { + handle.Free(); + } + } + public bool LoadNPCInfoFromPack(string szPath) + { + return true; + } + public void VerifyDynTasksPack(string szPath) + { + + } + + private void AddOneTaskTempl(ATaskTempl pTask) + { + //todo: recheck - wrong logic + if (m_AllTemplMap.ContainsKey(pTask.m_ID)) + { + CECTaskInterface.WriteLog(0, (int)pTask.m_ID, 0, "Dup Task Found"); + // Optionally log duplicate task found, e.g.: + // Debug.LogWarning($"Duplicate Task Found: {pTempl.m_ID}"); + return; + } + + m_TaskTemplMap[pTask.m_ID] = pTask; + + if (pTask.m_bDeathTrig) m_DeathTrigMap[pTask.m_ID] = pTask; + else if (pTask.m_bAutoDeliver) m_AutoDelvMap[pTask.m_ID] = pTask; + + if (pTask.m_bPQTask) m_PQTemplMap[pTask.m_ID] = pTask; + + if (pTask.m_bSkillTask) m_SkillTaskLst.Add(pTask); + + //todo: recheck m_DynTaskType type + if (pTask.m_DynTaskType) + { + TaskTemplMap::iterator itDyn = m_DynTaskMap.find(pTask.m_ID); + if (itDyn != m_DynTaskMap.end()) + TaskInterface::WriteLog(0, pTask.m_ID, 0, "Dup Dyn Task Found"); + + m_DynTaskMap[pTask.m_ID] = pTask; + } + if (pTask.m_bDisplayInTitleTaskUI) + m_TitleTaskMap[pTask.m_ID] = pTask; + if (pTask.m_bAutoDeliver && pTask.m_bDisplayInExclusiveUI) + m_ExlusiveAwardTaskMap[pTask.m_ID] = pTask; + +# if _TASK_CLIENT + if (pTask.m_ulDelvNPC != 0 && pTask.m_bCanSeekOut) + m_TasksCanSeekOut.push_back(pTask); +#endif + + AddTaskToMap(pTask); + } + + private void AddTaskToMap(ATaskTempl pTempl) + { + if (pTempl.m_enumMethod == (ulong)TaskMethod.enumTMProtectNPC && pTempl.m_ulNPCToProtect > 0) + m_ProtectNPCMap[pTempl.m_ulNPCToProtect] = pTempl; + + m_AllTemplMap[pTempl.m_ID] = pTempl; + ATaskTempl pChild = pTempl.m_pFirstChild; + + while (pChild != null) + { + AddTaskToMap(pChild); + pChild = pChild.m_pNextSibling; + } + } + + private void SortTasksCanSeekOut() + { + m_TasksCanSeekOut.Sort((lhs, rhs) => + { + if (lhs.m_ulPremItems != 0 && rhs.m_ulPremItems == 0) + return -1; // lhs comes before rhs + else if (lhs.m_ulPremItems == 0 && rhs.m_ulPremItems != 0) + return 1; // rhs comes before lhs + else if (lhs.m_ulPremItems != 0 && rhs.m_ulPremItems != 0) + return rhs.m_ID.CompareTo(lhs.m_ID); // descending by ID + else + return rhs.m_ulPremise_Lev_Min.CompareTo(lhs.m_ulPremise_Lev_Min); // descending by Premise_Lev_Min + }); + } + + void UpdateTimeLimitCheckList() + { + m_TmLmtChkLst.clear(); + + TaskTemplMap::iterator it = m_TaskTemplMap.begin(); + for (; it != m_TaskTemplMap.end(); ++it) + if (it->second->m_ulMaxReceiver) m_TmLmtChkLst.push_back(it->second); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Task/ATaskTemplMan.cs.meta b/Assets/Scripts/Task/ATaskTemplMan.cs.meta new file mode 100644 index 0000000000..bfd63cb493 --- /dev/null +++ b/Assets/Scripts/Task/ATaskTemplMan.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fb2a99ced76b6c847810e2eadf598724 \ No newline at end of file diff --git a/Assets/Scripts/Task/CECTaskInterface.cs b/Assets/Scripts/Task/CECTaskInterface.cs new file mode 100644 index 0000000000..bbe5b2fc27 --- /dev/null +++ b/Assets/Scripts/Task/CECTaskInterface.cs @@ -0,0 +1,97 @@ +using System.Collections.Generic; + +namespace PerfectWorld.Scripts.Task +{ + public class CECTaskInterface : TaskInterface + { + CECHostPlayer m_pHost; + object[] m_pActiveListBuf; // Active task list buffer + object[] m_pFinishedListBuf; // Finished task list buffer + object[] m_pFinishedTimeListBuf; // Finished time list buffer + object[] m_pFinishedCountListBuf;// Finished count list buffer + object[] m_pStorageTaskListBuf; // Storage tasks list buffer + private Dictionary m_TasksToConfirm = new Dictionary(); + + public bool Init(object[] pActiveListBuf, int iActiveListLen, object[] pFinishedListBuf, int iFinishedListLen, object[] pFinishedTimeListBuf, int iFinishedTimeListLen, object[] pFinishedCountListBuf, int iFinishedCountListLen, object[] pStorageTaskListBuf, int iStorageTaskListLen) + { + //if (!(m_pActiveListBuf = a_malloc(TASK_ACTIVE_LIST_BUF_SIZE))) + //{ + // glb_ErrorOutput(ECERR_NOTENOUGHMEMORY, "CECTaskInterface::Init", __LINE__); + // return false; + //} + + //if (!(m_pFinishedListBuf = a_malloc(TASK_FINISHED_LIST_BUF_SIZE))) + //{ + // a_free(m_pActiveListBuf); + // m_pFinishedListBuf = NULL; + // glb_ErrorOutput(ECERR_NOTENOUGHMEMORY, "CECTaskInterface::Init", __LINE__); + // return false; + //} + + //if (!(m_pFinishedTimeListBuf = a_malloc(TASK_FINISH_TIME_LIST_BUF_SIZE))) + //{ + // a_free(m_pActiveListBuf); + // a_free(m_pFinishedListBuf); + // glb_ErrorOutput(ECERR_NOTENOUGHMEMORY, "CECTaskInterface::Init", __LINE__); + // return false; + //} + + //if (!(m_pFinishedCountListBuf = a_malloc(TASK_FINISH_COUNT_LIST_BUF_SIZE))) + //{ + // a_free(m_pActiveListBuf); + // a_free(m_pFinishedListBuf); + // a_free(m_pFinishedCountListBuf); + // glb_ErrorOutput(ECERR_NOTENOUGHMEMORY, "CECTaskInterface::Init", __LINE__); + // return false; + //} + + //if (!(m_pStorageTaskListBuf = a_malloc(TASK_STORAGE_LIST_BUF_SIZE))) + //{ + // a_free(m_pActiveListBuf); + // a_free(m_pFinishedListBuf); + // a_free(m_pFinishedCountListBuf); + // a_free(m_pStorageTaskListBuf); + // glb_ErrorOutput(ECERR_NOTENOUGHMEMORY, "CECTaskInterface::Init", __LINE__); + // return false; + //} + //ASSERT(pActiveListBuf && pFinishedListBuf && pFinishedTimeListBuf && pFinishedCountListBuf); + //memcpy(m_pActiveListBuf, pActiveListBuf, iActiveListLen); + //memcpy(m_pFinishedListBuf, pFinishedListBuf, iFinishedListLen); + //memcpy(m_pFinishedTimeListBuf, pFinishedTimeListBuf, iFinishedTimeListLen); + //memcpy(m_pFinishedCountListBuf, pFinishedCountListBuf, iFinishedCountListLen); + //memcpy(m_pStorageTaskListBuf, pStorageTaskListBuf, iStorageTaskListLen); + + //// Clear rest buffer + //if (iActiveListLen < TASK_ACTIVE_LIST_BUF_SIZE) + // memset((BYTE*)m_pActiveListBuf + iActiveListLen, 0, TASK_ACTIVE_LIST_BUF_SIZE - iActiveListLen); + + //if (iFinishedListLen < TASK_FINISHED_LIST_BUF_SIZE) + // memset((BYTE*)m_pFinishedListBuf + iFinishedListLen, 0, TASK_FINISHED_LIST_BUF_SIZE - iFinishedListLen); + + //if (iFinishedTimeListLen < TASK_FINISH_TIME_LIST_BUF_SIZE) + // memset((BYTE*)m_pFinishedTimeListBuf + iFinishedTimeListLen, 0, TASK_FINISH_TIME_LIST_BUF_SIZE - iFinishedTimeListLen); + + //if (iFinishedCountListLen < TASK_FINISH_COUNT_LIST_BUF_SIZE) + // memset((BYTE*)m_pFinishedCountListBuf + iFinishedCountListLen, 0, TASK_FINISH_COUNT_LIST_BUF_SIZE - iFinishedCountListLen); + + //if (iStorageTaskListLen < TASK_STORAGE_LIST_BUF_SIZE) + // memset((BYTE*)m_pStorageTaskListBuf + iStorageTaskListLen, 0, TASK_STORAGE_LIST_BUF_SIZE - iStorageTaskListLen); + + //ATaskTemplMan* pTaskMan = GetTaskTemplMan(); + //pTaskMan->Release(); + //pTaskMan->LoadTasksFromPack("data\\tasks.data", true); + //pTaskMan->LoadNPCInfoFromPack("data\\task_npc.data"); + //pTaskMan->VerifyDynTasksPack("userdata\\dyn_tasks.data"); + //InitActiveTaskList(); + + //m_bForceNavigateFinish = false; + + return true; + } + + public static void WriteLog(int nPlayerId, int nTaskId, int nType, string szLog) + { + //do something? + } + } +} diff --git a/Assets/Scripts/Task/CECTaskInterface.cs.meta b/Assets/Scripts/Task/CECTaskInterface.cs.meta new file mode 100644 index 0000000000..4a321dc53c --- /dev/null +++ b/Assets/Scripts/Task/CECTaskInterface.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fb2c49d4eb415e343b0b312e215a2d00 \ No newline at end of file diff --git a/Assets/Scripts/Task/TaskInterface.cs b/Assets/Scripts/Task/TaskInterface.cs new file mode 100644 index 0000000000..242ccd320f --- /dev/null +++ b/Assets/Scripts/Task/TaskInterface.cs @@ -0,0 +1,7 @@ +namespace PerfectWorld.Scripts.Task +{ + public interface TaskInterface + { + bool Init(object[] pActiveListBuf, int iActiveListLen, object[] pFinishedListBuf, int iFinishedListLen, object[] pFinishedTimeListBuf, int iFinishedTimeListLen, object[] pFinishedCountListBuf, int iFinishedCountListLen, object[] pStorageTaskListBuf, int iStorageTaskListLen); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Task/TaskInterface.cs.meta b/Assets/Scripts/Task/TaskInterface.cs.meta new file mode 100644 index 0000000000..d9cc56d7d4 --- /dev/null +++ b/Assets/Scripts/Task/TaskInterface.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1247ada478ebf564e9086d6142776d50 \ No newline at end of file diff --git a/Assets/Scripts/Task/TaskTempl.cs b/Assets/Scripts/Task/TaskTempl.cs new file mode 100644 index 0000000000..2bb1df2348 --- /dev/null +++ b/Assets/Scripts/Task/TaskTempl.cs @@ -0,0 +1,523 @@ +using UnityEngine; +using System.IO; +namespace PerfectWorld.Scripts.Task +{ + /// + /// Completion Method + /// + 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 + } + + public class ATaskTemplFixedData + { + public ulong m_ID; + public ulong m_ulNPCToProtect; + public ulong m_ulProtectTimeLen; + public ulong m_enumMethod; + public ulong m_enumFinishType; + + //Hierarchy + public ATaskTempl m_pParent; + public ATaskTempl m_pPrevSibling; + public ATaskTempl m_pNextSibling; + public ATaskTempl m_pFirstChild; + + // Required items + public ulong m_ulPremItems; + // public ItemWanted[] m_PremItems; // [MAX_ITEM_WANTED] + public bool m_bShowByItems; + public bool m_bPremItemsAnyOne; + + // Level condition + public ulong m_ulPremise_Lev_Min; + public ulong m_ulPremise_Lev_Max; + public ulong m_bPremCheckMaxHistoryLevel; + public bool m_bShowByLev; + + // Monster controller + public long m_lMonsCtrl; + public bool m_bTrigCtrl; + + // Auto trigger when conditions are met + public bool m_bAutoDeliver; + + // Whether to display in exclusive UI + public bool m_bDisplayInExclusiveUI; + public bool m_bReadyToNotifyServer; + + // Whether used in token shop + public bool m_bUsedInTokenShop; + + // Trigger on death + public bool m_bDeathTrig; + + // Whether clear all acquired items + public bool m_bClearAcquired; + + // Recommended level + public ulong m_ulSuitableLevel; + + // Whether to show prompt + public bool m_bShowPrompt; + + // Whether it is a key task + public bool m_bKeyTask; + + // Deliver NPC + public ulong m_ulDelvNPC; + + // Award NPC + public ulong m_ulAwardNPC; + + // Whether it is a skill task + public bool m_bSkillTask; + + // Can be sought out + public bool m_bCanSeekOut; + + // Whether to show direction + public bool m_bShowDirection; + + // Marriage + public bool m_bMarriage; + + // Change global key/value + public ulong m_ulChangeKeyCnt; + public long[] m_plChangeKey; // [TASK_AWARD_MAX_CHANGE_VALUE] + public long[] m_plChangeKeyValue; + public bool[] m_pbChangeType; + + // Switch scene fail + public bool m_bSwitchSceneFail; + + // Hidden task + public bool m_bHidden; + + // Whether to deliver skill [Yongdong, 2010-1-6] + public bool m_bDeliverySkill; + public int m_iDeliveredSkillID; + public int m_iDeliveredSkillLevel; + + // Whether to show task finished effect [Yongdong, 2010-1-21] + public bool m_bShowGfxFinished; // Show effect when task is completed + + // Whether change PQ ranking + public bool m_bChangePQRanking; + + // Compare items with player inventory before delivery + public bool m_bCompareItemAndInventory; + public ulong m_ulInventorySlotNum; // Required number of inventory slots + + // Whether it is a PQ task + public bool m_bPQTask; + + // PQ task global variable display + public ulong m_ulPQExpCnt; + // Dynamic task type + public string m_DynTaskType; + + // Special award ID, used for events + public ulong m_ulSpecialAward; + // Whether to display in the title task UI + public bool m_bDisplayInTitleTaskUI; + } + public class ATaskTempl : ATaskTemplFixedData + { + 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) + { + // LOG_DELETE(m_Award_S); + // LOG_DELETE(m_Award_F); + // LOG_DELETE(m_AwByRatio_S); + // LOG_DELETE(m_AwByRatio_F); + // LOG_DELETE(m_AwByItems_S); + // LOG_DELETE(m_AwByItems_F); + // LOG_DELETE_ARR(m_tmStart); + // LOG_DELETE_ARR(m_tmEnd); + // LOG_DELETE_ARR(m_plChangeKey); + // LOG_DELETE_ARR(m_plChangeKeyValue); + // LOG_DELETE_ARR(m_pbChangeType); + // LOG_DELETE_ARR(m_PremItems); + // LOG_DELETE_ARR(m_GivenItems); + // LOG_DELETE_ARR(m_TeamMemsWanted); + // LOG_DELETE_ARR(m_ItemsWanted); + // LOG_DELETE_ARR(m_PlayerWanted); + // LOG_DELETE_ARR(m_MonsterWanted); + // LOG_DELETE_ARR(m_pszSignature); + // LOG_DELETE_ARR(m_pszExp); + // LOG_DELETE_ARR(m_pExpArr); + // LOG_DELETE_ARR(m_pTaskChar); + // LOG_DELETE_ARR(m_pszPQExp); + // LOG_DELETE_ARR(m_pPQExpArr); + // LOG_DELETE_ARR(m_MonstersContrib); + + // LOG_DELETE_ARR(m_pDelvRegion); + // LOG_DELETE_ARR(m_pEnterRegion); + // LOG_DELETE_ARR(m_pLeaveRegion); + // LOG_DELETE_ARR(m_pReachSite); + // LOG_DELETE_ARR(m_pLeaveSite); + // LOG_DELETE_ARR(m_PremTitles); + + // unsigned long i; + // fread(this, sizeof(*this), 1, fp); + + // 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; i0) + // { + // m_pDelvRegion = new Task_Region[m_ulDelvRegionCnt]; + // g_ulNewCount++; + // } + // else m_pDelvRegion = NULL; + + // for (i=0;i0) + // { + // m_pEnterRegion = new Task_Region[m_ulEnterRegionCnt]; + // g_ulNewCount++; + // } + // else m_pEnterRegion = NULL; + + // for (i=0;i0) + // { + // m_pLeaveRegion = new Task_Region[m_ulLeaveRegionCnt]; + // g_ulNewCount++; + // } + // else m_pLeaveRegion = NULL; + + // for (i=0;i0) + // { + // m_pReachSite = new Task_Region[m_ulReachSiteCnt]; + // g_ulNewCount++; + // } + // else m_pReachSite = NULL; + + // for (i=0;i0) + // { + // m_pLeaveSite = new Task_Region[m_ulLeaveSiteCnt]; + // g_ulNewCount++; + // } + // else m_pLeaveSite = NULL; + + // for (i=0;i