diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index c9a1c73d..53328f86 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -1439,7 +1439,6 @@ void CGameMode::InitializeCamera() { #include "Contents/Schedule/CheckGDISchedule.h" #include "Contents/Schedule/TimeScheduler.h" #include "Render/Textures/TextureCache.h" -#include "Contents/ClientItemLists.h" #include "Contents/Jobs/JobInheritance.h" #include "Network/Packets/PacketId.h" #include "Security/ReassemblyPacketMgr.h" @@ -3196,7 +3195,6 @@ void CGameMode::PlayItemUseEffect(int itemId, std::uint32_t aid) { #include "Client/Input/Mouse.h" #include "Client/Mode/CLoginMode.h" #include "Client/Registry.h" -#include "Contents/ClientItemLists.h" #include "Contents/Effects/EffectPrim.h" #include "Contents/MapSkyMgr.h" #include "Contents/NavigationManager.h" @@ -3402,13 +3400,13 @@ void CGameMode::InitializeState() { } } - reinterpret_cast(&g_session)->ResetUnknown166C(); + g_session.ResetUnknown166C(); g_session.UpdateRandomStats(); - reinterpret_cast(&g_session)->ClearItems1738(); + g_session.ClearItems1738(); g_session.ClearTradeItems(); - reinterpret_cast(&g_session)->ClearItems1768(); - reinterpret_cast(&g_session)->ClearItems1758(); - reinterpret_cast(&g_session)->ClearItems1750(); + g_session.ClearItems1768(); + g_session.ClearItems1758(); + g_session.ClearItems1750(); // GLOBAL: gl_25334 static int s_window315Checked; diff --git a/Source/Client/Mode/GameModeEquipWindow.cpp b/Source/Client/Mode/GameModeEquipWindow.cpp index bbad17b8..c513dc38 100644 --- a/Source/Client/Mode/GameModeEquipWindow.cpp +++ b/Source/Client/Mode/GameModeEquipWindow.cpp @@ -7,10 +7,6 @@ #include #include -struct ClientItemLists { - bool Equip(const ITEM_INFO& item); - void ResetEquipped(); -}; // GLOBAL: gl_25085 EquipWindowLook g_equipWindowLook; @@ -18,7 +14,7 @@ EquipWindowLook g_equipWindowLook; // OFFSET: 0x00D325F0 // FUNCTION: fn_21743 void CGameMode::ReceiveEquipWindowMicroscope(const unsigned char* packet) { - reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetEquipped(); g_session.ResetItems3500(); const int length = *reinterpret_cast(packet + 2); @@ -47,7 +43,7 @@ void CGameMode::ReceiveEquipWindowMicroscope(const unsigned char* packet) { if (g_session.IsCostumeLocation(item.unknown_0000[3])) { g_session.EquipItem3500(item); } else { - reinterpret_cast(&g_session)->Equip(item); + g_session.Equip(item); } } } diff --git a/Source/Client/Mode/GameModeHandlers.cpp b/Source/Client/Mode/GameModeHandlers.cpp index 5e88f20f..9069634d 100644 --- a/Source/Client/Mode/GameModeHandlers.cpp +++ b/Source/Client/Mode/GameModeHandlers.cpp @@ -488,10 +488,6 @@ void CGameMode::SpawnGroundSkill(std::uint32_t aid, std::uint32_t owner, int val skill->SendMsg(nullptr, 45, 0, address, address >> 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } -struct ClientItemLists { - void AddItem1718(const RawItemBasic& item, int mode); - void RemoveItem1710(std::uint32_t id, int quantity); -}; int sub_D64A40(const unsigned char* entries); @@ -688,7 +684,7 @@ void CGameMode::ReceiveItem1718BasicList(const unsigned char* packet) { item.unknown_0038 = record.unknown_000D; item.id = -1; item.identified = 1; - reinterpret_cast(&g_session)->AddItem1718(item, 0); + g_session.AddItem1718(item, 0); } if (UIWindow* window = g_windowMgr.EnsureWindow(22)) { @@ -770,7 +766,7 @@ void CGameMode::ReceiveItem1718IndexList(const unsigned char* packet) { item.unknown_0008 = record.unknown_0006; item.unknown_000C = owned.unknown_0000[0]; item.identified = owned.identified; - reinterpret_cast(&g_session)->AddItem1718(item, 1); + g_session.AddItem1718(item, 1); } } @@ -2275,7 +2271,7 @@ void CGameMode::ReceiveItemReward2(const unsigned char* data) { switch (packet->result) { case 0: g_session.AddStackedItem(reward); - reinterpret_cast(&g_session)->RemoveItem1710(reward.unknown_0000[1], reward.quantity); + g_session.RemoveItem1710(reward.unknown_0000[1], reward.quantity); g_session.unknown_6140 = value; g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(2594)), 0x64FFFF, 0, 0, 0); break; @@ -2316,7 +2312,7 @@ void CGameMode::ReceiveItemReward(const unsigned char* data) { } item.unknown_0074[0] = packet->bound; g_session.AddStackedItem(item); - reinterpret_cast(&g_session)->RemoveItem1710(packet->index, packet->quantity); + g_session.RemoveItem1710(packet->index, packet->quantity); g_session.unknown_6140 = packet->value; g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(2594)), 0x64FFFF, 0, 0, 0); break; @@ -2922,7 +2918,7 @@ void CGameMode::ReceivePendingItem1718List(const unsigned char* packet) { item.unknown_000C = record->type; item.id = -1; item.identified = 1; - reinterpret_cast(&g_session)->AddItem1718(item, 0); + g_session.AddItem1718(item, 0); if (g_unknown_015D4818 && g_unknown_015D4818->entry) { Unknown015D4818Values& values = g_unknown_015D4818->entry->values; values.unknown_0070 = record->unknown_000D; diff --git a/Source/Client/Mode/GameModeItemLists.cpp b/Source/Client/Mode/GameModeItemLists.cpp index 50d3f7fc..190df8b5 100644 --- a/Source/Client/Mode/GameModeItemLists.cpp +++ b/Source/Client/Mode/GameModeItemLists.cpp @@ -22,13 +22,6 @@ public: }; } -struct ClientItemLists { - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); - bool AddItem1738(const ITEM_INFO& item, unsigned char refresh); - bool AddItem1740(const ITEM_INFO& item); - void ClearInventory(); - void ClearItems1740(); -}; namespace { @@ -113,7 +106,7 @@ void CGameMode::ReceiveEquipListPart(unsigned char listType, int count, const un std::memcpy(options, record.options, sizeof(options)); ITEM_INFO item; FillEquipListItem(item, record, options); - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } break; case 0: @@ -129,7 +122,7 @@ void CGameMode::ReceiveEquipListPart(unsigned char listType, int count, const un } if (item.unknown_0000[3] == 0) { - reinterpret_cast(&g_session)->AddItem1710(item, 0); + g_session.AddItem1710(item, 0); g_session.UpdateInventoryItem(item, 0); } else { char equipped = 1; @@ -163,7 +156,7 @@ void CGameMode::ReceiveEquipListPart(unsigned char listType, int count, const un std::memcpy(options, record.options, sizeof(options)); ITEM_INFO item; FillEquipListItem(item, record, options); - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } break; } @@ -179,12 +172,12 @@ void CGameMode::ReceiveInventoryStart(const unsigned char* packet) { switch (g_gameModePacketBuffer[4]) { case 0: - reinterpret_cast(&g_session)->ClearInventory(); + g_session.ClearInventory(); g_session.ResetEquipment(); g_session.ResetItems2B50(); break; case 1: - reinterpret_cast(&g_session)->ClearItems1740(); + g_session.ClearItems1740(); break; case 2: case 3: { diff --git a/Source/Client/Mode/GameModeNotices.cpp b/Source/Client/Mode/GameModeNotices.cpp index 4c1aa04e..f7c41c29 100644 --- a/Source/Client/Mode/GameModeNotices.cpp +++ b/Source/Client/Mode/GameModeNotices.cpp @@ -1235,23 +1235,6 @@ struct ItemEffectResultPacket { }; #pragma pack(pop) -struct ClientItemLists { - void ClearItems1738(); - void ClearItems1784(int index); - void RemoveItem1710(std::uint32_t id, int quantity); - bool AddItem1738(const ITEM_INFO& item, unsigned char refresh); - bool AddExchangeItem(ITEM_INFO item); - void ClearItemSlotQuantities(); - void ClearItems1768(); - void ClearItems1758(); - void ClearItems1748(); - void ClearItems1760(); - void AddItem1758(const ITEM_INFO& item); - void AddItem1748(const ITEM_INFO& item); - void AddItem1718(const RawItemBasic& item, int mode); - int IsGuildMemberName(const char* name); - int IsFriendName(const char* name); -}; struct AchievementStatePacket { /* 0000 */ std::int16_t unknown_0000; @@ -1367,7 +1350,7 @@ void CGameMode::ReceiveItem1784List(const unsigned char* data) { } const unsigned int count = (packet->length - 6) / sizeof(Item1784Entry); - reinterpret_cast(&g_session)->ClearItems1784(9); + g_session.ClearItems1784(9); char name[256]; std::memset(name, 0, sizeof(name)); @@ -1422,7 +1405,7 @@ void CGameMode::ReceiveCardCompositionResult(const unsigned char* data) { } } - reinterpret_cast(&g_session)->RemoveItem1710(packet->cardIndex, 1); + g_session.RemoveItem1710(packet->cardIndex, 1); g_session.UpdateInventoryItem(equip, 1); } break; @@ -1820,7 +1803,7 @@ void __stdcall sub_D1C050(const AchievementStatePacket* packet) { g_windowMgr.CloseWindow(0x21); } - reinterpret_cast(&g_session)->ClearItems1738(); + g_session.ClearItems1738(); g_unknown_01738268 = 0; g_unknown_0173826C = 0; g_unknown_01738270 = 0; @@ -2975,7 +2958,7 @@ void CGameMode::ReceiveTradeItemFilter(const unsigned char* data) { raw.identified = item.identified; raw.unknown_0004 = 1; raw.unknown_0008 = 2; - reinterpret_cast(&g_session)->AddItem1718(raw, 1); + g_session.AddItem1718(raw, 1); } UIWindow* window = g_windowMgr.EnsureWindow(160); window->SendMsg(nullptr, 0x24, 1, 0, 0, 0); @@ -2995,7 +2978,7 @@ void CGameMode::ReceiveExchangeItemAddAck(const unsigned char* data) { if (packet->index != 0) { ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, packet->index); item.quantity = exchangeAmount; - reinterpret_cast(&g_session)->AddExchangeItem(item); + g_session.AddExchangeItem(item); } else { g_session.m_zeny -= exchangeAmount; g_session.RefreshHpSpWindows(); @@ -3028,7 +3011,7 @@ void CGameMode::ReceiveExchangeRequestAck2(const unsigned char* data) { this->SendMsg(40, 0, 0, 0, 0); *reinterpret_cast(&this->unknown_0100[0x14]) = 1; g_session.ResetSlots(); - reinterpret_cast(&g_session)->ClearItemSlotQuantities(); + g_session.ClearItemSlotQuantities(); g_windowMgr.CloseWindow(10011); UIWindow* window = g_windowMgr.EnsureWindow(10011); if (window) { @@ -3070,7 +3053,7 @@ void CGameMode::ReceiveExchangeRequestAck(const unsigned char* data) { this->SendMsg(40, 0, 0, 0, 0); *reinterpret_cast(&this->unknown_0100[0x14]) = 1; g_session.ResetSlots(); - reinterpret_cast(&g_session)->ClearItemSlotQuantities(); + g_session.ClearItemSlotQuantities(); g_windowMgr.CloseWindow(10011); UIWindow* window = g_windowMgr.EnsureWindow(10011); if (window) { @@ -3233,7 +3216,7 @@ void CGameMode::ReceiveStorageEquipList(const unsigned char* data) { item.unknown_005D = record->damaged; item.unknown_0060 = record->refine; item.unknown_0068 = record->expireTime; - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3261,7 +3244,7 @@ void CGameMode::ReceiveStorageEquipList2(const unsigned char* data) { item.unknown_0068 = record->expireTime; item.unknown_0064 = record->bindOnEquip; item.unknown_0070 = record->sprite; - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3295,7 +3278,7 @@ void CGameMode::ReceiveStorageEquipList3(const unsigned char* data) { item.unknown_0064 = record->bindOnEquip; item.unknown_0070 = record->sprite; item.unknown_0074[0] = (record->flags >> 2) & 1; - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3340,7 +3323,7 @@ void CGameMode::ReceiveStorageEquipList4(const unsigned char* data) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3385,7 +3368,7 @@ void CGameMode::ReceiveStorageEquipList5(const unsigned char* data) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3417,7 +3400,7 @@ void CGameMode::ReceiveStorageNormalList(const unsigned char* data) { item.unknown_0074[0] = (record->flags >> 1) & 1; item.unknown_0068 = record->expireTime; item.unknown_0060 = 0; - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3449,7 +3432,7 @@ void CGameMode::ReceiveStorageNormalList2(const unsigned char* data) { item.unknown_0074[0] = (record->flags >> 1) & 1; item.unknown_0068 = record->expireTime; item.unknown_0060 = 0; - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -3748,7 +3731,7 @@ void CGameMode::ReceiveVendingItemList( ) { const auto* records = reinterpret_cast(data); if (own == 1) { - reinterpret_cast(&g_session)->ClearItems1758(); + g_session.ClearItems1758(); for (int i = 0; i < count;) { const VendingItemRecord record = records[i]; ITEM_INFO item; @@ -3760,7 +3743,7 @@ void CGameMode::ReceiveVendingItemList( item.unknown_0000[1] = i; item.identified = 1; item.SetItemId(record.itemId); - reinterpret_cast(&g_session)->AddItem1758(item); + g_session.AddItem1758(item); } UIMerchantItemMyShopWnd* window = dynamic_cast(static_cast(g_windowMgr.EnsureWindow(176))); @@ -3772,8 +3755,8 @@ void CGameMode::ReceiveVendingItemList( window->SetDuration(duration); } } else { - reinterpret_cast(&g_session)->ClearItems1748(); - reinterpret_cast(&g_session)->ClearItems1760(); + g_session.ClearItems1748(); + g_session.ClearItems1760(); for (int i = 0; i < count;) { const VendingItemRecord record = records[i]; ITEM_INFO item; @@ -3785,7 +3768,7 @@ void CGameMode::ReceiveVendingItemList( item.unknown_0000[1] = i; item.identified = 1; item.SetItemId(record.itemId); - reinterpret_cast(&g_session)->AddItem1748(item); + g_session.AddItem1748(item); } UIMerchantItemShopWnd* shop = static_cast(g_windowMgr.EnsureWindow(177)); @@ -3874,12 +3857,12 @@ void CGameMode::ReceiveTraitStatusChangeAck(unsigned char result, unsigned short void CGameMode::ReceiveVendingItemList2(int aid, int storeId, char own, int count, std::uint32_t duration, const unsigned char* data) { const auto* records = reinterpret_cast(data); if (own == 1) { - reinterpret_cast(&g_session)->ClearItems1758(); + g_session.ClearItems1758(); for (int i = 0; i < count; ++i) { const VendingItemRecord2 record = records[i]; ITEM_INFO item; FillVendingItem(item, record); - reinterpret_cast(&g_session)->AddItem1758(item); + g_session.AddItem1758(item); } UIMerchantItemMyShopWnd* window = dynamic_cast(static_cast(g_windowMgr.EnsureWindow(45))); @@ -3891,13 +3874,13 @@ void CGameMode::ReceiveVendingItemList2(int aid, int storeId, char own, int coun } this->unknown_024C = 1; } else { - reinterpret_cast(&g_session)->ClearItems1748(); - reinterpret_cast(&g_session)->ClearItems1760(); + g_session.ClearItems1748(); + g_session.ClearItems1760(); for (int i = 0; i < count; ++i) { const VendingItemRecord2 record = records[i]; ITEM_INFO item; FillVendingItem(item, record); - reinterpret_cast(&g_session)->AddItem1748(item); + g_session.AddItem1748(item); } UIMerchantItemShopWnd* shop = static_cast(g_windowMgr.EnsureWindow(43)); @@ -7648,7 +7631,7 @@ void CGameMode::sub_D1A520(int unknown_0004, std::string name, std::string text, } prefix = prefix + " ] : " + message.data(); } else { - ClientItemLists& lists = reinterpret_cast(g_session); + CSession& lists = g_session; if (lists.IsFriendName(name.c_str())) { g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(917)), 0xFFFF, 0, 0, 0); g_windowMgr.SendNotice(19, reinterpret_cast(LookupMessage(917)), 0xFFFF, 0, 0, 0); @@ -7715,7 +7698,7 @@ void CGameMode::ReceiveStoreResult(unsigned char kind, unsigned char result) { switch (result) { case 0: g_windowMgr.CloseWindow(41); - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); break; case 1: case 2: @@ -7729,7 +7712,7 @@ void CGameMode::ReceiveStoreResult(unsigned char kind, unsigned char result) { case 4: case 6: case 7: - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); g_windowMgr.CloseWindow(41); break; } @@ -7737,7 +7720,7 @@ void CGameMode::ReceiveStoreResult(unsigned char kind, unsigned char result) { switch (result) { case 0: g_windowMgr.CloseWindow(174); - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); break; case 1: case 2: @@ -7752,7 +7735,7 @@ void CGameMode::ReceiveStoreResult(unsigned char kind, unsigned char result) { case 6: case 7: case 8: - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); g_windowMgr.CloseWindow(174); g_windowMgr.CloseWindow(175); break; @@ -7772,7 +7755,7 @@ void CGameMode::ReceiveStoreResult(unsigned char kind, unsigned char result) { } if (result == 200) { - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); g_windowMgr.CloseWindow(41); g_windowMgr.CloseWindow(174); g_windowMgr.CloseWindow(8); diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index 5aab1d06..5b692281 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -128,27 +128,6 @@ struct TradeItemRecord { static_assert(sizeof(TradeItemRecord) == 0x22); #endif -struct ClientItemLists { - bool AddItem1738(const ITEM_INFO& item, unsigned char refresh); - bool AddItem1740(const ITEM_INFO& item); - void AddItem1758(const ITEM_INFO& item); - void AddItem1718(const RawItemBasic& item, int quantity, std::uint16_t unknown_006C); - void AppendItem1718(const ITEM_INFO& item); - void AddItem1748(const ITEM_INFO& item); - void RemoveItem1758(ITEM_INFO& item); - void RemoveItem1758ByItemId(ITEM_INFO& item); - void ClearItems1768(); - void ClearItems1760And1748(); - void ClearItems1758(); - void ClearItems1760(); - void ClearItems1748(); - void ResetEquipped(); - bool Equip(const ITEM_INFO& item); - void RemoveItem1710(std::uint32_t id, int quantity); - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); - bool EquipItem6B68(const ITEM_INFO& item); - void ClearRecords0734(); -}; void __fastcall sub_DFF150(CSession* session); @@ -820,7 +799,7 @@ void CGameMode::ReceiveItem1738EquipList(const unsigned char* data) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } - reinterpret_cast(&g_session)->AddItem1738(item, 1); + g_session.AddItem1738(item, 1); } g_session.RefreshItem1738Window(); @@ -860,7 +839,7 @@ void CGameMode::ReceiveItem1738EquipListOptions(const unsigned char* data) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } - reinterpret_cast(&g_session)->AddItem1738(item, 1); + g_session.AddItem1738(item, 1); } g_session.RefreshItem1738Window(); @@ -892,7 +871,7 @@ void CGameMode::ReceiveItem1738NormalList(const unsigned char* data) { item.unknown_0060 = 0; item.unknown_0068 = record->expireTime; item.unknown_0074[0] = (record->flags >> 1) & 1; - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } g_session.RefreshItem1738Window(); @@ -1661,7 +1640,7 @@ void CGameMode::ReceiveItem1740EquipList(const unsigned char* packet) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } g_session.RefreshItem1740Window(); @@ -1695,7 +1674,7 @@ void CGameMode::ReceiveItem1740EquipListOptions(const unsigned char* packet) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } g_session.RefreshItem1740Window(); @@ -1886,7 +1865,7 @@ void __stdcall sub_D08110(int field8, int itemIdWord, int quantityWord, int fiel item.unknown_0014[0] = static_cast(field14); UIWindow* window = g_windowMgr.EnsureWindow(0x101); window->SendMsg(nullptr, 0x17, reinterpret_cast(&item), field18, field8, 0); - reinterpret_cast(&g_session)->RemoveItem1758(item); + g_session.RemoveItem1758(item); g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0xE7), item.DisplayName(0).c_str(), quantity).c_str()), 0xFFFF64, 0, 0, 0 @@ -1917,7 +1896,7 @@ void __declspec(noinline) __stdcall sub_D08670(int field14, int itemId, int quan item.unknown_0014[0] = static_cast(field8); UIWindow* window = g_windowMgr.EnsureWindow(0x102); window->SendMsg(nullptr, 0x17, reinterpret_cast(&item), field10, field14, 0); - reinterpret_cast(&g_session)->RemoveItem1758ByItemId(item); + g_session.RemoveItem1758ByItemId(item); if (g_saleOpenWindow != nullptr) { g_saleOpenWindow->SendMsg(nullptr, 0x17, 0, 0, 0, 0); } @@ -1964,7 +1943,7 @@ void CGameMode::ReceiveItem1740BasicList(const unsigned char* data) { item.unknown_005D = record->unknown_000C; item.unknown_0060 = record->refine; item.unknown_0068 = record->expireTime; - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } g_session.RefreshItem1740Window(); @@ -1991,7 +1970,7 @@ void CGameMode::ReceiveItem1740BasicListBind(const unsigned char* data) { item.unknown_0068 = record->expireTime; item.unknown_0064 = record->bindOnEquip; item.unknown_0070 = record->sprite; - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } g_session.RefreshItem1740Window(); @@ -2077,7 +2056,7 @@ void CGameMode::ReceivePartyDead(const unsigned char* packet) { void CGameMode::ReceiveShopItemList( const std::vector& items, int value, int unused1, int argument, int unused2, std::uint32_t duration, unsigned char myShop ) { - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; if (myShop == 1) { lists->ClearItems1758(); for (ITEM_INFO item : items) { @@ -2719,7 +2698,7 @@ void CGameMode::ReceivePacket0B73(const unsigned char* data) { // OFFSET: 0x00D25850 // FUNCTION: fn_21673 void CGameMode::ReceiveUnknownD25850(const unsigned char* packet) { - reinterpret_cast(&g_session)->RemoveItem1710(*reinterpret_cast(packet + 2), 1); + g_session.RemoveItem1710(*reinterpret_cast(packet + 2), 1); char number[12]; char text[260]; _itoa(*reinterpret_cast(packet + 4), number, 10); @@ -3446,7 +3425,7 @@ void CGameMode::ReceiveItem1740List(const unsigned char* packet) { item.unknown_0060 = 0; item.unknown_0068 = record->expireTime; item.unknown_0074[0] = (record->flags >> 1) & 1; - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } g_session.RefreshItem1740Window(); @@ -3489,10 +3468,10 @@ void CGameMode::ReceiveItem1758List(const unsigned char* packet) { reinterpret_cast(g_windowMgr.unknown_040C)->PrintBuyList(); } - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); g_windowMgr.CloseWindow(0xAE); g_windowMgr.CloseWindow(0xAF); - reinterpret_cast(&g_session)->ClearItems1758(); + g_session.ClearItems1758(); const int count = static_cast(static_cast(*reinterpret_cast(packet + 2)) - 12) / 11u; const Item1758Record* record = reinterpret_cast(packet + 12); @@ -3506,7 +3485,7 @@ void CGameMode::ReceiveItem1758List(const unsigned char* packet) { item.unknown_0000[1] = index + 1; item.identified = 1; item.SetItemId(entry.itemId); - reinterpret_cast(&g_session)->AddItem1758(item); + g_session.AddItem1758(item); } UIWindow* window = g_windowMgr.EnsureWindow(0xB0); @@ -3522,14 +3501,14 @@ void CGameMode::ReceiveUnknownD50810(const unsigned char* packet) { g_modeMgr.GetGameMode()->SendMsg(82, 0, 0, 0, 0); } - reinterpret_cast(&g_session)->ClearItems1758(); + g_session.ClearItems1758(); const int count = (*reinterpret_cast(packet + 2) - 8) / sizeof(Item1758StoreRecord); if (count == 0) { this->SendMsg(40, 0, 0, 0, 0); g_windowMgr.CloseWindow(43); g_windowMgr.CloseWindow(44); - reinterpret_cast(&g_session)->ClearItems1760And1748(); + g_session.ClearItems1760And1748(); return; } @@ -3550,15 +3529,15 @@ void CGameMode::ReceiveUnknownD50810(const unsigned char* packet) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = record->options[index]; } - reinterpret_cast(&g_session)->AddItem1758(item); + g_session.AddItem1758(item); } } // OFFSET: 0x00D50590 // FUNCTION: fn_21885 void CGameMode::ReceiveItem1748List(const unsigned char* packet) { - reinterpret_cast(&g_session)->ClearItems1748(); - reinterpret_cast(&g_session)->ClearItems1760(); + g_session.ClearItems1748(); + g_session.ClearItems1760(); const int count = (*reinterpret_cast(packet + 2) - 0x0C) / sizeof(Item1748Record); for (int i = 0; i < count; ++i) { @@ -3580,7 +3559,7 @@ void CGameMode::ReceiveItem1748List(const unsigned char* packet) { for (int index = 0; index < item.unknown_0098; ++index) { reinterpret_cast(item.unknown_009C)[index] = record.options[index]; } - reinterpret_cast(&g_session)->AddItem1748(item); + g_session.AddItem1748(item); } UIWindow* window = g_windowMgr.EnsureWindow(43); @@ -3685,7 +3664,7 @@ void CGameMode::ReceiveItem1718List(const unsigned char* packet) { item.id = -1; item.identified = 1; item.unknown_0038 = FindItemDescription(std::atoi(item.itemId)).unknown_0040; - reinterpret_cast(&g_session)->AddItem1718(item, entry.quantity, static_cast(entry.unknown_000D / 10)); + g_session.AddItem1718(item, entry.quantity, static_cast(entry.unknown_000D / 10)); } if (UIWindow* window = g_windowMgr.EnsureWindow(0xFE)) { @@ -3719,7 +3698,7 @@ void ReceiveTradeItems(int count, const TradeItemRecord* records) { item.identified = 1; item.unknown_0074[3] = 1; if (item.quantity > 0) { - reinterpret_cast(&g_session)->AppendItem1718(item); + g_session.AppendItem1718(item); } } @@ -3987,7 +3966,7 @@ struct BuyingStoreItemRecord { // OFFSET: 0x00D1CFF0 // FUNCTION: fn_21628 void CGameMode::ReceiveBuyingStoreItemList(const unsigned char* packet) { - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; lists->ClearItems1748(); lists->ClearItems1760(); @@ -4250,7 +4229,7 @@ void CGameMode::ReceiveSwapEquipmentList(const unsigned char* data) { } if (g_session.IsCostumeLocation(record->location)) { - reinterpret_cast(&g_session)->EquipItem6B68(item); + g_session.EquipItem6B68(item); } else { g_session.EquipItem61B8(item); } @@ -4435,7 +4414,7 @@ void CGameMode::ReceiveOpenStore(const unsigned char* packet) { } else { storeCount = count > 5 ? 5 : count; } - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); if (!g_windowMgr.window_027C && !g_windowMgr.window_0274 && !g_windowMgr.unknown_02FC) { if (UIWindow* window = g_windowMgr.EnsureWindow(174)) { static_cast(window)->AddActionButton(); @@ -6611,7 +6590,7 @@ void CGameMode::OpenBuyingStoreMake(unsigned char slotCount) { } else { g_session.m_buyingStoreSlotCount = count > 5 ? 5 : count; } - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); if (!g_windowMgr.window_027C && !g_windowMgr.window_0274 && !g_windowMgr.unknown_02FC) { g_windowMgr.EnsureWindow(174); if (g_windowMgr.unknown_040C) { @@ -6642,7 +6621,7 @@ void CGameMode::OpenVendingMake(unsigned char slotCount, int itemCount, const sh } else { g_session.m_vendingSlotCount = count > 13 ? 13 : count; } - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); if (!g_windowMgr.window_027C && !g_windowMgr.window_0274) { g_windowMgr.EnsureWindow(41); if (g_windowMgr.unknown_02FC) { @@ -6843,7 +6822,7 @@ void CGameMode::ReceiveItemConsumed(const unsigned char* packet) { g_session.ResetSlots(); } - reinterpret_cast(&g_session)->RemoveItem1710( + g_session.RemoveItem1710( *reinterpret_cast(packet + 4), *reinterpret_cast(packet + 6) ); *reinterpret_cast(&this->unknown_02B8[0x18]) = 0; @@ -6887,7 +6866,7 @@ void CGameMode::ReceiveItemSellResult(const unsigned char* packet) { reinterpret_cast(FormatOwnedString(LookupMessage(1746), item.DisplayName(0).c_str(), count, price * count).c_str()), 0xFFFF64, 0, 0, 0 ); - reinterpret_cast(&g_session)->RemoveItem1710( + g_session.RemoveItem1710( *reinterpret_cast(packet + 2), *reinterpret_cast(packet + 4) ); } @@ -6999,7 +6978,7 @@ void CGameMode::ReceiveBuyingStoreOpenResult(const unsigned char* packet) { case 1: g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(1741)), 0xFF, 0, 0, 0); - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); g_windowMgr.CloseWindow(174); g_windowMgr.CloseWindow(175); break; @@ -7019,7 +6998,7 @@ void CGameMode::ReceiveBuyingStoreOpenResult(const unsigned char* packet) { case 10: g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3229)), 0xFF, 0, 0, 0); - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); g_windowMgr.CloseWindow(174); g_windowMgr.CloseWindow(175); break; @@ -7250,7 +7229,7 @@ void CGameMode::ReceiveEquipCardChange(const unsigned char* packet) { // OFFSET: 0x00D284D0 // FUNCTION: fn_21694 void CGameMode::ReceiveEquipWindowMicroscope2(const unsigned char* packet) { - reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetEquipped(); g_session.ResetItems3500(); const int length = *reinterpret_cast(packet + 2); @@ -7276,7 +7255,7 @@ void CGameMode::ReceiveEquipWindowMicroscope2(const unsigned char* packet) { if (g_session.IsCostumeLocation(item.unknown_0000[3])) { g_session.EquipItem3500(item); } else { - reinterpret_cast(&g_session)->Equip(item); + g_session.Equip(item); } } } @@ -7300,7 +7279,7 @@ void CGameMode::ReceiveEquipWindowMicroscope2(const unsigned char* packet) { // OFFSET: 0x00D28700 // FUNCTION: fn_21695 void CGameMode::ReceiveEquipWindowMicroscope3(const unsigned char* packet) { - reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetEquipped(); g_session.ResetItems3500(); const int length = *reinterpret_cast(packet + 2); @@ -7328,7 +7307,7 @@ void CGameMode::ReceiveEquipWindowMicroscope3(const unsigned char* packet) { if (g_session.IsCostumeLocation(item.unknown_0000[3])) { g_session.EquipItem3500(item); } else { - reinterpret_cast(&g_session)->Equip(item); + g_session.Equip(item); } } } @@ -7900,7 +7879,7 @@ namespace { if (g_session.IsCostumeLocation(item.unknown_0000[3])) { g_session.EquipItem3500(item); } else { - reinterpret_cast(&g_session)->Equip(item); + g_session.Equip(item); } } @@ -7924,7 +7903,7 @@ namespace { // OFFSET: 0x00D28950 // FUNCTION: fn_21696 void CGameMode::ReceiveEquipWindowMicroscope4(const unsigned char* packet) { - reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetEquipped(); g_session.ResetItems3500(); const int length = *reinterpret_cast(packet + 2); @@ -7958,7 +7937,7 @@ void CGameMode::ReceiveEquipWindowMicroscope4(const unsigned char* packet) { // OFFSET: 0x00D28EA0 // FUNCTION: fn_21697 void CGameMode::ReceiveEquipWindowMicroscope5(const unsigned char* packet) { - reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetEquipped(); g_session.ResetItems3500(); const int length = *reinterpret_cast(packet + 2); @@ -7993,7 +7972,7 @@ void CGameMode::ReceiveEquipWindowMicroscope5(const unsigned char* packet) { // OFFSET: 0x00D29400 // FUNCTION: fn_21698 void CGameMode::ReceiveEquipWindowMicroscope6(const unsigned char* packet) { - reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetEquipped(); g_session.ResetItems3500(); const int length = *reinterpret_cast(packet + 2); @@ -8033,7 +8012,7 @@ namespace { } if (item.unknown_0000[3] == 0) { - reinterpret_cast(&g_session)->AddItem1710(item, 0); + g_session.AddItem1710(item, 0); g_session.UpdateInventoryItem(item, 0); } else { char equipped = 1; @@ -8242,7 +8221,7 @@ void CGameMode::ReceiveItemPickupAck2(const unsigned char* data) { item.unknown_0000[3] = 0x8000; } - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), packet->amount).c_str()), 0xFFFF00, 6, 0, 0 ); @@ -8335,7 +8314,7 @@ void CGameMode::ReceiveItemPickupAck3(const unsigned char* data) { item.unknown_0000[3] = 0x8000; } - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), packet->amount).c_str()), 0xFFFF00, 6, 0, 0 ); @@ -8432,7 +8411,7 @@ void CGameMode::ReceiveItemPickupAck(const unsigned char* data) { item.unknown_0000[3] = 0x8000; } - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), packet->amount).c_str()), 0xFFFF00, 6, 0, 0 ); @@ -8537,7 +8516,7 @@ void CGameMode::ReceiveItemPickupAck5( item.unknown_0000[3] = 0x8000; } - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice(1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), amount).c_str()), 0xFFFF00, 6, 0, 0); UIWindow* window = g_windowMgr.EnsureWindow(0x3A); @@ -8651,7 +8630,7 @@ void CGameMode::ReceiveItemPickupAck7(const unsigned char* data) { item.unknown_0000[3] = 0x8000; } - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), packet->amount).c_str()), 0xFFFF00, 6, 0, 0 ); @@ -9721,7 +9700,7 @@ void CGameMode::ReceiveItemPickupAck8(const unsigned char* data) { item.unknown_0088 = 0; item.unknown_0070 = packet->look; - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), packet->amount).c_str()), 0xFFFF00, 6, 0, 0 ); @@ -9841,7 +9820,7 @@ void CGameMode::ReceiveItemPickupAck9(const unsigned char* data) { item.unknown_0070 = packet->look; item.unknown_0088 = packet->grade; - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); g_windowMgr.SendNotice( 1, reinterpret_cast(FormatOwnedString(LookupMessage(0x99), item.DisplayName(0).c_str(), packet->amount).c_str()), 0xFFFF00, 6, 0, 0 ); @@ -10377,7 +10356,7 @@ void CGameMode::ReceiveActorDisappear(const unsigned char* data) { } if (g_windowMgr.unknown_0300 && static_cast(g_windowMgr.unknown_0300)->unknown_0100 == static_cast(packet->aid)) { this->SendMsg(245, 0, 0, 0, 0); - reinterpret_cast(&g_session)->ClearItems1760And1748(); + g_session.ClearItems1760And1748(); } if (this->scene->RemoveItem(packet->aid) == true) { this->SendMsg(13, packet->aid, 0, 0, 0); @@ -11564,7 +11543,7 @@ void CGameMode::ReceiveEquipItemListFlags(const unsigned char* packet) { } if (item.unknown_0000[3] == 0) { - reinterpret_cast(&g_session)->AddItem1710(item, 0); + g_session.AddItem1710(item, 0); g_session.UpdateInventoryItem(item, 0); } else { char equipped = 1; @@ -11607,7 +11586,7 @@ void CGameMode::ReceiveEquipItemList34(const unsigned char* packet) { } if (item.unknown_0000[3] == 0) { - reinterpret_cast(&g_session)->AddItem1710(item, 0); + g_session.AddItem1710(item, 0); g_session.UpdateInventoryItem(item, 0); } else { char equipped = 1; @@ -11649,7 +11628,7 @@ void CGameMode::ReceiveEquipItemList38(const unsigned char* packet) { } if (item.unknown_0000[3] == 0) { - reinterpret_cast(&g_session)->AddItem1710(item, 0); + g_session.AddItem1710(item, 0); g_session.UpdateInventoryItem(item, 0); } else { char equipped = 1; @@ -11712,7 +11691,7 @@ void CGameMode::ReceiveEquipItemResult(const unsigned char* packet) { ITEM_DESC description = FindItemDescription(std::atoi(item.itemId.c_str())); item.unknown_0070 = description.unknown_0040; if (g_session.IsCostumeLocation(*reinterpret_cast(packet + 4))) { - reinterpret_cast(&g_session)->EquipItem6B68(item); + g_session.EquipItem6B68(item); } else { g_session.EquipItem61B8(item); } @@ -12033,10 +12012,10 @@ void CGameMode::ReceiveItem1748List2(const unsigned char* packet) { const std::int32_t value8 = *reinterpret_cast(packet + 8); const std::int32_t value4 = *reinterpret_cast(packet + 4); - reinterpret_cast(&g_session)->ClearItems1748(); - reinterpret_cast(&g_session)->ClearItems1760(); + g_session.ClearItems1748(); + g_session.ClearItems1760(); for (ITEM_INFO item : items) { - reinterpret_cast(&g_session)->AddItem1748(item); + g_session.AddItem1748(item); } if (UIWindow* window = g_windowMgr.EnsureWindow(43)) { @@ -12095,7 +12074,7 @@ void CGameMode::ReceivePartyMemberLeft(const unsigned char* data) { if (g_windowMgr.unknown_03F8) { g_windowMgr.CloseWindow(0x89); } - reinterpret_cast(&g_session)->ClearRecords0734(); + g_session.ClearRecords0734(); } sub_DFF150(&g_session); @@ -12167,17 +12146,17 @@ void CGameMode::ReceiveItem1758StoreList(const unsigned char* packet) { g_modeMgr.GetGameMode()->SendMsg(82, 0, 0, 0, 0); } - reinterpret_cast(&g_session)->ClearItems1758(); + g_session.ClearItems1758(); if (items.size() == 0) { this->SendMsg(40, 0, 0, 0, 0); g_windowMgr.CloseWindow(43); g_windowMgr.CloseWindow(44); - reinterpret_cast(&g_session)->ClearItems1760And1748(); + g_session.ClearItems1760And1748(); return; } for (ITEM_INFO item : items) { - reinterpret_cast(&g_session)->AddItem1758(item); + g_session.AddItem1758(item); } } diff --git a/Source/Client/Mode/LoginMode.cpp b/Source/Client/Mode/LoginMode.cpp index 0450f51c..e59531e0 100644 --- a/Source/Client/Mode/LoginMode.cpp +++ b/Source/Client/Mode/LoginMode.cpp @@ -1849,7 +1849,7 @@ void CLoginMode::Initialize(const char* name) { g_soundMgr->PlayStream("bgm\\01.mp3", 0, false); } this->slotExtension = CharacterSlotExtension(); - g_session.ClearItems1784(); + g_session.ClearAllItems1784(); g_entryQueueMgr->ready = 0; g_entryQueueMgr->current = nullptr; g_session.ClearShortcutSlots(); diff --git a/Source/Client/Session.h b/Source/Client/Session.h index da5df625..2ad09d93 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -887,7 +887,63 @@ public: void LoadXmlTables(); void LoadExternalSettings(); void ReloadLanguageTables(); - void ClearItems1784(); + bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); + void AddItem1718(const RawItemBasic& item, int quantity, std::uint16_t unknown_006C); + void AddItem1718(const RawItemBasic& item, int mode); + bool AddItem1768(const ITEM_INFO& item, unsigned char alternate, unsigned char refresh); + bool AddItem1740(const ITEM_INFO& item); + bool AddItem1750(const ITEM_INFO& item, int type, unsigned char refresh); + void AddItem1758(const ITEM_INFO& item); + void AddItem1760(const ITEM_INFO& item); + void AddItem1748(const ITEM_INFO& item); + bool Equip(const ITEM_INFO& item); + void AppendItem1718(const ITEM_INFO& item); + void MergeItem1718ByName(const ITEM_INFO& item); + void MergeItem1720ByName(const ITEM_INFO& item); + void MergeItem1720(const ITEM_INFO& item); + void AddItem1730(const ITEM_INFO& item); + void MergeItem1718(const ITEM_INFO& item); + bool AddItem1738(const ITEM_INFO& item, unsigned char refresh); + void RemoveItem1758ByItemId(ITEM_INFO& item); + __declspec(noinline) void RemoveItem1710(std::uint32_t id, int quantity); + bool AddExchangeItem(ITEM_INFO item); + bool RemoveItem1768(const ITEM_INFO& item, unsigned char alternate); + bool RemoveItem1740(const ITEM_INFO& item); + bool RemoveItem1750(const ITEM_INFO& item, int type, unsigned char refresh); + void RemoveItem1758(ITEM_INFO& item); + void RemoveItem1760(const ITEM_INFO& item); + void RemoveItem1718ByItemId(const ITEM_INFO& item); + void RemoveItem1718(const ITEM_INFO& item); + void RemoveItem1720ByName(const ITEM_INFO& item); + void RemoveItem1720(const ITEM_INFO& item); + void RemoveItem1730(const ITEM_INFO& item); + void ReduceItem1718(const ITEM_INFO& item); + bool RemoveItem1738(const ITEM_INFO& item); + void ClearInventory(); + void ClearItems1760And1748(); + void ClearItems1768(); + void ClearItems1740(); + void ClearItems1750(); + void SetItems1750(int count, const short* ids); + void ClearItems1758(); + void ClearItems1760(); + void ClearItems1748(); + void ClearItems1784(int index); + void ClearItemSlotQuantities(); + void ResetEquipped(); + void ClearItems1720(); + void ClearItems1738(); + void CopyItems1740To1750(); + void CopyItems1760To1770(); + std::pair FindItem1750(const ITEM_INFO& item, unsigned char unknown); + void ClearRecords0734(); + void ResetUnknown166C(); + void ResetHotkeyDescriptions(); + int IsDifferentName(const char* name, const char* other); + int IsGuildMemberNameDifferent(const char* name); + int IsFriendNameDifferent(const char* name); + bool EquipItem6B68(const ITEM_INFO& item); + void ClearAllItems1784(); void UpdateRandomStats(); void ResetEquipment(); void ResetSlots(); diff --git a/Source/Client/Stove/StoveMgr.cpp b/Source/Client/Stove/StoveMgr.cpp index 4eacbe53..c9699d44 100644 --- a/Source/Client/Stove/StoveMgr.cpp +++ b/Source/Client/Stove/StoveMgr.cpp @@ -41,9 +41,6 @@ const wchar_t g_stoveCategoryIdA[] = L"44C71118750747D"; // STRING: st_01260 const wchar_t g_stoveCategoryIdB[] = L"14A6891F90E24D7"; -struct ClientItemLists { - void ClearItems1784(int index); -}; // OFFSET: 0x0063EEE0 // FUNCTION: fn_04800 @@ -59,7 +56,7 @@ void CStoveMgr::FetchAllProducts() { Sleep(200); } while (g_stoveWaitingCallback); - reinterpret_cast(&g_session)->ClearItems1784(9); + g_session.ClearItems1784(9); Stove::PCSDK::IAP::StovePCFetchProductParam categoryParam; categoryParam.SetCategoryId(this->m_environment == 2 ? g_stoveCategoryIdA : g_stoveCategoryIdB); categoryParam.SetPageNumber(1); @@ -88,7 +85,7 @@ void FetchStoveTermsAgreement() { // OFFSET: 0x0063E910 // FUNCTION: fn_45460 void CStoveMgr::FetchCategoryProducts() { - reinterpret_cast(&g_session)->ClearItems1784(9); + g_session.ClearItems1784(9); Stove::PCSDK::IAP::StovePCFetchProductParam param; param.SetCategoryId(this->m_environment == 2 ? g_stoveCategoryIdA : g_stoveCategoryIdB); param.SetPageNumber(1); @@ -300,7 +297,7 @@ void CategoryProductsCallback::operator()(Stove::PCSDK::CallbackResult callbackR unsigned int count) const { g_stoveWaitingCallback = false; if (callbackResult.GetResult().IsSuccessful()) { - g_session.ClearItems1784(); + g_session.ClearAllItems1784(); for (unsigned int index = 0; index < count; ++index) { const Stove::PCSDK::IAP::StovePCProduct& product = products[index]; std::string categoryId = EncodeText(CP_ACP, std::wstring(product.GetCategoryId())); diff --git a/Source/Contents/ClientItemLists.cpp b/Source/Contents/ClientItemLists.cpp index b6448c5a..37b31f6f 100644 --- a/Source/Contents/ClientItemLists.cpp +++ b/Source/Contents/ClientItemLists.cpp @@ -169,110 +169,6 @@ static_assert(sizeof(ItemAddGradePacket) == 0x3A); static_assert(sizeof(ItemListRecord) == 0x22); #endif -struct ClientItemLists { - /* 0000 */ unsigned char unknown_0000[0xC0]; - /* 00C0 */ std::string hotkeyDescriptions[36]; - /* 0420 */ unsigned char unknown_0420[0x314]; - /* 0734 */ std::list records0734; - /* 073C */ unsigned char unknown_073C[0xF30]; - /* 166C */ int unknown_166C; - /* 1670 */ int unknown_1670; - /* 1674 */ int unknown_1674; - /* 1678 */ int unknown_1678; - /* 167C */ int unknown_167C; - /* 1680 */ int unknown_1680; - /* 1684 */ unsigned char unknown_1684[0x8C]; - /* 1710 */ std::list inventory; - /* 1718 */ std::list items_1718; - /* 1720 */ std::list items_1720; - /* 1728 */ std::list items_1728; - /* 1730 */ std::list items_1730; - /* 1738 */ std::list items_1738; - /* 1740 */ std::list items_1740; - /* 1748 */ std::list items_1748; - /* 1750 */ std::list items_1750; - /* 1758 */ std::list items_1758; - /* 1760 */ std::list items_1760; - /* 1768 */ std::list items_1768; - /* 1770 */ std::list items_1770; - /* 1778 */ unsigned char unknown_1778[0xC]; - /* 1784 */ std::list items_1784[11]; - /* 17DC */ std::list partyMembers; - /* 17E4 */ std::list friends; - /* 17EC */ unsigned char unknown_17EC[0x9B4]; - /* 21A0 */ ITEM_INFO equipped[10]; - /* 2B50 */ unsigned char unknown_2B50[0x1360]; - /* 3EB0 */ ITEM_INFO exchangeItems[10]; - /* 4860 */ ITEM_INFO itemSlots[10]; - /* 5210 */ int unknown_5210; - /* 5214 */ int unknown_5214; - /* 5218 */ unsigned char unknown_5218[0x24C]; - /* 5464 */ int unknown_5464; - /* 5468 */ unsigned char unknown_5468[0x5C]; - /* 54C4 */ std::string unknown_54C4; - /* 54DC */ unsigned char unknown_54DC[0xCDC]; - /* 61B8 */ ITEM_INFO items_61B8[10]; - /* 6B68 */ ITEM_INFO items_6B68[10]; - - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); - void AddItem1718(const RawItemBasic& item, int quantity, std::uint16_t unknown_006C); - void AddItem1718(const RawItemBasic& item, int mode); - bool AddItem1768(const ITEM_INFO& item, unsigned char alternate, unsigned char refresh); - bool AddItem1740(const ITEM_INFO& item); - bool AddItem1750(const ITEM_INFO& item, int type, unsigned char refresh); - void AddItem1758(const ITEM_INFO& item); - void AddItem1760(const ITEM_INFO& item); - void AddItem1748(const ITEM_INFO& item); - bool Equip(const ITEM_INFO& item); - void AppendItem1718(const ITEM_INFO& item); - void MergeItem1718ByName(const ITEM_INFO& item); - void MergeItem1720ByName(const ITEM_INFO& item); - void MergeItem1720(const ITEM_INFO& item); - void AddItem1730(const ITEM_INFO& item); - void MergeItem1718(const ITEM_INFO& item); - bool AddItem1738(const ITEM_INFO& item, unsigned char refresh); - void RemoveItem1758ByItemId(ITEM_INFO& item); - __declspec(noinline) void RemoveItem1710(std::uint32_t id, int quantity); - bool AddExchangeItem(ITEM_INFO item); - bool RemoveItem1768(const ITEM_INFO& item, unsigned char alternate); - bool RemoveItem1740(const ITEM_INFO& item); - bool RemoveItem1750(const ITEM_INFO& item, int type, unsigned char refresh); - void RemoveItem1758(ITEM_INFO& item); - void RemoveItem1760(const ITEM_INFO& item); - void RemoveItem1718ByItemId(const ITEM_INFO& item); - void RemoveItem1718(const ITEM_INFO& item); - void RemoveItem1720ByName(const ITEM_INFO& item); - void RemoveItem1720(const ITEM_INFO& item); - void RemoveItem1730(const ITEM_INFO& item); - void ReduceItem1718(const ITEM_INFO& item); - bool RemoveItem1738(const ITEM_INFO& item); - void ClearInventory(); - void ClearItems1760And1748(); - void ClearItems1768(); - void ClearItems1740(); - void ClearItems1750(); - void SetItems1750(int count, const short* ids); - void ClearItems1758(); - void ClearItems1760(); - void ClearItems1748(); - void ClearItems1784(int index); - void ClearItemSlotQuantities(); - void ResetEquipped(); - void ClearItems1720(); - void ClearItems1738(); - void CopyItems1740To1750(); - void CopyItems1760To1770(); - std::pair FindItem1750(const ITEM_INFO& item, unsigned char unknown); - void ClearRecords0734(); - void ResetUnknown166C(); - void ResetHotkeyDescriptions(); - int IsDifferentName(const char* name, const char* other); - int IsGuildMemberName(const char* name); - int IsFriendName(const char* name); - bool EquipItem6B68(const ITEM_INFO& item); - void ResetItems6B68(); - void ResetItems61B8(); -}; int GetEquipLocationIndex(const int& mask); @@ -316,20 +212,6 @@ public: #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(EquipmentProperties::CEquipmentPropertiesMgr) == 0x1FC); -static_assert(offsetof(ClientItemLists, inventory) == 0x1710); -static_assert(offsetof(ClientItemLists, items_1768) == 0x1768); -static_assert(offsetof(ClientItemLists, items_1784) == 0x1784); -static_assert(offsetof(ClientItemLists, equipped) == 0x21A0); -static_assert(offsetof(ClientItemLists, itemSlots) == 0x4860); -static_assert(offsetof(ClientItemLists, unknown_5214) == 0x5214); -static_assert(offsetof(ClientItemLists, hotkeyDescriptions) == 0xC0); -static_assert(offsetof(ClientItemLists, records0734) == 0x734); -static_assert(offsetof(ClientItemLists, unknown_166C) == 0x166C); -static_assert(offsetof(ClientItemLists, partyMembers) == 0x17DC); -static_assert(offsetof(ClientItemLists, unknown_5464) == 0x5464); -static_assert(offsetof(ClientItemLists, unknown_54C4) == 0x54C4); -static_assert(offsetof(ClientItemLists, items_61B8) == 0x61B8); -static_assert(offsetof(ClientItemLists, items_6B68) == 0x6B68); #endif // OFFSET: 0x00AA6440 @@ -379,7 +261,7 @@ void CGameMode::ReceiveItem1738Add(const unsigned char* data) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } item.unknown_0088 = 0; - reinterpret_cast(&g_session)->AddItem1738(item, 1); + g_session.AddItem1738(item, 1); } struct ItemAddSlotPacket { @@ -557,7 +439,7 @@ void CGameMode::ReceiveItem1740Add(const unsigned char* data) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } item.unknown_0088 = 0; - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } // OFFSET: 0x00D1FF70 @@ -580,7 +462,7 @@ void CGameMode::ReceiveItem1740AddOptions(const unsigned char* data) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } item.unknown_0088 = 0; - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } // OFFSET: 0x00D20180 @@ -603,7 +485,7 @@ void CGameMode::ReceiveItem1740AddGrade(const unsigned char* data) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } item.unknown_0088 = packet.grade; - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } // OFFSET: 0x00D204B0 @@ -626,7 +508,7 @@ void CGameMode::ReceiveItem1738AddOptions(const unsigned char* data) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } item.unknown_0088 = 0; - reinterpret_cast(&g_session)->AddItem1738(item, 1); + g_session.AddItem1738(item, 1); } // OFFSET: 0x00D206C0 @@ -649,7 +531,7 @@ void CGameMode::ReceiveItem1738AddGrade(const unsigned char* data) { reinterpret_cast(item.unknown_009C)[index] = options[index]; } item.unknown_0088 = packet.grade; - reinterpret_cast(&g_session)->AddItem1738(item, 1); + g_session.AddItem1738(item, 1); } namespace { @@ -724,7 +606,7 @@ void CGameMode::ReceiveEquipItemList(const unsigned char* packet) { std::memcpy(options, record.options, sizeof(options)); ITEM_INFO item; FillEquipItemListItem(item, record, options); - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); } break; case 0: @@ -740,7 +622,7 @@ void CGameMode::ReceiveEquipItemList(const unsigned char* packet) { } if (item.unknown_0000[3] == 0) { - reinterpret_cast(&g_session)->AddItem1710(item, 0); + g_session.AddItem1710(item, 0); g_session.UpdateInventoryItem(item, 0); } else { char equipped = 1; @@ -774,7 +656,7 @@ void CGameMode::ReceiveEquipItemList(const unsigned char* packet) { std::memcpy(options, record.options, sizeof(options)); ITEM_INFO item; FillEquipItemListItem(item, record, options); - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); } break; } @@ -803,11 +685,11 @@ void CGameMode::ReceiveItemListPart(unsigned char listType, int count, const uns g_session.UpdateInventoryItem(item, 0); break; case 1: - reinterpret_cast(&g_session)->AddItem1740(item); + g_session.AddItem1740(item); break; case 2: case 3: - reinterpret_cast(&g_session)->AddItem1738(item, 0); + g_session.AddItem1738(item, 0); break; } } @@ -863,8 +745,8 @@ EquipSlots EquipSlotDecoder::Decode(int mask) const { // OFFSET: 0x00DD7030 // FUNCTION: fn_23282 -bool ClientItemLists::AddItem1710(const ITEM_INFO& item, unsigned char refresh) { - for (ITEM_INFO& value : this->inventory) { +bool CSession::AddItem1710(const ITEM_INFO& item, unsigned char refresh) { + for (ITEM_INFO& value : this->m_inventoryItems) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; value.unknown_0074[1] = item.unknown_0074[1]; @@ -876,7 +758,7 @@ bool ClientItemLists::AddItem1710(const ITEM_INFO& item, unsigned char refresh) } } - this->inventory.push_back(item); + this->m_inventoryItems.push_back(item); if (refresh) { RefreshItemWindows(&g_windowMgr); } @@ -885,8 +767,8 @@ bool ClientItemLists::AddItem1710(const ITEM_INFO& item, unsigned char refresh) // OFFSET: 0x00DD7210 // FUNCTION: fn_23284 -bool ClientItemLists::AddItem1768(const ITEM_INFO& item, unsigned char alternate, unsigned char refresh) { - for (ITEM_INFO& value : this->items_1768) { +bool CSession::AddItem1768(const ITEM_INFO& item, unsigned char alternate, unsigned char refresh) { + for (ITEM_INFO& value : this->unknown_1768) { if (value.unknown_0000[1] == item.unknown_0000[1]) { if (!alternate) { value.quantity += item.quantity; @@ -900,7 +782,7 @@ bool ClientItemLists::AddItem1768(const ITEM_INFO& item, unsigned char alternate } } - this->items_1768.push_back(item); + this->unknown_1768.push_back(item); if (refresh == 1) { UIWindow* window = reinterpret_cast(alternate ? g_windowMgr.unknown_040C : g_windowMgr.unknown_02FC); if (window) { @@ -912,8 +794,8 @@ bool ClientItemLists::AddItem1768(const ITEM_INFO& item, unsigned char alternate // OFFSET: 0x00DD72C0 // FUNCTION: fn_23285 -bool ClientItemLists::AddItem1740(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1740) { +bool CSession::AddItem1740(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1740) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; if (UIWindow* window = reinterpret_cast(g_windowMgr.unknown_02F4)) { @@ -923,7 +805,7 @@ bool ClientItemLists::AddItem1740(const ITEM_INFO& item) { } } - this->items_1740.push_back(item); + this->unknown_1740.push_back(item); if (UIWindow* window = reinterpret_cast(g_windowMgr.unknown_02F4)) { window->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -932,8 +814,8 @@ bool ClientItemLists::AddItem1740(const ITEM_INFO& item) { // OFFSET: 0x00DD7350 // FUNCTION: fn_23286 -bool ClientItemLists::AddItem1750(const ITEM_INFO& item, int type, unsigned char refresh) { - for (ITEM_INFO& value : this->items_1750) { +bool CSession::AddItem1750(const ITEM_INFO& item, int type, unsigned char refresh) { + for (ITEM_INFO& value : this->unknown_1750) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; if (refresh == 1) { @@ -951,7 +833,7 @@ bool ClientItemLists::AddItem1750(const ITEM_INFO& item, int type, unsigned char } } - this->items_1750.push_back(item); + this->unknown_1750.push_back(item); if (refresh == 1) { std::uint32_t window; if (type == 1) { @@ -968,53 +850,53 @@ bool ClientItemLists::AddItem1750(const ITEM_INFO& item, int type, unsigned char // OFFSET: 0x00DD7420 // FUNCTION: fn_23287 -void ClientItemLists::AddItem1758(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1758) { +void CSession::AddItem1758(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1758) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; return; } } - this->items_1758.push_back(item); + this->unknown_1758.push_back(item); } // OFFSET: 0x00DD7470 // FUNCTION: fn_23288 -void ClientItemLists::AddItem1760(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1760) { +void CSession::AddItem1760(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1760) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; return; } } - this->items_1760.push_back(item); + this->unknown_1760.push_back(item); } // OFFSET: 0x00DD74C0 // FUNCTION: fn_23289 -void ClientItemLists::AddItem1748(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1748) { +void CSession::AddItem1748(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1748) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; return; } } - this->items_1748.push_back(item); + this->unknown_1748.push_back(item); } // OFFSET: 0x00DD7510 // FUNCTION: fn_23290 -bool ClientItemLists::Equip(const ITEM_INFO& item) { +bool CSession::Equip(const ITEM_INFO& item) { const EquipSlots slots = reinterpret_cast(this)->GetEquipSlots(item.unknown_0000[3]); const int order[3] = {slots.values[2], slots.values[1], slots.values[0]}; for (int index = 0; index < 3; ++index) { const int slot = order[index]; if (slot != -1) { - ITEM_INFO& equipped = this->equipped[slot]; + ITEM_INFO& equipped = this->unknown_21A0[slot]; equipped = item; equipped.quantity = 1; equipped.unknown_0068 = item.unknown_0068; @@ -1028,7 +910,7 @@ bool ClientItemLists::Equip(const ITEM_INFO& item) { // OFFSET: 0x00DD75C0 // FUNCTION: fn_23291 -void ClientItemLists::AddItem1718(const RawItemBasic& item, int quantity, std::uint16_t unknown_006C) { +void CSession::AddItem1718(const RawItemBasic& item, int quantity, std::uint16_t unknown_006C) { ITEM_INFO value; value.AssignBasic(item); value.quantity = quantity; @@ -1036,45 +918,45 @@ void ClientItemLists::AddItem1718(const RawItemBasic& item, int quantity, std::u value.unknown_0060 = 0; value.unknown_005D = 0; value.SetItemId(std::atoi(value.itemId.c_str())); - this->items_1718.push_back(value); + this->unknown_1718.push_back(value); } // OFFSET: 0x00DD76C0 // FUNCTION: fn_23292 -void ClientItemLists::AppendItem1718(const ITEM_INFO& item) { - this->items_1718.push_back(item); +void CSession::AppendItem1718(const ITEM_INFO& item) { + this->unknown_1718.push_back(item); } // OFFSET: 0x00DD76D0 // FUNCTION: fn_23293 -void ClientItemLists::MergeItem1718ByName(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1718) { +void CSession::MergeItem1718ByName(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1718) { if (value.itemId == item.itemId) { value.quantity = value.quantity == -1 ? -1 : value.quantity + item.quantity; return; } } - this->items_1718.push_back(item); + this->unknown_1718.push_back(item); } // OFFSET: 0x00DD7770 // FUNCTION: fn_23294 -void ClientItemLists::MergeItem1720ByName(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1720) { +void CSession::MergeItem1720ByName(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1720) { if (value.itemId == item.itemId) { value.quantity += item.quantity; return; } } - this->items_1720.push_back(item); + this->unknown_1720.push_back(item); } // OFFSET: 0x00DD77F0 // FUNCTION: fn_23295 -void ClientItemLists::MergeItem1720(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1720) { +void CSession::MergeItem1720(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1720) { const bool same = item.unknown_0074[3] ? value.unknown_0000[1] == item.unknown_0000[1] : value.itemId == item.itemId; if (same) { value.quantity += item.quantity; @@ -1082,15 +964,15 @@ void ClientItemLists::MergeItem1720(const ITEM_INFO& item) { } } - this->items_1720.push_back(item); + this->unknown_1720.push_back(item); } // OFFSET: 0x00DD7890 // FUNCTION: fn_23296 -void ClientItemLists::AddItem1730(const ITEM_INFO& item) { - const ITEM_INFO owned = LookupClientItemByIdentity(this->inventory, item.unknown_0000[1]); +void CSession::AddItem1730(const ITEM_INFO& item) { + const ITEM_INFO owned = LookupClientItemByIdentity(this->m_inventoryItems, item.unknown_0000[1]); if (owned.unknown_0000[1] > 0) { - for (ITEM_INFO& value : this->items_1730) { + for (ITEM_INFO& value : this->unknown_1730) { if (value.unknown_0000[1] == item.unknown_0000[1]) { const int quantity = value.quantity + item.quantity; if (owned.quantity >= quantity) { @@ -1101,21 +983,21 @@ void ClientItemLists::AddItem1730(const ITEM_INFO& item) { } if (owned.quantity >= item.quantity) { - this->items_1730.push_back(item); + this->unknown_1730.push_back(item); } } } // OFFSET: 0x00DD7970 // FUNCTION: fn_23297 -void ClientItemLists::AddItem1718(const RawItemBasic& item, int mode) { +void CSession::AddItem1718(const RawItemBasic& item, int mode) { if (mode != 0) { - const ITEM_INFO owned = LookupClientItemByIdentity(this->inventory, item.id); + const ITEM_INFO owned = LookupClientItemByIdentity(this->m_inventoryItems, item.id); if (owned.unknown_0000[1] != 0) { ITEM_INFO value(owned); value.AssignBasic(item); value.SetItemId(std::atoi(value.itemId.c_str())); - this->items_1718.push_back(value); + this->unknown_1718.push_back(value); } } else { ITEM_INFO value; @@ -1125,14 +1007,14 @@ void ClientItemLists::AddItem1718(const RawItemBasic& item, int mode) { value.SetItemId(std::atoi(value.itemId.c_str())); value.unknown_0000[2] = item.unknown_0034; value.unknown_0070 = item.unknown_0038; - this->items_1718.push_back(value); + this->unknown_1718.push_back(value); } } // OFFSET: 0x00DD7B30 // FUNCTION: fn_23298 -void ClientItemLists::MergeItem1718(const ITEM_INFO& item) { - for (ITEM_INFO& value : this->items_1718) { +void CSession::MergeItem1718(const ITEM_INFO& item) { + for (ITEM_INFO& value : this->unknown_1718) { if (value.unknown_0000[1] == item.unknown_0000[1]) { if (value.quantity != -1) { value.quantity += item.quantity; @@ -1141,17 +1023,17 @@ void ClientItemLists::MergeItem1718(const ITEM_INFO& item) { } } - this->items_1718.push_back(item); + this->unknown_1718.push_back(item); } // OFFSET: 0x00DD7B80 // FUNCTION: fn_23299 -bool ClientItemLists::AddItem1738(const ITEM_INFO& item, unsigned char refresh) { +bool CSession::AddItem1738(const ITEM_INFO& item, unsigned char refresh) { if (g_replayAnimationScaling && !Replay::Instance().header.options.Get(ReplayRecordOption::Item)) { return true; } - for (ITEM_INFO& value : this->items_1738) { + for (ITEM_INFO& value : this->unknown_1738) { if (value.unknown_0000[1] == item.unknown_0000[1]) { value.quantity += item.quantity; if (refresh && g_windowMgr.window_0288) { @@ -1161,7 +1043,7 @@ bool ClientItemLists::AddItem1738(const ITEM_INFO& item, unsigned char refresh) } } - this->items_1738.push_back(item); + this->unknown_1738.push_back(item); if (refresh && g_windowMgr.window_0288) { g_windowMgr.window_0288->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -1225,7 +1107,7 @@ bool CSession::OnItemEquipped(ITEM_INFO& item) { } if (item.unknown_0000[3] != 0x8000) { - reinterpret_cast(this)->RemoveItem1710(item.unknown_0000[1], 1); + this->RemoveItem1710(item.unknown_0000[1], 1); } if (UIWindow* window = reinterpret_cast(g_windowMgr.unknown_022C)) { window->SendMsg(nullptr, 60, 0, 0, 0, 0); @@ -1388,83 +1270,83 @@ EquipSlots CSession::GetEquipSlots(int location) { // OFFSET: 0x00DD8890 // FUNCTION: fn_23313 -void ClientItemLists::ClearInventory() { - this->inventory.erase(this->inventory.begin(), this->inventory.end()); +void CSession::ClearInventory() { + this->m_inventoryItems.erase(this->m_inventoryItems.begin(), this->m_inventoryItems.end()); RefreshItemWindows(&g_windowMgr); } // OFFSET: 0x00DD88C0 // FUNCTION: fn_23314 -void ClientItemLists::ClearItems1760And1748() { - this->items_1760.erase(this->items_1760.begin(), this->items_1760.end()); - this->items_1748.erase(this->items_1748.begin(), this->items_1748.end()); +void CSession::ClearItems1760And1748() { + this->unknown_1760.erase(this->unknown_1760.begin(), this->unknown_1760.end()); + this->unknown_1748.erase(this->unknown_1748.begin(), this->unknown_1748.end()); } // OFFSET: 0x00DD8900 // FUNCTION: fn_23315 -void ClientItemLists::ClearItems1768() { - this->items_1768.erase(this->items_1768.begin(), this->items_1768.end()); +void CSession::ClearItems1768() { + this->unknown_1768.erase(this->unknown_1768.begin(), this->unknown_1768.end()); } // OFFSET: 0x00DD8920 // FUNCTION: fn_23316 -void ClientItemLists::ClearItems1740() { - this->items_1740.erase(this->items_1740.begin(), this->items_1740.end()); +void CSession::ClearItems1740() { + this->unknown_1740.erase(this->unknown_1740.begin(), this->unknown_1740.end()); } // OFFSET: 0x00DD8940 // FUNCTION: fn_23317 -void ClientItemLists::ClearItems1750() { - this->items_1750.erase(this->items_1750.begin(), this->items_1750.end()); +void CSession::ClearItems1750() { + this->unknown_1750.erase(this->unknown_1750.begin(), this->unknown_1750.end()); } // OFFSET: 0x00DD8960 // FUNCTION: fn_23318 -void ClientItemLists::ClearItems1758() { - this->items_1758.erase(this->items_1758.begin(), this->items_1758.end()); +void CSession::ClearItems1758() { + this->unknown_1758.erase(this->unknown_1758.begin(), this->unknown_1758.end()); } // OFFSET: 0x00DD8980 // FUNCTION: fn_23319 -void ClientItemLists::ClearItems1760() { - this->items_1760.erase(this->items_1760.begin(), this->items_1760.end()); +void CSession::ClearItems1760() { + this->unknown_1760.erase(this->unknown_1760.begin(), this->unknown_1760.end()); } // OFFSET: 0x00DD89A0 // FUNCTION: fn_23320 -void ClientItemLists::ClearItems1748() { - this->items_1748.erase(this->items_1748.begin(), this->items_1748.end()); +void CSession::ClearItems1748() { + this->unknown_1748.erase(this->unknown_1748.begin(), this->unknown_1748.end()); } // OFFSET: 0x00DD89C0 // FUNCTION: fn_23321 -void ClientItemLists::ClearRecords0734() { - this->records0734.clear(); +void CSession::ClearRecords0734() { + this->unknown_0734.clear(); } // OFFSET: 0x00DD8A20 // FUNCTION: fn_23322 -void ClientItemLists::ClearItems1784(int index) { +void CSession::ClearItems1784(int index) { if (index >= 0 && static_cast(index) < 11) { - this->items_1784[index].erase(this->items_1784[index].begin(), this->items_1784[index].end()); + this->unknown_1784[index].erase(this->unknown_1784[index].begin(), this->unknown_1784[index].end()); } } // OFFSET: 0x00DD8A50 // FUNCTION: fn_23323 -void ClientItemLists::ClearItemSlotQuantities() { +void CSession::ClearItemSlotQuantities() { this->unknown_5214 = 0; for (int index = 0; index < 10; ++index) { - this->itemSlots[index].quantity = 0; + this->m_itemSlots[index].quantity = 0; } } // OFFSET: 0x00DD8AC0 // FUNCTION: fn_23324 -void ClientItemLists::ResetEquipped() { +void CSession::ResetEquipped() { for (int index = 0; index < 10; ++index) { - this->equipped[index].Reset(); + this->unknown_21A0[index].Reset(); } } @@ -1489,7 +1371,7 @@ void CSession::ClearPartyMembers() { // OFFSET: 0x00DD8BD0 // FUNCTION: fn_23326 -void ClientItemLists::ResetUnknown166C() { +void CSession::ResetUnknown166C() { this->unknown_166C = 0; this->unknown_167C = 0; this->unknown_1680 = 0; @@ -1500,61 +1382,61 @@ void ClientItemLists::ResetUnknown166C() { // OFFSET: 0x00DD8C10 // FUNCTION: fn_23327 -void ClientItemLists::ClearItems1720() { - this->items_1720.erase(this->items_1720.begin(), this->items_1720.end()); +void CSession::ClearItems1720() { + this->unknown_1720.erase(this->unknown_1720.begin(), this->unknown_1720.end()); } // OFFSET: 0x00DD8C70 // FUNCTION: fn_23328 -void ClientItemLists::ResetHotkeyDescriptions() { +void CSession::ResetHotkeyDescriptions() { for (int index = 0; index < 9; ++index) { - this->hotkeyDescriptions[index] = "nothing"; + this->m_hotkeyDescriptions[index] = "nothing"; } } // OFFSET: 0x00DD8CA0 // FUNCTION: fn_23329 -void ClientItemLists::ClearItems1738() { - this->items_1738.erase(this->items_1738.begin(), this->items_1738.end()); +void CSession::ClearItems1738() { + this->unknown_1738.erase(this->unknown_1738.begin(), this->unknown_1738.end()); } // OFFSET: 0x00DD8CC0 // FUNCTION: fn_23330 -void ClientItemLists::CopyItems1740To1750() { - this->items_1750.erase(this->items_1750.begin(), this->items_1750.end()); +void CSession::CopyItems1740To1750() { + this->unknown_1750.erase(this->unknown_1750.begin(), this->unknown_1750.end()); - for (auto item = this->items_1740.begin(); item != this->items_1740.end(); ++item) { - this->items_1750.push_back(*item); + for (auto item = this->unknown_1740.begin(); item != this->unknown_1740.end(); ++item) { + this->unknown_1750.push_back(*item); } } // OFFSET: 0x00DD8DB0 // FUNCTION: fn_23331 -void ClientItemLists::CopyItems1760To1770() { - this->items_1770.erase(this->items_1770.begin(), this->items_1770.end()); +void CSession::CopyItems1760To1770() { + this->unknown_1770.erase(this->unknown_1770.begin(), this->unknown_1770.end()); - for (auto item = this->items_1760.begin(); item != this->items_1760.end(); ++item) { - this->items_1770.push_back(*item); + for (auto item = this->unknown_1760.begin(); item != this->unknown_1760.end(); ++item) { + this->unknown_1770.push_back(*item); } } // OFFSET: 0x00DD8EA0 // FUNCTION: fn_23332 -std::pair ClientItemLists::FindItem1750(const ITEM_INFO& item, unsigned char) { - auto found = this->items_1750.begin(); +std::pair CSession::FindItem1750(const ITEM_INFO& item, unsigned char) { + auto found = this->unknown_1750.begin(); - for (; found != this->items_1750.end(); ++found) { + for (; found != this->unknown_1750.end(); ++found) { if (IsSameItem(*found, item)) { break; } } - return found != this->items_1750.end() ? std::make_pair(true, *found) : std::make_pair(false, ITEM_INFO()); + return found != this->unknown_1750.end() ? std::make_pair(true, *found) : std::make_pair(false, ITEM_INFO()); } // OFFSET: 0x00DD91C0 // FUNCTION: fn_23333 -int ClientItemLists::IsDifferentName(const char* name, const char* other) { +int CSession::IsDifferentName(const char* name, const char* other) { if (std::strlen(other) == 0) { return 1; } @@ -1628,13 +1510,13 @@ int ClientItemLists::IsDifferentName(const char* name, const char* other) { // OFFSET: 0x00DDA470 // FUNCTION: fn_23338 -void ClientItemLists::RemoveItem1758ByItemId(ITEM_INFO& item) { - for (auto it = this->items_1758.begin(); it != this->items_1758.end(); ++it) { +void CSession::RemoveItem1758ByItemId(ITEM_INFO& item) { + for (auto it = this->unknown_1758.begin(); it != this->unknown_1758.end(); ++it) { if (std::atoi(it->itemId.c_str()) == std::atoi(item.itemId.c_str())) { item.itemId = it->itemId; it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1758.erase(it); + this->unknown_1758.erase(it); } return; } @@ -1643,15 +1525,15 @@ void ClientItemLists::RemoveItem1758ByItemId(ITEM_INFO& item) { // OFFSET: 0x00DDA510 // FUNCTION: fn_23339 -void ClientItemLists::RemoveItem1710(std::uint32_t id, int quantity) { - for (auto it = this->inventory.begin(); it != this->inventory.end(); ++it) { +void CSession::RemoveItem1710(std::uint32_t id, int quantity) { + for (auto it = this->m_inventoryItems.begin(); it != this->m_inventoryItems.end(); ++it) { if (it->unknown_0000[1] == id) { if (quantity < it->quantity) { it->quantity -= quantity; } else { - this->inventory.erase(it); + this->m_inventoryItems.erase(it); } - for (auto it2 = this->inventory.begin(); it2 != this->inventory.end(); ++it2) { + for (auto it2 = this->m_inventoryItems.begin(); it2 != this->m_inventoryItems.end(); ++it2) { if (it2->unknown_0000[1] == id) { it2->unknown_0074[2] = 0; break; @@ -1665,21 +1547,21 @@ void ClientItemLists::RemoveItem1710(std::uint32_t id, int quantity) { // OFFSET: 0x00DDA5A0 // FUNCTION: fn_23340 -bool ClientItemLists::RemoveItem1768(const ITEM_INFO& item, unsigned char alternate) { +bool CSession::RemoveItem1768(const ITEM_INFO& item, unsigned char alternate) { int index = 0; - for (auto it = this->items_1768.begin(); it != this->items_1768.end(); ++it, ++index) { + for (auto it = this->unknown_1768.begin(); it != this->unknown_1768.end(); ++it, ++index) { if (it->unknown_0000[1] == item.unknown_0000[1]) { if (!alternate) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1768.erase(it); + this->unknown_1768.erase(it); reinterpret_cast(this)->RefreshItem1768Window(0, index + 1); return true; } reinterpret_cast(this)->RefreshItem1768Window(0, 0); return true; } - this->items_1768.erase(it); + this->unknown_1768.erase(it); reinterpret_cast(this)->RefreshItem1768Window(1, 0); return true; } @@ -1690,14 +1572,14 @@ bool ClientItemLists::RemoveItem1768(const ITEM_INFO& item, unsigned char altern // OFFSET: 0x00DDA690 // FUNCTION: fn_23341 -bool ClientItemLists::RemoveItem1740(const ITEM_INFO& item) { - for (auto it = this->items_1740.begin(); it != this->items_1740.end(); ++it) { +bool CSession::RemoveItem1740(const ITEM_INFO& item) { + for (auto it = this->unknown_1740.begin(); it != this->unknown_1740.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1740.erase(it); + this->unknown_1740.erase(it); } - for (auto it2 = this->items_1740.begin(); it2 != this->items_1740.end(); ++it2) { + for (auto it2 = this->unknown_1740.begin(); it2 != this->unknown_1740.end(); ++it2) { if (it2->unknown_0000[1] == item.unknown_0000[1]) { it2->unknown_0074[2] = 0; break; @@ -1713,16 +1595,16 @@ bool ClientItemLists::RemoveItem1740(const ITEM_INFO& item) { // OFFSET: 0x00DDA740 // FUNCTION: fn_23342 -bool ClientItemLists::RemoveItem1750(const ITEM_INFO& item, int type, unsigned char refresh) { - for (auto it = this->items_1750.begin(); it != this->items_1750.end(); ++it) { +bool CSession::RemoveItem1750(const ITEM_INFO& item, int type, unsigned char refresh) { + for (auto it = this->unknown_1750.begin(); it != this->unknown_1750.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { if (type == 0) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1750.erase(it); + this->unknown_1750.erase(it); } } else { - this->items_1750.erase(it); + this->unknown_1750.erase(it); } if (refresh == 1) { @@ -1758,13 +1640,13 @@ bool ClientItemLists::RemoveItem1750(const ITEM_INFO& item, int type, unsigned c // OFFSET: 0x00DDA8B0 // FUNCTION: fn_23343 -void ClientItemLists::RemoveItem1758(ITEM_INFO& item) { - for (auto it = this->items_1758.begin(); it != this->items_1758.end(); ++it) { +void CSession::RemoveItem1758(ITEM_INFO& item) { + for (auto it = this->unknown_1758.begin(); it != this->unknown_1758.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { item.itemId = it->itemId; it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1758.erase(it); + this->unknown_1758.erase(it); } return; } @@ -1773,12 +1655,12 @@ void ClientItemLists::RemoveItem1758(ITEM_INFO& item) { // OFFSET: 0x00DDA920 // FUNCTION: fn_23344 -void ClientItemLists::RemoveItem1760(const ITEM_INFO& item) { - for (auto it = this->items_1760.begin(); it != this->items_1760.end(); ++it) { +void CSession::RemoveItem1760(const ITEM_INFO& item) { + for (auto it = this->unknown_1760.begin(); it != this->unknown_1760.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1760.erase(it); + this->unknown_1760.erase(it); } return; } @@ -1787,13 +1669,13 @@ void ClientItemLists::RemoveItem1760(const ITEM_INFO& item) { // OFFSET: 0x00DDA9C0 // FUNCTION: fn_23345 -void ClientItemLists::RemoveItem1718ByItemId(const ITEM_INFO& item) { - for (auto it = this->items_1718.begin(); it != this->items_1718.end(); ++it) { +void CSession::RemoveItem1718ByItemId(const ITEM_INFO& item) { + for (auto it = this->unknown_1718.begin(); it != this->unknown_1718.end(); ++it) { if (std::atoi(it->itemId.c_str()) == std::atoi(item.itemId.c_str())) { if (it->quantity != -1) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1718.erase(it); + this->unknown_1718.erase(it); } } return; @@ -1803,13 +1685,13 @@ void ClientItemLists::RemoveItem1718ByItemId(const ITEM_INFO& item) { // OFFSET: 0x00DDAA50 // FUNCTION: fn_23346 -void ClientItemLists::RemoveItem1718(const ITEM_INFO& item) { - for (auto it = this->items_1718.begin(); it != this->items_1718.end(); ++it) { +void CSession::RemoveItem1718(const ITEM_INFO& item) { + for (auto it = this->unknown_1718.begin(); it != this->unknown_1718.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { if (it->quantity != -1) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1718.erase(it); + this->unknown_1718.erase(it); } } return; @@ -1819,12 +1701,12 @@ void ClientItemLists::RemoveItem1718(const ITEM_INFO& item) { // OFFSET: 0x00DDAAB0 // FUNCTION: fn_23347 -void ClientItemLists::RemoveItem1720ByName(const ITEM_INFO& item) { - for (auto it = this->items_1720.begin(); it != this->items_1720.end(); ++it) { +void CSession::RemoveItem1720ByName(const ITEM_INFO& item) { + for (auto it = this->unknown_1720.begin(); it != this->unknown_1720.end(); ++it) { if (it->itemId == item.itemId) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1720.erase(it); + this->unknown_1720.erase(it); } return; } @@ -1833,14 +1715,14 @@ void ClientItemLists::RemoveItem1720ByName(const ITEM_INFO& item) { // OFFSET: 0x00DDAB30 // FUNCTION: fn_23348 -void ClientItemLists::RemoveItem1720(const ITEM_INFO& item) { +void CSession::RemoveItem1720(const ITEM_INFO& item) { const bool hasFlag = item.unknown_0074[3] != 0; - for (auto it = this->items_1720.begin(); it != this->items_1720.end(); ++it) { + for (auto it = this->unknown_1720.begin(); it != this->unknown_1720.end(); ++it) { const bool same = hasFlag ? it->unknown_0000[1] == item.unknown_0000[1] : it->itemId == item.itemId; if (same) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1720.erase(it); + this->unknown_1720.erase(it); } return; } @@ -1849,12 +1731,12 @@ void ClientItemLists::RemoveItem1720(const ITEM_INFO& item) { // OFFSET: 0x00DDAC40 // FUNCTION: fn_23349 -void ClientItemLists::RemoveItem1730(const ITEM_INFO& item) { - for (auto it = this->items_1730.begin(); it != this->items_1730.end(); ++it) { +void CSession::RemoveItem1730(const ITEM_INFO& item) { + for (auto it = this->unknown_1730.begin(); it != this->unknown_1730.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1730.erase(it); + this->unknown_1730.erase(it); } return; } @@ -1863,12 +1745,12 @@ void ClientItemLists::RemoveItem1730(const ITEM_INFO& item) { // OFFSET: 0x00DDAC90 // FUNCTION: fn_23350 -void ClientItemLists::ReduceItem1718(const ITEM_INFO& item) { - for (auto it = this->items_1718.begin(); it != this->items_1718.end(); ++it) { +void CSession::ReduceItem1718(const ITEM_INFO& item) { + for (auto it = this->unknown_1718.begin(); it != this->unknown_1718.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1718.erase(it); + this->unknown_1718.erase(it); } return; } @@ -1877,14 +1759,14 @@ void ClientItemLists::ReduceItem1718(const ITEM_INFO& item) { // OFFSET: 0x00DDACE0 // FUNCTION: fn_23351 -bool ClientItemLists::RemoveItem1738(const ITEM_INFO& item) { - for (auto it = this->items_1738.begin(); it != this->items_1738.end(); ++it) { +bool CSession::RemoveItem1738(const ITEM_INFO& item) { + for (auto it = this->unknown_1738.begin(); it != this->unknown_1738.end(); ++it) { if (it->unknown_0000[1] == item.unknown_0000[1]) { it->quantity -= item.quantity; if (it->quantity < 1) { - this->items_1738.erase(it); + this->unknown_1738.erase(it); } - for (auto it2 = this->items_1738.begin(); it2 != this->items_1738.end(); ++it2) { + for (auto it2 = this->unknown_1738.begin(); it2 != this->unknown_1738.end(); ++it2) { if (it2->unknown_0000[1] == item.unknown_0000[1]) { it2->unknown_0074[2] = 0; break; @@ -1900,14 +1782,14 @@ bool ClientItemLists::RemoveItem1738(const ITEM_INFO& item) { // OFFSET: 0x00E2EC10 // FUNCTION: fn_24149 -bool ClientItemLists::EquipItem6B68(const ITEM_INFO& item) { +bool CSession::EquipItem6B68(const ITEM_INFO& item) { const EquipSlots slots = g_session.GetEquipSlots(item.unknown_0000[3]); const int order[3] = {slots.values[2], slots.values[1], slots.values[0]}; for (int index = 0; index < 3; ++index) { const int slot = order[index]; if (slot != -1) { - ITEM_INFO& equipped = this->items_6B68[slot]; + ITEM_INFO& equipped = this->unknown_6B68[slot]; equipped = item; equipped.quantity = 1; equipped.unknown_0068 = item.unknown_0068; @@ -1923,30 +1805,6 @@ bool ClientItemLists::EquipItem6B68(const ITEM_INFO& item) { return true; } -// OFFSET: 0x00E2F540 -// FUNCTION: fn_24155 -void ClientItemLists::ResetItems6B68() { - int count = 10; - ITEM_INFO* item = this->items_6B68; - do { - item->Reset(); - ++item; - } while (--count); - RefreshItemWindows(&g_windowMgr); -} - -// OFFSET: 0x00E2F570 -// FUNCTION: fn_24156 -void ClientItemLists::ResetItems61B8() { - int count = 10; - ITEM_INFO* item = this->items_61B8; - do { - item->Reset(); - ++item; - } while (--count); - RefreshItemWindows(&g_windowMgr); -} - // OFFSET: 0x00E2FC50 // FUNCTION: fn_24164 ITEM_INFO CSession::FindItemByIdentity(std::uint32_t identity, int location) { @@ -1985,19 +1843,19 @@ ITEM_INFO CSession::FindItemByIdentity(std::uint32_t identity, int location) { // OFFSET: 0x00E49F40 // FUNCTION: fn_24247 -void ClientItemLists::SetItems1750(int count, const short* ids) { +void CSession::SetItems1750(int count, const short* ids) { this->ClearItems1750(); for (int i = 0; i < count; ++i) { const ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, ids[i]); if (item.unknown_0000[1] > 0) { - this->items_1750.push_back(item); + this->unknown_1750.push_back(item); } } } // OFFSET: 0x00DF9560 // FUNCTION: fn_23520 -int ClientItemLists::IsGuildMemberName(const char* name) { +int CSession::IsGuildMemberNameDifferent(const char* name) { std::list members = g_guildInfo.m_members; for (auto it = members.begin(); it != members.end(); ++it) { if (this->IsDifferentName(name, it->name.c_str()) == 0) { @@ -2010,8 +1868,8 @@ int ClientItemLists::IsGuildMemberName(const char* name) { // OFFSET: 0x00DF9690 // FUNCTION: fn_23521 -int ClientItemLists::IsFriendName(const char* name) { - for (auto it = this->friends.begin(); it != this->friends.end(); ++it) { +int CSession::IsFriendNameDifferent(const char* name) { + for (auto it = this->m_friends.begin(); it != this->m_friends.end(); ++it) { if (this->IsDifferentName(name, it->name.c_str()) == 0) { return 1; } @@ -2022,10 +1880,10 @@ int ClientItemLists::IsFriendName(const char* name) { // OFFSET: 0x00DFCBB0 // FUNCTION: fn_23600 -bool ClientItemLists::AddExchangeItem(ITEM_INFO item) { +bool CSession::AddExchangeItem(ITEM_INFO item) { int count = 0; for (int i = 0; i < 10; ++i) { - if (this->exchangeItems[i].quantity != 0) { + if (this->m_exchangeItems[i].quantity != 0) { ++count; } } @@ -2039,16 +1897,16 @@ bool ClientItemLists::AddExchangeItem(ITEM_INFO item) { ITEM_INFO added = item; int index = 0; for (; index < 10; ++index) { - if (this->exchangeItems[index].quantity != 0 && this->exchangeItems[index].unknown_0000[1] == added.unknown_0000[1]) { - this->exchangeItems[index].quantity += added.quantity; + if (this->m_exchangeItems[index].quantity != 0 && this->m_exchangeItems[index].unknown_0000[1] == added.unknown_0000[1]) { + this->m_exchangeItems[index].quantity += added.quantity; break; } } if (index == 10) { for (int i = 0; i < 10; ++i) { - if (this->exchangeItems[i].quantity == 0) { - this->exchangeItems[i] = added; + if (this->m_exchangeItems[i].quantity == 0) { + this->m_exchangeItems[i] = added; break; } } diff --git a/Source/Contents/ClientItemLists.h b/Source/Contents/ClientItemLists.h deleted file mode 100644 index 8e3cc886..00000000 --- a/Source/Contents/ClientItemLists.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef RAGNAROK_SOURCE_CONTENTS_CLIENTITEMLISTS_H -#define RAGNAROK_SOURCE_CONTENTS_CLIENTITEMLISTS_H - -#include "Client/Session.h" -#include "Contents/Items/ItemInfo.h" -#include "Contents/Messenger/MessengerMember.h" - -#include -#include -#include -#include - -struct ClientItemLists { - /* 0000 */ unsigned char unknown_0000[0xC0]; - /* 00C0 */ std::string hotkeyDescriptions[36]; - /* 0420 */ unsigned char unknown_0420[0x314]; - /* 0734 */ std::list records0734; - /* 073C */ unsigned char unknown_073C[0xF30]; - /* 166C */ int unknown_166C; - /* 1670 */ int unknown_1670; - /* 1674 */ int unknown_1674; - /* 1678 */ int unknown_1678; - /* 167C */ int unknown_167C; - /* 1680 */ int unknown_1680; - /* 1684 */ unsigned char unknown_1684[0x8C]; - /* 1710 */ std::list inventory; - /* 1718 */ std::list items_1718; - /* 1720 */ std::list items_1720; - /* 1728 */ std::list items_1728; - /* 1730 */ std::list items_1730; - /* 1738 */ std::list items_1738; - /* 1740 */ std::list items_1740; - /* 1748 */ std::list items_1748; - /* 1750 */ std::list items_1750; - /* 1758 */ std::list items_1758; - /* 1760 */ std::list items_1760; - /* 1768 */ std::list items_1768; - /* 1770 */ std::list items_1770; - /* 1778 */ unsigned char unknown_1778[0xC]; - /* 1784 */ std::list items_1784[11]; - /* 17DC */ std::list partyMembers; - /* 17E4 */ std::list friends; - /* 17EC */ unsigned char unknown_17EC[0x9B4]; - /* 21A0 */ ITEM_INFO equipped[10]; - /* 2B50 */ unsigned char unknown_2B50[0x1360]; - /* 3EB0 */ ITEM_INFO exchangeItems[10]; - /* 4860 */ ITEM_INFO itemSlots[10]; - /* 5210 */ int unknown_5210; - /* 5214 */ int unknown_5214; - /* 5218 */ unsigned char unknown_5218[0x24C]; - /* 5464 */ int unknown_5464; - /* 5468 */ unsigned char unknown_5468[0x5C]; - /* 54C4 */ std::string unknown_54C4; - /* 54DC */ unsigned char unknown_54DC[0xCDC]; - /* 61B8 */ ITEM_INFO items_61B8[10]; - /* 6B68 */ ITEM_INFO items_6B68[10]; - - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); - void AddItem1718(const RawItemBasic& item, int quantity, std::uint16_t unknown_006C); - void AddItem1718(const RawItemBasic& item, int mode); - bool AddItem1768(const ITEM_INFO& item, unsigned char alternate, unsigned char refresh); - bool AddItem1740(const ITEM_INFO& item); - bool AddItem1750(const ITEM_INFO& item, int type, unsigned char refresh); - void AddItem1758(const ITEM_INFO& item); - void AddItem1760(const ITEM_INFO& item); - void AddItem1748(const ITEM_INFO& item); - bool Equip(const ITEM_INFO& item); - void AppendItem1718(const ITEM_INFO& item); - void MergeItem1718ByName(const ITEM_INFO& item); - void MergeItem1720ByName(const ITEM_INFO& item); - void MergeItem1720(const ITEM_INFO& item); - void AddItem1730(const ITEM_INFO& item); - void MergeItem1718(const ITEM_INFO& item); - bool AddItem1738(const ITEM_INFO& item, unsigned char refresh); - void RemoveItem1758ByItemId(ITEM_INFO& item); - __declspec(noinline) void RemoveItem1710(std::uint32_t id, int quantity); - bool AddExchangeItem(ITEM_INFO item); - bool RemoveItem1768(const ITEM_INFO& item, unsigned char alternate); - bool RemoveItem1740(const ITEM_INFO& item); - bool RemoveItem1750(const ITEM_INFO& item, int type, unsigned char refresh); - void RemoveItem1758(ITEM_INFO& item); - void RemoveItem1760(const ITEM_INFO& item); - void RemoveItem1718ByItemId(const ITEM_INFO& item); - void RemoveItem1718(const ITEM_INFO& item); - void RemoveItem1720ByName(const ITEM_INFO& item); - void RemoveItem1720(const ITEM_INFO& item); - void RemoveItem1730(const ITEM_INFO& item); - void ReduceItem1718(const ITEM_INFO& item); - bool RemoveItem1738(const ITEM_INFO& item); - void ClearInventory(); - void ClearItems1760And1748(); - void ClearItems1768(); - void ClearItems1740(); - void ClearItems1750(); - void SetItems1750(int count, const short* ids); - void ClearItems1758(); - void ClearItems1760(); - void ClearItems1748(); - void ClearItems1784(int index); - void ClearItemSlotQuantities(); - void ResetEquipped(); - void ClearItems1720(); - void ClearItems1738(); - void CopyItems1740To1750(); - void CopyItems1760To1770(); - std::pair FindItem1750(const ITEM_INFO& item, unsigned char unknown); - void ClearRecords0734(); - void ResetUnknown166C(); - void ResetHotkeyDescriptions(); - int IsDifferentName(const char* name, const char* other); - int IsGuildMemberName(const char* name); - int IsFriendName(const char* name); - bool EquipItem6B68(const ITEM_INFO& item); - void ResetItems6B68(); - void ResetItems61B8(); -}; - -#endif diff --git a/Source/Contents/Jobs/JobInheritance.cpp b/Source/Contents/Jobs/JobInheritance.cpp index 34531ee4..aced4d69 100644 --- a/Source/Contents/Jobs/JobInheritance.cpp +++ b/Source/Contents/Jobs/JobInheritance.cpp @@ -1,7 +1,6 @@ #include "Client/Mode/ModeMgr.h" #include "Client/Mode/CMode.h" #include "Client/Mode/CGameMode.h" -#include "Contents/ClientItemLists.h" #include "Contents/ClientState.h" #include "Contents/Items/ItemDescription.h" #include "Contents/Items/WeaponType.h" @@ -1723,7 +1722,7 @@ bool CSession::UnequipItem2B50(int location) { const std::string text = FormatOwnedString("%s%s", name.c_str(), message); g_windowMgr.SendNotice(1, reinterpret_cast(text.c_str()), 0xFF, 7, 0, 0); item.unknown_0000[3] = 0; - reinterpret_cast(this)->AddItem1710(item, 1); + this->AddItem1710(item, 1); item.Reset(); } if (slots.values[1] != -1 && slots.values[1] < 10) { diff --git a/Source/Contents/Messenger/ClientMessenger.cpp b/Source/Contents/Messenger/ClientMessenger.cpp index a495a093..b06b5ff8 100644 --- a/Source/Contents/Messenger/ClientMessenger.cpp +++ b/Source/Contents/Messenger/ClientMessenger.cpp @@ -5626,7 +5626,7 @@ int CSession::GetList5Size() const { // OFFSET: 0x00DD8380 // FUNCTION: fn_23305 -void CSession::ClearItems1784() { +void CSession::ClearAllItems1784() { for (std::list& items : this->unknown_1784) { items.clear(); } diff --git a/Source/Contents/Skills/ClientSkills.cpp b/Source/Contents/Skills/ClientSkills.cpp index eff226f2..c09f123e 100644 --- a/Source/Contents/Skills/ClientSkills.cpp +++ b/Source/Contents/Skills/ClientSkills.cpp @@ -23,9 +23,6 @@ #include #include -struct ClientItemLists { - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); -}; // GLOBAL: gl_24650 char g_decodedPlayerName[64]; @@ -898,7 +895,7 @@ void CSession::RestoreItems5C68() { for (int index = 0; index < 5; ++index) { if (this->unknown_5C68[index].quantity != 0) { restored = true; - reinterpret_cast(g_session).AddItem1710(this->unknown_5C68[index], 0); + g_session.AddItem1710(this->unknown_5C68[index], 0); } } @@ -915,7 +912,7 @@ void CSession::ReturnStackedItem(int index, int count) { const int quantity = item.quantity; if (quantity != 0 && item.unknown_0000[1] == index) { item.quantity = count; - reinterpret_cast(g_session).AddItem1710(item, 0); + g_session.AddItem1710(item, 0); item.quantity = quantity - count; RefreshItemWindows(&g_windowMgr); break; diff --git a/Source/Contents/Store/MCStoreInfoBackup.cpp b/Source/Contents/Store/MCStoreInfoBackup.cpp index c54e0bde..6ab20ca0 100644 --- a/Source/Contents/Store/MCStoreInfoBackup.cpp +++ b/Source/Contents/Store/MCStoreInfoBackup.cpp @@ -3,7 +3,6 @@ #include "Contents/Store/MCStoreInfoBackup.h" #include "Contents/MessageTable.h" #include "Client/Session.h" -#include "Contents/ClientItemLists.h" #include "UI/Window/UIWindowMgr.h" #include "Utility/Async/AsyncDiagnostic.h" @@ -32,7 +31,7 @@ void CMCStoreInfoBackup::Clear() { // OFFSET: 0x00606BB0 // FUNCTION: fn_04234 int CMCStoreInfoBackup::Restore(unsigned char wholeItem, int maximum) { - ClientItemLists& lists = *reinterpret_cast(&g_session); + CSession& lists = g_session; int examined = 0; auto saved = this->items.begin(); diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index 72b09567..55281ab6 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -18,7 +18,6 @@ #include "Contents/ForbiddenWords.h" #include "Contents/Messenger/ClientMessenger.h" #include "Contents/Jobs/JobInheritance.h" -#include "Contents/ClientItemLists.h" #include "UI/Chat/UINewChatWnd.h" #include "UI/Rodex/UIRodexComposeWnd.h" #include "Contents/Items/ItemNaming.h" @@ -8822,7 +8821,7 @@ void UInCashWnd::Slot26(int x, int y) { g_modeMgr.GetGameMode(); this->m_selected = ~this->m_selected; - reinterpret_cast(g_session).RemoveItem1720ByName(item); + g_session.RemoveItem1720ByName(item); this->m_totalPrice -= item.quantity * item.unknown_0014[1]; this->m_otherItems.clear(); diff --git a/Source/UI/CashShop/UICashShopWnd.cpp b/Source/UI/CashShop/UICashShopWnd.cpp index 2727e99f..4a480299 100644 --- a/Source/UI/CashShop/UICashShopWnd.cpp +++ b/Source/UI/CashShop/UICashShopWnd.cpp @@ -91,9 +91,6 @@ struct PACKET_CZ_SE_PC_BUY_CASHITEM_LIST { static_assert(sizeof(CashItemPurchase) == 10); static_assert(offsetof(PACKET_CZ_SE_PC_BUY_CASHITEM_LIST, items) == 10); -struct ClientItemLists { - void ClearItems1784(int index); -}; struct CashShopReplaceCartItemText { @@ -790,7 +787,7 @@ void UICashShopWnd_Banner::CreateButtons() { // OFFSET: 0x007D17A0 // FUNCTION: fn_09558 int UICashShopWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { - ClientItemLists& itemLists = reinterpret_cast(g_session); + CSession& itemLists = g_session; const CSession& lists = g_session; switch (message) { case 0: diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index de17ab3c..8fce9000 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -126,22 +126,6 @@ static const std::string g_editNaviTagBegin = ""; // GLOBAL: gl_24648 static const std::string g_editNaviTagEnd = ""; -struct ClientItemLists { - void SetItems1750(int count, const short* ids); - bool AddItem1750(const ITEM_INFO& item, int type, unsigned char refresh); - bool RemoveItem1768(const ITEM_INFO& item, unsigned char alternate); - void RemoveItem1760(const ITEM_INFO& item); - void AddItem1760(const ITEM_INFO& item); - bool RemoveItem1750(const ITEM_INFO& item, int type, unsigned char refresh); - void AddItem1730(const ITEM_INFO& item); - void ReduceItem1718(const ITEM_INFO& item); - void ClearItems1760(); - void MergeItem1718(const ITEM_INFO& item); - void RemoveItem1730(const ITEM_INFO& item); - void RemoveItem1720ByName(const ITEM_INFO& item); - void CopyItems1740To1750(); - void ClearItems1760And1748(); -}; @@ -2499,7 +2483,7 @@ void UIMerchantShopMakeWnd::SetItems(int count, const short* ids) { if (this->mode == 1) { window = reinterpret_cast(g_windowMgr.unknown_0410); } else { - reinterpret_cast(&g_session)->SetItems1750(count, ids); + g_session.SetItems1750(count, ids); window = reinterpret_cast(g_windowMgr.unknown_02F8); } @@ -3674,7 +3658,7 @@ void UIMerchantMirrorItemWnd::Slot15(int width, int height) { } else if (this->unknown_00F4 == 2) { g_session.RefreshItems1750(); } else if (Replay::Instance().state != 6) { - reinterpret_cast(&g_session)->CopyItems1740To1750(); + g_session.CopyItems1740To1750(); } this->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -4715,7 +4699,7 @@ int UIMerchantMirrorItemWnd::SendMsg(UIWindow* sender, int message, std::intptr_ ModeDragState& drag = mode->drag; ITEM_INFO item; item.Assign(reinterpret_cast(drag)); - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; switch (drag.source) { case 10: @@ -4859,7 +4843,7 @@ int UIItemSellWnd2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std: ITEM_INFO item; item.Assign(reinterpret_cast(drag)); if (g_session.HasItem1718(drag.id)) { - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; lists->AddItem1730(item); lists->ReduceItem1718(item); if (g_windowMgr.unknown_0254) { @@ -4983,15 +4967,15 @@ int UIMerchantItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std::intpt g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(694)), 255, 0, 0, 0); } else { - reinterpret_cast(&g_session)->AddItem1760(item); - reinterpret_cast(&g_session)->RemoveItem1750(item, 2, 1); + g_session.AddItem1760(item); + g_session.RemoveItem1750(item, 2, 1); this->SendMsg(nullptr, 23, 0, 0, 0, 0); if (g_windowMgr.unknown_0420) { reinterpret_cast(g_windowMgr.unknown_0420)->SendMsg(nullptr, 23, 0, 0, 0, 0); } } } else if (g_session.m_zeny >= static_cast(price) * item.quantity + pending) { - reinterpret_cast(&g_session)->AddItem1760(item); + g_session.AddItem1760(item); this->SendMsg(nullptr, 23, 0, 0, 0, 0); } else { g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); @@ -5047,7 +5031,7 @@ int UIMerchantItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std::intpt g_windowMgr.CloseWindow(first); g_windowMgr.CloseWindow(second); mode->SendMsg(40, 0, 0, 0, 0); - reinterpret_cast(&g_session)->ClearItems1760And1748(); + g_session.ClearItems1760And1748(); } return 0; } @@ -5195,7 +5179,7 @@ int UIMerchantItemShopWnd::SendMsg(UIWindow* sender, int message, std::intptr_t if (this->unknown_010C == 0) { ITEM_INFO item; item.Assign(reinterpret_cast(mode->drag)); - reinterpret_cast(&g_session)->RemoveItem1760(item); + g_session.RemoveItem1760(item); if (g_windowMgr.unknown_0308) { reinterpret_cast(g_windowMgr.unknown_0308)->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -6411,7 +6395,7 @@ UIMerchantItemPurchaseWnd::UIMerchantItemPurchaseWnd(int value) : UIItemBaseWnd( this->unknown_00F8 = 0; this->saved = nullptr; this->hovered = -1; - reinterpret_cast(&g_session)->ClearItems1760(); + g_session.ClearItems1760(); this->unknown_00F0 = 0; } @@ -6533,7 +6517,7 @@ int UIItemShopWnd2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std: CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); ITEM_INFO item; item.Assign(reinterpret_cast(mode->drag)); - reinterpret_cast(&g_session)->RemoveItem1720ByName(item); + g_session.RemoveItem1720ByName(item); if (g_windowMgr.unknown_0258) { g_windowMgr.unknown_0258->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -6546,7 +6530,7 @@ int UIItemShopWnd2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std: CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); ITEM_INFO item; item.Assign(reinterpret_cast(mode->drag)); - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; lists->MergeItem1718(item); lists->RemoveItem1730(item); if (g_windowMgr.unknown_0260) { @@ -6596,7 +6580,7 @@ int UIItemShopWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); ITEM_INFO item; item.Assign(reinterpret_cast(mode->drag)); - reinterpret_cast(&g_session)->RemoveItem1720ByName(item); + g_session.RemoveItem1720ByName(item); if (g_windowMgr.unknown_0258) { g_windowMgr.unknown_0258->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -6609,7 +6593,7 @@ int UIItemShopWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); ITEM_INFO item; item.Assign(reinterpret_cast(mode->drag)); - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; lists->MergeItem1718(item); lists->RemoveItem1730(item); if (g_windowMgr.unknown_025C) { @@ -7848,7 +7832,7 @@ int UIMerchantItemPurchaseMSGWnd::SendMsg(UIWindow* sender, int message, std::in static_cast(g_charViewMode)->SendMsg(83, this->purchaseIndex, this->unknown_00D0, 0, 0); case 185: g_windowMgr.CloseWindow(230); - reinterpret_cast(&g_session)->ClearItems1760And1748(); + g_session.ClearItems1760And1748(); break; } return 0; @@ -8723,7 +8707,7 @@ int UIItemSellWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:: ITEM_INFO item; item.Assign(reinterpret_cast(drag)); if (g_session.HasItem1718(drag.id)) { - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; lists->AddItem1730(item); lists->ReduceItem1718(item); if (g_windowMgr.unknown_0250) { diff --git a/Source/UI/Item/UIParaItemShopWnd.cpp b/Source/UI/Item/UIParaItemShopWnd.cpp index 452667a9..5ea71698 100644 --- a/Source/UI/Item/UIParaItemShopWnd.cpp +++ b/Source/UI/Item/UIParaItemShopWnd.cpp @@ -9,7 +9,6 @@ #include "Client/Mode/ModeMgr.h" #include "Client/Replay.h" #include "Client/Session.h" -#include "Contents/ClientItemLists.h" #include "Contents/Configuration/ServiceConfiguration.h" #include "Contents/Items/ItemDescription.h" #include "Contents/Items/ItemNaming.h" @@ -352,7 +351,7 @@ int UIParaItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std::intptr_t g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(2536)), 255, 0, 0, 0); } else { - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; if (item.unknown_0074[3] == 1) { lists->RemoveItem1718(item); lists->MergeItem1720(item); @@ -507,7 +506,7 @@ int UIParaItemShopWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); ITEM_INFO item; item.Assign(reinterpret_cast(mode->drag)); - ClientItemLists* lists = reinterpret_cast(&g_session); + CSession* lists = &g_session; if (item.unknown_0074[3] == 1) { lists->RemoveItem1720(item); lists->MergeItem1718(item); diff --git a/Source/UI/Items/MergeItemWnd.cpp b/Source/UI/Items/MergeItemWnd.cpp index 08472c14..840c1e25 100644 --- a/Source/UI/Items/MergeItemWnd.cpp +++ b/Source/UI/Items/MergeItemWnd.cpp @@ -36,10 +36,6 @@ struct MergeItemCancelPacket { /* 0000 */ std::int16_t id; }; -struct ClientItemLists { - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); - void RemoveItem1710(std::uint32_t id, int quantity); -}; // OFFSET: 0x007DEC20 // FUNCTION: fn_09659 @@ -368,9 +364,9 @@ int CMergeItemWnd::SendMsg(UIWindow*, int message, std::intptr_t argument1, std: } case 60: { ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, argument1); - reinterpret_cast(&g_session)->RemoveItem1710(item.unknown_0000[1], item.quantity); + g_session.RemoveItem1710(item.unknown_0000[1], item.quantity); item.quantity = argument2; - reinterpret_cast(&g_session)->AddItem1710(item, 1); + g_session.AddItem1710(item, 1); break; } } diff --git a/Source/UI/Items/UIMakeTargetProcessWnd.cpp b/Source/UI/Items/UIMakeTargetProcessWnd.cpp index c5c11102..cd773375 100644 --- a/Source/UI/Items/UIMakeTargetProcessWnd.cpp +++ b/Source/UI/Items/UIMakeTargetProcessWnd.cpp @@ -18,10 +18,6 @@ #include #include -struct ClientItemLists { - bool AddItem1710(const ITEM_INFO& item, unsigned char refresh); - void RemoveItem1710(std::uint32_t id, int quantity); -}; // OFFSET: 0x009A0090 // FUNCTION: fn_13598 @@ -55,7 +51,7 @@ void UIMakeTargetProcessWnd::Slot10(int x, int y, std::intptr_t value) { if (item.unknown_0000[1] != 0 && item.IsForgeMaterial() && (!hasElementalStone || !item.IsElementalStone())) { this->materials[emptySlot] = item; this->materials[emptySlot].quantity = 1; - reinterpret_cast(&g_session)->RemoveItem1710(item.unknown_0000[1], 1); + g_session.RemoveItem1710(item.unknown_0000[1], 1); if (g_windowMgr.unknown_01D4) { reinterpret_cast(g_windowMgr.unknown_01D4)->SendMsg(nullptr, 23, 0, 0, 0, 0); } @@ -191,7 +187,7 @@ int UIMakeTargetProcessWnd::SendMsg(UIWindow* sender, int message, std::intptr_t for (ITEM_INFO& material : this->materials) { if (material.unknown_0000[1] != 0) { restored = true; - reinterpret_cast(&g_session)->AddItem1710(material, 0); + g_session.AddItem1710(material, 0); } } @@ -220,7 +216,7 @@ int UIMakeTargetProcessWnd::SendMsg(UIWindow* sender, int message, std::intptr_t for (int index = 2; index >= 0; --index) { ITEM_INFO& material = this->materials[index]; if (material.unknown_0000[1] != 0 && material.itemId == name) { - reinterpret_cast(&g_session)->AddItem1710(material, 1); + g_session.AddItem1710(material, 1); material.Reset(); this->Invalidate(); return 0; diff --git a/Source/UI/MiniPartyManager.cpp b/Source/UI/MiniPartyManager.cpp index a42f8eac..f1e368b5 100644 --- a/Source/UI/MiniPartyManager.cpp +++ b/Source/UI/MiniPartyManager.cpp @@ -1,5 +1,4 @@ #include "Client/Session.h" -#include "Contents/ClientItemLists.h" #include "Contents/Messenger/ClientMessenger.h" #include "Contents/Messenger/MessengerMember.h" #include "UI/MiniPartyGrid.h" @@ -126,7 +125,7 @@ void UIWindowMgr::RebuildMiniPartyWindows() { records.push_back(record); } - reinterpret_cast(g_session).ClearRecords0734(); + g_session.ClearRecords0734(); for (const SessionRecord0734& record : records) { MessengerMember member = g_session.PartyByAccount(record.id); diff --git a/Source/UI/Shop/MerchantShopRefresh.cpp b/Source/UI/Shop/MerchantShopRefresh.cpp index b3c6aef8..613e8541 100644 --- a/Source/UI/Shop/MerchantShopRefresh.cpp +++ b/Source/UI/Shop/MerchantShopRefresh.cpp @@ -1,5 +1,4 @@ #include "Client/Session.h" -#include "Contents/ClientItemLists.h" #include "Contents/Store/MCStoreInfoBackup.h" #include "UI/Shop/PriceColor.h" #include "UI/Shop/UIMerchantShopMakeWnd.h" @@ -47,10 +46,10 @@ void UIMerchantShopMakeWnd::Refresh() { for (int index = 0; index < count; ++index) { const ITEM_INFO item = g_session.GetItem1768At(index); - reinterpret_cast(&g_session)->AddItem1750(item, this->mode, 0); + g_session.AddItem1750(item, this->mode, 0); } - reinterpret_cast(&g_session)->ClearItems1768(); + g_session.ClearItems1768(); backup.Restore(this->mode != 0, this->unknown_012C); const std::vector displayed(backup.items); diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 52a1a44b..841b5d81 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -31,7 +31,6 @@ #include "Resource/ResourceMgr.h" #include "File/ShortcutFilename.h" #include "Contents/Sound/SoundMgr.h" -#include "Contents/ClientItemLists.h" #include "Contents/Skills/AutomaticSkills.h" #include "UI/Window/UIHotKeyWnd.h" #include "UI/Window/UIWindow.h" @@ -968,9 +967,9 @@ int UIWindowMgr::ShowWhisperFrom(const char* name, const char* text, int color, label = LookupMessage(102); } else if (g_session.IsGuildMemberCharacter(accountId)) { label = "GuildMember"; - } else if (reinterpret_cast(&g_session)->IsFriendName(name)) { + } else if (g_session.IsFriendNameDifferent(name)) { g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(917)), 0xFFFF, 0, 0, 0); - } else if (reinterpret_cast(&g_session)->IsGuildMemberName(name)) { + } else if (g_session.IsGuildMemberNameDifferent(name)) { g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(919)), 0xFFFF, 0, 0, 0); } diff --git a/Source/UI/Window/WindowMgrState.cpp b/Source/UI/Window/WindowMgrState.cpp index 37ffcc3b..0ba6111b 100644 --- a/Source/UI/Window/WindowMgrState.cpp +++ b/Source/UI/Window/WindowMgrState.cpp @@ -42,9 +42,6 @@ const char* g_uiRectInfoKeySuffix = "\\UIRectInfo"; // GLOBAL: gl_24987 const char* g_shortcutItemKeySuffix = "\\ShortcutItem"; -struct ClientItemLists { - void ResetHotkeyDescriptions(); -}; // OFFSET: 0x00A911E0 // FUNCTION: fn_17156 @@ -159,7 +156,7 @@ void UIWindowMgr::LoadShortcutItems() { RegCloseKey(probe); HKEY key; if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, path, 0, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS) { - reinterpret_cast(&g_session)->ResetHotkeyDescriptions(); + g_session.ResetHotkeyDescriptions(); g_session.ClearUnknown0420(); for (int index = 0; index < 36; ++index) { DWORD type = REG_SZ;