From d50cf423a87babe8d281b1ac0aa2a4162919e419 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 2 Nov 2026 12:07:54 +0000 Subject: [PATCH] Decompile fn_17123 (UIWindowMgr::ShowWhisperFrom) Batch #9776 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_17123 UIWindowMgr::ShowWhisperFrom: logic confirmed by peer review Reviewed-by: ragnarok-clanker --- Source/UI/Window/UIWindowMgr.cpp | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 08eaf6e6..06ab8531 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -28,6 +28,10 @@ #include "Contents/MessageTable.h" #include "Contents/NavigationManager.h" #include "Contents/WorldView/WorldViewData.h" +#include "Resource/ResourceMgr.h" +#include "File/ShortcutFilename.h" +#include "Contents/Sound/SoundMgr.h" +#include "Contents/ClientItemLists.h" #include "Contents/Skills/AutomaticSkills.h" #include "UI/Window/UIHotKeyWnd.h" #include "UI/Window/UIWindow.h" @@ -948,6 +952,78 @@ void UIWindowMgr::SelectWhisperName(const char* name) { this->window_01C8->SendMsg(field, 0x27, index, 0, 0, 0); } +// GLOBAL: gl_25163 +const char* g_newWhisperWave = "..\\..\\BGM\\Msg_NewMsg.wav"; + +// OFFSET: 0x00A8B3D0 +// FUNCTION: fn_17123 +int UIWindowMgr::ShowWhisperFrom(const char* name, const char* text, int color, std::uint32_t accountId) { + int shown = 0; + const bool isFriend = g_session.IsFriendName(name) != 0; + if ((g_session.m_autoOpenWhisperWindow != 0 && !isFriend) || (g_session.m_autoOpenFriendWhisperWindow != 0 && isFriend)) { + const char* label = nullptr; + if (isFriend) { + label = LookupMessage(102); + } else if (g_session.IsGuildMemberCharacter(accountId)) { + label = "GuildMember"; + } else if (reinterpret_cast(&g_session)->IsFriendName(name)) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(917)), 0xFFFF, 0, 0, 0); + } else if (reinterpret_cast(&g_session)->IsGuildMemberName(name)) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(919)), 0xFFFF, 0, 0, 0); + } + + shown = this->SendNotice(14, reinterpret_cast(name), reinterpret_cast(label), reinterpret_cast(ShortcutFilename(accountId).c_str()), 0, 0); + if (shown) { + if (ResourceMgr::Instance().Exists(g_newWhisperWave)) { + g_soundMgr->PlayWave(g_newWhisperWave, 0.0f, 0.0f, 0.0f, 250, 40, 1.0f, 0); + } else if (g_session.m_whisperOpenSound != 0) { + g_soundMgr->PlayWave("버튼소리.wav", 0.0f, 0.0f, 0.0f, 250, 40, 1.0f, 0); + } + } + } + + if (std::strcmp(name, g_session.DecodePlayerName()) == 0) { + return 0; + } + + if (g_session.m_autoOpenWhisperWindow != 0 && shown) { + this->AddWhisperName(name); + } + + const auto entry = this->namedWindows.find(std::string(name)); + if (entry == this->namedWindows.end()) { + return 0; + } + + UIWindow* window = entry->second; + window->SendMsg(nullptr, 37, reinterpret_cast(text), color, 2, 0); + if ((this->modal == nullptr || this->window_4F174 == window) && !this->LookupWindow(278) && !this->LookupWindow(4) && !this->LookupWindow(199) && + !this->LookupWindow(200)) { + int companion = -1; + if (window->geometry.id == 12) { + companion = 234; + } else if (window->geometry.id == 82) { + companion = 250; + } + + if (companion != -1) { + const auto found = std::find_if(this->rendered.begin(), this->rendered.end(), [&](const UIWindow* value) { return value->geometry.id == companion; }); + if (found != this->rendered.end()) { + UIWindow* value = *found; + this->rendered.erase(found); + this->rendered.push_back(value); + } + } + + const auto found = std::find(this->rendered.begin(), this->rendered.end(), window); + if (found != this->rendered.end()) { + this->rendered.erase(found); + this->rendered.push_back(window); + } + } + return 1; +} + // OFFSET: 0x00A8B240 // FUNCTION: fn_17122 void UIWindowMgr::AddWhisperName(const char* name) {