From 2bde55e7198d3bd4e8fd2ad3bd28050cdfbc195a Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 21:14:01 +0000 Subject: [PATCH] Decompile fn_21889 (CGameMode::ReceiveGuildPositionInfo) Batch #8771 by aDw: 0 byte-identical, 1 confirmed by peer review. - fn_21889 CGameMode::ReceiveGuildPositionInfo: 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 | 1 + Source/Client/Mode/GameModePackets.cpp | 31 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Source/Client/Mode/CGameMode.h b/Source/Client/Mode/CGameMode.h index 86637650..02adf850 100644 --- a/Source/Client/Mode/CGameMode.h +++ b/Source/Client/Mode/CGameMode.h @@ -655,6 +655,7 @@ public: void ReceiveEquipWindowMicroscope2(const unsigned char* packet); void ReceiveEquipWindowMicroscope3(const unsigned char* packet); void ReceiveGuildMemberAdd(const unsigned char* packet); + void ReceiveGuildPositionInfo(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 7c2ba70f..8153ad09 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -7228,3 +7228,34 @@ void CGameMode::ReceiveGuildMemberAdd(const unsigned char* packet) { guildInfo->UpdateMemberExpRatios(); g_windowMgr.RefreshGuildWindows(); } + +// OFFSET: 0x00D510C0 +// FUNCTION: fn_21889 +void CGameMode::ReceiveGuildPositionInfo(const unsigned char* packet) { + GuildInfo* guildInfo = reinterpret_cast(reinterpret_cast(&g_guildId) - offsetof(GuildInfo, m_guildId)); + const int count = static_cast(*reinterpret_cast(packet + 2) - 4) >> 4; + guildInfo->unknown_00D4.clear(); + + const unsigned char* entry = packet + 4; + for (int index = 0; index < count; ++index, entry += 16) { + const int positionId = *reinterpret_cast(entry); + std::string name; + name = guildInfo->m_positions[positionId]; + + const unsigned int mode = *reinterpret_cast(entry + 4); + GuildInfo::Unknown00D4Entry position; + position.unknown_0000 = *reinterpret_cast(entry + 8); + position.unknown_0004 = positionId; + position.unknown_0008 = name; + position.unknown_0020 = mode & 1; + position.unknown_0024 = (mode >> 4) & 1; + position.unknown_0028 = *reinterpret_cast(entry + 12); + position.unknown_002C = (mode >> 8) & 1; + guildInfo->unknown_00D4.push_back(position); + } + + guildInfo->unknown_00D4.sort([](const GuildInfo::Unknown00D4Entry& left, const GuildInfo::Unknown00D4Entry& right) { + return left.unknown_0004 < right.unknown_0004; + }); + g_windowMgr.RefreshGuildWindows(); +}