Decompile fn_11212 (UITextViewer::AddUrlLinks)
Batch #1848 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_11212 UITextViewer::AddUrlLinks: logic confirmed by peer review Peer-reviewed-by: Yommy Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
7f865917a0
commit
9953d967a3
1 changed files with 46 additions and 0 deletions
|
|
@ -182,6 +182,52 @@ bool UITextViewer::AddQuestLinks(std::string text, unsigned addedLines) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: 0x00878750
|
// OFFSET: 0x00878750
|
||||||
|
// OFFSET: 0x00878750
|
||||||
|
// FUNCTION: fn_11212
|
||||||
|
bool UITextViewer::AddUrlLinks(std::string text, unsigned addedLines) {
|
||||||
|
auto& owner = this->m_text->list;
|
||||||
|
std::string parsed = RemoveTextColors(text.c_str(), owner.codePage);
|
||||||
|
parsed = DisplayTextTag(std::move(parsed), "<NAVI>", "</NAVI>");
|
||||||
|
parsed = DisplayTextTag(std::move(parsed), "<ITEM>", "</ITEM>");
|
||||||
|
|
||||||
|
if (this->m_text->chatConversions) {
|
||||||
|
parsed = this->ConvertChat(std::move(parsed));
|
||||||
|
}
|
||||||
|
|
||||||
|
parsed = DisplayTextTag(std::move(parsed), "<TIPBOX>", "</TIPBOX>");
|
||||||
|
std::string navigation;
|
||||||
|
DisplayNavigationLink(navigation, parsed);
|
||||||
|
parsed = std::move(navigation);
|
||||||
|
parsed = DisplayTextTag(std::move(parsed), "<QUEST>", "</QUEST>");
|
||||||
|
|
||||||
|
std::vector<TextLink> extracted;
|
||||||
|
ExtractTextLinks(parsed, "<URL>", "</URL>", extracted);
|
||||||
|
|
||||||
|
if (extracted.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& link : extracted) {
|
||||||
|
auto* button = new UITextButton(*this->m_context, this->m_text->buttons);
|
||||||
|
button->Configure(link.display.c_str(), 0x00E6A300, 0, 12, 0, 1);
|
||||||
|
button->m_hoverColor = 0x00EFB700;
|
||||||
|
button->SetId(437);
|
||||||
|
const int height = button->geometry.height;
|
||||||
|
const int width = this->TextWidth(owner.fonts, owner.locale, link.display.c_str(), 0, 0, 12, 0, 0);
|
||||||
|
button->Resize(width + 1, height);
|
||||||
|
parsed = RemoveTextLinkInfo(parsed);
|
||||||
|
const auto position = this->LinkPosition(link.position, addedLines);
|
||||||
|
button->m_value = position.first;
|
||||||
|
button->Move(position.second, -100);
|
||||||
|
this->AddChild(button);
|
||||||
|
SplitTextLinkArguments(link.metadata, button->m_lines);
|
||||||
|
this->links.push_back(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->SendMsg(nullptr, 7, 0, 0, 0, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// INLINED
|
// INLINED
|
||||||
void UITextViewer::AddLinks(const char* text, unsigned addedLines, int kind) {
|
void UITextViewer::AddLinks(const char* text, unsigned addedLines, int kind) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue