diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index 41e5ebf6..5cd665d3 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -1,4 +1,6 @@ +#include "Client/Session.h" #include "Contents/AdventureGuideMgr.h" +#include "Contents/Items/ItemInfo.h" #include "Contents/MessageTable.h" #include "Contents/RenewQuestMgr.h" #include "UI/AdventureGuide/UIAdventureGuide.h" @@ -7,14 +9,18 @@ #include "UI/Lists/UIVScrollBar.h" #include "UI/Text/UIStaticTextControl.h" #include "UI/Text/UITextViewerControl.h" +#include "UI/Window/UIWindowMgr.h" #include "Utility/Text/FormatString.h" +#include +#include #include #include template void CUIListBoxEx::UpdateScrollBar(); template void CUIListBox::UpdateScrollBar(); template void CUIListBox::UpdateScrollBar(); +template <> __declspec(noinline) void CUIListBox::SelectItem(CUIListItem* item); // OFFSET: 0x009C28B0 // OFFSET: 0x009C2980 @@ -495,3 +501,107 @@ void CUIAdventureGuide::MarkQuest(int questId) { } } } + +// OFFSET: 0x009DC140 +// FUNCTION: fn_14317 +void CUIAdventureGuide::OnSelectTab(AdventureGuide::CUITab* tab) { + this->titleText->SetText(tab->unknown_00F0.c_str(), tab->unknown_00F0.size()); + AdventureGuide::CUIPage* page = tab->page; + if (!page) { + return; + } + + const int type = tab->type; + CUIListBox* subTabs = tab->subTabs; + if (!subTabs) { + page->Slot54(type, 0); + return; + } + + if (!subTabs->items.empty()) { + AdventureGuide::CUISubTab* first = subTabs->items.front(); + if (first) { + subTabs->SelectItem(first); + if (first != subTabs->selected) { + return; + } + } + } + + if (subTabs->selected) { + page->Slot54(type, subTabs->selected->id); + } else { + page->Slot54(type, 0); + } +} + +namespace AdventureGuide { + +// OFFSET: 0x009DCE10 +// FUNCTION: fn_14330 +void CUICharacterInfo::Slot16() { + this->jobIcon->SetImage(std::format("유저인터페이스\\renewalparty\\icon_jobs_{}.bmp", g_session.m_job)); + const std::string level = std::format("Lv. {}", g_session.m_level); + this->level->SetText(level.c_str(), level.size()); + const std::string jobLevel = std::format("Jv. {}", g_session.m_jobLevel); + this->jobLevel->SetText(jobLevel.c_str(), jobLevel.size()); + const char* name = g_session.DecodePlayerName(); + this->name->SetText(name, std::strlen(name)); +} + +// OFFSET: 0x009DD750 +// FUNCTION: fn_14343 +void CUIItemInfo::Slot32(int, int) { + ITEM_INFO info; + info.SetItemId(this->itemId); + info.unknown_0000[0] = this->type; + info.identified = 1; + if (this->type == 5) { + info.unknown_0000[2] = this->location > 9 ? 0x22 : 2; + } else if (this->type == 4) { + switch (this->location) { + case 0: + info.unknown_0000[2] = 0x100; + break; + case 1: + info.unknown_0000[2] = 0x200; + break; + case 2: + info.unknown_0000[2] = 1; + break; + case 3: + info.unknown_0000[2] = 0x10; + break; + case 4: + info.unknown_0000[2] = 4; + break; + case 5: + info.unknown_0000[2] = 0x20; + break; + case 6: + info.unknown_0000[2] = 0x40; + break; + case 7: + info.unknown_0000[2] = 0x88; + break; + case 8: + info.unknown_0000[2] = 8; + break; + case 9: + info.unknown_0000[2] = 0x80; + break; + default: + info.unknown_0000[2] = 0; + break; + } + } else { + info.unknown_0000[2] = 0; + } + + UIWindow* window = g_windowMgr.EnsureWindow(12); + if (window) { + window->SendMsg(nullptr, 0x18, reinterpret_cast(&info), 0, 0, 0); + } +} + +} diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index f3a84b73..d98f2555 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -12,9 +12,12 @@ public: virtual void Slot53(); void OnButtonClick(); + void OnSelectTab(AdventureGuide::CUITab* tab); void MarkQuest(int questId); - /* 00D8 */ unsigned char unknown_00D8[0x20]; + /* 00D8 */ unsigned char unknown_00D8[0x0C]; + /* 00E4 */ CUIStaticText* titleText; + /* 00E8 */ unsigned char unknown_00E8[0x10]; /* 00F8 */ CUIListBox* tabs; }; @@ -25,6 +28,16 @@ public: virtual void Slot54(int first, int second) = 0; }; +class CUICharacterInfo : public CUIControl { +public: + void Slot16() override; + + /* 0084 */ CUIStaticText* level; + /* 0088 */ CUIStaticText* jobLevel; + /* 008C */ CUIStaticText* name; + /* 0080 */ CUIStaticImage* jobIcon; +}; + class CUIIntro : public CUIPage { public: void Slot16() override; diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 91e91a4b..3dc3aac6 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -67,12 +67,15 @@ public: class CUIItemInfo : public CUIListItem { public: void Slot16() override; + void Slot32(int x, int y) override; /* 00E8 */ unsigned char unknown_00E8[0x08]; /* 00F0 */ CUIStaticText* unknown_00F0; /* 00F4 */ CUIStaticText* unknown_00F4; /* 00F8 */ CUIStaticText* unknown_00F8; - /* 00FC */ unsigned char unknown_00FC[0x0C]; + /* 00FC */ int itemId; + /* 0100 */ int type; + /* 0104 */ int location; /* 0108 */ std::string unknown_0108; };