Decompile 2 functions in Source/UI/Rodex/UIRodexComposeWnd.cpp, Source/UI/Rodex/UIRodexComposeWnd.h, ...

Batch #6082 by KWDev: 0 byte-identical, 2 confirmed by peer review.

- fn_10003 UIRodexComposeWnd::sub_7FF710: logic confirmed by peer review
- fn_10004 UIRodexComposeWnd::sub_7FF940: logic confirmed by peer review

Peer-reviewed-by: eAthena, Lumen
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-10-30 19:43:32 +00:00
commit 3ae87a2b80
3 changed files with 98 additions and 0 deletions

View file

@ -8,6 +8,8 @@
#include <string>
#include <vector>
struct ITEM_INFO;
class UIItemTagCtrl : public UIEditCtrl {
public:
virtual bool CanInsertTag(const std::string& name, int width);
@ -15,6 +17,8 @@ public:
std::string AppendTag(const std::string& name);
bool SyncTagsWithText();
void SetTaggedText(const std::string& text, int width);
void sub_89CFE0(const ITEM_INFO& item, unsigned int color);
std::string sub_874A40(int tagId, unsigned int color);
/* 011C */ int unknown_011C;
/* 0120 */ std::list<ItemTagRecord> tags;

View file

@ -7,6 +7,7 @@
#include "File/ShortcutFilename.h"
#include "UI/Buttons/UIBmpTextButton.h"
#include "UI/Edit/ItemTagRetirement.h"
#include "UI/Edit/UIItemTagCtrl.h"
#include "UI/Shortcuts/ShortcutVisibility.h"
#include "UI/Text/UIStaticText.h"
#include "Utility/Text/FormatString.h"
@ -17,6 +18,12 @@
#include "UI/Edit/UIEditCtrl_Currency.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowManagerWindows.h"
#include "Client/Input/InputCharset.h"
#include "Client/Mode/ModeTooltip.h"
#include "Contents/Configuration/ServiceConfiguration.h"
#include "Contents/Items/ItemNaming.h"
#include "Contents/MessageTable.h"
#include "Contents/PlayerNameDictionary.h"
#include <cstdlib>
#include <cstring>
@ -39,6 +46,61 @@ ITEM_INFO UIRodexComposeWnd::GetItemAtPoint(int x, int y) {
return ITEM_INFO(0);
}
// OFFSET: 0x007FF710
// FUNCTION: fn_10003
void UIRodexComposeWnd::sub_7FF710(const ITEM_INFO& item) {
if (!this->unknown_0100) {
this->unknown_0100 = new UIItemTagOnMail();
if (!this->unknown_0100) {
return;
}
}
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
std::string name = naming.DisplayName(item, 0);
auto* tagCtrl = static_cast<UIItemTagOnMail*>(this->unknown_0100);
if (!tagCtrl->CanInsertTag(name, this->m_contents->geometry.width)) {
return;
}
tagCtrl->taggedText = this->m_contents->Text();
std::string appendResult = tagCtrl->AppendTag(naming.DisplayName(item, 0));
this->m_contents->SetText(appendResult.c_str());
this->m_contents->sub_855150();
tagCtrl->sub_89CFE0(item, 0xd630a9);
}
// OFFSET: 0x007FF940
// FUNCTION: fn_10004
void UIRodexComposeWnd::sub_7FF940(int tagId) {
if (!this->unknown_0100) {
this->unknown_0100 = new UIItemTagOnMail();
if (!this->unknown_0100) {
return;
}
}
auto* tagCtrl = static_cast<UIItemTagOnMail*>(this->unknown_0100);
if (tagCtrl->tags.size() >= 3) {
return;
}
if (this->m_contents->Length() + this->m_contents->unknown_00F0 > this->m_contents->maximum) {
return;
}
std::string tagText = tagCtrl->sub_874A40(tagId, 0xd630a9);
tagCtrl->taggedText = this->m_contents->Text();
std::string fullText = std::string(this->m_contents->Text()) + tagText;
this->m_contents->SetText(fullText.c_str());
this->m_contents->sub_855150();
}
// OFFSET: 0x00800480
// FUNCTION: fn_10006
void UIRodexEditCtrl3::Slot15(int width, int height) {
@ -98,6 +160,34 @@ void UIRodexComposeWnd::Slot25(int x, int y) {
}
}
// OFFSET: 0x00800FA0
// FUNCTION: fn_10010
void UIRodexComposeWnd::Slot28(int x, int y) {
ITEM_INFO item = this->GetItemAtPoint(x, y);
if (std::atoi(item.itemId.c_str()) != 0) {
int screenX = this->m_itemIndex * 34 + 30;
int screenY = 290;
this->ToScreen(screenX, screenY);
ItemDescriptions descriptions{g_itemDescriptions};
bool languagePrefix = false;
WORD language = g_serverLanguage->language;
ItemNaming naming{descriptions, g_itemCardNames, *g_playerNameDictionary, languagePrefix, g_serviceType, language};
ModeTooltip* tooltip = reinterpret_cast<ModeTooltip*>(g_modeMgr.gameMode);
if (item.identified == 1 && item.unknown_0098 != 0) {
unsigned int color = g_session.sub_DDD2C0(item);
std::string text = FormatOwnedString(LookupMessage(2600), naming.DisplayName(item, 0).c_str(), item.unknown_0098);
if (tooltip) {
tooltip->Show(text.c_str(), screenX, screenY, color, 0, 1);
}
} else {
unsigned int color = g_session.sub_DDD2C0(item);
if (tooltip) {
tooltip->Show(naming.DisplayName(item, 0).c_str(), screenX, screenY, color, 0, 1);
}
}
}
}
// OFFSET: 0x008011B0
// FUNCTION: fn_10011
void UIRodexComposeWnd::Slot19() {

View file

@ -29,6 +29,7 @@ public:
class UIRodexEditCtrl3 : public UIEditCtrl3 {
public:
void Slot15(int width, int height) override;
void sub_855150();
};
class UIRodexComposeWnd : public UIFrameWnd {
@ -38,7 +39,10 @@ public:
void Slot10(int x, int y, std::intptr_t value) override;
void Slot19() override;
void Slot25(int x, int y) override;
void Slot28(int x, int y) override;
void Slot32(int x, int y) override;
void sub_7FF710(const ITEM_INFO& item);
void sub_7FF940(int tagId);
ITEM_INFO GetItemAtPoint(int x, int y);
int MeasureText(const std::string& text, const unsigned& bytes);
void SetRecipient(int id, unsigned short job, unsigned short level, const char* name);