From f645f7e25f062dc7df280d7c7c839f3e76e8422a Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 12:13:22 +0000 Subject: [PATCH] Decompile fn_23599 (CSession::OnItemEquipped) Batch #7820 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_23599 CSession::OnItemEquipped: logic confirmed by peer review Peer-reviewed-by: secret, Snow, pedrao Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Session.h | 1 + Source/Contents/ClientItemLists.cpp | 42 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 997a5a7a..9fca9499 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -599,6 +599,7 @@ public: void AddUnknownId(int id); EquipSlots GetEquipSlots(int location); bool EquipUnknown17F0(const ITEM_INFO& item, const char* name); + bool OnItemEquipped(ITEM_INFO& item); bool EquipItem2B50(const ITEM_INFO& item, const char* name); bool EquipItem3500(const ITEM_INFO& item); void AddStackedItem(ITEM_INFO item); diff --git a/Source/Contents/ClientItemLists.cpp b/Source/Contents/ClientItemLists.cpp index b632a4f0..330fe568 100644 --- a/Source/Contents/ClientItemLists.cpp +++ b/Source/Contents/ClientItemLists.cpp @@ -15,6 +15,7 @@ #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowOrdering.h" +#include "Utility/Text/FormatString.h" #include #include #include @@ -1186,6 +1187,47 @@ bool CSession::EquipUnknown17F0(const ITEM_INFO& item, const char* name) { return true; } +// OFFSET: 0x00DFC9B0 +// FUNCTION: fn_23599 +bool CSession::OnItemEquipped(ITEM_INFO& item) { + g_windowMgr.SendNotice(1, reinterpret_cast(FormatOwnedString("%s %s", item.DisplayName(0).c_str(), LookupMessage(0xAA)).c_str()), 0xC8FF00, 7, 0, 0); + if (item.unknown_0064 == 1) { + item.unknown_0064 = 2; + } + + if (g_session.IsCostumeLocation(item.unknown_0000[3])) { + char name[1] = ""; + g_session.EquipItem2B50(item, name); + } else { + 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 && slot < 10) { + ITEM_INFO& equipped = this->unknown_17F0[slot]; + equipped = item; + equipped.quantity = 1; + } + } + + RequestBasicInfoRefresh(); + if (g_equipmentPropertiesMgr == nullptr) { + g_equipmentPropertiesMgr = new (std::nothrow) EquipmentProperties::CEquipmentPropertiesMgr; + } + g_equipmentPropertiesMgr->EquipWearable(&item, true); + reinterpret_cast(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC); + } + + if (item.unknown_0000[3] != 0x8000) { + reinterpret_cast(this)->RemoveItem1710(item.unknown_0000[1], 1); + } + if (UIWindow* window = reinterpret_cast(g_windowMgr.unknown_022C)) { + window->SendMsg(nullptr, 60, 0, 0, 0, 0); + } + return true; +} + // OFFSET: 0x006B6C70 // FUNCTION: fn_06201 __declspec(noinline) void EquipmentProperties::CEquipmentPropertiesMgr::EquipWearable(const ITEM_INFO* item, bool notify) {