diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index 8bed2e6a..d154311c 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -490,6 +490,38 @@ void CUIQuest::OnSelectQuest(CUIQuestInfo* item, const CQuestInfo&) { this->unknown_0088->Show(selected); } +// OFFSET: 0x009DC770 +// FUNCTION: fn_14323 +void __stdcall BindQuestInfo(CUIQuestInfo* owner, const CQuestInfo& data) { + switch (data.type) { + case 1: + reinterpret_cast(0x009E0350)(owner, data.id); + owner->SetViewerLines(data.rewards); + owner->unknown_00F8 = data.title; + reinterpret_cast(owner->unknown_00F4)->Clear(); + reinterpret_cast(owner->unknown_00F4)->AddLine(data.text); + owner->questId = data.questId; + owner->unknown_00E8->Show(g_renewQuestMgr->IsNewQuest(data.questId)); + break; + case 3: + reinterpret_cast(0x009E0350)(owner, data.id); + owner->SetViewerLines(data.rewards); + owner->unknown_00F8 = data.title; + reinterpret_cast(owner->unknown_00F4)->Clear(); + reinterpret_cast(owner->unknown_00F4)->AddLine(data.text); + owner->unknown_00E8->Show(0); + return; + case 4: + reinterpret_cast(0x009DE7D0)(owner, data.id); + owner->SetViewerLines(data.rewards); + owner->unknown_00F8 = data.title; + reinterpret_cast(owner->unknown_00F4)->Clear(); + reinterpret_cast(owner->unknown_00F4)->AddLine(data.text); + owner->unknown_00E8->Show(0); + return; + } +} + // OFFSET: 0x009DC8E0 // FUNCTION: fn_14324 void CUIIntro::Paint() { @@ -853,6 +885,73 @@ void CUIListBox::SelectItem(CUIListItem* item) { } } +// OFFSET: 0x009DC950 +// FUNCTION: fn_14329 +void CUIAdventureGuide::Slot16() { + const char* title = LookupMessage(0xFD5); + this->titleBar->SetTitle(title, std::strlen(title)); + + std::map pages = { + {0, this->intro}, + {1, this->quest}, + {2, this->monster}, + {3, this->quest}, + {4, this->quest}, + {5, this->item}, + {6, this->item}, + }; + + for (const auto& [type, intro] : g_adventureGuideMgr->m_intros) { + AdventureGuide::CUITab* tab = + reinterpret_cast*)>(0x009DB4B0)(this->tabs); + tab->type = type; + tab->unknown_00E8->SetText(intro.text.c_str(), intro.text.size()); + tab->unknown_00F0 = intro.title; + tab->unknown_0110 = this->tabs->rowHeight; + + auto page = pages.find(tab->type); + if (page != pages.end() && page->first == tab->type) { + tab->page = page->second; + } + + if (!intro.details.empty()) { + std::map details; + for (const auto& [id, detail] : intro.details) { + if (g_adventureGuideMgr->IsAvailable(tab->type, id)) { + details[id] = detail; + } + } + if (!details.empty()) { + CUIListBox* subTabs = tab->CreateSubTabList(); + subTabs->Resize(subTabs->geometry.width, subTabs->rowHeight * static_cast(details.size())); + for (const auto& [id, detail] : details) { + AdventureGuide::CUISubTab* subTab = + reinterpret_cast*)>(0x009DB280)(subTabs); + subTab->unknown_00E8->SetText(detail.text.c_str(), detail.text.size()); + subTab->id = id; + subTab->unknown_00F4 = detail.unknown_0008; + if (tab->type == 1) { + const bool isNew = g_renewQuestMgr->IsNewQuest(detail.unknown_0008); + subTab->unknown_00EC->Show(isNew); + if (!isNew) { + g_renewQuestMgr->AddStatusRequest(detail.unknown_0008); + } + } + } + tab->Resize(tab->geometry.width, this->tabs->rowHeight + subTabs->geometry.height); + } + } + } + + if (!this->tabs->items.empty()) { + AdventureGuide::CUITab* first = this->tabs->items.front(); + if (first) { + reinterpret_cast*, CUIListItem*)>(0x009DE560)(this->tabs, first); + } + } + g_renewQuestMgr->SendQuestStatusRequest(); +} + // OFFSET: 0x009DEBF0 // FUNCTION: fn_14357 void CUIAdventureGuide::MarkQuest(int questId) { diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index db90cf6f..c5413d6b 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -19,6 +19,7 @@ class CUIAdventureGuide : public CUIFrameWnd { public: __declspec(noinline) CUIAdventureGuide(); void Slot15(int width, int height) override; + void Slot16() override; virtual void Slot53(); void OnButtonClick();