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).
This commit is contained in:
ragnarok-clanker 2026-10-31 12:13:22 +00:00
commit f645f7e25f
2 changed files with 43 additions and 0 deletions

View file

@ -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);

View file

@ -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 <cstddef>
#include <cstdint>
#include <cstdio>
@ -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<std::intptr_t>(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<WindowOrdering&>(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC);
}
if (item.unknown_0000[3] != 0x8000) {
reinterpret_cast<ClientItemLists*>(this)->RemoveItem1710(item.unknown_0000[1], 1);
}
if (UIWindow* window = reinterpret_cast<UIWindow*>(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) {