From fee796db9de2064ef38d6cc4bb7510bc4beff199 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 08:04:30 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/UIBartermarketWnd.cpp Batch #13754 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_10563 UIBarterItemPurchaseWnd::SendMsg: logic confirmed by peer review - fn_10564 UIBartermarketWnd::SendMsg: logic confirmed by peer review Peer-reviewed-by: Yommy, secret, KWDev, codeplay Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/UIBartermarketWnd.cpp | 208 ++++++++++++++++---------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/Source/UI/UIBartermarketWnd.cpp b/Source/UI/UIBartermarketWnd.cpp index b159b5d45..560b21225 100644 --- a/Source/UI/UIBartermarketWnd.cpp +++ b/Source/UI/UIBartermarketWnd.cpp @@ -1239,74 +1239,6 @@ void UIBarterItemPurchaseWnd::Slot15(int width, int height) { // FUNCTION: fn_10563 int UIBarterItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { switch (message) { - case 6: { - CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); - if (!mode) { - return 0; - } - - if (a == 184) { - if (!this->Purchase()) { - return 0; - } - mode->SendMsg(308, 0, 0, 0, 0); - } else if (a != 185) { - return 0; - } - - mode->SendMsg(40, 0, 0, 0, 0); - g_barterMarketItemMgr->Clear(); - return 0; - } - - case 14: { - if (a != 3) { - return 0; - } - - int width = b <= 320 ? static_cast(b) : 320; - int height = c <= 336 ? static_cast(c) : 336; - if (width < 232) { - width = 232; - } - if (height < 120) { - height = 120; - } - width = (width - 280) / 32 * 32 + 280; - height = (height - 120) / 32 * 32 + 120; - - if (width != this->geometry.width || height != this->geometry.height) { - this->Resize(width, height); - this->columns = 1; - const int rowsHeight = this->geometry.height - 38; - this->visibleRows = rowsHeight / 32; - this->resizer->Move(this->geometry.width - 15, this->geometry.height - 15); - this->scrollBar->Move(this->geometry.width - 15, 14); - this->scrollBar->Resize(this->scrollBar->geometry.width, rowsHeight); - this->UpdateScrollBar(); - } - - const int xs[2] = {this->geometry.width - 106, this->geometry.width - 61}; - const int y = this->geometry.height - 24; - for (int index = 0; index < 2; ++index) { - this->buttons[index]->Move(xs[index], y); - } - - g_windowMgr.StoreSnapRectangle(this); - return 0; - } - - case 23: { - this->items.clear(); - std::list* items = g_barterMarketItemMgr->GetAllItems(); - for (std::list::iterator it = items->begin(); it != items->end(); ++it) { - this->items.push_back(it->ToItemInfo()); - } - this->Invalidate(); - this->UpdateScrollBar(); - return 0; - } - case 34: { this->saved = reinterpret_cast(a); if (!this->saved) { @@ -1392,6 +1324,74 @@ int UIBarterItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std::intptr_ return 0; } + case 6: { + CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); + if (!mode) { + return 0; + } + + if (a == 184) { + if (!this->Purchase()) { + return 0; + } + mode->SendMsg(308, 0, 0, 0, 0); + } else if (a != 185) { + return 0; + } + + mode->SendMsg(40, 0, 0, 0, 0); + g_barterMarketItemMgr->Clear(); + return 0; + } + + case 14: { + if (a != 3) { + return 0; + } + + int width = b <= 320 ? static_cast(b) : 320; + int height = c <= 336 ? static_cast(c) : 336; + if (width < 232) { + width = 232; + } + if (height < 120) { + height = 120; + } + width = (width - 280) / 32 * 32 + 280; + height = (height - 120) / 32 * 32 + 120; + + if (width != this->geometry.width || height != this->geometry.height) { + this->Resize(width, height); + this->columns = 1; + const int rowsHeight = this->geometry.height - 38; + this->visibleRows = rowsHeight / 32; + this->resizer->Move(this->geometry.width - 15, this->geometry.height - 15); + this->scrollBar->Move(this->geometry.width - 15, 14); + this->scrollBar->Resize(this->scrollBar->geometry.width, rowsHeight); + this->UpdateScrollBar(); + } + + const int xs[2] = {this->geometry.width - 106, this->geometry.width - 61}; + const int y = this->geometry.height - 24; + for (int index = 0; index < 2; ++index) { + this->buttons[index]->Move(xs[index], y); + } + + g_windowMgr.StoreSnapRectangle(this); + return 0; + } + + case 23: { + this->items.clear(); + std::list* items = g_barterMarketItemMgr->GetAllItems(); + for (std::list::iterator it = items->begin(); it != items->end(); ++it) { + this->items.push_back(it->ToItemInfo()); + } + this->Invalidate(); + this->UpdateScrollBar(); + return 0; + } + default: break; } @@ -1445,6 +1445,42 @@ void UIExpandedBarterItemPurchaseWnd::Slot15(int width, int height) { // FUNCTION: fn_10564 int UIBartermarketWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { switch (message) { + case 34: { + this->saved = reinterpret_cast(a); + if (a == 0) { + return 0; + } + if (!this->saved->IsValid()) { + this->saved->Reset(); + } + this->SendMsg(nullptr, 14, 7, this->saved->width, this->saved->height, 0); + this->Move(this->saved->x, this->saved->y); + return 0; + } + + case 38: { + CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); + if (!mode) { + return 0; + } + + std::pair found = g_barterMarketItemMgr->FindAllItem(mode->drag.unknown_03B0); + if (found.first == false) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3554)), 255, 0, 0, 0); + mode->SendMsg(18, 0, 0, 0, 0); + return 0; + } + + found.second.value = mode->drag.quantity; + g_barterMarketItemMgr->RemoveItem(found.second); + if (UIWindow* window = g_windowMgr.LookupWindow(335)) { + window->SendMsg(nullptr, 23, 0, 0, 0, 0); + } + this->SendMsg(nullptr, 23, 0, 0, 0, 0); + mode->SendMsg(18, 0, 0, 0, 0); + return 0; + } + case 14: { if (a == 7) { int width = b <= 320 ? static_cast(b) : 320; @@ -1485,42 +1521,6 @@ int UIBartermarketWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s return 0; } - case 34: { - this->saved = reinterpret_cast(a); - if (a == 0) { - return 0; - } - if (!this->saved->IsValid()) { - this->saved->Reset(); - } - this->SendMsg(nullptr, 14, 7, this->saved->width, this->saved->height, 0); - this->Move(this->saved->x, this->saved->y); - return 0; - } - - case 38: { - CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); - if (!mode) { - return 0; - } - - std::pair found = g_barterMarketItemMgr->FindAllItem(mode->drag.unknown_03B0); - if (found.first == false) { - g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3554)), 255, 0, 0, 0); - mode->SendMsg(18, 0, 0, 0, 0); - return 0; - } - - found.second.value = mode->drag.quantity; - g_barterMarketItemMgr->RemoveItem(found.second); - if (UIWindow* window = g_windowMgr.LookupWindow(335)) { - window->SendMsg(nullptr, 23, 0, 0, 0, 0); - } - this->SendMsg(nullptr, 23, 0, 0, 0, 0); - mode->SendMsg(18, 0, 0, 0, 0); - return 0; - } - default: break; }