diff --git a/Source/Client/Mode/CGameMode.h b/Source/Client/Mode/CGameMode.h index 3db6c2b6..7a00af31 100644 --- a/Source/Client/Mode/CGameMode.h +++ b/Source/Client/Mode/CGameMode.h @@ -639,5 +639,6 @@ static_assert(sizeof(CGameMode) == 0x670); extern char g_pendingWhisperCount; extern int g_whisperRecord; +extern unsigned char g_gameModePacketBuffer[0x10000]; #endif diff --git a/Source/Client/Mode/GameModeItemLists.cpp b/Source/Client/Mode/GameModeItemLists.cpp index 77c406d7..4970b74b 100644 --- a/Source/Client/Mode/GameModeItemLists.cpp +++ b/Source/Client/Mode/GameModeItemLists.cpp @@ -173,3 +173,37 @@ void CGameMode::ReceiveEquipListPart(unsigned char listType, int count, const un } // OFFSET: 0x00D44600 +// FUNCTION: fn_21835 +void CGameMode::ReceiveInventoryStart(const unsigned char* packet) { + const int length = *reinterpret_cast(g_gameModePacketBuffer + 2) - 5; + if (length > 24) { + return; + } + + switch (g_gameModePacketBuffer[4]) { + case 0: + reinterpret_cast(&g_session)->ClearInventory(); + reinterpret_cast(&g_session)->ResetEquipment(); + g_session.ResetItems2B50(); + break; + case 1: + reinterpret_cast(&g_session)->ClearItems1740(); + break; + case 2: + case 3: { + char title[24] = {}; + memcpy_s(title, sizeof(title), packet + 5, length); + UIItemStoreWnd* window = static_cast(g_windowMgr.EnsureWindow(33)); + if (window) { + const std::size_t titleLength = std::strlen(title); + if (titleLength != 0) { + window->SetTitle(std::string(title, titleLength)); + } + } + break; + } + } +} + +// GLOBAL: gl_25206 +unsigned char g_gameModePacketBuffer[0x10000];