From b4e480a4cb97821aaec08dbf9fb1ef806b76e21e Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 02:56:20 +0000 Subject: [PATCH] Decompile fn_13136 (UIListBoxAgitMenu::SendMsg) Batch #4221 by bigodeira: 0 byte-identical, 1 confirmed by peer review. - fn_13136 UIListBoxAgitMenu::SendMsg: logic confirmed by peer review Peer-reviewed-by: willerthal, KWDev, Millenium, Snow Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Guild/UIAgitWnd.cpp | 57 +++++++++++++++++++++++++++++++++++ Source/UI/Guild/UIAgitWnd.h | 6 +++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Source/UI/Guild/UIAgitWnd.cpp b/Source/UI/Guild/UIAgitWnd.cpp index 5f8f603a..1cccccf3 100644 --- a/Source/UI/Guild/UIAgitWnd.cpp +++ b/Source/UI/Guild/UIAgitWnd.cpp @@ -2,16 +2,28 @@ #include "Client/Mode/CMode.h" #include "Client/Mode/ModeMgr.h" #include "Client/ReplayPacketRecorder.h" +#include "Client/Session.h" +#include "Contents/GuildInfo.h" +#include "Contents/GuildMgr.h" #include "Contents/MessageTable.h" +#include "Render/Renderer.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/SkinPalette.h" #include "Resource/TextureNames.h" +#include "Script/LuaScript.h" #include "UI/Buttons/UIButton.h" #include "UI/Window/UIWindowMgr.h" +#include "Utility/Text/FormatString.h" +#include +#include #include +UIAgitMessageBox::UIAgitMessageBox() + : UIFrameWnd(*reinterpret_cast(0), *reinterpret_cast(0), 0), m_agitId(0) { +} + // OFFSET: 0x0095D580 // FUNCTION: fn_13068 void UIAgitMessageBox::Paint() { @@ -126,3 +138,48 @@ void UIListBoxAgitMenu::Slot28(int x, int y) { this->Invalidate(); } } + +// OFFSET: 0x00964F80 +// FUNCTION: fn_13136 +int UIListBoxAgitMenu::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message != 48) { + return this->UIListBox::SendMsg(sender, message, a, b, c, d); + } + + if (a == 0) { + if (g_session.GetSceneUnknown004C() == 1) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3633)), 0xFF, 0, 0, 0); + return 0; + } + + GuildInfo* guildInfo = reinterpret_cast(reinterpret_cast(&g_guildId) - offsetof(GuildInfo, m_guildId)); + uint16_t agitId = static_cast(guildInfo->GetUnknown0114(this->m_agitIndex)); + + LuaScript* luaScript = *reinterpret_cast(0x01738010); + char* agitName = nullptr; + luaScript->Call("get_agit_name", "d>s", agitId, &agitName); + if (agitName != nullptr && strnlen(agitName, 256) != 0) { + int costZeny = 0; + luaScript->Call("get_agit_costzeny", "db>d", agitId, 0, &costZeny); + int costGuildPoint = 0; + luaScript->Call("get_agit_costzeny", "db>d", agitId, 1, &costGuildPoint); + + UIAgitMessageBox* box = new UIAgitMessageBox(); + const char* text = FormatString(LookupMessage(3631), agitName, costZeny, costGuildPoint, 310, 130); + box->sub_956130(text); + + int x = g_renderer->viewport.centerX - box->geometry.width / 2; + int y = g_renderer->viewport.centerY - box->geometry.height / 2; + box->Move(x, y); + box->m_agitId = agitId; + g_windowMgr.AddRendered(box); + } + } else if (a == 1) { + CMode* mode = g_modeMgr.GetGameMode(); + GuildInfo* guildInfo = reinterpret_cast(reinterpret_cast(&g_guildId) - offsetof(GuildInfo, m_guildId)); + uint16_t agitId = static_cast(guildInfo->GetUnknown0114(this->m_agitIndex)); + mode->SendMsg(316, agitId, 0, 0, 0); + } + + return 0; +} diff --git a/Source/UI/Guild/UIAgitWnd.h b/Source/UI/Guild/UIAgitWnd.h index 88e51d11..0f278750 100644 --- a/Source/UI/Guild/UIAgitWnd.h +++ b/Source/UI/Guild/UIAgitWnd.h @@ -16,10 +16,11 @@ struct UIAgitMessageBoxContext { class UIAgitMessageBox : public UIFrameWnd { public: + UIAgitMessageBox(); void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; + void sub_956130(const char* text); -protected: /* 00B4 */ std::uint16_t m_agitId; UIAgitMessageBoxContext* m_dialog; }; @@ -34,8 +35,11 @@ public: class UIListBoxAgitMenu : public UIListBox { public: void Paint() override; + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; void Slot25(int x, int y) override; void Slot28(int x, int y) override; + + /* 00D4 */ int m_agitIndex; }; #endif