From 7f08a825e182a99beb4a34c876df4dcc80f2e696 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 21:05:15 +0000 Subject: [PATCH] Decompile 3 functions in Source/Client/Mode/GameModePackets.cpp, Source/Client/Mode/CGameMode.h Batch #8767 by aDw: 0 byte-identical, 3 confirmed by peer review. - fn_21995 CGameMode::ReceiveEquipCardChange: logic confirmed by peer review - fn_21694 CGameMode::ReceiveEquipWindowMicroscope2: logic confirmed by peer review - fn_21877 CGameMode::ReceiveGuildMemberAdd: logic confirmed by peer review Peer-reviewed-by: eAthena, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Mode/CGameMode.h | 4 + Source/Client/Mode/GameModePackets.cpp | 110 +++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/Source/Client/Mode/CGameMode.h b/Source/Client/Mode/CGameMode.h index 8167af34..aa7a4974 100644 --- a/Source/Client/Mode/CGameMode.h +++ b/Source/Client/Mode/CGameMode.h @@ -641,6 +641,10 @@ public: void RefreshEmotionPurchaseSchedule(); void RefreshEmotionSaleSchedule(); void ReceiveTypedNotice(const unsigned char* packet); + void ReceiveEquipCardChange(const unsigned char* packet); + void ReceiveEquipWindowMicroscope2(const unsigned char* packet); + void ReceiveEquipWindowMicroscope3(const unsigned char* packet); + void ReceiveGuildMemberAdd(const unsigned char* packet); void ReceiveRodexMailReturn(const unsigned char* packet); void ReceiveActorStatusValuePacket(const unsigned char* packet); void ReceivePartyMemberEffect(const unsigned char* packet); diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index be1a6060..5f00cceb 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -2,6 +2,7 @@ #include "File/ShortcutFilename.h" #include "Client/Input/InputCharset.h" #include "Client/Mode/CGameMode.h" +#include "Client/Mode/EquipWindowLook.h" #include "UI/UIMacroDetectorWnd.h" #include "UI/UIMacroBlackListCheckWnd.h" #include "UI/UILapineScrollBar.h" @@ -7068,3 +7069,112 @@ void CGameMode::ReceivePartyItemPickupNotice(const unsigned char* packet) { ); } } + + +// OFFSET: 0x00D64940 +// FUNCTION: fn_21995 +void CGameMode::ReceiveEquipCardChange(const unsigned char* packet) { + const EquipSlots slots = g_session.GetEquipSlots(*reinterpret_cast(packet + 2)); + ITEM_INFO item = g_session.GetItem17F0(slots.values[2]); + if (item.unknown_0000[1] != 0) { + int* cards = reinterpret_cast(item.unknown_001C); + switch (packet[0xA]) { + case 1: + cards[*reinterpret_cast(packet + 4)] = *reinterpret_cast(packet + 6); + break; + case 2: + case 3: + cards[*reinterpret_cast(packet + 4)] = 0; + break; + } + g_session.SetEquipItem17F0(slots.values[2], item); + } +} + +// OFFSET: 0x00D284D0 +// FUNCTION: fn_21694 +void CGameMode::ReceiveEquipWindowMicroscope2(const unsigned char* packet) { + reinterpret_cast(&g_session)->ResetEquipped(); + g_session.ResetItems3500(); + + const int length = *reinterpret_cast(packet + 2); + const int count = static_cast(length - 45) / 38u; + const unsigned char* entry = packet + 45; + for (int index = 0; index < count; ++index, entry += 38) { + ITEM_INFO item; + item.unknown_0000[0] = entry[6]; + item.unknown_0000[2] = *reinterpret_cast(entry + 8); + item.unknown_0000[1] = *reinterpret_cast(entry); + item.unknown_0000[3] = *reinterpret_cast(entry + 10); + item.quantity = 1; + std::memcpy(item.unknown_001C, entry + 14, sizeof(item.unknown_001C)); + item.SetItemId(*reinterpret_cast(entry + 2)); + item.identified = entry[7]; + item.unknown_005D = entry[12]; + item.unknown_0060 = entry[13]; + item.unknown_0068 = *reinterpret_cast(entry + 30); + item.unknown_0064 = *reinterpret_cast(entry + 34); + item.unknown_0070 = *reinterpret_cast(entry + 36); + + if (item.unknown_0000[3] != 0) { + if (g_session.IsCostumeLocation(item.unknown_0000[3])) { + g_session.EquipItem3500(item); + } else { + reinterpret_cast(&g_session)->Equip(item); + } + } + } + + g_equipWindowLook.job = *reinterpret_cast(packet + 0x1C); + g_equipWindowLook.sex = packet[0x2C]; + g_equipWindowLook.head = *reinterpret_cast(packet + 0x1E); + g_equipWindowLook.accessory = *reinterpret_cast(packet + 0x20); + g_equipWindowLook.accessory2 = *reinterpret_cast(packet + 0x22); + g_equipWindowLook.accessory3 = *reinterpret_cast(packet + 0x24); + g_equipWindowLook.bodyPalette = *reinterpret_cast(packet + 0x2A); + g_equipWindowLook.headPalette = *reinterpret_cast(packet + 0x28); + std::memcpy(g_equipWindowLook.name, packet + 4, sizeof(g_equipWindowLook.name)); + g_equipWindowLook.robe = *reinterpret_cast(packet + 0x26); + + if (!g_windowMgr.CloseWindow(0x8B)) { + g_windowMgr.EnsureWindow(0x8B); + } +} + +// OFFSET: 0x00D28700 + +// OFFSET: 0x00D4E5A0 +// FUNCTION: fn_21877 +void CGameMode::ReceiveGuildMemberAdd(const unsigned char* packet) { + GuildInfo* guildInfo = reinterpret_cast(reinterpret_cast(&g_guildId) - offsetof(GuildInfo, m_guildId)); + if (guildInfo->unknown_00C0 == 0) { + return; + } + + char memo[51]; + std::memcpy(memo, packet + 0x20, 50); + memo[50] = '\0'; + char name[25]; + std::memcpy(name, packet + 0x52, 24); + name[24] = '\0'; + + GuildInfo::Member member; + member.accountId = *reinterpret_cast(packet + 2); + member.characterId = *reinterpret_cast(packet + 6); + member.name = name; + member.unknown_0020 = *reinterpret_cast(packet + 0xA); + member.unknown_0024 = *reinterpret_cast(packet + 0xC); + member.job = *reinterpret_cast(packet + 0x10); + member.unknown_002C = *reinterpret_cast(packet + 0xE); + member.positionId = *reinterpret_cast(packet + 0x1C); + member.level = *reinterpret_cast(packet + 0x12); + member.unknown_0050 = memo; + member.exp = *reinterpret_cast(packet + 0x14); + member.online = *reinterpret_cast(packet + 0x18); + guildInfo->AddMember(member); + + const std::string playerName(name, 25); + g_playerNameDictionary->Set(*reinterpret_cast(packet + 6), playerName.c_str()); + guildInfo->UpdateMemberExpRatios(); + g_windowMgr.RefreshGuildWindows(); +}