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).
This commit is contained in:
ragnarok-clanker 2026-11-01 17:49:15 +00:00
commit afafe25291
2 changed files with 22 additions and 4 deletions

View file

@ -7159,7 +7159,7 @@ int UIMerchantItemPurchaseMSGWnd::SendMsg(UIWindow* sender, int message, std::in
switch (a) {
case 184:
static_cast<CMode*>(g_charViewMode)->SendMsg(83, reinterpret_cast<std::intptr_t>(this->m_controls), this->unknown_00D0, 0, 0);
static_cast<CMode*>(g_charViewMode)->SendMsg(83, this->purchaseIndex, this->unknown_00D0, 0, 0);
case 185:
g_windowMgr.CloseWindow(230);
reinterpret_cast<ClientItemLists*>(&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<const SessionMessengerContext*>(&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

View file

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