Decompile fn_21835 (CGameMode::ReceiveInventoryStart)

Batch #8241 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_21835 CGameMode::ReceiveInventoryStart: logic confirmed by peer review

Peer-reviewed-by: gordaoprogramas, System4z, vinnyamancio
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-31 16:16:32 +00:00
commit 6644c81653
2 changed files with 35 additions and 0 deletions

View file

@ -639,5 +639,6 @@ static_assert(sizeof(CGameMode) == 0x670);
extern char g_pendingWhisperCount;
extern int g_whisperRecord;
extern unsigned char g_gameModePacketBuffer[0x10000];
#endif

View file

@ -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<const std::int16_t*>(g_gameModePacketBuffer + 2) - 5;
if (length > 24) {
return;
}
switch (g_gameModePacketBuffer[4]) {
case 0:
reinterpret_cast<ClientItemLists*>(&g_session)->ClearInventory();
reinterpret_cast<SessionMessengerContext*>(&g_session)->ResetEquipment();
g_session.ResetItems2B50();
break;
case 1:
reinterpret_cast<ClientItemLists*>(&g_session)->ClearItems1740();
break;
case 2:
case 3: {
char title[24] = {};
memcpy_s(title, sizeof(title), packet + 5, length);
UIItemStoreWnd* window = static_cast<UIItemStoreWnd*>(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];