diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs b/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs index 2109586757..71a171410d 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_Inventory.cs @@ -15,6 +15,24 @@ namespace BrewMonster.Scripts.Managers // Item array: index is slot, null means empty. private EC_IvtrItem[] m_aItems = Array.Empty(); + public static class Inventory_type + { + public const int IVTRTYPE_PACK = 0, // Normal pack + IVTRTYPE_EQUIPPACK = 1, // Equipment + IVTRTYPE_TASKPACK = 2, // Task pack + IVTRTYPE_TRASHBOX = 3, // Trash box + IVTRTYPE_TRASHBOX2 = 4, // Trash box - material box + IVTRTYPE_TRASHBOX3 = 5, // Trash box - fashion box + IVTRTYPE_ACCOUNT_BOX = 6, // User account box + IVTRTYPE_GENERALCARD_BOX = 7; // 卡牌包裹 + }; + + // 注意 IVTRTYPE_CLIENT_GENERALCARD_PACK 枚举值不能喝上面的 Inventory type 值重复!! + public static class IVTRTYPE_PACK_CLIENT_GENERALCAR + { + public const int IVTRTYPE_CLIENT_GENERALCARD_PACK = 1024; // 客户端本地包裹, 由于卡牌图鉴要求对已获得卡牌通过聊天发送。为了统一处理聊天窗口的物品,添加本地包裹。 + }; + public EC_Inventory() { } diff --git a/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs b/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs index 38c650a54b..0b5badac55 100644 --- a/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs +++ b/Assets/PerfectWorld/Scripts/NPC/CECNPCServer.cs @@ -10,6 +10,7 @@ public class CECNPCServer : CECNPC { NPC_ESSENCE? m_pDBEssence; MONSTER_ESSENCE? m_pMonEssence; + float m_fTaxRate = 0.05f; // Tax rate public override void SetUpCECNPC(CECNPCMan pNPCMan) { base.SetUpCECNPC(pNPCMan); @@ -71,4 +72,13 @@ public class CECNPCServer : CECNPC // Get essence data in database public NPC_ESSENCE? GetDBEssence() { return m_pDBEssence; } + + // Get tax rate + public float GetTaxRate() { return m_fTaxRate; } + + // Get item price scale factor + public float GetPriceScale() + { + return 1.0f + m_pDBEssence.Value.tax_rate; + } } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs index 7fd23c980b..ac7f66fb9b 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs @@ -1359,6 +1359,29 @@ namespace CSNetwork.S2CCommand { public int id; }; + + public struct cmd_sevnpc_serve + { + public int service_type; + public uint len; + }; + + public struct accept_task_CONTENT + { + public int idTask; + public int idStorage; + public int idRefreshItem; + }; + + public struct SevReturnTaskCONTENT + { + public int idTask; + public int iChoice; + } + public struct SevTaskMatterCONTENT + { + public int idTask; + } } // Player and NPC state \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs index 770c4232b9..60928a1410 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs @@ -516,22 +516,22 @@ namespace CSNetwork.C2SCommand return SerializeCommand(CommandID.NORMAL_ATTACK, cmd); } - public static Octets CreateCmdNPCSevAcceptTask(int idTask,int idStorage,int idRefreshItem) + public static Octets CreateCmdNPCSevAcceptTask(int idTask, int idStorage, int idRefreshItem) { cmd_sevnpc_serve cmd = new cmd_sevnpc_serve() { - service_type = 1, - len = Marshal.SizeOf() + service_type = NPC_service_type.GP_NPCSEV_TASK_ACCEPT, + len = (uint)Marshal.SizeOf() }; - accept_task_CONTENT acceptTaskContent = new accept_task_CONTENT() + accept_task_CONTENT content = new accept_task_CONTENT() { idTask = idTask, idStorage = idStorage, idRefreshItem = idRefreshItem }; - var octets = SerializeCommand(CommandID.SEVNPC_SERVE, command: cmd, command2: acceptTaskContent); + var octets = SerializeCommand(CommandID.SEVNPC_SERVE, command: cmd, command2: content); return octets; } @@ -545,10 +545,39 @@ namespace CSNetwork.C2SCommand var cmd = new cmd_sevnpc_serve { service_type = serviceType, - len = (int)len + len = len }; return SerializeCommand(CommandID.SEVNPC_SERVE, cmd); } + + public static Octets CreateNPCSevReturnTaskCmd(int idTask, int iChoice) + { + var cmd = new cmd_sevnpc_serve + { + service_type = NPC_service_type.GP_NPCSEV_TASK_RETURN, + len = (uint)Marshal.SizeOf() + }; + SevReturnTaskCONTENT content = new SevReturnTaskCONTENT() + { + idTask = idTask, + iChoice = iChoice, + }; + return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); + } + + public static Octets CreateNPCSevTaskMatterCmd(int idTask) + { + var cmd = new cmd_sevnpc_serve + { + service_type = NPC_service_type.GP_NPCSEV_TASK_MATTER, + len = (uint)Marshal.SizeOf() + }; + SevTaskMatterCONTENT content = new SevTaskMatterCONTENT() + { + idTask = idTask + }; + return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); + } public static Octets CreateTaskNotifyCmd() { diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index 43a34dfad1..7a23e8e12d 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1611,19 +1611,6 @@ namespace CSNetwork.GPDataType public int time; public int timebias; public int lua_version; - }; - - public struct cmd_sevnpc_serve - { - public int service_type; - public int len; - }; - - public struct accept_task_CONTENT - { - public int idTask; - public int idStorage; - public int idRefreshItem; - }; + }; } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 51bbe10263..39c7ac13f4 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -6,6 +6,7 @@ using CSNetwork.C2SCommand; using CSNetwork.GPDataType; using CSNetwork.Protocols; using CSNetwork.Protocols.RPCData; +using CSNetwork.S2CCommand; using System; using System; using System.Collections.Generic; @@ -1125,6 +1126,32 @@ namespace CSNetwork // } } + public void c2s_SendCmdNPCSevAcceptTask(int idTask, int idStorage, int idRefreshItem) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateCmdNPCSevAcceptTask( + idTask, + idStorage, + idRefreshItem); + SendProtocol(gamedatasend); + } + + public void c2s_SendCmdNPCSevReturnTask(int idTask, int iChoice) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateNPCSevReturnTaskCmd( + idTask, + iChoice); + SendProtocol(gamedatasend); + } + + public void c2s_SendCmdNPCSevTaskMatter(int idTask) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateNPCSevTaskMatterCmd(idTask); + SendProtocol(gamedatasend); + } + public void GetRoleCustomizeData(int iNumRole, List aRoleIDs) { if (iNumRole <= 0 || aRoleIDs == null || aRoleIDs.Count == 0) return; diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index 4b15bd8f5f..4ef1bed97e 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -274,10 +274,25 @@ namespace BrewMonster.Network { Instance._gameSession.c2s_CmdSendEnterPKPrecinctint(); } + + public static void c2s_CmdNPCSevHeal() + { + + } public static void c2s_CmdNPCSevAcceptTask(int idTask,int idStorage,int idRefreshItem) { Instance._gameSession.c2s_CmdNPCSevAcceptTask(idTask, idStorage, idRefreshItem); } + + public static void c2s_CmdNPCSevReturnTask(int idTask, int iChoice) + { + Instance._gameSession.c2s_SendCmdNPCSevReturnTask(idTask, iChoice); + } + + public static void c2s_CmdNPCSevTaskMatter(int idTask) + { + Instance._gameSession.c2s_SendCmdNPCSevTaskMatter(idTask); + } #region Task public static void c2s_CmdGetAllData(bool byPack, bool byEquip, bool byTask) { diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index 454a909e70..d797e21c22 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -335,7 +335,7 @@ namespace BrewMonster.Scripts.Task private Dictionary m_TasksToConfirm = new Dictionary(); private readonly System.Collections.Generic.Dictionary m_emotionTask = new System.Collections.Generic.Dictionary(); private bool m_bForceNavigateFinish; - + private int m_tmFinishDlgShown; public CECTaskInterface() { @@ -445,7 +445,7 @@ namespace BrewMonster.Scripts.Task public bool IsDeliverLegal() { - // return !m_pHost->IsTrading() && m_pHost->GetBoothState() == 0 && !m_pHost->IsDead(); + // return !m_pHost.IsTrading() && m_pHost.GetBoothState() == 0 && !m_pHost.IsDead(); return true; // TODO: implement return m_pHost.IsTrading() && m_pHost.GetBoothState() == 0 && !m_pHost.IsDead(); @@ -462,8 +462,8 @@ namespace BrewMonster.Scripts.Task public int GetTaskItemCount(uint ulTaskItem) { - // CECInventory* pPack = m_pHost->GetTaskPack(); - // return pPack ? pPack->GetItemTotalNum((int)ulTaskItem) : 0; + // CECInventory* pPack = m_pHost.GetTaskPack(); + // return pPack ? pPack.GetItemTotalNum((int)ulTaskItem) : 0; var inv = m_pHost?.GetInventory(InventoryConst.IVTRTYPE_TASKPACK); return inv != null ? inv.GetItemTotalNum((int)ulTaskItem) : 0; @@ -964,7 +964,7 @@ namespace BrewMonster.Scripts.Task if (!IsDeliverLegal()) return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_INDETERMINATE; - // return pTempl->CheckPrerequisite(this, static_cast(GetActiveTaskList()), GetCurTime(), true, true, false); + // return pTempl.CheckPrerequisite(this, static_cast(GetActiveTaskList()), GetCurTime(), true, true, false); return pTempl.CheckPrerequisite(this, GetActiveTaskList(), GetCurTime(), true, true, false); // if (!pTempl.CheckReachLevel(this)) return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_BELOW_LEVEL; @@ -1186,7 +1186,7 @@ namespace BrewMonster.Scripts.Task return; } - private uint GetCurTime() + public uint GetCurTime() { // use this to avoid task hack by changing the system time return (uint)EC_Game.GetServerAbsTime(); @@ -1202,6 +1202,93 @@ namespace BrewMonster.Scripts.Task string strName = m_pHost.GetName(); // assumes string; use ToString() if needed return ret.Replace(SYMBOL_HOSTNAME, $"&{strName}&"); } + + public bool GetAwardCandidates(uint ulTaskId, ref AWARD_DATA pAward) + { + ActiveTaskList pLst = GetActiveTaskList() as ActiveTaskList; + ActiveTaskEntry pEntry = pLst.GetEntry(ulTaskId); + if (pEntry == null || pEntry.m_ulTemplAddr == 0) return false; + + uint ulCurTime = GetCurTime(); + pEntry.GetTempl().CalcAwardData( + this, + ref pAward, + pEntry, + pEntry.m_ulTaskTime, + ulCurTime); + + return true; + } + + public uint GetTaskFinishedTime(uint value) { return 0; } + + bool IsCaptain() + { + // TO DO: fix later + //CECTeam pTeam = m_pHost.GetTeam(); + //if (!pTeam) + // return false; + + //return pTeam.GetLeaderID() == m_pHost.GetCharacterID(); + + return true; + } + + public bool CanFinishTask(uint ulTaskId) + { + ActiveTaskEntry pEntry = (GetActiveTaskList() as ActiveTaskList).GetEntry(ulTaskId); + + if (pEntry == null) + return false; + + ATaskTempl pTempl = pEntry.GetTempl(); + + if (pTempl == null) + return false; + + if (pTempl.m_FixedData.m_bMarriage && !IsCaptain()) + return false; + + return pTempl.CanFinishTask(this, pEntry, GetCurTime()); + } + + public bool CanShowTask(uint ulTaskId) + { + ATaskTempl pTempl = GetTaskTemplMan().GetTopTaskByID(ulTaskId); + return pTempl != null && pTempl.CanShowTask(this); + } + + public void SetFinishDlgShowTime(int t) { m_tmFinishDlgShown = t; } + + public void OnUIDialogEnd(uint ulTask) + { + SetFinishDlgShowTime(0); + ActiveTaskList pLst = GetActiveTaskList() as ActiveTaskList; + ActiveTaskEntry pEntry = pLst.GetEntry(ulTask); + if (pEntry == null || pEntry.m_ulTemplAddr == 0) return; + //ATaskTempl pTempl = (pEntry.m_ulTemplAddr) as ATaskTempl; + ATaskTempl pTempl = GetTaskTemplMan().GetTaskTemplByID(pEntry.m_ulTemplAddr); + + switch (pTempl.m_FixedData.m_enumMethod) + { + case (uint)TaskCompletionMethod.enumTMReachSite: + pTempl.IncValidCount(); + _notify_svr(this, 3, (ushort)ulTask); //TASK_CLT_NOTIFY_REACH_SITE = 3 + break; + } + } + + public void GiveUpTask(uint ulTaskId) + { + ActiveTaskEntry pEntry = (GetActiveTaskList() as ActiveTaskList).GetEntry(ulTaskId); + if (pEntry == null || pEntry.GetTempl() == null) return; + _notify_svr(this, 2, (ushort)(pEntry.GetTempl().GetTopTask().GetID())); //TASK_CLT_NOTIFY_CHECK_GIVEUP = 2 + } + + void _notify_svr(TaskInterface pTask, byte uReason, ushort uTaskID) + { + + } public bool IsTaskReadyToConfirm(int iTaskID) { diff --git a/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs index 7ef606ed71..f493d8d7d7 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs @@ -82,6 +82,8 @@ namespace BrewMonster.Scripts.Task bool IsKing(); bool IsInTeam(); uint GetAccountTotalCash(); + uint GetCurTime(); + void SetFinishDlgShowTime(int t); void NotifyServer(ref task_notify_base pBuf, uint sz); bool CheckVersion(); StorageTaskList GetStorageTaskList(); diff --git a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs index 4c92ec6682..e84118f11e 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs @@ -143,43 +143,43 @@ namespace PerfectWorld.Scripts.Task } return null; } - // const ATaskTempl* GetCap() const { return reinterpret_cast(m_ulCapTemplAddr); } - // const ATaskTempl* GetCapOrSelf() const - // { - // if (m_ulCapTemplAddr) return GetCap(); - // else return GetTempl(); - // } - // bool HasParent() const { return m_ParentIndex != 0xff; } - // bool HasChildren() const { return m_ChildIndex != 0xff; } - // bool IsValid(unsigned char uIndex, unsigned char uMaxCount) const - // { - // if (m_ParentIndex != 0xff) - // { - // if (m_ParentIndex >= uIndex || m_ParentIndex >= uMaxCount) - // return false; - // } - // - // if (m_PrevSblIndex != 0xff) - // { - // if (m_PrevSblIndex >= uIndex || m_PrevSblIndex >= uMaxCount) - // return false; - // } - // - // if (m_NextSblIndex != 0xff) - // { - // if (m_NextSblIndex <= uIndex || m_NextSblIndex >= uMaxCount) - // return false; - // } - // - // if (m_ChildIndex != 0xff) - // { - // if (m_ChildIndex <= uIndex || m_ChildIndex >= uMaxCount) - // return false; - // } - // - // return true; - // } - }; + // const ATaskTempl* GetCap() const { return reinterpret_cast(m_ulCapTemplAddr); } + // const ATaskTempl* GetCapOrSelf() const + // { + // if (m_ulCapTemplAddr) return GetCap(); + // else return GetTempl(); + // } + // bool HasParent() const { return m_ParentIndex != 0xff; } + // bool HasChildren() const { return m_ChildIndex != 0xff; } + // bool IsValid(unsigned char uIndex, unsigned char uMaxCount) const + // { + // if (m_ParentIndex != 0xff) + // { + // if (m_ParentIndex >= uIndex || m_ParentIndex >= uMaxCount) + // return false; + // } + // + // if (m_PrevSblIndex != 0xff) + // { + // if (m_PrevSblIndex >= uIndex || m_PrevSblIndex >= uMaxCount) + // return false; + // } + // + // if (m_NextSblIndex != 0xff) + // { + // if (m_NextSblIndex <= uIndex || m_NextSblIndex >= uMaxCount) + // return false; + // } + // + // if (m_ChildIndex != 0xff) + // { + // if (m_ChildIndex <= uIndex || m_ChildIndex >= uMaxCount) + // return false; + // } + // + // return true; + // } + }; public class ActiveTaskList { @@ -421,27 +421,35 @@ namespace PerfectWorld.Scripts.Task } } } - - // void ClearChildrenOf(TaskInterface* pTask, ActiveTaskEntry* pParent, bool bRemoveItem = true); - // ActiveTaskEntry* GetEntry(unsigned long ulId) - // { - // for (unsigned char i = 0; i < m_uTaskCount; i++) - // if (m_TaskEntries[i].m_ID == ulId) - // return &m_TaskEntries[i]; - // - // return NULL; - // } - // void RemoveAll() - // { - // unsigned short ver = m_Version; - // memset(this, 0, sizeof(*this)); - // m_Version = ver; - // } - // bool IsValid() const { return m_uTaskCount <= TASK_ACTIVE_LIST_MAX_LEN; } - // bool IsTimeMarkUpdate() const { return (m_uListState & TLIST_STATE_UPDATE_TIME_MARK) != 0; } - // void SetTimeMarkUpdate() { m_uListState |= TLIST_STATE_UPDATE_TIME_MARK; } - // void ClearTimeMarkUpdate() { m_uListState &= ~TLIST_STATE_UPDATE_TIME_MARK; } - // int GetMaxSimultaneousCount() {return m_uMaxSimultaneousCount ? TASK_MAX_SIMULTANEOUS_COUT : TASK_DEFAULT_MAX_SIMULTANEOUS_COUT;} - // void ExpandMaxSimultaneousCount() {m_uMaxSimultaneousCount = 1;} - }; + + public ActiveTaskEntry GetEntry(uint ulId) + { + for (int i = 0; i < m_uTaskCount; i++) + if (m_TaskEntries[i].m_ID == ulId) + return m_TaskEntries[i]; + + return null; + } + // void ClearChildrenOf(TaskInterface* pTask, ActiveTaskEntry* pParent, bool bRemoveItem = true); + // ActiveTaskEntry* GetEntry(unsigned long ulId) + // { + // for (unsigned char i = 0; i < m_uTaskCount; i++) + // if (m_TaskEntries[i].m_ID == ulId) + // return &m_TaskEntries[i]; + // + // return NULL; + // } + // void RemoveAll() + // { + // unsigned short ver = m_Version; + // memset(this, 0, sizeof(*this)); + // m_Version = ver; + // } + // bool IsValid() const { return m_uTaskCount <= TASK_ACTIVE_LIST_MAX_LEN; } + // bool IsTimeMarkUpdate() const { return (m_uListState & TLIST_STATE_UPDATE_TIME_MARK) != 0; } + // void SetTimeMarkUpdate() { m_uListState |= TLIST_STATE_UPDATE_TIME_MARK; } + // void ClearTimeMarkUpdate() { m_uListState &= ~TLIST_STATE_UPDATE_TIME_MARK; } + // int GetMaxSimultaneousCount() {return m_uMaxSimultaneousCount ? TASK_MAX_SIMULTANEOUS_COUT : TASK_DEFAULT_MAX_SIMULTANEOUS_COUT;} + // void ExpandMaxSimultaneousCount() {m_uMaxSimultaneousCount = 1;} + }; } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs index 4814b070f3..51a1795960 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs @@ -606,13 +606,13 @@ namespace BrewMonster.Scripts.Task // const wchar_t* GetDescription() const { assert(m_pwstrDescript); return (wchar_t*)m_pwstrDescript; } // const wchar_t* GetOkText() const { assert(m_pwstrOkText); return (wchar_t*)m_pwstrOkText; } // const wchar_t* GetNoText() const { assert(m_pwstrNoText); return (wchar_t*)m_pwstrNoText; } - // const wchar_t* GetTribute() const { assert(m_pwstrTribute); return (wchar_t*)m_pwstrTribute; } + public ushort[] GetTribute() { return m_pwstrTribute; } // - // const talk_proc* GetDeliverTaskTalk() const { return &m_DelvTaskTalk; } - // const talk_proc* GetUnqualifiedTalk() const { return &m_UnqualifiedTalk; } - // const talk_proc* GetDeliverItemTalk() const { return &m_DelvItemTalk; } - // const talk_proc* GetUnfinishedTalk() const { return &m_ExeTalk; } - // const talk_proc* GetAwardTalk() const { return &m_AwardTalk; } + public talk_proc GetDeliverTaskTalk() { return m_DelvTaskTalk; } + public talk_proc GetUnqualifiedTalk() { return m_UnqualifiedTalk; } + public talk_proc GetDeliverItemTalk() { return m_DelvItemTalk; } + public talk_proc GetUnfinishedTalk() { return m_ExeTalk; } + public talk_proc GetAwardTalk() { return m_AwardTalk; } // public uint GetDeliverNPC() { return m_FixedData.m_ulDelvNPC; } public uint GetAwardNPC() { return m_FixedData.m_ulAwardNPC; } diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs index 52a704bad0..9045a4b6ac 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs @@ -408,7 +408,7 @@ namespace BrewMonster.Scripts.Task public struct ITEM_WANTED { public uint m_ulItemTemplId; - // when check bool -> m_bCommonItem > 0 == true + // when check bool . m_bCommonItem > 0 == true [MarshalAs(UnmanagedType.U1)] public bool m_bCommonItem; public uint m_ulItemNum; @@ -1395,6 +1395,22 @@ namespace BrewMonster.Scripts.Task public byte m_uValidCount; private uint m_ulMask; // 浠诲姟鎺╃爜 // Task mask + + /* 脠脦脦帽陆谩脢酶潞贸碌脛陆卤脌酶 */ + + uint m_ulAwardType_S; + uint m_ulAwardType_F; + // 脢卤录盲脧脼脰脝 + uint m_ulTimeLimit; + /* 脝脮脥篓潞脥掳麓脙驴赂枚路陆脢陆 */ + AWARD_DATA m_Award_S = new AWARD_DATA(); /* 鲁脡鹿娄 */ + AWARD_DATA m_Award_F = new AWARD_DATA(); /* 脢搂掳脺 */ + /* 脢卤录盲卤脠脌媒路陆脢陆 */ + AWARD_RATIO_SCALE m_AwByRatio_S; + AWARD_RATIO_SCALE m_AwByRatio_F; + /* 掳麓禄帽碌脙脦茂卤脠脌媒路陆脢陆 */ + AWARD_ITEMS_SCALE m_AwByItems_S; + AWARD_ITEMS_SCALE m_AwByItems_F; public bool LoadFromBinFile(FileStream fp) { LoadBinary(fp); @@ -1416,7 +1432,7 @@ namespace BrewMonster.Scripts.Task if (pTask == null || pEntry == null) break; if (!pTask.IsDeliverLegal()) break; - // 宸插畬鎴愮洿鎺ヨ繑鍥 // Already finished -> true + // 宸插畬鎴愮洿鎺ヨ繑鍥 // Already finished . true if (pEntry.IsFinished()) { ret = true; @@ -1665,7 +1681,7 @@ namespace BrewMonster.Scripts.Task // ATaskTempl* pSub = new ATaskTempl; // g_ulNewCount++; // AddSubTaskTempl(pSub); - // pSub->LoadBinary(fp); + // pSub.LoadBinary(fp); // } // 涓婅堪C++閫昏緫鐨凜#瀹炵幇 // C# implementation of the above C++ logic if (m_nSubCount > 0) @@ -2320,7 +2336,7 @@ namespace BrewMonster.Scripts.Task fixedData.m_ulMutexTasks = AAssit.ReadArrayFromBinary(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 + // Living skills levels (C++ long . 4 bytes). Read as int and widen to long var skillLevelsInt = AAssit.ReadArrayFromBinary(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"; @@ -3283,12 +3299,12 @@ namespace BrewMonster.Scripts.Task ad.m_ulCandItems = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulCandItems: {ad.m_ulCandItems} \n"; fp.Seek(4, SeekOrigin.Current); // C++: AWARD_ITEMS_CAND* m_CandItems; skip pointer address - logContent += $"skip 4 bytes -> AWARD_ITEMS_CAND* m_CandItems \n"; + logContent += $"skip 4 bytes . AWARD_ITEMS_CAND* m_CandItems \n"; ad.m_ulSummonedMonsters = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulSummonedMonsters: {ad.m_ulSummonedMonsters} \n"; fp.Seek(4, SeekOrigin.Current); // C++: AWARD_MONSTERS_SUMMONED* m_SummonedMonsters; skip pointer address - logContent += $"skip 4 bytes -> AWARD_MONSTERS_SUMMONED* m_SummonedMonsters \n"; + logContent += $"skip 4 bytes . AWARD_MONSTERS_SUMMONED* m_SummonedMonsters \n"; ad.m_bAwardDeath = AAssit.ReadFromBinaryOf(fp, ref readBytes) > 0; logContent += $"m_bAwardDeath: {ad.m_bAwardDeath} \n"; @@ -3327,7 +3343,7 @@ namespace BrewMonster.Scripts.Task ad.m_ulPQRankingAwardCnt = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulPQRankingAwardCnt: {ad.m_ulPQRankingAwardCnt} \n"; fp.Seek(4, SeekOrigin.Current); // C++: AWARD_PQ_RANKING* m_PQRankingAward; skip pointer address - logContent += $"skip 4 bytes -> AWARD_PQ_RANKING* m_PQRankingAward \n"; + logContent += $"skip 4 bytes . AWARD_PQ_RANKING* m_PQRankingAward \n"; // Change global key/value arrays (pointers to basic types) ad.m_ulChangeKeyCnt = AAssit.ReadFromBinaryOf(fp, ref readBytes); @@ -3335,7 +3351,7 @@ namespace BrewMonster.Scripts.Task fp.Seek(4, SeekOrigin.Current); // C++: long* m_plChangeKey; skip sizeof(long) fp.Seek(4, SeekOrigin.Current); // C++: long* m_plChangeKeyValue; skip sizeof(long) fp.Seek(4, SeekOrigin.Current); // C++: bool* m_pbChangeType; skip sizeof(bool) - logContent += $"skip 4 pointers -> m_plChangeKey(4) \n m_plChangeKeyValue(4) \n m_pbChangeType(4) \n"; + logContent += $"skip 4 pointers . m_plChangeKey(4) \n m_plChangeKeyValue(4) \n m_pbChangeType(4) \n"; // Modify historical progress ad.m_ulHistoryChangeCnt = AAssit.ReadFromBinaryOf(fp, ref readBytes); @@ -3344,7 +3360,7 @@ namespace BrewMonster.Scripts.Task fp.Seek(4, SeekOrigin.Current); // C++: long* m_plHistoryChangeKey fp.Seek(4, SeekOrigin.Current); // C++: long* m_plHistoryChangeKeyValue fp.Seek(4, SeekOrigin.Current); // C++: bool* m_pbHistoryChangeType - logContent += $"skip pointers -> m_plHistoryChangeKey(4) \n m_plHistoryChangeKeyValue(4) \n m_pbHistoryChangeType(4) \n"; + logContent += $"skip pointers . m_plHistoryChangeKey(4) \n m_plHistoryChangeKeyValue(4) \n m_pbHistoryChangeType(4) \n"; // Multiplier ad.m_bMulti = AAssit.ReadFromBinaryOf(fp, ref readBytes) > 0; @@ -3358,21 +3374,21 @@ namespace BrewMonster.Scripts.Task ad.m_ulDisplayKeyCnt = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulDisplayKeyCnt: {ad.m_ulDisplayKeyCnt} \n"; fp.Seek(4, SeekOrigin.Current); // C++: long* m_plDisplayKey - logContent += $"skip 4 bytes -> long* m_plDisplayKey \n"; + logContent += $"skip 4 bytes . long* m_plDisplayKey \n"; // Display global variable expressions ad.m_ulExpCnt = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulExpCnt: {ad.m_ulExpCnt} \n"; fp.Seek(4, SeekOrigin.Current); // C++: char (*m_pszExp)[TASK_AWARD_MAX_DISPLAY_CHAR_LEN] fp.Seek(4, SeekOrigin.Current); // C++: TASK_EXPRESSION (*m_pExpArr)[TASK_AWARD_MAX_DISPLAY_CHAR_LEN] - logContent += $"skip 4 bytes -> m_pszExp(row ptr) \n"; - logContent += $"skip 4 bytes -> m_pExpArr(row ptr) \n"; + logContent += $"skip 4 bytes . m_pszExp(row ptr) \n"; + logContent += $"skip 4 bytes . m_pExpArr(row ptr) \n"; // Display global variable expression prompt strings ad.m_ulTaskCharCnt = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulTaskCharCnt: {ad.m_ulTaskCharCnt} \n"; fp.Seek(4, SeekOrigin.Current); // C++: task_char (*m_pTaskChar)[TASK_AWARD_MAX_DISPLAY_CHAR_LEN] - logContent += $"skip 4 bytes -> task_char (*m_pTaskChar)[LEN] \n"; + logContent += $"skip 4 bytes . task_char (*m_pTaskChar)[LEN] \n"; // Force-related ad.m_iForceContribution = AAssit.ReadFromBinaryOf(fp, ref readBytes); @@ -3389,7 +3405,7 @@ namespace BrewMonster.Scripts.Task ad.m_ulTitleNum = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_ulTitleNum: {ad.m_ulTitleNum} \n"; fp.Seek(4, SeekOrigin.Current); // C++: TITLE_AWARD* m_pTitleAward - logContent += $"skip 4 bytes -> TITLE_AWARD* m_pTitleAward \n"; + logContent += $"skip 4 bytes . TITLE_AWARD* m_pTitleAward \n"; ad.m_iLeaderShip = AAssit.ReadFromBinaryOf(fp, ref readBytes); logContent += $"m_iLeaderShip: {ad.m_iLeaderShip} \n"; @@ -3416,7 +3432,7 @@ namespace BrewMonster.Scripts.Task if (ad.m_ulSummonedMonsters > 0) { - //C++: ad.m_SummonedMonsters->m_ulMonsterNum = ad.m_ulSummonedMonsters; + //C++: ad.m_SummonedMonsters.m_ulMonsterNum = ad.m_ulSummonedMonsters; ad.m_SummonedMonsters.m_ulMonsterNum = ad.m_ulSummonedMonsters; LoadAwardMonstersBin(fp, ref ad.m_SummonedMonsters, ulVersion, ref readBytes); } @@ -3425,7 +3441,7 @@ namespace BrewMonster.Scripts.Task if (ad.m_ulPQRankingAwardCnt > 0) { - // C++: ad.m_PQRankingAward->m_ulRankingAwardNum = ad.m_ulPQRankingAwardCnt; + // C++: ad.m_PQRankingAward.m_ulRankingAwardNum = ad.m_ulPQRankingAwardCnt; ad.m_PQRankingAward.m_ulRankingAwardNum = ad.m_ulPQRankingAwardCnt; LoadAwardPQRankingBin(fp, ref ad.m_PQRankingAward, ulVersion, ref readBytes); } @@ -4210,5 +4226,123 @@ namespace BrewMonster.Scripts.Task unchecked { m_uDepth += uDepthLocal; } } + + public void CalcAwardData( + TaskInterface pTask, + ref AWARD_DATA pAward, + ActiveTaskEntry pEntry, + uint ulTaskTime, + uint ulCurTime) + { + var ulType = (pEntry.IsSuccess() ? m_ulAwardType_S : m_ulAwardType_F); + switch (ulType) + { + case (uint)TaskAwardType.enumTATNormal: + case (uint)TaskAwardType.enumTATEach: + pAward = (pEntry.IsSuccess() ? m_Award_S : m_Award_F); + break; + case (uint)TaskAwardType.enumTATRatio: + CalcAwardDataByRatio(ref pAward, pEntry, ulTaskTime, ulCurTime); + break; + case (uint)TaskAwardType.enumTATItemCount: + CalcAwardDataByItems(pTask, ref pAward, pEntry); + break; + default: + break; + } + } + + public void CalcAwardDataByRatio( + ref AWARD_DATA pAward, + ActiveTaskEntry pEntry, + uint ulTaskTime, + uint ulCurTime) + { + if (m_ulTimeLimit == 0) return; + + AWARD_RATIO_SCALE p = (pEntry.IsSuccess() ? m_AwByRatio_S : m_AwByRatio_F); + float ratio = (float)(ulCurTime - ulTaskTime) / m_ulTimeLimit; + uint i; + + for (i = 0; i= p.m_Counts[i]) + { + pAward = p.m_Awards[i]; + return; + } + } + } + + public bool CanShowTask(TaskInterface pTask) + { + + uint ulCurTime = pTask.GetCurTime(); + + if (m_pParent != null + || (pTask.GetActiveTaskList() as ActiveTaskList).GetEntry(GetID()) != null + || CheckTimetable(ulCurTime) > 0 + || CheckDeliverTime(pTask, ulCurTime) > 0 + || CheckFnshLst(pTask, ulCurTime) > 0 + || CheckMutexTask(pTask, ulCurTime) > 0 + || CheckLivingSkill(pTask) > 0 + || CheckSpecialAward(pTask) > 0 + || CheckGlobalKeyValue(pTask, false) > 0) + return false; + + uint ulRet; + + if (m_FixedData.m_bShowByDeposit && CheckDeposit(pTask) > 0) return false; + if (m_FixedData.m_bShowByGender && CheckGender(pTask) > 0) return false; + if (m_FixedData.m_bShowByItems && CheckItems(pTask) > 0) return false; + ulRet = CheckLevel(pTask); + if (ulRet == TaskInterfaceConstants.TASK_PREREQU_FAIL_ABOVE_LEVEL || (m_FixedData.m_bShowByLev && ulRet > 0)) return false; + if (m_FixedData.m_bShowByTransformed && CheckTransform(pTask) > 0) return false; + if (m_FixedData.m_bShowByForce && CheckForce(pTask) > 0) return false; + if (m_FixedData.m_bShowByForceActivityLevel && CheckForceActivityLevel(pTask) > 0) return false; + if (m_FixedData.m_bShowByForceExp && CheckExp(pTask) > 0) return false; + if (m_FixedData.m_bShowByForceSP && CheckSP(pTask) > 0) return false; + if (m_FixedData.m_bShowByForceContribution && CheckForceContribution(pTask) > 0) return false; + if (m_FixedData.m_bShowByForceReputation && CheckForceReputation(pTask) > 0) return false; + if (m_FixedData.m_bShowByNeedRecordTasksNum && CheckRecordTasksNum(pTask) > 0) return false; + if (m_FixedData.m_bShowByFactionContrib && CheckFactionContrib(pTask) > 0) return false; + if (m_FixedData.m_bShowByOccup && CheckOccupation(pTask) > 0) return false; + if (m_FixedData.m_bShowByPreTask && CheckPreTask(pTask) > 0) return false; + if (m_FixedData.m_bShowByRepu && CheckRepu(pTask) > 0) return false; + if (m_FixedData.m_bShowByTeam && CheckTeamTask(pTask) > 0) return false; + if (m_FixedData.m_bShowByFaction && CheckFaction(pTask) > 0) return false; + if (m_FixedData.m_bShowByPeriod && CheckPeriod(pTask) > 0) return false; + if (m_FixedData.m_bShowByCharTime && CheckCharTime(pTask) > 0) return false; + if (m_FixedData.m_bShowByRMB && CheckAccountRMB(pTask) > 0) return false; + if (m_FixedData.m_bShowByWeddingOwner && CheckWeddingOwner(pTask) > 0) return false; + if (m_FixedData.m_bShowByKing && CheckKing(pTask) > 0) return false; + if (m_FixedData.m_bShowByNotInTeam && CheckNotInTeam(pTask) > 0) return false; + if (m_FixedData.m_bShowByReincarnation && CheckReincarnation(pTask) > 0) return false; + if (m_FixedData.m_bShowByRealmLevel && (CheckRealmLevel(pTask) > 0 || CheckRealmExpFull(pTask) > 0)) return false; + if (m_FixedData.m_bShowByGeneralCard && CheckCardCollection(pTask) > 0) return false; + if (m_FixedData.m_bShowByGeneralCardRank && CheckCardRankCount(pTask) > 0) return false; + if (m_FixedData.m_bShowByHistoryStage && CheckHistoryStage(pTask) > 0) return false; + + return true; + } + public uint GetType() { return m_FixedData.m_ulType; } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs index 310ba92f32..c95b6d801a 100644 --- a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs @@ -12,6 +12,7 @@ namespace BrewMonster.UI protected Canvas m_canvas; protected Dictionary m_StringTable = new Dictionary(); protected Dictionary m_auiDialog_stringTable = new Dictionary(); + protected Dictionary m_DlgName = new Dictionary(); public string GetStringFromTable(int idString) { @@ -254,5 +255,14 @@ namespace BrewMonster.UI } return true; } + + public AUIDialog GetDialog(string pszName) + { + if(m_DlgName.TryGetValue(pszName, out AUIDialog dlg)) + { + return dlg; + } + return null; + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs index 0c6c9146b6..186994bfbb 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs @@ -70,7 +70,6 @@ namespace BrewMonster.UI return str; } - public AUIManager GetAUIManager() { return m_pAUIManager; @@ -80,5 +79,25 @@ namespace BrewMonster.UI { m_pAUIManager = pAUIManager; } + + public virtual void OnEnable() + { + + } + + public virtual void OnDisable() + { + + } + + public virtual void Awake() + { + + } + + public virtual void Start() + { + + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs index cc1bc4f40a..5d9f6b9387 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIListBox.cs @@ -15,6 +15,7 @@ namespace BrewMonster.UI List m_Item = new List(); int m_nCurSel = 0; + Action m_OnClickBtn = null; const uint AUILISTBOX_ERROR = 0xFFFFFFFF; // same as -1 for uint public void ResetContent() @@ -28,6 +29,11 @@ namespace BrewMonster.UI content.sizeDelta = Vector2.zero; } + public void SetActionOnClickBtnItem(Action onClick) + { + m_OnClickBtn = onClick; + } + public void AddString(string pszString) { ItemUIListBox item = Instantiate(prefabItemUIListBox, content); @@ -47,6 +53,8 @@ namespace BrewMonster.UI return -1; m_Item[nIndex].strDataName[nSubIndex] = strName; m_Item[nIndex].dwData[nSubIndex] = dwItemData; + + m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex); return nIndex; } @@ -59,9 +67,37 @@ namespace BrewMonster.UI m_Item[nIndex].strDataPtrName[nSubIndex] = strName; m_Item[nIndex].pvData[nSubIndex] = pData; + + m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex); return nIndex; } + public int SetItemData64(int nIndex, ulong pData, int nSubIndex = 0, string strName = "") + { + if (nIndex < 0 || nIndex >= (m_Item.Count)) + return -1; + if (nSubIndex < 0 || nSubIndex >= 20) // #define AUILISTBOX_DATA_NUM AUILISTBOX_MAX_COLUMN 20 + return -1; + + m_Item[nIndex].strData64Name[nSubIndex] = strName; + m_Item[nIndex].uiData64[nSubIndex] = pData; + + m_Item[nIndex].SetActOnClickBtn(m_OnClickBtn, nIndex); + return nIndex; + } + + public ulong GetItemData64(int nIndex, int nSubIndex, string strName) + { + if (nIndex < 0 || nIndex >= (m_Item.Count)) + return AUILISTBOX_ERROR; + if (nSubIndex < 0 || nSubIndex >= 20) // AUILISTBOX_DATA_NUM 20 + return AUILISTBOX_ERROR; + + //if (0 != m_Item[nIndex].uiData64[nSubIndex] && strName != m_Item[nIndex].strData64Name[nSubIndex]) + // AUI_ReportError(__LINE__, 1, "AUIListBox::GetItemData64(), data name not match"); + return m_Item[nIndex].uiData64[nSubIndex]; + } + public int GetCount() { return m_Item.Count; @@ -111,5 +147,20 @@ namespace BrewMonster.UI else return m_Item[nIndex].strText; } + + //public int SetItemTextColor(int nIndex, A3DCOLOR color, int nItem) + //{ + // if (nIndex < 0 || nIndex >= int(m_Item.size())) + // return AUILISTBOX_ERROR; + + // UpdateRenderTarget(); + + // if (nItem >= 0) + // m_Item[nIndex].color[nItem] = color; + // else + // for (int i = 0; i < max(1, m_nNumColumns); i++) + // m_Item[nIndex].color[i] = color; + // return nIndex; + //} } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index 8816e48fca..61a5100c00 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -1,14 +1,19 @@ +锘縰sing BrewMonster.Assets.PerfectWorld.Scripts.UI; using BrewMonster.Common; using BrewMonster.Managers; using BrewMonster.Network; +using BrewMonster.Scripts.Managers; using BrewMonster.Scripts.Task; using CSNetwork; using CSNetwork.Common; using CSNetwork.GPDataType; using ModelRenderer.Scripts.Common; using ModelRenderer.Scripts.GameData; +using PerfectWorld.Scripts.Task; using System; +using System.Collections.Generic; using System.Drawing; +using System.Reflection; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; @@ -24,11 +29,25 @@ namespace BrewMonster.UI [SerializeField] private TextMeshProUGUI m_pTxt_npc; [SerializeField] private TextMeshProUGUI m_pTxt_Content; [SerializeField] private AUIListBox m_pLst_Main; + [SerializeField] private Button m_btnBack; + [SerializeField] private Button m_btnClose; int m_iTracedTaskID; int m_iTracedTaskNPCID; CECTimeSafeChecker m_tracedTaskTimer; + public struct TASK_ITEM + { + public int task_id; + public int service; + + public TASK_ITEM(int id, int serv) + { + task_id = id; + service = serv; + } + }; + bool HasTracedTask() { return m_iTracedTaskID > 0; @@ -112,14 +131,14 @@ namespace BrewMonster.UI CDLGNPC_OFFLINESHOP_SELLBUY = 0xFFFFF45, CDLGNPC_REINCARNATION = 0xFFFFF46, CDLGNPC_GIFTCARD = 0xFFFFF47, - CDLGNPC_TRICKBATTLE = 0xFFFFF48, // 跨服活动, 战车 - CDLGNPC_CARDRESPAWN = 0xFFFFF49, // 卡牌转生 - CDLGNPC_QUERYCHARIOTAMOUNT = 0xFFFFF50, // 战车数量 - CDLGNPC_FLYSWORDIMPROVE = 0xFFFFF51, // 飞剑强化 - CDLGNPC_OPEN_FACTION_PVP = 0xFFFFF52, // 开启帮派掠夺 + CDLGNPC_TRICKBATTLE = 0xFFFFF48, // 驴莽路镁禄卯露炉, 脮陆鲁碌 + CDLGNPC_CARDRESPAWN = 0xFFFFF49, // 驴篓脜脝脳陋脡煤 + CDLGNPC_QUERYCHARIOTAMOUNT = 0xFFFFF50, // 脮陆鲁碌脢媒脕驴 + CDLGNPC_FLYSWORDIMPROVE = 0xFFFFF51, // 路脡陆拢脟驴禄炉 + CDLGNPC_OPEN_FACTION_PVP = 0xFFFFF52, // 驴陋脝么掳茂脜脡脗脫露谩 CDLGNPC_FACTION_RENAME = 0xFFFFF53, CDLGNPC_GOLD_SHOP = 0xFFFFF54, - CDLGNPC_PLAYER_CHANGE_GENDER = 0xFFFFF55; // 修改性别 + CDLGNPC_PLAYER_CHANGE_GENDER = 0xFFFFF55; // 脨脼赂脛脨脭卤冒 }; bool PopupTracedTaskDialog(NPC_ESSENCE pEssence) @@ -132,7 +151,7 @@ namespace BrewMonster.UI object pData = m_pLst_Main.GetItemDataPtr(i, 0, ""); uint iService = m_pLst_Main.GetItemData(i, 0, ""); DATA_TYPE DataType = DATA_TYPE.DT_INVALID; - EC_Game.GetElementDataMan().get_data_ptr(iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + ElementDataManProvider.GetElementDataMan().get_data_ptr(iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); if (DataType == DATA_TYPE.DT_NPC_TASK_IN_SERVICE || DataType == DATA_TYPE.DT_NPC_TASK_OUT_SERVICE || DataType == DATA_TYPE.DT_NPC_TASK_MATTER_SERVICE) @@ -142,18 +161,18 @@ namespace BrewMonster.UI } } } - //if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_LIST) - //{ - // for (int i = 0; i < m_pLst_Main.GetCount() - 1; ++i) - // { - // UINT64 taskid = m_pLst_Main.GetItemData64(i, 0, "TaskID"); - // if (taskid == m_iTracedTaskID) - // { - // SelectListItem(i); - // return GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK; - // } - // } - //} + if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_LIST) + { + for (int i = 0; i < m_pLst_Main.GetCount() - 1; ++i) + { + ulong taskid = m_pLst_Main.GetItemData64(i, 0, "TaskID"); + if (taskid == (ulong)m_iTracedTaskID) + { + SelectListItem(i); + return GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK; + } + } + } return false; } @@ -210,7 +229,7 @@ namespace BrewMonster.UI object pData; DATA_TYPE DataType = new DATA_TYPE(); string strText = GetStringFromTable(249); - elementdataman pDataMan = EC_Game.GetElementDataMan(); + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); Show(true); @@ -218,32 +237,32 @@ namespace BrewMonster.UI // pEssence.id_goblin_skill_service = 1; uint[] a_uiService = { - pEssence.id_talk_service, // 交谈的服务ID - pEssence.id_sell_service, // 出售商品的服务ID - pEssence.id_buy_service, // 收购品的服务ID - pEssence.id_install_service, // 安装镶嵌品的服务ID - pEssence.id_uninstall_service, // 拆除镶嵌品的服务ID - pEssence.id_skill_service, // 教授技能的服务ID - pEssence.id_heal_service, // 治疗的服务ID - pEssence.id_transmit_service, // 传送的服务ID - pEssence.id_transport_service, // 运输的服务ID - pEssence.id_proxy_service, // 代售的服务ID - pEssence.id_storage_service, // 仓库的服务ID - pEssence.id_make_service, // 生产的服务ID - pEssence.id_decompose_service, // 分解的服务ID - pEssence.id_identify_service, // 鉴定的服务ID - pEssence.id_war_towerbuild_service,// 建造箭塔的服务ID - pEssence.id_resetprop_service, // 洗点的服务ID - pEssence.id_petname_service, // 宠物改名服务 - pEssence.id_petlearnskill_service, // 宠物学习技能服务 - pEssence.id_petforgetskill_service,// 宠物遗忘技能服务 - pEssence.id_equipbind_service, // 装备绑定服务 - pEssence.id_equipdestroy_service, // 装备销毁服务 - pEssence.id_equipundestroy_service,// 装备解除销毁服务 - pEssence.id_goblin_skill_service, // 小精灵学习服务 - pEssence.id_engrave_service, // 镌刻服务 - pEssence.id_randprop_service, // 随机属性 - pEssence.id_force_service, // 势力属性 + pEssence.id_talk_service, // 陆禄脤赂碌脛路镁脦帽ID + pEssence.id_sell_service, // 鲁枚脢脹脡脤脝路碌脛路镁脦帽ID + pEssence.id_buy_service, // 脢脮鹿潞脝路碌脛路镁脦帽ID + pEssence.id_install_service, // 掳虏脳掳脧芒脟露脝路碌脛路镁脦帽ID + pEssence.id_uninstall_service, // 虏冒鲁媒脧芒脟露脝路碌脛路镁脦帽ID + pEssence.id_skill_service, // 陆脤脢脷录录脛脺碌脛路镁脦帽ID + pEssence.id_heal_service, // 脰脦脕脝碌脛路镁脦帽ID + pEssence.id_transmit_service, // 麓芦脣脥碌脛路镁脦帽ID + pEssence.id_transport_service, // 脭脣脢盲碌脛路镁脦帽ID + pEssence.id_proxy_service, // 麓煤脢脹碌脛路镁脦帽ID + pEssence.id_storage_service, // 虏脰驴芒碌脛路镁脦帽ID + pEssence.id_make_service, // 脡煤虏煤碌脛路镁脦帽ID + pEssence.id_decompose_service, // 路脰陆芒碌脛路镁脦帽ID + pEssence.id_identify_service, // 录酶露篓碌脛路镁脦帽ID + pEssence.id_war_towerbuild_service,// 陆篓脭矛录媒脣镁碌脛路镁脦帽ID + pEssence.id_resetprop_service, // 脧麓碌茫碌脛路镁脦帽ID + pEssence.id_petname_service, // 鲁猫脦茂赂脛脙没路镁脦帽 + pEssence.id_petlearnskill_service, // 鲁猫脦茂脩搂脧掳录录脛脺路镁脦帽 + pEssence.id_petforgetskill_service,// 鲁猫脦茂脪脜脥眉录录脛脺路镁脦帽 + pEssence.id_equipbind_service, // 脳掳卤赂掳贸露篓路镁脦帽 + pEssence.id_equipdestroy_service, // 脳掳卤赂脧煤禄脵路镁脦帽 + pEssence.id_equipundestroy_service,// 脳掳卤赂陆芒鲁媒脧煤禄脵路镁脦帽 + pEssence.id_goblin_skill_service, // 脨隆戮芦脕茅脩搂脧掳路镁脦帽 + pEssence.id_engrave_service, // 茂脭驴脤路镁脦帽 + pEssence.id_randprop_service, // 脣忙禄煤脢么脨脭 + pEssence.id_force_service, // 脢脝脕娄脢么脨脭 }; GetGameUIMan().m_pCurNPCEssence = (NPC_ESSENCE)pEssence; @@ -254,6 +273,7 @@ namespace BrewMonster.UI //m_pLst_Main.SetHOver(true); m_pLst_Main.ResetContent(); + m_pLst_Main.SetActionOnClickBtnItem((int value) => { SelectListItem(value); }); //add for test by czx @@ -408,13 +428,13 @@ namespace BrewMonster.UI if (idFaction <= 0 || EC_Game.GetFactionMan().GetFaction((uint)idFaction, false) == null) { - // 无帮派、或者帮派信息尚未查询到 + // 脦脼掳茂脜脡隆垄禄貌脮脽掳茂脜脡脨脜脧垄脡脨脦麓虏茅脩炉碌陆 break; } if (GetHostPlayer().GetFactionFortressConfig().require_level == int.MinValue) // this replace logic == null { - // 没有基地配置表 + // 脙禄脫脨禄霉碌脴脜盲脰脙卤铆 break; } @@ -443,31 +463,31 @@ namespace BrewMonster.UI if (bFortressOK) { - // 帮派基地相关 + // 掳茂脜脡禄霉碌脴脧脿鹿脴 if ((pEssence.combined_services & 0x8000000) != 0) { if (bMaster) { - // 帮主可以创建基地 + // 掳茂脰梅驴脡脪脭麓麓陆篓禄霉碌脴 m_pLst_Main.AddString(strText + GetStringFromTable(9101)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_CREATE); } // if (bMaster || bViceMaster) // { - // // 帮主、副帮主可以处理战斗事宜 + // // 掳茂脰梅隆垄赂卤掳茂脰梅驴脡脪脭麓娄脌铆脮陆露路脢脗脪脣 // m_pLst_Main.AddString(strText + GetStringFromTable(9102)); // m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CGLDNPC_FORTRESS_WAR); // } if (!bInFortressNow) { - // 帮众随时可进入我方基地 + // 掳茂脰脷脣忙脢卤驴脡陆酶脠毛脦脪路陆禄霉碌脴 m_pLst_Main.AddString(strText + GetStringFromTable(9107)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_ENTER); } - // 帮众随时可查看对战表 + // 掳茂脰脷脣忙脢卤驴脡虏茅驴麓露脭脮陆卤铆 // m_pLst_Main.AddString(strText + GetStringFromTable(9108)); // m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CGLDNPC_FORTRESS_WARLIST); } @@ -478,23 +498,23 @@ namespace BrewMonster.UI { if (!GetHostPlayer().IsInFortressWar()) { - // 帮主非战时可以升级基地设施 + // 掳茂脰梅路脟脮陆脢卤驴脡脪脭脡媒录露禄霉碌脴脡猫脢漏 m_pLst_Main.AddString(strText + GetStringFromTable(9103)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_UPGRADE); } } - // 帮众可以缴纳材料 + // 掳茂脰脷驴脡脪脭陆脡脛脡虏脛脕脧 m_pLst_Main.AddString(strText + GetStringFromTable(9104)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_HANDIN_MATERIAL); - // 帮众可以缴纳贡献度 + // 掳茂脰脷驴脡脪脭陆脡脛脡鹿卤脧脳露脠 m_pLst_Main.AddString(strText + GetStringFromTable(9105)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_HANDIN_CONTRIB); if (bInFortressNow) { - // 帮众可以离开基地 + // 掳茂脰脷驴脡脪脭脌毛驴陋禄霉碌脴 m_pLst_Main.AddString(strText + GetStringFromTable(9109)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_LEAVE); } @@ -504,7 +524,7 @@ namespace BrewMonster.UI { if (bMaster) { - // 帮主可以兑换材料 + // 掳茂脰梅驴脡脪脭露脪禄禄虏脛脕脧 m_pLst_Main.AddString(strText + GetStringFromTable(9106)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CGLDNPC_FORTRESS_EXCHANGE_MATERIAL); } @@ -572,26 +592,26 @@ namespace BrewMonster.UI // m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_GOTO_ORIGINALSERVER); //} } - // 改名服务 + // 赂脛脙没路镁脦帽 if ((pEssence.combined_services2 & 0x00000020) != 0) { m_pLst_Main.AddString(strText + GetStringFromTable(10150)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_PLAYER_RENAME); } - // 宝石转换 + // 卤娄脢炉脳陋禄禄 bool bHasStoneChange = (pEssence.combined_services2 & 0x00000040) != 0; if (bHasStoneChange) { m_pLst_Main.AddString(strText + GetStringFromTable(10172)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_STONE_CHANGE); } - // 国王相关 + // 鹿煤脥玫脧脿鹿脴 if ((pEssence.combined_services2 & 0x00000080) != 0) { m_pLst_Main.AddString(strText + GetStringFromTable(10304)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_KING_SERVICE); } - // 寄卖服务 + // 录脛脗么路镁脦帽 if ((pEssence.combined_services2 & 0x00000100) != 0) { m_pLst_Main.AddString(strText + GetStringFromTable(10508)); @@ -600,7 +620,7 @@ namespace BrewMonster.UI m_pLst_Main.AddString(strText + GetStringFromTable(10513)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_OFFLINESHOP_SELLBUY); } - // 时装拆分 + // 脢卤脳掳虏冒路脰 if ((pEssence.combined_services2 & 0x00000200) != 0) { m_pLst_Main.AddString(strText + GetStringFromTable(10430)); @@ -608,7 +628,7 @@ namespace BrewMonster.UI } if ((pEssence.combined_services2 & 0x00000400) != 0) { - // 转生版本上限 + // 脳陋脡煤掳忙卤戮脡脧脧脼 if (GetHostPlayer().GetReincarnationCount() < CECPlayer.MAX_REINCARNATION) { m_pLst_Main.AddString(strText + GetStringFromTable(10800)); @@ -630,7 +650,7 @@ namespace BrewMonster.UI m_pLst_Main.AddString(strText + GetStringFromTable(11000)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_CARDRESPAWN); } - if ((pEssence.combined_services2 & 0x00001000) != 0) // 战车开启npc 自动带有改服务器,(纯客户端) + if ((pEssence.combined_services2 & 0x00001000) != 0) // 脮陆鲁碌驴陋脝么npc 脳脭露炉麓酶脫脨赂脛路镁脦帽脝梅拢卢拢篓麓驴驴脥禄搂露脣拢漏 { m_pLst_Main.AddString(strText + GetStringFromTable(10912)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, CDLGNPC.CDLGNPC_QUERYCHARIOTAMOUNT); @@ -838,7 +858,7 @@ namespace BrewMonster.UI } else { - // 未识别的服务 + // 脦麓脢露卤冒碌脛路镁脦帽 continue; } @@ -911,7 +931,7 @@ namespace BrewMonster.UI // } //} - // 任务相关末尾添加,以判断是以“任务相关”显示在列表里,还是直接显示任务列表 + // 脠脦脦帽脧脿鹿脴脛漏脦虏脤铆录脫拢卢脪脭脜脨露脧脢脟脪脭隆掳脠脦脦帽脧脿鹿脴隆卤脧脭脢戮脭脷脕脨卤铆脌茂拢卢禄鹿脢脟脰卤陆脫脧脭脢戮脠脦脦帽脕脨卤铆 CheckTaskService(pEssence); if (pEssence.domain_related == 1) @@ -983,15 +1003,15 @@ namespace BrewMonster.UI uint[] a_uiService2 = { - pEssence.id_task_out_service, // 任务相关的服务ID: 发放任务服务 - pEssence.id_task_in_service, // 任务相关的服务ID: 验证完成任务服务 - pEssence.id_task_matter_service, // 任务相关的服务ID: 发放任务物品服务 + pEssence.id_task_out_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 路垄路脜脠脦脦帽路镁脦帽 + pEssence.id_task_in_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 脩茅脰陇脥锚鲁脡脠脦脦帽路镁脦帽 + pEssence.id_task_matter_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 路垄路脜脠脦脦帽脦茂脝路路镁脦帽 }; object pData; DATA_TYPE DataType = new DATA_TYPE(); string strText = GetStringFromTable(249); - elementdataman pDataMan = EC_Game.GetElementDataMan(); + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); // flag if this NPC contains task related service uint validTaskService = 0; @@ -1009,7 +1029,7 @@ namespace BrewMonster.UI for (int i = 0; i < a_uiService2.Length; i++) { if (a_uiService2[i] == 0) continue; - + pData = ElementDataManProvider.GetElementDataMan().get_data_ptr(a_uiService2[i], ID_SPACE.ID_SPACE_ESSENCE, ref DataType); // ignore other service @@ -1053,7 +1073,7 @@ namespace BrewMonster.UI if (isEmptyMenu && pStorageService.storage_deliver_per_day == int.MinValue) { - // 没有非任务选项,直接弹出任务内容 + // 脙禄脫脨路脟脠脦脦帽脩隆脧卯拢卢脰卤陆脫碌炉鲁枚脠脦脦帽脛脷脠脻 PopupTaskDialog(true); } else @@ -1072,7 +1092,7 @@ namespace BrewMonster.UI { pData = pDataMan.get_data_ptr(validTaskService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); - // 有其它非任务内容,把所有任务相关集中放在“任务相关”栏里 + // 脫脨脝盲脣眉路脟脠脦脦帽脛脷脠脻拢卢掳脩脣霉脫脨脠脦脦帽脧脿鹿脴录炉脰脨路脜脭脷隆掳脠脦脦帽脧脿鹿脴隆卤脌赂脌茂 m_pLst_Main.AddString(strText + GetStringFromTable(244)); m_pLst_Main.SetItemData(m_pLst_Main.GetCount() - 1, validTaskService); m_pLst_Main.SetItemDataPtr(m_pLst_Main.GetCount() - 1, pData); @@ -1083,222 +1103,285 @@ namespace BrewMonster.UI void PopupTaskDialog(bool bTaskNPC) { - //NPC_ESSENCE pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; - //NPC_ESSENCE pEssence = pCurNPCEssence; - ////if (!pEssence) return; + NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; + NPC_ESSENCE pEssence = pCurNPCEssence.Value; + //if (!pEssence) return; - //int i, j, idTask; - //object pData; - //DATA_TYPE DataType = new DATA_TYPE(); - //unsigned int* a_idTask; - //uint[] a_uiService = - //{ - // pEssence.id_task_out_service, // 任务相关的服务ID: 发放任务服务 - // pEssence.id_task_in_service, // 任务相关的服务ID: 验证完成任务服务 - // pEssence.id_task_matter_service // 任务相关的服务ID: 发放任务物品服务 - // }; - //int idLastTask = 0, nLastTaskTime = 0, nFinishTime; - //elementdataman pDataMan = EC_Game.GetElementDataMan(); - //abase::vector taskIn, taskOut, taskMatter; - //CECTaskInterface* pTask = GetHostPlayer().GetTaskInterface(); + int i, j, idTask; + object pData; + DATA_TYPE DataType = new DATA_TYPE(); + uint[] a_idTask = new uint[0]; + uint[] a_uiService = + { + pEssence.id_task_out_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 路垄路脜脠脦脦帽路镁脦帽 + pEssence.id_task_in_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 脩茅脰陇脥锚鲁脡脠脦脦帽路镁脦帽 + pEssence.id_task_matter_service // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 路垄路脜脠脦脦帽脦茂脝路路镁脦帽 + }; + int idLastTask = 0, nLastTaskTime = 0, nFinishTime; + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); + List taskIn = new List(), + taskOut = new List(), + taskMatter = new List(); + CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); - //for (i = 0; i < sizeof(a_uiService) / sizeof(unsigned int) ; i++ ) - //{ - // pData = pDataMan.get_data_ptr(a_uiService[i], ID_SPACE_ESSENCE, DataType); + for (i = 0; i < a_uiService.Length; i++) + { + pData = pDataMan.get_data_ptr(a_uiService[i], ID_SPACE.ID_SPACE_ESSENCE, ref DataType); - // if (DataType == DT_NPC_TASK_IN_SERVICE || - // DataType == DT_NPC_TASK_OUT_SERVICE) - // { - // int total_count = 0; + if (DataType == DATA_TYPE.DT_NPC_TASK_IN_SERVICE || + DataType == DATA_TYPE.DT_NPC_TASK_OUT_SERVICE) + { + int total_count = 0; - // if (DataType == DT_NPC_TASK_IN_SERVICE) - // { - // NPC_TASK_IN_SERVICE* pService = (NPC_TASK_IN_SERVICE*)pData; - // a_idTask = pService.id_tasks; - // total_count = sizeof(pService.id_tasks) / sizeof(pService.id_tasks[0]); - // } - // else - // { - // NPC_TASK_OUT_SERVICE* pService = (NPC_TASK_OUT_SERVICE*)pData; + if (DataType == DATA_TYPE.DT_NPC_TASK_IN_SERVICE) + { + NPC_TASK_IN_SERVICE pService = (NPC_TASK_IN_SERVICE)pData; + a_idTask = pService.id_tasks; + total_count = pService.id_tasks.Length; + } + else + { + NPC_TASK_OUT_SERVICE pService = (NPC_TASK_OUT_SERVICE)pData; - // // if storage task not exists - // if (pService.storage_id == 0 || pService.storage_open_item == 0) - // { - // a_idTask = pService.id_tasks; - // total_count = sizeof(pService.id_tasks) / sizeof(pService.id_tasks[0]); - // } - // } + // if storage task not exists + if (pService.storage_id == 0 || pService.storage_open_item == 0) + { + a_idTask = pService.id_tasks; + total_count = pService.id_tasks.Length; + } + } - // for (j = 0; j < total_count; j++) - // { - // idTask = a_idTask[j]; - // if (idTask <= 0) continue; + for (j = 0; j < total_count; j++) + { + idTask = (int)a_idTask[j]; + if (idTask <= 0) continue; - // if (DataType == DT_NPC_TASK_IN_SERVICE) - // taskIn.push_back(TASK_ITEM(idTask, a_uiService[i])); - // else - // taskOut.push_back(TASK_ITEM(idTask, a_uiService[i])); + if (DataType == DATA_TYPE.DT_NPC_TASK_IN_SERVICE) + taskIn.Add(new TASK_ITEM(idTask, (int)a_uiService[i])); + else + taskOut.Add(new TASK_ITEM(idTask, (int)a_uiService[i])); - // nFinishTime = (int)pTask.GetTaskFinishedTime(idTask); - // if (nFinishTime > nLastTaskTime) - // { - // idLastTask = idTask; - // nLastTaskTime = nFinishTime; - // } - // } - // } - // else if (DataType == DT_NPC_TASK_MATTER_SERVICE) - // { - // NPC_TASK_MATTER_SERVICE* pService = (NPC_TASK_MATTER_SERVICE*)pData; + nFinishTime = (int)pTask.GetTaskFinishedTime((uint)idTask); + if (nFinishTime > nLastTaskTime) + { + idLastTask = idTask; + nLastTaskTime = nFinishTime; + } + } + } + else if (DataType == DATA_TYPE.DT_NPC_TASK_MATTER_SERVICE) + { + NPC_TASK_MATTER_SERVICE pService = (NPC_TASK_MATTER_SERVICE)pData; - // for (j = 0; j < 16; j++) - // { - // idTask = pService.tasks[j].id_task; - // if (idTask > 0) - // { - // taskMatter.push_back(TASK_ITEM(idTask, a_uiService[i])); - // } - // } - // } - //} + for (j = 0; j < 16; j++) + { + idTask = (int)pService.tasks[j].id_task; + if (idTask > 0) + { + taskMatter.Add(new TASK_ITEM(idTask, (int)a_uiService[i])); + } + } + } + } //A3DCOLOR color; - //string strText; - //const talk_proc* pTalk; - //ATaskTempl* pTemp, *pTempRoot; - //int nIndex, nNumTasks = 0; - //int nHostLevel = GetHostPlayer().GetBasicProps().iLevel; - //ATaskTemplMan* pTempMan = g_pGame.GetTaskTemplateMan(); + string strText = ""; + talk_proc? pTalk; + ATaskTempl pTemp, pTempRoot; + int nIndex, nNumTasks = 0; + int nHostLevel = GetHostPlayer().GetBasicProps().iLevel; + ATaskTemplMan pTempMan = EC_Game.GetTaskTemplateMan(); - //m_pLst_Main.ResetContent(); - //abase::vector* a_uiTasks[] = { &taskIn, &taskOut, &taskMatter }; - //for (int idx = 0; idx < sizeof(a_uiTasks) / sizeof(a_uiTasks[0]); idx++) - //{ - // abase::vector::iterator it; - // for (it = a_uiTasks[idx].begin(); it != a_uiTasks[idx].end(); ++it) - // { - // idTask = it.task_id; + m_pLst_Main.ResetContent(); + List[] a_uiTasks = { taskIn, taskOut, taskMatter }; + for (int idx = 0; idx < a_uiTasks.Length; idx++) + { + foreach (var it in a_uiTasks[idx]) + { + idTask = it.task_id; - // color = 0; - // bool bNeedSetSpecialColor = false; - // pTemp = NULL; - // pTalk = NULL; - // color = m_pLst_Main.GetColor(); - // strText = GetStringFromTable(249); + //color = 0; + bool bNeedSetSpecialColor = false; + pTemp = null; + pTalk = null; + //color = m_pLst_Main.GetColor(); + strText = GetStringFromTable(249); - // if (idx == 1) - // { - // if (pTask.HasTask(idTask)) - // { - // if (!pTask.CanFinishTask(idTask)) - // { - // pTemp = pTempMan.GetTaskTemplByID(idTask); - // pTalk = pTemp.GetUnfinishedTalk(); - // } - // } - // else if (pTask.CanShowTask(idTask)) - // { - // pTemp = pTempMan.GetTaskTemplByID(idTask); + if (idx == 1) + { + if (pTask.HasTask((uint)idTask)) + { + if (!pTask.CanFinishTask((uint)idTask)) + { + pTemp = pTempMan.GetTaskTemplByID((uint)idTask); + pTalk = pTemp.GetUnfinishedTalk(); + } + } + else if (pTask.CanShowTask((uint)idTask)) + { + pTemp = pTempMan.GetTaskTemplByID((uint)idTask); - // if (0 == pTask.CanDeliverTask(idTask)) - // pTalk = pTemp.GetDeliverTaskTalk(); - // else - // { - // pTalk = pTemp.GetUnqualifiedTalk(); - // color = A3DCOLORRGB(128, 128, 128); - // bNeedSetSpecialColor = true; - // } - // } - // } + if (0 == pTask.CanDeliverTask((uint)idTask)) + pTalk = pTemp.GetDeliverTaskTalk(); + else + { + pTalk = pTemp.GetUnqualifiedTalk(); + //color = A3DCOLORRGB(128, 128, 128); + bNeedSetSpecialColor = true; + } + } + } - // if (idx == 0 && pTask.HasTask(idTask) - // && pTask.CanFinishTask(idTask) && !pTalk) - // { - // pTemp = pTempMan.GetTaskTemplByID(idTask); - // pTalk = pTemp.GetAwardTalk(); - // strText = GetStringFromTable(302); - // } + if (idx == 0 && pTask.HasTask((uint)idTask) + && pTask.CanFinishTask((uint)idTask) && pTalk == null) + { + pTemp = pTempMan.GetTaskTemplByID((uint)idTask); + pTalk = pTemp.GetAwardTalk(); + strText = GetStringFromTable(302); + } - // if (pTemp && pTalk && (pTalk.num_window > 1 || pTalk.num_window == 1 && wcslen(pTalk.windows[0].talk_text))) - // { - // if (pTemp.IsKeyTask()) - // { - // color = A3DCOLORRGB(255, 162, 0); - // bNeedSetSpecialColor = true; - // } - // else if (color != 0) - // { - // // 去掉根据人物和任务级别差来改变颜色的逻辑 - // /* - // nLevel = pTemp.GetSuitableLevel(); - // if( nHostLevel <= nLevel - 2 ) - // color = A3DCOLORRGB(255, 54, 0); - // else if( nHostLevel >= nLevel + 3 ) - // color = A3DCOLORRGB(22, 142, 54); - // */ - // } + if (pTemp != null && pTalk != null && (pTalk?.num_window > 1 || pTalk?.num_window == 1 && (pTalk?.windows[0].talk_text).Length > 0)) + { + if (pTemp.IsKeyTask()) + { + //color = A3DCOLORRGB(255, 162, 0); + bNeedSetSpecialColor = true; + } + //else if (color != 0) + //{ + // // 脠楼碌么赂霉戮脻脠脣脦茂潞脥脠脦脦帽录露卤冒虏卯脌麓赂脛卤盲脩脮脡芦碌脛脗脽录颅 + // /* + // nLevel = pTemp.GetSuitableLevel(); + // if( nHostLevel <= nLevel - 2 ) + // color = A3DCOLORRGB(255, 54, 0); + // else if( nHostLevel >= nLevel + 3 ) + // color = A3DCOLORRGB(22, 142, 54); + // */ + //} - // pTempRoot = (ATaskTempl*)pTemp.GetTopTask(); - // if (pTemp != pTempRoot) - // { - // if (bNeedSetSpecialColor) - // { - // strText += CDlgTask::GetTaskNameWithOutColor(pTempRoot); - // } - // else - // { - // strText += CDlgTask::GetTaskNameWithColor(pTempRoot); - // } - // strText += _AL(" - "); - // } - // if (bNeedSetSpecialColor) - // { - // strText += CDlgTask::GetTaskNameWithOutColor(pTemp); - // } - // else - // { - // strText += CDlgTask::GetTaskNameWithColor(pTemp); - // } - // m_pLst_Main.AddString(strText); - // nIndex = m_pLst_Main.GetCount() - 1; - // m_pLst_Main.SetItemData(nIndex, it.service); // Service ID. - // m_pLst_Main.SetItemDataPtr(nIndex, (void*)pTalk); // Talk data. - // m_pLst_Main.SetItemData64(nIndex, pTemp.GetID(), 0, "TaskID"); + pTempRoot = (ATaskTempl)pTemp.GetTopTask(); + if (pTemp != pTempRoot) + { + if (bNeedSetSpecialColor) + { + strText += GetTaskNameWithOutColor(pTempRoot); + } + else + { + strText += GetTaskNameWithColor(pTempRoot); + } + strText += (" - "); + } + if (bNeedSetSpecialColor) + { + strText += GetTaskNameWithOutColor(pTemp); + } + else + { + strText += GetTaskNameWithColor(pTemp); + } + m_pLst_Main.AddString(strText); + nIndex = m_pLst_Main.GetCount() - 1; + m_pLst_Main.SetItemData(nIndex, (uint)it.service); // Service ID. + m_pLst_Main.SetItemDataPtr(nIndex, (object)pTalk); // Talk data. + m_pLst_Main.SetItemData64(nIndex, pTemp.GetID(), 0, "TaskID"); - // if (bNeedSetSpecialColor) - // { - // m_pLst_Main.SetItemTextColor(nIndex, color); - // } - // nNumTasks++; - // } - // } - //} + //if (bNeedSetSpecialColor) + //{ + // m_pLst_Main.SetItemTextColor(nIndex, color); + //} + nNumTasks++; + } + } + } - //if (idLastTask > 0) - //{ - // pTemp = pTempMan.GetTaskTemplByID(idLastTask); - // if (a_strlen(pTemp.GetTribute()) > 0) - // m_pTxt_Content.SetText(pTemp.GetTribute()); - // else - // { - // if (nNumTasks > 0) - // m_pTxt_Content.SetText(GetStringFromTable(502)); - // else - // m_pTxt_Content.SetText(GetStringFromTable(501)); - // } - //} - //else if (bTaskNPC) - // m_pTxt_Content.SetText(pCurNPCEssence.hello_msg); - //else - //{ - // if (nNumTasks > 0) - // m_pTxt_Content.SetText(GetStringFromTable(502)); - // else - // m_pTxt_Content.SetText(GetStringFromTable(501)); - //} + if (idLastTask > 0) + { + pTemp = pTempMan.GetTaskTemplByID((uint)idLastTask); + if ((pTemp.GetTribute().Length) > 0) + { + string text = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pTemp.GetTribute())); + m_pTxt_Content.SetText(text); + } + else + { + if (nNumTasks > 0) + m_pTxt_Content.SetText(GetStringFromTable(502)); + else + m_pTxt_Content.SetText(GetStringFromTable(501)); + } + } + else if (bTaskNPC) + { + if (pCurNPCEssence != null) + { + string text = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pCurNPCEssence.Value.hello_msg)); + m_pTxt_Content.SetText(text); + } + } + else + { + if (nNumTasks > 0) + m_pTxt_Content.SetText(GetStringFromTable(502)); + else + m_pTxt_Content.SetText(GetStringFromTable(501)); + } - //SetData(NPC_DIALOG_TASK_LIST); + SetData(NPC_DIALOG.NPC_DIALOG_TASK_LIST, ""); + } + + string GetTaskNameWithOutColor(ATaskTempl pTempl) + { + string text = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pTempl.m_FixedData.m_szName)); + return TrimColorPrefix(text); + } + + string GetTaskNameWithColor(ATaskTempl pTempl) + { + string text = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pTempl.m_FixedData.m_szName)); + if (pTempl.GetType() == (uint)ENUM_TASK_TYPE.enumTTQiShaList && text[0] == '^') + { + // 脠莽鹿没脢脟脝脽脡卤掳帽脠脦脦帽脟脪脪脩戮颅录脫脕脣脩脮脡芦拢卢脭貌脩脮脡芦虏禄卤盲 + return text; + } + string strTaskName = GetTaskNameWithOutColor(pTempl); + //string strColorPreFix = A3DCOLOR_TO_STRING(GetTaskColor(pTempl)); + + //strTaskName = strColorPreFix + strTaskName; + return strTaskName; + } + + string TrimColorPrefix(string szName) + { + const int COLOR_PREFIX_LENGTH = 7; // "^ffffff" + + if (!string.IsNullOrEmpty(name) && name.Length >= COLOR_PREFIX_LENGTH && name[0] == '^') + { + bool bColorPrefix = true; + for (int i = 1; i < COLOR_PREFIX_LENGTH; i++) + { + char c = name[i]; + bool isHexDigit = + (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F'); + + if (!isHexDigit) + { + bColorPrefix = false; + break; + } + } + + if (bColorPrefix) + { + // L岷 ph岷 sau prefix + return name.Substring(COLOR_PREFIX_LENGTH); + } + } + + return name; } public void PopupNPCDialog(talk_proc pTalk) @@ -1328,341 +1411,418 @@ namespace BrewMonster.UI if (!IsShow()) Show(true); } - bool PopupCorrespondingServiceDialog(int idFunction, int iService, object pData) + bool c(int idFunction, int iService, object pData) { - //AUIDialog pShow1 = null, pShow2 = null; - //NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; + AUIDialog pShow1 = null, pShow2 = null; + NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; - //if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) - //{ - // Button pButton; + if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) + { + //Button pButton; - // pShow1 = m_pAUIManager.GetDialog("Win_Shop"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //pShow1 = m_pAUIManager.GetDialog("Win_Shop"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // GetHostPlayer().PrepareNPCService(iService); - // GetGameUIMan().m_pDlgShop.UpdateShop(1); + //GetHostPlayer().PrepareNPCService(iService); + //GetGameUIMan().m_pDlgShop.UpdateShop(1); - // if (pCurNPCEssence && pCurNPCEssence.id_repair_service) - // { - // pShow1.GetDlgItem("Btn_Repair").Show(true); - // pShow1.GetDlgItem("Btn_RepairAll").Show(true); - // } - // else - // { - // pShow1.GetDlgItem("Btn_Repair").Show(false); - // pShow1.GetDlgItem("Btn_RepairAll").Show(false); - // } + //if (pCurNPCEssence && pCurNPCEssence.id_repair_service) + //{ + // pShow1.GetDlgItem("Btn_Repair").Show(true); + // pShow1.GetDlgItem("Btn_RepairAll").Show(true); + //} + //else + //{ + // pShow1.GetDlgItem("Btn_Repair").Show(false); + // pShow1.GetDlgItem("Btn_RepairAll").Show(false); + //} - // pButton = (PAUISTILLIMAGEBUTTON)pShow2.GetDlgItem("Btn_NormalItem"); - // pButton.SetPushed(true); - // pButton = (PAUISTILLIMAGEBUTTON)pShow2.GetDlgItem("Btn_QuestItem"); - // pButton.SetPushed(false); - // GetGameUIMan().m_pDlgInventory.SetShowItem(CDlgInventory::INVENTORY_ITEM_NORMAL); - //} - //else if (idFunction == NPC_INSTALL) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_Enchase"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //} - //else if (idFunction == NPC_UNINSTALL) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_Disenchase"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //} - //else if (idFunction == NPC_HEAL) - //{ - // GetGameSession().c2s_CmdNPCSevHeal(); - // GetGameUIMan().EndNPCService(); - //} - //else if (idFunction == NPC_TRANSMIT) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_WorldMapTravel"); - // ((CDlgWorldMap*)pShow1).BuildTravelMap(DT_NPC_TRANSMIT_SERVICE, pData); - //} - //else if (idFunction == NPC_SKILL) - //{ - // string strText = m_pLst_Main.GetText(m_pLst_Main.GetCurSel()); - // string strHead = GetStringFromTable(249); - // string strComp = string(strHead + GetStringFromTable(7107)); - // if (0 == a_stricmp(strText, strComp)) - // { - // pShow1 = m_pAUIManager.GetDialog("Win_ELFLearn"); - // ((CDlgELFLearn*)pShow1).SetNPCName(pCurNPCEssence.name); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetData(DT_NPC_SKILL_SERVICE); - // } - // else - // { - // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetData(DT_NPC_SKILL_SERVICE); - // GetGameUIMan().UpdateTeach(0); - // } - //} - //else if (idFunction == NPC_MAKE) - //{ - // NPC_MAKE_SERVICE* pMake = (NPC_MAKE_SERVICE*)pData; - // if (pMake.produce_type == 2) - // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); - // else - // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); - // GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); - // if (pMake.produce_type == 1 || - // pMake.produce_type == 3 || - // pMake.produce_type == 4 || - // pMake.produce_type == 5) - // GetGameUIMan().m_pDlgProduce.ClearMaterial(); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); - //} - //else if (idFunction == NPC_DECOMPOSE) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_Split"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // pShow1.SetDataPtr(pData, "ptr_NPC_DECOMPOSE_SERVICE"); + //pButton = (Button)pShow2.GetDlgItem("Btn_NormalItem"); + //pButton.SetPushed(true); + //pButton = (Button)pShow2.GetDlgItem("Btn_QuestItem"); + //pButton.SetPushed(false); + //GetGameUIMan().m_pDlgInventory.SetShowItem(CDlgInventory::INVENTORY_ITEM_NORMAL); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_INSTALL) + { + pShow1 = m_pAUIManager.GetDialog("Win_Enchase"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_UNINSTALL) + { + pShow1 = m_pAUIManager.GetDialog("Win_Disenchase"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_HEAL) + { + UnityGameSession.c2s_CmdNPCSevHeal(); + GetGameUIMan().EndNPCService(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_TRANSMIT) + { + //pShow1 = m_pAUIManager.GetDialog("Win_WorldMapTravel"); + //((CDlgWorldMap)pShow1).BuildTravelMap(DATA_TYPE.DT_NPC_TRANSMIT_SERVICE, pData); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_SKILL) + { + //string strText = m_pLst_Main.GetText(m_pLst_Main.GetCurSel()); + //string strHead = GetStringFromTable(249); + //string strComp = (strHead + GetStringFromTable(7107)); + //if (0 == a_stricmp(strText, strComp)) + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_ELFLearn"); + // ((CDlgELFLearn*)pShow1).SetNPCName(pCurNPCEssence.name); + // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetData(DATA_TYPE.DT_NPC_SKILL_SERVICE); + //} + //else + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetData((uint)DATA_TYPE.DT_NPC_SKILL_SERVICE, ""); + // GetGameUIMan().UpdateTeach(0); + //} + } + else if (idFunction == (int)SERVICE_TYPE.NPC_MAKE) + { + //NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; + //if (pMake.produce_type == 2) + // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); + //else + // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); + //GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; + //GetHostPlayer().PrepareNPCService(iService); + //pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); + //if (pMake.produce_type == 1 || + // pMake.produce_type == 3 || + // pMake.produce_type == 4 || + // pMake.produce_type == 5) + // GetGameUIMan().m_pDlgProduce.ClearMaterial(); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_DECOMPOSE) + { + //pShow1 = m_pAUIManager.GetDialog("Win_Split"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //pShow1.SetDataPtr(pData, "ptr_NPC_DECOMPOSE_SERVICE"); - // PAUIPROGRESS pProgress; - // PAUIIMAGEPICTURE pImage; + //PAUIPROGRESS pProgress; + //PAUIIMAGEPICTURE pImage; - // pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_a"); - // pImage.ClearCover(); - // pImage.SetDataPtr(NULL); + //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_a"); + //pImage.ClearCover(); + //pImage.SetDataPtr(NULL); - // pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_b"); - // pImage.ClearCover(); - // pImage.SetDataPtr(NULL); + //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_b"); + //pImage.ClearCover(); + //pImage.SetDataPtr(NULL); - // pProgress = (PAUIPROGRESS)pShow1.GetDlgItem("Prgs_1"); - // pProgress.SetProgress(0); + //pProgress = (PAUIPROGRESS)pShow1.GetDlgItem("Prgs_1"); + //pProgress.SetProgress(0); - // pShow1.GetDlgItem("Btn_Start").Enable(false); - // pShow1.GetDlgItem("Btn_Cancel").Enable(true); - // pShow1.GetDlgItem("Txt_no1").SetText(_AL("")); - // pShow1.GetDlgItem("Txt_no2").SetText(_AL("")); - // pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); - // pShow1.GetDlgItem("Txt_SkillName").SetText(_AL("")); - // pShow1.GetDlgItem("Txt_SkillLevel").SetText(_AL("")); - //} - //else if (idFunction == NPC_WAR_TOWERBUILD) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_WarTower"); - //} - //else if (idFunction == NPC_RESETPROP) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_ResetProp"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //} - //else if (idFunction == NPC_PETNAME) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_PetRename"); - // pShow2 = m_pAUIManager.GetDialog("Win_PetList"); - //} - //else if (idFunction == NPC_PETLEARNSKILL) - //{ - // CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); - // CECPetData* pPet = pPetCorral.GetActivePet(); - // if (!pPet) - // { - // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); - // GetGameUIMan().EndNPCService(); - // } - // else - // { - // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetData(DT_NPC_PETLEARNSKILL_SERVICE); - // GetGameUIMan().UpdateTeach(0); - // } - //} - //else if (idFunction == NPC_PETFORGETSKILL) - //{ - // CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); - // CECPetData* pPet = pPetCorral.GetActivePet(); - // if (!pPet) - // { - // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); - // GetGameUIMan().EndNPCService(); - // } - // else - // pShow1 = m_pAUIManager.GetDialog("Win_PetRetrain"); - //} - //else if (idFunction == NPC_EQUIPBIND) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_EquipBind"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // pShow1.SetData((DWORD)pData, "ptr_NPC_EQUIPBIND_SERVICE"); - //} - //else if (idFunction == NPC_EQUIPDESTROY) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_EquipDestroy"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //} - //else if (idFunction == NPC_EQUIPUNDESTROY) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_EquipUndestroy"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //} - //else if (idFunction == NPC_IDENTIFY) - //{ - // PAUIIMAGEPICTURE pImage; + //pShow1.GetDlgItem("Btn_Start").Enable(false); + //pShow1.GetDlgItem("Btn_Cancel").Enable(true); + //pShow1.GetDlgItem("Txt_no1").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_no2").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_SkillName").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_SkillLevel").SetText(_AL("")); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_WAR_TOWERBUILD) + { + pShow1 = m_pAUIManager.GetDialog("Win_WarTower"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_RESETPROP) + { + pShow1 = m_pAUIManager.GetDialog("Win_ResetProp"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_PETNAME) + { + pShow1 = m_pAUIManager.GetDialog("Win_PetRename"); + pShow2 = m_pAUIManager.GetDialog("Win_PetList"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_PETLEARNSKILL) + { + //CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); + //CECPetData* pPet = pPetCorral.GetActivePet(); + //if (!pPet) + //{ + // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); + // GetGameUIMan().EndNPCService(); + //} + //else + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetData(DT_NPC_PETLEARNSKILL_SERVICE); + // GetGameUIMan().UpdateTeach(0); + //} + } + else if (idFunction == (int)SERVICE_TYPE.NPC_PETFORGETSKILL) + { + //CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); + //CECPetData* pPet = pPetCorral.GetActivePet(); + //if (!pPet) + //{ + // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); + // GetGameUIMan().EndNPCService(); + //} + //else + // pShow1 = m_pAUIManager.GetDialog("Win_PetRetrain"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPBIND) + { + //pShow1 = m_pAUIManager.GetDialog("Win_EquipBind"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //pShow1.SetData((DWORD)pData, "ptr_NPC_EQUIPBIND_SERVICE"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPDESTROY) + { + pShow1 = m_pAUIManager.GetDialog("Win_EquipDestroy"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPUNDESTROY) + { + pShow1 = m_pAUIManager.GetDialog("Win_EquipUndestroy"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_IDENTIFY) + { + //PAUIIMAGEPICTURE pImage; - // pShow1 = m_pAUIManager.GetDialog("Win_Identify"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // pShow1.SetDataPtr(pData, "ptr_NPC_IDENTIFY_SERVICE"); + //pShow1 = m_pAUIManager.GetDialog("Win_Identify"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //pShow1.SetDataPtr(pData, "ptr_NPC_IDENTIFY_SERVICE"); - // pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item"); - // pImage.ClearCover(); - // pImage.SetDataPtr(NULL); + //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item"); + //pImage.ClearCover(); + //pImage.SetDataPtr(NULL); - // pShow1.GetDlgItem("Txt").SetText(_AL("")); - // pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); - // pShow1.GetDlgItem("Btn_Confirm").Enable(false); - // pShow1.GetDlgItem("Btn_Cancel").Enable(true); - //} - //else if (idFunction == NPC_GIVE_TASK) - //{ - // talk_proc::option* opt = (talk_proc::option*)pData; - // int idTask = opt.param; - // if (g_pGame.GetConfigs().IsMiniClient() && CECUIConfig::Instance().GetGameUI().IsTaskDisabledInMiniClient(idTask)) - // { - // GetGameUIMan().MessageBox("", GetStringFromTable(10714), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); - // } - // else - // { - // GetGameSession().c2s_CmdNPCSevAcceptTask(idTask, 0, 0); - // } - // GetGameUIMan().EndNPCService(); - //} - //else if (idFunction == NPC_COMPLETE_TASK) - //{ - // AWARD_DATA ad; - // talk_proc::option* opt = (talk_proc::option*)pData; - // CECTaskInterface* pTask = GetHostPlayer().GetTaskInterface(); + //pShow1.GetDlgItem("Txt").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); + //pShow1.GetDlgItem("Btn_Confirm").Enable(false); + //pShow1.GetDlgItem("Btn_Cancel").Enable(true); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_GIVE_TASK) + { + talk_proc.option opt = new talk_proc.option(); + opt = (talk_proc.option)pData; + int idTask = (int)opt.param; + //if (EC_Game.GetConfigs().IsMiniClient() && CECUIConfig.Instance().GetGameUI().IsTaskDisabledInMiniClient(idTask)) + //{ + // GetGameUIMan().MessageBox("", GetStringFromTable(10714), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); + //} + //else + { + UnityGameSession.c2s_CmdNPCSevAcceptTask(idTask, 0, 0); + } + GetGameUIMan().EndNPCService(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_COMPLETE_TASK) + { + AWARD_DATA ad = new AWARD_DATA(); + talk_proc.option opt = (talk_proc.option)pData; + CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); - // pTask.GetAwardCandidates(opt.param, &ad); - // if (ad.m_ulCandItems > 1) - // { - // pShow1 = m_pAUIManager.GetDialog("Win_Award"); - // CDlgAward* pAward = dynamic_cast(pShow1); - // if (pAward) pAward.UpdateAwardItem(opt.param, true); - // } - // else - // { - // GetGameSession().c2s_CmdNPCSevReturnTask(opt.param, 0); - // GetGameUIMan().EndNPCService(); - // } - //} - //else if (idFunction == NPC_GIVE_TASK_MATTER) - //{ - // talk_proc::option* opt = (talk_proc::option*)pData; - // GetGameSession().c2s_CmdNPCSevTaskMatter(opt.param); - // GetGameUIMan().EndNPCService(); - //} - //else if (idFunction == NPC_STORAGE) - //{ - // if (GetHostPlayer().TrashBoxHasPsw()) - // { - // pShow1 = m_pAUIManager.GetDialog("Win_InputString"); - // pShow1.GetDlgItem("DEFAULT_Txt_Input").SetText(_AL("")); - // } - // else - // g_pGame.GetGameSession().c2s_CmdNPCSevOpenTrash(""); - //} - //else if (idFunction == NPC_STORAGE_PASSWORD) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_InputString3"); - //} - //else if (idFunction == NPC_ACCOUNT_STORAGE) - //{ - // if (CECCrossServer::Instance().IsOnSpecialServer()) - // { - // GetGameUIMan().ShowErrorMsg(10130); - // GetGameUIMan().EndNPCService(); - // } - // else g_pGame.GetGameSession().c2s_CmdNPCSevOpenAccountBox(); - //} - //else if (idFunction == NPC_ENGRAVE) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_Engrave"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //} - //else if (idFunction == NPC_RANDPROP) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_RandProp"); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetDataPtr(pData, "ptr_NPC_RANDPROP_SERVICE"); - //} - //else if (idFunction == TALK_RETURN) - //{ - // OnCommand_back("back"); - // return true; // To avoid to close NPC dialog. - //} - //else if (idFunction == TALK_EXIT) - //{ - // GetGameUIMan().EndNPCService(); + pTask.GetAwardCandidates(opt.param, ref ad); + if (ad.m_ulCandItems > 1) + { + pShow1 = m_pAUIManager.GetDialog("Win_Award"); + //CDlgAward pAward = (pShow1) as CDlgAward; + //if (pAward) pAward.UpdateAwardItem(opt.param, true); + } + else + { + UnityGameSession.c2s_CmdNPCSevReturnTask((int)opt.param, 0); + GetGameUIMan().EndNPCService(); + } + } + else if (idFunction == (int)SERVICE_TYPE.NPC_GIVE_TASK_MATTER) + { + talk_proc.option opt = (talk_proc.option)pData; + UnityGameSession.c2s_CmdNPCSevTaskMatter((int)opt.param); + GetGameUIMan().EndNPCService(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_STORAGE) + { + //if (GetHostPlayer().TrashBoxHasPsw()) + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_InputString"); + // pShow1.GetDlgItem("DEFAULT_Txt_Input").SetText(_AL("")); + //} + //else + // g_pGame.GetGameSession().c2s_CmdNPCSevOpenTrash(""); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_STORAGE_PASSWORD) + { + pShow1 = m_pAUIManager.GetDialog("Win_InputString3"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_ACCOUNT_STORAGE) + { + //if (CECCrossServer::Instance().IsOnSpecialServer()) + //{ + // GetGameUIMan().ShowErrorMsg(10130); + // GetGameUIMan().EndNPCService(); + //} + //else g_pGame.GetGameSession().c2s_CmdNPCSevOpenAccountBox(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_ENGRAVE) + { + pShow1 = m_pAUIManager.GetDialog("Win_Engrave"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_RANDPROP) + { + pShow1 = m_pAUIManager.GetDialog("Win_RandProp"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + GetHostPlayer().PrepareNPCService(iService); + pShow1.SetDataPtr(pData, "ptr_NPC_RANDPROP_SERVICE"); + } + else if (idFunction == (int)SERVICE_TYPE.TALK_RETURN) + { + OnCommand_back("back"); + return true; // To avoid to close NPC dialog. + } + else if (idFunction == (int)SERVICE_TYPE.TALK_EXIT) + { + GetGameUIMan().EndNPCService(); - // int idCurFinishTask = GetGameUIMan().m_idCurFinishTask; - // if (GetData() == CDlgNPC::NPC_DIALOG_TASK_TALK && idCurFinishTask > 0) - // { - // GetHostPlayer().GetTaskInterface().OnUIDialogEnd(idCurFinishTask); - // GetGameUIMan().m_idCurFinishTask = -1; - // } - //} - //else if (idFunction == TALK_GIVEUP_TASK) - //{ - // talk_proc::option* opt = (talk_proc::option*)pData; - // GetHostPlayer().GetTaskInterface().GiveUpTask(opt.param); - // GetGameUIMan().EndNPCService(); - //} - //else - //{ - // GetHostPlayer().GetPack(IVTRTYPE_PACK).UnfreezeAllItems(); - // GetGameUIMan().EndNPCService(); - //} + int idCurFinishTask = GetGameUIMan().m_idCurFinishTask; + if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK && idCurFinishTask > 0) + { + GetHostPlayer().GetTaskInterface().OnUIDialogEnd((uint)idCurFinishTask); + GetGameUIMan().m_idCurFinishTask = -1; + } + } + else if (idFunction == (int)SERVICE_TYPE.TALK_GIVEUP_TASK) + { + talk_proc.option opt = (talk_proc.option)pData; + GetHostPlayer().GetTaskInterface().GiveUpTask(opt.param); + GetGameUIMan().EndNPCService(); + } + else + { + //GetHostPlayer().GetPack(IVTRTYPE_PACK).UnfreezeAllItems(); + GetGameUIMan().EndNPCService(); + } - //if (pShow1) - //{ - // DATA_TYPE DataType; - // elementdataman* pDataMan = g_pGame.GetElementDataMan(); + if (pShow1) + { + DATA_TYPE DataType = new DATA_TYPE(); + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); - // pDataMan.get_data_ptr(iService, ID_SPACE_ESSENCE, DataType); + pDataMan.get_data_ptr((uint)iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); - // pShow1.Show(true); + pShow1.Show(true); - // if (pShow2) - // { - // POINT ptPos = pShow1.GetPos(); - // if (ptPos.x == 0 && ptPos.y == 0) - // { - // SIZE s1 = pShow1.GetSize(); - // SIZE s2 = pShow2.GetSize(); - // A3DVIEWPORTPARAM* p = m_pA3DEngine.GetActiveViewport().GetParam(); - // int x, y = (p.Height - max(s1.cy, s2.cy)) / 2; + if (pShow2) + { + //POINT ptPos = pShow1.GetPos(); + //if (ptPos.x == 0 && ptPos.y == 0) + //{ + // SIZE s1 = pShow1.GetSize(); + // SIZE s2 = pShow2.GetSize(); + // A3DVIEWPORTPARAM* p = m_pA3DEngine.GetActiveViewport().GetParam(); + // int x, y = (p.Height - max(s1.cy, s2.cy)) / 2; - // x = (p.Width - s1.cx - s2.cx) / 2; + // x = (p.Width - s1.cx - s2.cx) / 2; - // // old : pShow1.SetPos(x, y); - // pShow1.SetPosEx(x, y); + // // old : pShow1.SetPos(x, y); + // pShow1.SetPosEx(x, y); - // x += s1.cx; + // x += s1.cx; - // // old : pShow2.SetPos(x, y); - // pShow2.SetPosEx(x, y); - // } + // // old : pShow2.SetPos(x, y); + // pShow2.SetPosEx(x, y); + //} - // pShow2.Show(true); - // } - //} + pShow2.Show(true); + } + } Show(false); return true; } + public void OnCommand_back(string szCommand) + { + + NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; + + if (GetData() == NPC_DIALOG.NPC_DIALOG_TALK || + GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK) + { + int i, j, nIndex; + string strText; + talk_proc pTalk = (talk_proc)GetDataPtr("ptr_talk_proc"); + uint id = 0;//(uint)m_pTxt_Content.GetData(); + CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); + + if (0xFFFFFFFF == id) // No any more parent window. + { + if (GetData() == NPC_DIALOG.NPC_DIALOG_TALK) + PopupNPCDialog(pCurNPCEssence.Value); + else if (pCurNPCEssence != null) + { + // 锟斤拷锟斤拷锟斤拷谈锟斤拷锟截碉拷锟斤拷锟斤拷锟叫憋拷锟斤拷锟斤拷 + + // 锟饺碉拷锟斤拷迎锟斤拷锟芥,锟斤拷锟斤拷迎锟斤拷锟斤拷锟角凤拷锟斤拷锟斤拷锟斤拷锟斤拷斜锟斤拷锟斤拷锟 + PopupNPCDialog(pCurNPCEssence.Value); + if (GetData() != NPC_DIALOG.NPC_DIALOG_TASK_LIST) + { + // 锟斤拷迎锟斤拷锟芥不锟斤拷锟斤拷锟斤拷锟叫憋拷锟斤拷锟芥,锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 + // 锟斤拷锟铰碉拷锟斤拷锟斤拷锟斤拷锟叫憋拷锟斤拷锟斤拷 + PopupTaskDialog(false); + m_pLst_Main.AddString(GetStringFromTable(503)); + } + } + } + else + { + for (i = 0; i < pTalk.num_window; i++) + { + if (id != pTalk.windows[i].id) continue; + string text = Encoding.Unicode.GetString(MemoryMarshal.AsBytes(pTalk.windows[i].talk_text)); + m_pTxt_Content.SetText(pTask.FormatTaskTalk(text)); + //m_pTxt_Content.SetData(pTalk.windows[i].id_parent); + + m_pLst_Main.ResetContent(); + for (j = 0; j < pTalk.windows[i].num_option; j++) + { + strText = GetStringFromTable(249); + strText += pTalk.windows[i].options[j].text; + m_pLst_Main.AddString(strText); + nIndex = m_pLst_Main.GetCount() - 1; + m_pLst_Main.SetItemData(nIndex, pTalk.windows[i].options[j].id); + m_pLst_Main.SetItemDataPtr(nIndex, pTalk.windows[i].options[j]); + } + + break; + } + } + } + + else if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_LIST) + { + PopupNPCDialog(pCurNPCEssence.Value); + + if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_LIST) + { + // 锟斤拷锟斤拷锟角癗PC只锟斤拷锟斤拷锟斤拷锟斤拷胤锟斤拷锟斤拷蚍祷氐锟酵拷锟斤拷顺锟絅PC锟斤拷锟斤拷 + Show(false); + GetGameUIMan().EndNPCService(); + } + } + else if (GetData() == NPC_DIALOG.NPC_DIALOG_ESSENCE) + { + Show(false); + GetGameUIMan().EndNPCService(); + } + } + void SelectListItem(int index) { m_pLst_Main.SetCurSel(index); @@ -1706,24 +1866,24 @@ namespace BrewMonster.UI int nIndex1 = (int)CECGameUIMan.TALKPROC_GET_FUNCTION_ID(id); uint[] a_uiService = { - pEssence.id_talk_service, // 交谈的服务ID - pEssence.id_sell_service, // 出售商品的服务ID - pEssence.id_buy_service, // 收购品的服务ID - pEssence.id_repair_service, // 修理商品的服务ID - pEssence.id_install_service, // 安装镶嵌品的服务ID - pEssence.id_uninstall_service, // 拆除镶嵌品的服务ID - pEssence.id_task_out_service, // 任务相关的服务ID: 发放任务服务 - pEssence.id_task_in_service, // 任务相关的服务ID: 验证完成任务服务 - pEssence.id_task_matter_service, // 任务相关的服务ID: 发放任务物品服务 - pEssence.id_skill_service, // 教授技能的服务ID - pEssence.id_heal_service, // 治疗的服务ID - pEssence.id_transmit_service, // 传送的服务ID - pEssence.id_transport_service, // 运输的服务ID - pEssence.id_proxy_service, // 代售的服务ID - pEssence.id_storage_service, // 仓库的服务ID - pEssence.id_make_service, // 生产的服务ID - pEssence.id_decompose_service, // 分解的服务ID - pEssence.id_identify_service, // 鉴定的服务ID + pEssence.id_talk_service, // 陆禄脤赂碌脛路镁脦帽ID + pEssence.id_sell_service, // 鲁枚脢脹脡脤脝路碌脛路镁脦帽ID + pEssence.id_buy_service, // 脢脮鹿潞脝路碌脛路镁脦帽ID + pEssence.id_repair_service, // 脨脼脌铆脡脤脝路碌脛路镁脦帽ID + pEssence.id_install_service, // 掳虏脳掳脧芒脟露脝路碌脛路镁脦帽ID + pEssence.id_uninstall_service, // 虏冒鲁媒脧芒脟露脝路碌脛路镁脦帽ID + pEssence.id_task_out_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 路垄路脜脠脦脦帽路镁脦帽 + pEssence.id_task_in_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 脩茅脰陇脥锚鲁脡脠脦脦帽路镁脦帽 + pEssence.id_task_matter_service, // 脠脦脦帽脧脿鹿脴碌脛路镁脦帽ID: 路垄路脜脠脦脦帽脦茂脝路路镁脦帽 + pEssence.id_skill_service, // 陆脤脢脷录录脛脺碌脛路镁脦帽ID + pEssence.id_heal_service, // 脰脦脕脝碌脛路镁脦帽ID + pEssence.id_transmit_service, // 麓芦脣脥碌脛路镁脦帽ID + pEssence.id_transport_service, // 脭脣脢盲碌脛路镁脦帽ID + pEssence.id_proxy_service, // 麓煤脢脹碌脛路镁脦帽ID + pEssence.id_storage_service, // 虏脰驴芒碌脛路镁脦帽ID + pEssence.id_make_service, // 脡煤虏煤碌脛路镁脦帽ID + pEssence.id_decompose_service, // 路脰陆芒碌脛路镁脦帽ID + pEssence.id_identify_service, // 录酶露篓碌脛路镁脦帽ID 0, // Talk return. 0, // Talk exit. 0 // Storage password. @@ -1920,7 +2080,7 @@ namespace BrewMonster.UI //GetGameUIMan().m_pDlgMailList.Show(true); return; } - else if (iService == CDLGNPC.CDLGNPC_AUCTION && (pEssence?.combined_services & 0x80 ) != 0) + else if (iService == CDLGNPC.CDLGNPC_AUCTION && (pEssence?.combined_services & 0x80) != 0) { Show(false); // TO DO: fix later @@ -2036,7 +2196,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_ELFGENIUSRESET && (pEssence?.combined_services & 0x40000) != 0) { - //新的对话框 + //脨脗碌脛露脭禄掳驴貌 Show(false); //GetGameUIMan().m_pDlgELFGeniusReset.Show(true); //GetGameUIMan().m_pDlgInventory.Show(true); @@ -2123,7 +2283,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_CREATE && (pEssence?.combined_services & 0x8000000) != 0) { - // 创建基地 + // 麓麓陆篓禄霉碌脴 //CECHostPlayer pHost = GetHostPlayer(); //int idFaction = pHost.GetFactionID(); @@ -2142,7 +2302,7 @@ namespace BrewMonster.UI // bool bOK = true; - // // 帮派等级 + // // 掳茂脜脡碌脠录露 // if (pInfo.GetLevel() < pConfig.require_level) // bOK = false; @@ -2153,7 +2313,7 @@ namespace BrewMonster.UI // strMsg += strNextLine; // strMsg += strTemp; - // // 道具需求 + // // 碌脌戮脽脨猫脟贸 // CECInventory* pPack = pHost.GetPack(); // int nItems = sizeof(pConfig.require_item) / sizeof(pConfig.require_item[0]); // for (int i = 0; i < nItems; ++i) @@ -2181,13 +2341,13 @@ namespace BrewMonster.UI // if (!bOK) // { - // // 条件不满足,显示具体信息 + // // 脤玫录镁虏禄脗煤脳茫拢卢脧脭脢戮戮脽脤氓脨脜脧垄 // GetGameUIMan().MessageBox("", strMsg, MB_OK, A3DCOLORRGB(255, 255, 255)); // GetGameUIMan().EndNPCService(); // } // else // { - // // 条件满足,弹出对话框确认 + // // 脤玫录镁脗煤脳茫拢卢碌炉鲁枚露脭禄掳驴貌脠路脠脧 // GetGameUIMan().MessageBox("Fortress_Create", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); // } //} @@ -2201,7 +2361,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_WAR && (pEssence?.combined_services & 0x8000000) != 0) { - // 基地战 + // 禄霉碌脴脮陆 //PAUIDIALOG pDlg1 = GetGameUIMan().GetDialog("Win_FortressWar"); //if (pDlg1) //{ @@ -2216,7 +2376,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_ENTER && (pEssence?.combined_services & 0x8000000) != 0) { - // 进入基地 + // 陆酶脠毛禄霉碌脴 //GetGameSession().factionFortress_Enter(GetHostPlayer().GetFactionID()); //GetGameUIMan().EndNPCService(); Show(false); @@ -2224,7 +2384,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_WARLIST && (pEssence?.combined_services & 0x8000000) != 0) { - // 基地对战表 + // 禄霉碌脴露脭脮陆卤铆 //PAUIDIALOG pDlg1 = GetGameUIMan().GetDialog("Win_FortressWarList"); //if (pDlg1) //{ @@ -2239,7 +2399,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_UPGRADE && (pEssence?.combined_services & 0x10000000) != 0) { - // 基地升级 + // 禄霉碌脴脡媒录露 //PAUIDIALOG pDlg1 = GetGameUIMan().GetDialog("Win_FortressInfo"); //PAUIDIALOG pDlg2 = GetGameUIMan().GetDialog("Win_FortressBuild"); //if (pDlg1 && pDlg2) @@ -2256,7 +2416,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_HANDIN_MATERIAL && (pEssence?.combined_services & 0x10000000) != 0) { - // 缴纳材料 + // 陆脡脛脡虏脛脕脧 //PAUIDIALOG pDlg1 = GetGameUIMan().GetDialog("Win_FortressInfo"); //PAUIDIALOG pDlg2 = GetGameUIMan().GetDialog("Win_FortressMaterial"); //if (pDlg1 && pDlg2) @@ -2273,7 +2433,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_HANDIN_CONTRIB && (pEssence?.combined_services & 0x10000000) != 0) { - // 缴纳贡献度 + // 陆脡脛脡鹿卤脧脳露脠 //PAUIDIALOG pDlg1 = GetGameUIMan().GetDialog("Win_FortressInfo"); //PAUIDIALOG pDlg2 = GetGameUIMan().GetDialog("Win_FortressContrib"); //if (pDlg1 && pDlg2) @@ -2290,7 +2450,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_LEAVE && (pEssence?.combined_services & 0x10000000) != 0) { - // 离开基地 + // 脌毛驴陋禄霉碌脴 //GetGameSession().c2s_CmdNPCSevFactionFortressLeave(); GetGameUIMan().EndNPCService(); Show(false); @@ -2298,7 +2458,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CGLDNPC_FORTRESS_EXCHANGE_MATERIAL && (pEssence?.combined_services & 0x200000000) != 0) { - // 兑换材料 + // 露脪禄禄虏脛脕脧 //PAUIDIALOG pDlg1 = GetGameUIMan().GetDialog("Win_FortressInfo"); //PAUIDIALOG pDlg2 = GetGameUIMan().GetDialog("Win_FortressExchange"); //if (pDlg1 && pDlg2) @@ -2348,7 +2508,7 @@ namespace BrewMonster.UI Show(false); return; } - else if ((iService == CDLGNPC.CDLGNPC_JOIN_COUNTRY || iService == CDLGNPC.CDLGNPC_QUIT_COUNTRY) + else if ((iService == CDLGNPC.CDLGNPC_JOIN_COUNTRY || iService == CDLGNPC.CDLGNPC_QUIT_COUNTRY) && (pEssence?.combined_services2 & 0x00000001) != 0) { //if (iService == CDLGNPC.CDLGNPC_JOIN_COUNTRY) @@ -2362,7 +2522,7 @@ namespace BrewMonster.UI // bool bOK(true); - // // 玩家等级 + // // 脥忙录脪碌脠录露 // const int REQUIRE_LEVEL = CECUIConfig::Instance().GetGameUI().nCountryWarEnterLevel; // int iLevel = GetHostPlayer().GetMaxLevelSofar(); // if (iLevel < REQUIRE_LEVEL) bOK = false; @@ -2374,7 +2534,7 @@ namespace BrewMonster.UI // strMsg += strNextLine; // strMsg += strTemp; - // // 道具需求 + // // 碌脌戮脽脨猫脟贸 // const int REQUIRE_ITEM = CECUIConfig::Instance().GetGameUI().nCountryWarEnterItem; // const int REQUIRE_COUNT = CECUIConfig::Instance().GetGameUI().nCountryWarEnterItemCount; // CECInventory* pPack = pHost.GetPack(); @@ -2391,7 +2551,7 @@ namespace BrewMonster.UI // strMsg += strNextLine; // strMsg += strTemp; - // // 组队要求是队长 + // // 脳茅露脫脪陋脟贸脢脟露脫鲁陇 // CECTeam* pTeam = pHost.GetTeam(); // if (pTeam != NULL) // { @@ -2404,7 +2564,7 @@ namespace BrewMonster.UI // strMsg += strTemp; // } - // // 冷却检查 + // // 脌盲脠麓录矛虏茅 // bool bCoolDown = pHost.GetCoolTime(GP_CT_COUNTRY_BATTLE_APPLY) > 0; // if (bCoolDown) bOK = false; // strTemp.Format(GetStringFromTable(9774) @@ -2418,13 +2578,13 @@ namespace BrewMonster.UI // if (!bOK) // { - // // 条件不满足,显示具体信息 + // // 脤玫录镁虏禄脗煤脳茫拢卢脧脭脢戮戮脽脤氓脨脜脧垄 // GetGameUIMan().MessageBox("", strMsg, MB_OK, A3DCOLORRGB(255, 255, 255)); // GetGameUIMan().EndNPCService(); // } // else // { - // // 条件满足,弹出对话框确认 + // // 脤玫录镁脗煤脳茫拢卢碌炉鲁枚露脭禄掳驴貌脠路脠脧 // PAUIDIALOG pDlgMsgBox = NULL; // GetGameUIMan().MessageBox("Country_JoinLeave", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160), &pDlgMsgBox); // pDlgMsgBox.SetData(1); @@ -2432,7 +2592,7 @@ namespace BrewMonster.UI //} //else //{ - // // 离开确定 + // // 脌毛驴陋脠路露篓 // PAUIDIALOG pDlgMsgBox = NULL; // string strMsg = GetStringFromTable(9770); // GetGameUIMan().MessageBox("Country_JoinLeave", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160), &pDlgMsgBox); @@ -2443,7 +2603,7 @@ namespace BrewMonster.UI } else if (iService == CDLGNPC.CDLGNPC_LEAVE_COUNTRY_WAR && (pEssence?.combined_services2 & 0x00000002) != 0) { - // 离开确定 + // 脌毛驴陋脠路露篓 string strMsg = GetStringFromTable(9915); //GetGameUIMan().MessageBox("Country_LeaveWar", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); Show(false); @@ -2469,7 +2629,7 @@ namespace BrewMonster.UI // bool bOK(true); - // // 玩家等级 + // // 脥忙录脪碌脠录露 // const int REQUIRE_LEVEL = CECUIConfig::Instance().GetGameUI().nCrossServerEnterLevel; // int iLevel = GetHostPlayer().GetMaxLevelSofar(); // if (iLevel < REQUIRE_LEVEL) bOK = false; @@ -2481,7 +2641,7 @@ namespace BrewMonster.UI // strMsg += strNextLine; // strMsg += strTemp; - // // 修真要求 + // // 脨脼脮忙脪陋脟贸 // const int REQUIRE_LEVEL2 = CECUIConfig::Instance().GetGameUI().nCrossServerEnterLevel2; // int iLevel2 = GetHostPlayer().GetBasicProps().iLevel2; // if (iLevel2 < REQUIRE_LEVEL2) bOK = false; @@ -2493,7 +2653,7 @@ namespace BrewMonster.UI // strMsg += strNextLine; // strMsg += strTemp; - // // 冷却检查 + // // 脌盲脠麓录矛虏茅 // bool bCoolDown = pHost.GetCoolTime(GP_CT_CROSS_SERVER_APPLY) > 0; // if (bCoolDown) bOK = false; // strTemp.Format(GetStringFromTable(9774) @@ -2508,13 +2668,13 @@ namespace BrewMonster.UI // if (!bOK) // { - // // 条件不满足,显示具体信息 + // // 脤玫录镁虏禄脗煤脳茫拢卢脧脭脢戮戮脽脤氓脨脜脧垄 // GetGameUIMan().MessageBox("", strMsg, MB_OK, A3DCOLORRGB(255, 255, 255)); // GetGameUIMan().EndNPCService(); // } // else // { - // // 条件满足,弹出对话框确认 + // // 脤玫录镁脗煤脳茫拢卢碌炉鲁枚露脭禄掳驴貌脠路脠脧 // GetGameUIMan().MessageBox("CrossServer_GetIn", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); // } //} @@ -2532,7 +2692,7 @@ namespace BrewMonster.UI return; } else if (iService == CDLGNPC.CDLGNPC_PLAYER_RENAME && (pEssence?.combined_services2 & 0x00000020) != 0) - {// 改名服务 + {// 赂脛脙没路镁脦帽 //if (CECCrossServer::Instance().IsOnSpecialServer()) //{ // GetGameUIMan().ShowErrorMsg(10130); @@ -2540,7 +2700,7 @@ namespace BrewMonster.UI //} //else if (!CECUIConfig::Instance().GetGameUI().bEnablePlayerRename) //{ - // // 未开启改名服务则不显示该对话框 + // // 脦麓驴陋脝么赂脛脙没路镁脦帽脭貌虏禄脧脭脢戮赂脙露脭禄掳驴貌 // GetGameUIMan().ShowErrorMsg(10152); // GetGameUIMan().EndNPCService(); //} @@ -2663,7 +2823,7 @@ namespace BrewMonster.UI //GetGameUIMan().MessageBox("Faction_PVP_Open", strMsg, MB_YESNO, A3DCOLORRGBA(255, 255, 255, 160)); return; } - else if (iService == CDLGNPC.CDLGNPC_GOLD_SHOP + else if (iService == CDLGNPC.CDLGNPC_GOLD_SHOP && ((pEssence?.combined_services2 & 0x00010000) != 0 || (pEssence?.combined_services2 & 0x00020000) != 0)) { Show(false); @@ -2714,7 +2874,7 @@ namespace BrewMonster.UI int idFunction = 0, id_dialog = 0; object pData = m_pLst_Main.GetItemDataPtr(nCurSel, 0, ""); - EC_Game.GetElementDataMan().get_data_ptr((uint)iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); if (DataType == DATA_TYPE.DT_NPC_TASK_IN_SERVICE || DataType == DATA_TYPE.DT_NPC_TASK_OUT_SERVICE || @@ -2726,7 +2886,7 @@ namespace BrewMonster.UI NPC_TASK_OUT_SERVICE pService = (NPC_TASK_OUT_SERVICE)pData; if (!(pService.storage_id == 0 || pService.storage_open_item == 0)) { - //PopupStorageTaskDialog(pService, false); + PopupStorageTaskDialog(pService, false); return; } } @@ -2882,7 +3042,7 @@ namespace BrewMonster.UI if (id_dialog > 0) { - object result = EC_Game.GetElementDataMan() + object result = ElementDataManProvider.GetElementDataMan() .get_data_ptr((uint)id_dialog, ID_SPACE.ID_SPACE_TALK, ref DataType); if (result != null) { @@ -2894,10 +3054,394 @@ namespace BrewMonster.UI } else { - object pData1 = m_pLst_Main.GetItemDataPtr(nCurSel, 0 ,""); + object pData1 = m_pLst_Main.GetItemDataPtr(nCurSel, 0, ""); PopupCorrespondingServiceDialog(idFunction, iService, pData1); } } } + + bool PopupCorrespondingServiceDialog(int idFunction, int iService, object pData) + { + AUIDialog pShow1 = null, pShow2 = null; + NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; + + if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) + { + //Button pButton; + + //pShow1 = m_pAUIManager.GetDialog("Win_Shop"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + + //GetHostPlayer().PrepareNPCService(iService); + //GetGameUIMan().m_pDlgShop.UpdateShop(1); + + //if (pCurNPCEssence && pCurNPCEssence.id_repair_service) + //{ + // pShow1.GetDlgItem("Btn_Repair").Show(true); + // pShow1.GetDlgItem("Btn_RepairAll").Show(true); + //} + //else + //{ + // pShow1.GetDlgItem("Btn_Repair").Show(false); + // pShow1.GetDlgItem("Btn_RepairAll").Show(false); + //} + + //pButton = (PAUISTILLIMAGEBUTTON)pShow2.GetDlgItem("Btn_NormalItem"); + //pButton.SetPushed(true); + //pButton = (PAUISTILLIMAGEBUTTON)pShow2.GetDlgItem("Btn_QuestItem"); + //pButton.SetPushed(false); + //GetGameUIMan().m_pDlgInventory.SetShowItem(CDlgInventory::INVENTORY_ITEM_NORMAL); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_INSTALL) + { + pShow1 = m_pAUIManager.GetDialog("Win_Enchase"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_UNINSTALL) + { + pShow1 = m_pAUIManager.GetDialog("Win_Disenchase"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_HEAL) + { + UnityGameSession.c2s_CmdNPCSevHeal(); + GetGameUIMan().EndNPCService(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_TRANSMIT) + { + pShow1 = m_pAUIManager.GetDialog("Win_WorldMapTravel"); + //((CDlgWorldMap*)pShow1).BuildTravelMap(DT_NPC_TRANSMIT_SERVICE, pData); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_SKILL) + { + //string strText = m_pLst_Main.GetText(m_pLst_Main.GetCurSel()); + //string strHead = GetStringFromTable(249); + //string strComp = (strHead + GetStringFromTable(7107)); + //if (0 == a_stricmp(strText, strComp)) + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_ELFLearn"); + // ((CDlgELFLearn*)pShow1).SetNPCName(pCurNPCEssence.name); + // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetData(DT_NPC_SKILL_SERVICE); + //} + //else + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetData(DT_NPC_SKILL_SERVICE); + // GetGameUIMan().UpdateTeach(0); + //} + } + else if (idFunction == (int)SERVICE_TYPE.NPC_MAKE) + { + //NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; + //if (pMake.produce_type == 2) + // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); + //else + // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); + //GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; + //GetHostPlayer().PrepareNPCService(iService); + //pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); + //if (pMake.produce_type == 1 || + // pMake.produce_type == 3 || + // pMake.produce_type == 4 || + // pMake.produce_type == 5) + // GetGameUIMan().m_pDlgProduce.ClearMaterial(); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_DECOMPOSE) + { + //pShow1 = m_pAUIManager.GetDialog("Win_Split"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //pShow1.SetDataPtr(pData, "ptr_NPC_DECOMPOSE_SERVICE"); + + //PAUIPROGRESS pProgress; + //PAUIIMAGEPICTURE pImage; + + //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_a"); + //pImage.ClearCover(); + //pImage.SetDataPtr(NULL); + + //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_b"); + //pImage.ClearCover(); + //pImage.SetDataPtr(NULL); + + //pProgress = (PAUIPROGRESS)pShow1.GetDlgItem("Prgs_1"); + //pProgress.SetProgress(0); + + //pShow1.GetDlgItem("Btn_Start").Enable(false); + //pShow1.GetDlgItem("Btn_Cancel").Enable(true); + //pShow1.GetDlgItem("Txt_no1").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_no2").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_SkillName").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_SkillLevel").SetText(_AL("")); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_WAR_TOWERBUILD) + { + pShow1 = m_pAUIManager.GetDialog("Win_WarTower"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_RESETPROP) + { + pShow1 = m_pAUIManager.GetDialog("Win_ResetProp"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_PETNAME) + { + pShow1 = m_pAUIManager.GetDialog("Win_PetRename"); + pShow2 = m_pAUIManager.GetDialog("Win_PetList"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_PETLEARNSKILL) + { + //CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); + //CECPetData* pPet = pPetCorral.GetActivePet(); + //if (!pPet) + //{ + // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); + // GetGameUIMan().EndNPCService(); + //} + //else + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetData(DT_NPC_PETLEARNSKILL_SERVICE); + // GetGameUIMan().UpdateTeach(0); + //} + } + else if (idFunction == (int)SERVICE_TYPE.NPC_PETFORGETSKILL) + { + //CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); + //CECPetData* pPet = pPetCorral.GetActivePet(); + //if (!pPet) + //{ + // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); + // GetGameUIMan().EndNPCService(); + //} + //else + // pShow1 = m_pAUIManager.GetDialog("Win_PetRetrain"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPBIND) + { + pShow1 = m_pAUIManager.GetDialog("Win_EquipBind"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + pShow1.SetData((uint)pData, "ptr_NPC_EQUIPBIND_SERVICE"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPDESTROY) + { + pShow1 = m_pAUIManager.GetDialog("Win_EquipDestroy"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPUNDESTROY) + { + pShow1 = m_pAUIManager.GetDialog("Win_EquipUndestroy"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_IDENTIFY) + { + //PAUIIMAGEPICTURE pImage; + + //pShow1 = m_pAUIManager.GetDialog("Win_Identify"); + //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + //pShow1.SetDataPtr(pData, "ptr_NPC_IDENTIFY_SERVICE"); + + //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item"); + //pImage.ClearCover(); + //pImage.SetDataPtr(NULL); + + //pShow1.GetDlgItem("Txt").SetText(_AL("")); + //pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); + //pShow1.GetDlgItem("Btn_Confirm").Enable(false); + //pShow1.GetDlgItem("Btn_Cancel").Enable(true); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_GIVE_TASK) + { + talk_proc.option opt = (talk_proc.option)pData; + int idTask = (int)opt.param; + //if (g_pGame.GetConfigs().IsMiniClient() && CECUIConfig::Instance().GetGameUI().IsTaskDisabledInMiniClient(idTask)) + //{ + // GetGameUIMan().MessageBox("", GetStringFromTable(10714), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); + //} + //else + { + UnityGameSession.c2s_CmdNPCSevAcceptTask(idTask, 0, 0); + } + GetGameUIMan().EndNPCService(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_COMPLETE_TASK) + { + AWARD_DATA ad = new AWARD_DATA(); + talk_proc.option opt = (talk_proc.option)pData; + CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); + + pTask.GetAwardCandidates(opt.param, ref ad); + if (ad.m_ulCandItems > 1) + { + pShow1 = m_pAUIManager.GetDialog("Win_Award"); + //CDlgAward pAward = (pShow1) as CDlgAward; + //if (pAward) pAward.UpdateAwardItem(opt.param, true); + } + else + { + UnityGameSession.c2s_CmdNPCSevReturnTask((int)opt.param, 0); + GetGameUIMan().EndNPCService(); + } + } + else if (idFunction == (int)SERVICE_TYPE.NPC_GIVE_TASK_MATTER) + { + talk_proc.option opt = (talk_proc.option)pData; + UnityGameSession.c2s_CmdNPCSevTaskMatter((int)opt.param); + GetGameUIMan().EndNPCService(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_STORAGE) + { + //if (GetHostPlayer().TrashBoxHasPsw()) + //{ + // pShow1 = m_pAUIManager.GetDialog("Win_InputString"); + // pShow1.GetDlgItem("DEFAULT_Txt_Input").SetText(_AL("")); + //} + //else + // g_pGame.GetGameSession().c2s_CmdNPCSevOpenTrash(""); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_STORAGE_PASSWORD) + { + pShow1 = m_pAUIManager.GetDialog("Win_InputString3"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_ACCOUNT_STORAGE) + { + //if (CECCrossServer::Instance().IsOnSpecialServer()) + //{ + // GetGameUIMan().ShowErrorMsg(10130); + // GetGameUIMan().EndNPCService(); + //} + //else g_pGame.GetGameSession().c2s_CmdNPCSevOpenAccountBox(); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_ENGRAVE) + { + pShow1 = m_pAUIManager.GetDialog("Win_Engrave"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + } + else if (idFunction == (int)SERVICE_TYPE.NPC_RANDPROP) + { + pShow1 = m_pAUIManager.GetDialog("Win_RandProp"); + pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + GetHostPlayer().PrepareNPCService(iService); + pShow1.SetDataPtr(pData, "ptr_NPC_RANDPROP_SERVICE"); + } + else if (idFunction == (int)SERVICE_TYPE.TALK_RETURN) + { + OnCommand_back("back"); + return true; // To avoid to close NPC dialog. + } + else if (idFunction == (int)SERVICE_TYPE.TALK_EXIT) + { + GetGameUIMan().EndNPCService(); + + int idCurFinishTask = GetGameUIMan().m_idCurFinishTask; + if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK && idCurFinishTask > 0) + { + GetHostPlayer().GetTaskInterface().OnUIDialogEnd((uint)idCurFinishTask); + GetGameUIMan().m_idCurFinishTask = -1; + } + } + else if (idFunction == (int)SERVICE_TYPE.TALK_GIVEUP_TASK) + { + talk_proc.option opt = (talk_proc.option)pData; + GetHostPlayer().GetTaskInterface().GiveUpTask(opt.param); + GetGameUIMan().EndNPCService(); + } + else + { + //GetHostPlayer().GetPack(IVTRTYPE_PACK).UnfreezeAllItems(); + GetGameUIMan().EndNPCService(); + } + + if (pShow1) + { + DATA_TYPE DataType = new DATA_TYPE(); + elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); + + pDataMan.get_data_ptr((uint)iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); + + pShow1.Show(true); + + if (pShow2) + { + //POINT ptPos = pShow1.GetPos(); + //if (ptPos.x == 0 && ptPos.y == 0) + //{ + // SIZE s1 = pShow1.GetSize(); + // SIZE s2 = pShow2.GetSize(); + // A3DVIEWPORTPARAM* p = m_pA3DEngine.GetActiveViewport().GetParam(); + // int x, y = (p.Height - max(s1.cy, s2.cy)) / 2; + + // x = (p.Width - s1.cx - s2.cx) / 2; + + // // old : pShow1.SetPos(x, y); + // pShow1.SetPosEx(x, y); + + // x += s1.cx; + + // // old : pShow2.SetPos(x, y); + // pShow2.SetPosEx(x, y); + //} + + pShow2.Show(true); + } + } + Show(false); + + return true; + } + + public void OnCommand_CANCEL(string szCommand) + { + Show(false); + GetGameUIMan().EndNPCService(); + + int idCurFinishTask = GetGameUIMan().m_idCurFinishTask; + if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK && idCurFinishTask > 0) + { + GetHostPlayer().GetTaskInterface().OnUIDialogEnd((uint)idCurFinishTask); + GetGameUIMan().m_idCurFinishTask = -1; + } + } + + public override void Awake() + { + base.Awake(); + m_btnBack.onClick.AddListener(()=> { OnCommand_back("back"); }); + m_btnClose.onClick.AddListener(()=> { OnCommand_CANCEL("cancel"); }); + } + + void PopupStorageTaskDialog(NPC_TASK_OUT_SERVICE pService, bool bTaskNPC) + { + NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; + + if (GetHostPlayer().GetPack().GetItemTotalNum((int)pService.storage_open_item) > 0) + { + Show(false); + + var pDlg = GetGameUIMan().GetDialog("Win_QuestList"); + if (pDlg) + { + pDlg.Show(true); + } + else // in case the dialog is missing or name changed... + { + GetGameUIMan().EndNPCService(); + } + } + else + { + EC_IvtrItem pItem = EC_IvtrItem.CreateItem((int)pService.storage_open_item, 0, 1); + string szMsg; + // cannot open storage task + m_pLst_Main.ResetContent(); + //m_pTxt_Content.SetText(bTaskNPC ? pCurNPCEssence.Value.hello_msg : szMsg.Format(GetStringFromTable(984), pItem.GetName())); + //SetData(NPC_DIALOG.NPC_DIALOG_TASK_LIST, ""); + } + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/ItemUIListBox.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/ItemUIListBox.cs index 0c94883f22..5e2e927b2f 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/ItemUIListBox.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/ItemUIListBox.cs @@ -1,5 +1,7 @@ +using System; using TMPro; using UnityEngine; +using UnityEngine.UI; namespace BrewMonster { @@ -9,15 +11,33 @@ namespace BrewMonster public string[] strDataName = new string[20]; public string[] strDataPtrName = new string[20]; + public string[] strData64Name = new string[20]; + public ulong[] uiData64 = new ulong[20]; public uint[] dwData = new uint[20]; public object[] pvData = new object[20]; - + public int indexItem; public string strText; + Button btnItem = null; + public void OnEnable() + { + if(btnItem == null) + { + btnItem = GetComponent