diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index 96f8ae54..86e3ec73 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -9,6 +9,9 @@ #include "UI/Text/UITextViewerControl.h" #include "Utility/Text/FormatString.h" +#include +#include + template void CUIListBoxEx::UpdateScrollBar(); template void CUIListBox::UpdateScrollBar(); template void CUIListBox::UpdateScrollBar(); @@ -287,12 +290,67 @@ void CUIQuestInfo::SetViewerLines(const std::vector& lines) { void CUIIntro::Slot54(int, int) { } +// OFFSET: 0x009DDA50 +// FUNCTION: fn_14348 +void CUIItem::Slot54(int type, int id) { + this->itemList->ClearData(); + this->location = id; + std::list> entries; + g_adventureGuideMgr->GetEntryList(entries, type, id); + for (const auto& [key, entry] : entries) { + CItemData data; + data.id = key; + data.first = entry.unknown_0000; + data.second = entry.unknown_0001; + data.third = entry.unknown_0002; + data.unknown_0008 = entry.unknown_0004; + data.unknown_000C = entry.unknown_0008; + data.text = entry.text; + data.values = entry.values; + data.type = type; + this->itemList->data.push_back(data); + } + this->itemList->UpdateScrollBar(); + this->unknown_0084->Show(0); + this->unknown_0088->Show(0); +} + // OFFSET: 0x009DDE50 // FUNCTION: fn_14350 void CUIMonster::Slot54(int, int) { this->unknown_0084->Show(0); } +// OFFSET: 0x009DDE60 +// FUNCTION: fn_14351 +void CUIQuest::Slot54(int type, int id) { + this->questList->ClearData(); + std::list> contents; + g_adventureGuideMgr->GetContentsList(contents, type, id); + for (const auto& [key, content] : contents) { + CQuestInfo data; + data.id = key; + data.unknown_0004 = content.unknown_0000; + data.unknown_0008 = content.unknown_0004; + data.unknown_000C = content.unknown_0008; + data.questId = content.unknown_000C; + data.title = content.first; + data.text = content.second; + data.rewards = content.values; + data.type = type; + this->questList->data.push_back(data); + if (type == 1 && !g_renewQuestMgr->IsNewQuest(content.unknown_000C)) { + g_renewQuestMgr->AddStatusRequest(content.unknown_000C); + } + } + this->questList->UpdateScrollBar(); + if (type == 1) { + g_renewQuestMgr->SendQuestStatusRequest(); + } + this->unknown_0084->Show(0); + this->unknown_0088->Show(0); +} + // OFFSET: 0x009DE410 // FUNCTION: fn_14353 diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index 6ff7bc1b..f3a84b73 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -42,13 +42,15 @@ class CUIItem : public CUIPage { public: void Slot16() override; void Paint() override; + void Slot54(int type, int id) override; void OnSelectItem(CUIItemInfo* item, const CItemData& data); /* 0084 */ UIWindow* unknown_0084; /* 0088 */ UIWindow* unknown_0088; /* 008C */ std::string unknown_008C; - /* 00A4 */ unsigned char unknown_00A4[0x04]; + /* 00A4 */ int location; + /* 0080 */ CUIListBoxEx* itemList; }; class CUIMonster : public CUIPage { @@ -68,6 +70,7 @@ class CUIQuest : public CUIPage { public: void Slot16() override; void Paint() override; + void Slot54(int type, int id) override; void OnSelectQuest(CUIQuestInfo* item, const CQuestInfo& data); @@ -81,7 +84,6 @@ public: #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(AdventureGuide::CUIIntro) == 0x8C); -static_assert(sizeof(AdventureGuide::CUIItem) == 0xA8); static_assert(sizeof(AdventureGuide::CUIMonster) == 0xA4); static_assert(sizeof(AdventureGuide::CUIQuest) == 0xA8); #endif diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 0e9f95f3..b55a8542 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -105,13 +106,36 @@ public: /* 00E8 */ CUIStaticText* unknown_00E8; /* 00EC */ CUIStaticText* unknown_00EC; }; -class CItemData {}; +class CItemData { +public: + /* 0000 */ int id; + /* 0004 */ std::uint8_t first; + /* 0005 */ std::uint8_t second; + /* 0006 */ std::uint8_t third; + /* 0008 */ int unknown_0008; + /* 000C */ int unknown_000C; + /* 0010 */ std::string text; + /* 0028 */ std::vector values; + /* 0034 */ int type; +}; + class CMonsterData { public: /* 0000 */ std::string name; /* 0018 */ std::vector values; }; -class CQuestInfo {}; +class CQuestInfo { +public: + /* 0000 */ int id; + /* 0004 */ std::uint8_t unknown_0004; + /* 0008 */ int unknown_0008; + /* 000C */ int unknown_000C; + /* 0010 */ int questId; + /* 0014 */ std::string title; + /* 002C */ std::string text; + /* 0044 */ std::vector rewards; + /* 0050 */ int type; +}; } namespace Guide_Intro {