From 896f11fd97e4fdc52d2bdff9d382a7801bace0e1 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 16:34:29 +0000 Subject: [PATCH] Decompile fn_13274 (UIItemStoreWnd::Slot10) Batch #8310 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_13274 UIItemStoreWnd::Slot10: logic confirmed by peer review Peer-reviewed-by: Yommy, gordaoprogramas, 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 | 3 +++ Source/UI/Edit/UIEditCtrl.cpp | 45 +++++++++++++++++++++++++++++++++ Source/UI/Item/UIItemStoreWnd.h | 1 + 3 files changed, 49 insertions(+) diff --git a/Source/Client/Mode/CGameMode.h b/Source/Client/Mode/CGameMode.h index a88fa651..8d0b8780 100644 --- a/Source/Client/Mode/CGameMode.h +++ b/Source/Client/Mode/CGameMode.h @@ -649,5 +649,8 @@ static_assert(sizeof(CGameMode) == 0x670); extern char g_pendingWhisperCount; extern int g_whisperRecord; extern unsigned char g_gameModePacketBuffer[0x10000]; +extern int g_unknown_01738268; +extern int g_unknown_0173826C; +extern int g_unknown_01738270; #endif diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 98b7d447..d844150b 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -1074,6 +1074,51 @@ void UIItemStoreSubWnd::Slot10(int x, int y, std::intptr_t value) { g_windowMgr.window_01EC->SendMsg(nullptr, 13, 7, 0, 0, 0); } +// OFFSET: 0x00972630 +// FUNCTION: fn_13274 +void UIItemStoreWnd::Slot10(int x, int y, std::intptr_t value) { + char text[256]; + if (g_unknown_01738268) { + if (g_unknown_01738270 == 1) { + std::memset(text, 0, 250); + std::sprintf(text, LookupMessage(0x9C2)); + g_windowMgr.SendNotice(1, reinterpret_cast(text), 0xFF, 0, 0, 0); + return; + } + + if (!g_unknown_0173826C && !g_unknown_01738270) { + std::memset(text, 0, 250); + std::sprintf(text, LookupMessage(0x9C5)); + g_windowMgr.SendNotice(1, reinterpret_cast(text), 0xFF, 0, 0, 0); + return; + } + } + + if (g_windowMgr.LookupWindow(10011)) { + UIWindow::Slot10(x, y, value); + return; + } + + CMode* mode = g_modeMgr.GetGameMode(); + const ModeDragState* drag = reinterpret_cast(value); + if (drag->source != 1 && drag->source != 9) { + mode->SendMsg(18, 0, 0, 0, 0); + return; + } + + if (static_cast(mode)->ConfirmDraggedItemUse()) { + return; + } + + if (drag->quantity == 1) { + this->SendMsg(nullptr, 38, 0, 0, 0, 0); + return; + } + + reinterpret_cast(g_windowMgr).Show(15, 1); + g_windowMgr.window_01EC->SendMsg(nullptr, 13, 7, 0, 0, 0); +} + // OFFSET: 0x009727F0 // FUNCTION: fn_13275 void UIItemWnd::Slot10(int x, int y, std::intptr_t value) { diff --git a/Source/UI/Item/UIItemStoreWnd.h b/Source/UI/Item/UIItemStoreWnd.h index 0a31154f..8d318341 100644 --- a/Source/UI/Item/UIItemStoreWnd.h +++ b/Source/UI/Item/UIItemStoreWnd.h @@ -12,6 +12,7 @@ class UIStaticText; class UIItemStoreWnd : public UIItemBaseWnd { public: + void Slot10(int x, int y, std::intptr_t value) override; void Slot28(int x, int y) override; void Slot32(int x, int y) override; void Slot11() override;