From afafe25291d5d7d608f8bc8ece95bdb4f5bf298f Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 17:49:15 +0000 Subject: [PATCH] Decompile fn_13477 (UIMerchantItemPurchaseMSGWnd::SetPurchase) Batch #9656 by doczeira: 0 byte-identical, 1 confirmed by peer review. - fn_13477 UIMerchantItemPurchaseMSGWnd::SetPurchase: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, tayoba, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Edit/UIEditCtrl.cpp | 21 ++++++++++++++++++- Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h | 5 ++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 7b653f9b..f99fbb37 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -7159,7 +7159,7 @@ int UIMerchantItemPurchaseMSGWnd::SendMsg(UIWindow* sender, int message, std::in switch (a) { case 184: - static_cast(g_charViewMode)->SendMsg(83, reinterpret_cast(this->m_controls), this->unknown_00D0, 0, 0); + static_cast(g_charViewMode)->SendMsg(83, this->purchaseIndex, this->unknown_00D0, 0, 0); case 185: g_windowMgr.CloseWindow(230); reinterpret_cast(&g_session)->ClearItems1760And1748(); @@ -7307,6 +7307,25 @@ bool UIItemStoreSubWnd::sub_996C90() { } // OFFSET: 0x00996E30 +// FUNCTION: fn_13477 +void UIMerchantItemPurchaseMSGWnd::SetPurchase(int value, int amount) { + this->purchaseIndex = value; + this->unknown_00D0 = amount; + + int total = 0; + const int count = reinterpret_cast(&g_session)->GetList10Size(); + for (int i = 0; i < count; ++i) { + ITEM_INFO item; + item = g_session.GetItem1760At(i); + if (item.unknown_0000[1] > 0) { + total += item.quantity * item.unknown_0014[0]; + } + } + + const std::string text = IntToSignedString(total, true, false) + std::string(LookupMessage(2328)); + this->secondLine->SetText(text.c_str(), 0); + this->Invalidate(); +} // OFFSET: 0x00857420 // FUNCTION: fn_10762 diff --git a/Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h b/Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h index e00a9a84..4a302d3c 100644 --- a/Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h +++ b/Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h @@ -21,12 +21,11 @@ public: /* 00C0 */ UIStaticText* secondLine; /* 00C4 */ UIBitmapButton* buyButton; /* 00C8 */ UIBitmapButton* cancelButton; + /* 00CC */ int purchaseIndex; + /* 00D0 */ int unknown_00D0; protected: UIButtonContext* m_controls; - -public: - /* 00D0 */ int unknown_00D0; }; #endif