Batch #7578 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_13992 AdventureGuide::CUITab::CreateSubTabList: logic confirmed by peer review Peer-reviewed-by: Yommy, secret Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
900 lines
30 KiB
C++
900 lines
30 KiB
C++
#include "Client/Session.h"
|
|
#include "Contents/AdventureGuideMgr.h"
|
|
#include "Contents/Items/ItemInfo.h"
|
|
#include "Contents/MessageTable.h"
|
|
#include "Contents/NavigationManager.h"
|
|
#include "Contents/RenewQuestMgr.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "Resource/Sprites/ActionResource.h"
|
|
#include "Resource/Sprites/SpriteResource.h"
|
|
#include "UI/AdventureGuide/UIAdventureGuide.h"
|
|
#include "UI/Lists/UIListBoxTemplate.h"
|
|
#include "Render/Renderer.h"
|
|
#include "UI/Lists/UIVScrollBar.h"
|
|
#include "UI/Text/UIStaticTextControl.h"
|
|
#include "UI/Text/UITextViewerControl.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
#include "Utility/Cipher/XorBytes.h"
|
|
#include "Utility/Text/FormatString.h"
|
|
|
|
#include <cstring>
|
|
#include <format>
|
|
#include <list>
|
|
#include <utility>
|
|
|
|
template void CUIListBoxEx<AdventureGuide::CUIMonsterInfo, AdventureGuide::CMonsterData>::UpdateScrollBar();
|
|
template void CUIListBox<AdventureGuide::CUITab>::UpdateScrollBar();
|
|
template void CUIListBox<AdventureGuide::CUISubTab>::UpdateScrollBar();
|
|
template <> __declspec(noinline) void CUIListBox<AdventureGuide::CUISubTab>::SelectItem(CUIListItem* item);
|
|
|
|
// OFFSET: 0x009C28B0
|
|
// OFFSET: 0x009C2980
|
|
// FUNCTION: fn_13993
|
|
// FUNCTION: fn_13994
|
|
template <class T> void CUIListBox<T>::Slot15(int width, int height) {
|
|
this->scrollBar = new CUIVScrollBar(*this->m_context);
|
|
this->scrollBar->Show(0);
|
|
this->scrollBar->SetOnChange([this](int position) {
|
|
int y = 0;
|
|
for (T* item : this->items) {
|
|
if (position <= item->geometry.height + y && y < this->geometry.height + position) {
|
|
item->Show(1);
|
|
item->Move(this->itemX, this->itemY - position + y);
|
|
} else {
|
|
item->Show(0);
|
|
}
|
|
y += item->geometry.height;
|
|
}
|
|
});
|
|
this->AddChild(this->scrollBar);
|
|
}
|
|
|
|
template void CUIListBox<AdventureGuide::CUISubTab>::Slot15(int, int);
|
|
template void CUIListBox<AdventureGuide::CUITab>::Slot15(int, int);
|
|
|
|
// OFFSET: 0x009C2A50
|
|
// OFFSET: 0x009C2B20
|
|
// OFFSET: 0x009C2BF0
|
|
// OFFSET: 0x009C2CC0
|
|
// FUNCTION: fn_13995
|
|
// FUNCTION: fn_13996
|
|
// FUNCTION: fn_13997
|
|
// FUNCTION: fn_13998
|
|
template <class T, class D> void CUIListBoxEx<T, D>::Slot15(int width, int height) {
|
|
this->scrollBar = new CUIVScrollBar(*this->m_context);
|
|
this->scrollBar->Show(0);
|
|
this->scrollBar->SetOnChange([this](int position) { this->OnScroll(position); });
|
|
this->AddChild(this->scrollBar);
|
|
}
|
|
|
|
template void CUIListBoxEx<AdventureGuide::CUIItemInfo, AdventureGuide::CItemData>::Slot15(int, int);
|
|
template void CUIListBoxEx<AdventureGuide::CUIMonsterInfo, AdventureGuide::CMonsterData>::Slot15(int, int);
|
|
template void CUIListBoxEx<AdventureGuide::CUIQuestInfo, AdventureGuide::CQuestInfo>::Slot15(int, int);
|
|
template void CUIListBoxEx<AdventureGuide::CUITabInfo, Guide_Intro::Contents>::Slot15(int, int);
|
|
|
|
// OFFSET: 0x009C12B0
|
|
// FUNCTION: fn_13987
|
|
template <>
|
|
void CUIListBoxEx<AdventureGuide::CUIItemInfo, AdventureGuide::CItemData>::ClearItems() {
|
|
for (AdventureGuide::CUIItemInfo* item : this->items) {
|
|
this->RemoveChild(item, 1);
|
|
}
|
|
|
|
this->items.clear();
|
|
this->selected = static_cast<unsigned int>(-1);
|
|
}
|
|
|
|
// OFFSET: 0x009C1310
|
|
// FUNCTION: fn_13988
|
|
template <>
|
|
void CUIListBoxEx<AdventureGuide::CUIMonsterInfo, AdventureGuide::CMonsterData>::ClearItems() {
|
|
for (AdventureGuide::CUIMonsterInfo* item : this->items) {
|
|
this->RemoveChild(item, 1);
|
|
}
|
|
|
|
this->items.clear();
|
|
this->selected = static_cast<unsigned int>(-1);
|
|
}
|
|
|
|
// OFFSET: 0x009C1370
|
|
// FUNCTION: fn_13989
|
|
template <>
|
|
void CUIListBoxEx<AdventureGuide::CUIQuestInfo, AdventureGuide::CQuestInfo>::ClearItems() {
|
|
for (AdventureGuide::CUIQuestInfo* item : this->items) {
|
|
this->RemoveChild(item, 1);
|
|
}
|
|
|
|
this->items.clear();
|
|
this->selected = static_cast<unsigned int>(-1);
|
|
}
|
|
|
|
// OFFSET: 0x009C13D0
|
|
// FUNCTION: fn_13990
|
|
template <>
|
|
void CUIListBoxEx<AdventureGuide::CUITabInfo, Guide_Intro::Contents>::ClearItems() {
|
|
for (AdventureGuide::CUITabInfo* item : this->items) {
|
|
this->RemoveChild(item, 1);
|
|
}
|
|
|
|
this->items.clear();
|
|
this->selected = static_cast<unsigned int>(-1);
|
|
}
|
|
|
|
// OFFSET: 0x009C14F0
|
|
// FUNCTION: fn_13991
|
|
void CUIAdventureGuide::Slot53() {
|
|
this->unknown_00B4 = 0;
|
|
this->Resize(750, 468);
|
|
this->Move((g_renderer->viewport.width - this->geometry.width) / 2, (g_renderer->viewport.height - this->geometry.height) / 2);
|
|
this->Slot15(this->geometry.width, this->geometry.height);
|
|
this->Slot16();
|
|
}
|
|
|
|
// OFFSET: 0x009DB710
|
|
// FUNCTION: fn_14308
|
|
void CUIAdventureGuide::OnButtonClick() {
|
|
}
|
|
|
|
// OFFSET: 0x009DBFD0
|
|
// FUNCTION: fn_14313
|
|
void CRenewQuestMgr::AddStatusRequest(unsigned int id) {
|
|
this->m_statusRequests.insert(id);
|
|
}
|
|
|
|
namespace AdventureGuide {
|
|
|
|
// OFFSET: 0x009DC0B0
|
|
// FUNCTION: fn_14314
|
|
void CUITab::OnSelectSubTab(CUISubTab* subTab) {
|
|
if (subTab) {
|
|
this->page->Slot54(this->type, subTab->id);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009DC0E0
|
|
// FUNCTION: fn_14315
|
|
void CUIIntro::OnSelectContents(CUITabInfo*, const Guide_Intro::Contents&) {
|
|
}
|
|
|
|
// OFFSET: 0x009DC210
|
|
// FUNCTION: fn_14318
|
|
void CUIItem::OnSelectItem(CUIItemInfo* item, const CItemData&) {
|
|
if (item) {
|
|
this->unknown_008C = item->unknown_0108;
|
|
}
|
|
const bool selected = !this->unknown_008C.empty();
|
|
this->unknown_0084->Show(selected);
|
|
this->unknown_0088->Show(selected);
|
|
}
|
|
|
|
// OFFSET: 0x009DC270
|
|
// FUNCTION: fn_14319
|
|
void CUIMonster::OnSelectMonster(CUIMonsterInfo* item, const CMonsterData&) {
|
|
if (item) {
|
|
this->unknown_0088 = item->unknown_00E8->unknown_0098;
|
|
}
|
|
this->unknown_0084->Show(!this->unknown_0088.empty());
|
|
}
|
|
|
|
// OFFSET: 0x009DC2C0
|
|
// FUNCTION: fn_14320
|
|
void CUIQuest::OnSelectQuest(CUIQuestInfo* item, const CQuestInfo&) {
|
|
if (item) {
|
|
this->unknown_008C = item->unknown_00F8;
|
|
}
|
|
const bool selected = !this->unknown_008C.empty();
|
|
this->unknown_0084->Show(selected);
|
|
this->unknown_0088->Show(selected);
|
|
}
|
|
|
|
// OFFSET: 0x009DC8E0
|
|
// FUNCTION: fn_14324
|
|
void CUIIntro::Paint() {
|
|
this->ClearSurface(0xFFFF00FF);
|
|
}
|
|
|
|
// OFFSET: 0x009DC8F0
|
|
// FUNCTION: fn_14325
|
|
void CUIItem::Paint() {
|
|
this->ClearSurface(0xFFFF00FF);
|
|
}
|
|
|
|
// OFFSET: 0x009DC900
|
|
// FUNCTION: fn_14326
|
|
void CUIMonster::Paint() {
|
|
this->ClearSurface(0xFFFF00FF);
|
|
}
|
|
|
|
// OFFSET: 0x009DC940
|
|
// FUNCTION: fn_14328
|
|
void CUIQuest::Paint() {
|
|
this->ClearSurface(0xFFFF00FF);
|
|
}
|
|
|
|
// OFFSET: 0x009DCFF0
|
|
// FUNCTION: fn_14331
|
|
void CUIIntro::Slot16() {
|
|
const std::string& title = g_adventureGuideMgr->unknown_0014;
|
|
const std::map<int, AdventureGuideText>& texts = g_adventureGuideMgr->unknown_002C;
|
|
if (texts.empty()) {
|
|
return;
|
|
}
|
|
|
|
for (const auto& text : texts) {
|
|
this->contents->data.emplace_back(text.second.first, text.second.second);
|
|
}
|
|
|
|
this->contents->UpdateScrollBar();
|
|
this->image->SetImage(title);
|
|
this->contents->scrollBar->SetHidden(1);
|
|
}
|
|
|
|
// OFFSET: 0x009DD1C0
|
|
// FUNCTION: fn_14333
|
|
void CUIItem::Slot16() {
|
|
}
|
|
|
|
// OFFSET: 0x009DD6B0
|
|
// FUNCTION: fn_14338
|
|
void CUIQuest::Slot16() {
|
|
}
|
|
|
|
// OFFSET: 0x009DD1D0
|
|
// FUNCTION: fn_14334
|
|
void CUIItemInfo::Slot16() {
|
|
this->unknown_00F0->scrollBar->SetHidden(1);
|
|
this->unknown_00F4->scrollBar->SetHidden(1);
|
|
this->unknown_00F8->scrollBar->SetHidden(1);
|
|
}
|
|
|
|
// OFFSET: 0x009DD210
|
|
// FUNCTION: fn_14335
|
|
void CUIMonster::Slot16() {
|
|
std::list<AdventureGuideEpisode> episodes;
|
|
g_adventureGuideMgr->GetEpisodeList(episodes);
|
|
for (const AdventureGuideEpisode& episode : episodes) {
|
|
CMonsterData data;
|
|
data.name = episode.name;
|
|
data.values = episode.values;
|
|
this->monsterList->data.push_back(data);
|
|
}
|
|
this->monsterList->UpdateScrollBar();
|
|
}
|
|
|
|
// OFFSET: 0x009DD680
|
|
// FUNCTION: fn_14337
|
|
void CUIMonsterInfo::Slot16() {
|
|
this->unknown_00EC->scrollBar->SetHidden(1);
|
|
this->unknown_00F0->scrollBar->SetHidden(1);
|
|
}
|
|
|
|
// OFFSET: 0x009DD6C0
|
|
// FUNCTION: fn_14339
|
|
void CUIQuestInfo::Slot16() {
|
|
this->unknown_00EC->scrollBar->SetHidden(1);
|
|
CUIVScrollBar* first = this->unknown_00EC->scrollBar;
|
|
first->dragging = 0;
|
|
first->Invalidate();
|
|
this->unknown_00F0->scrollBar->SetHidden(1);
|
|
CUIVScrollBar* last = this->unknown_00F4->scrollBar;
|
|
last->dragging = 1;
|
|
last->Invalidate();
|
|
}
|
|
|
|
// OFFSET: 0x009DD720
|
|
// FUNCTION: fn_14340
|
|
void CUISubTab::Slot16() {
|
|
this->unknown_00EC->Show(0);
|
|
}
|
|
|
|
// OFFSET: 0x009DD730
|
|
// FUNCTION: fn_14341
|
|
void CUITab::Slot16() {
|
|
}
|
|
|
|
// OFFSET: 0x009DD740
|
|
// FUNCTION: fn_14342
|
|
void CUITabInfo::Slot16() {
|
|
}
|
|
|
|
// OFFSET: 0x009DC0F0
|
|
// FUNCTION: fn_14316
|
|
void CUIIntro::BindContents(CUITabInfo* item, const Guide_Intro::Contents& contents) {
|
|
item->unknown_00E8->SetText(contents.first.c_str(), contents.first.size());
|
|
item->unknown_00EC->SetText(contents.second.c_str(), contents.second.size());
|
|
}
|
|
|
|
// OFFSET: 0x009DFAD0
|
|
// FUNCTION: fn_14359
|
|
void CUIQuestInfo::SetStatusLines(bool first, bool second, bool third) {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->Clear();
|
|
if (first == true) {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->SetTextColor(0xC86464u);
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC2)));
|
|
} else {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->SetTextColor(0x6464C8u);
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC3)));
|
|
}
|
|
if (second == true) {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->SetTextColor(0xC86464u);
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC4)));
|
|
} else {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->SetTextColor(0x6464C8u);
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC5)));
|
|
}
|
|
if (third == true) {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->SetTextColor(0xC86464u);
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC6)));
|
|
} else {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->SetTextColor(0x6464C8u);
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC7)));
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009E07B0
|
|
// FUNCTION: fn_14362
|
|
void CUIQuestInfo::SetViewerLines(const std::vector<std::string>& lines) {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F0)->Clear();
|
|
for (const std::string& line : lines) {
|
|
reinterpret_cast<CUITextViewer*>(this->unknown_00F0)->AddLine(line);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009DDA40
|
|
// FUNCTION: fn_14347
|
|
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<std::pair<int, AdventureGuideEntry>> 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<std::pair<int, AdventureGuideContents>> 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
|
|
void CUITab::SetSelected(bool selected) {
|
|
CUIListItem::SetSelected(selected);
|
|
const bool expand = selected && this->subTabs && !this->subTabs->geometry.visible;
|
|
if (this->subTabs) {
|
|
this->subTabs->Show(expand);
|
|
}
|
|
this->Resize(this->geometry.width, this->unknown_0110 + (expand ? this->subTabs->geometry.height : 0));
|
|
CUIListBox<CUITab>* list = dynamic_cast<CUIListBox<CUITab>*>(this->parent);
|
|
if (list) {
|
|
list->UpdateScrollBar();
|
|
}
|
|
if (this->page) {
|
|
this->page->Show(selected);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// OFFSET: 0x009DE4C0
|
|
// FUNCTION: fn_14354
|
|
template <>
|
|
void CUIListBox<AdventureGuide::CUISubTab>::SelectItem(CUIListItem* item) {
|
|
if (this->locked) {
|
|
return;
|
|
}
|
|
for (AdventureGuide::CUISubTab* entry : this->items) {
|
|
if (entry != item) {
|
|
entry->SetSelected(false);
|
|
}
|
|
}
|
|
item->SetSelected(true);
|
|
if (this->selected != item) {
|
|
AdventureGuide::CUISubTab* selected = dynamic_cast<AdventureGuide::CUISubTab*>(item);
|
|
if (selected) {
|
|
this->selected = selected;
|
|
if (this->onSelect) {
|
|
this->onSelect(selected);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009DE560
|
|
// FUNCTION: fn_14355
|
|
template <>
|
|
void CUIListBox<AdventureGuide::CUITab>::SelectItem(CUIListItem* item) {
|
|
if (this->locked) {
|
|
return;
|
|
}
|
|
for (AdventureGuide::CUITab* entry : this->items) {
|
|
if (entry != item) {
|
|
entry->SetSelected(false);
|
|
}
|
|
}
|
|
item->SetSelected(true);
|
|
if (this->selected != item) {
|
|
AdventureGuide::CUITab* selected = dynamic_cast<AdventureGuide::CUITab*>(item);
|
|
if (selected) {
|
|
this->selected = selected;
|
|
if (this->onSelect) {
|
|
this->onSelect(selected);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009DEBF0
|
|
// FUNCTION: fn_14357
|
|
void CUIAdventureGuide::MarkQuest(int questId) {
|
|
for (AdventureGuide::CUITab* tab : this->tabs->items) {
|
|
if (tab->type != 1) {
|
|
continue;
|
|
}
|
|
|
|
if (tab->subTabs) {
|
|
std::list<AdventureGuide::CUISubTab*> subTabs = tab->subTabs->items;
|
|
auto found = std::find_if(subTabs.begin(), subTabs.end(), [questId](AdventureGuide::CUISubTab* subTab) {
|
|
return subTab->unknown_00F4 == static_cast<unsigned int>(questId);
|
|
});
|
|
if (found != subTabs.end()) {
|
|
(*found)->unknown_00EC->Show(1);
|
|
}
|
|
}
|
|
|
|
AdventureGuide::CUIQuest* quest = dynamic_cast<AdventureGuide::CUIQuest*>(tab->page);
|
|
if (quest) {
|
|
std::vector<AdventureGuide::CUIQuestInfo*> items = quest->questList->items;
|
|
auto found = std::find_if(items.begin(), items.end(), [questId](AdventureGuide::CUIQuestInfo* item) {
|
|
return item->questId == questId;
|
|
});
|
|
if (found != items.end()) {
|
|
(*found)->unknown_00E8->Show(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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<AdventureGuide::CUISubTab>* 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 {
|
|
|
|
template <std::size_t Length, std::uint64_t Key>
|
|
class EncryptedName {
|
|
public:
|
|
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
|
|
for (std::uint64_t index = 0; index < Length; ++index) {
|
|
this->m_text[index] = source[index];
|
|
}
|
|
}
|
|
|
|
~EncryptedName() {
|
|
for (std::uint64_t index = 0; index < Length; ++index) {
|
|
this->m_text[index] = 0;
|
|
}
|
|
}
|
|
|
|
const char* Text() {
|
|
if (this->m_encrypted) {
|
|
utility::XorBytes(this->m_text, Length, Key);
|
|
this->m_encrypted = false;
|
|
}
|
|
|
|
return reinterpret_cast<const char*>(this->m_text);
|
|
}
|
|
|
|
private:
|
|
std::uint8_t m_text[Length];
|
|
bool m_encrypted;
|
|
};
|
|
|
|
}
|
|
|
|
namespace AdventureGuide {
|
|
|
|
// OFFSET: 0x009C5400
|
|
// FUNCTION: fn_14000
|
|
void CUICharacterInfo::Slot15(int width, int height) {
|
|
this->jobIcon = new CUIStaticImage(*this->m_context);
|
|
this->jobIcon->SetSize(25, 25);
|
|
this->jobIcon->Move(10, 8);
|
|
this->jobIcon->SetImage(std::string());
|
|
this->AddChild(this->jobIcon);
|
|
|
|
this->level = new CUIStaticText(*this->m_context);
|
|
this->level->SetSize(50, 12);
|
|
this->level->Move(46, 6);
|
|
this->level->SetText("", 0);
|
|
this->level->SetFitText(0);
|
|
this->level->SetAlign(0, 0);
|
|
const std::uint8_t levelFontSource[] = {0xFE, 0x70, 0x1B, 0x26, 0x66, 0x1D};
|
|
// GLOBAL: gl_25126
|
|
thread_local EncryptedName<sizeof(levelFontSource), 0x758F1D0B4F7705B9ULL> levelFont(levelFontSource);
|
|
this->level->SetFont(std::string(levelFont.Text()));
|
|
this->level->SetFontHeight(12);
|
|
this->level->SetBold(0);
|
|
this->level->SetColor(0);
|
|
this->level->SetShadow(1, 0xFFFFFF);
|
|
this->level->SetOutline(0, 0xFFFFFF);
|
|
this->AddChild(this->level);
|
|
|
|
this->jobLevel = new CUIStaticText(*this->m_context);
|
|
this->jobLevel->SetSize(50, 12);
|
|
this->jobLevel->Move(97, 6);
|
|
this->jobLevel->SetText("", 0);
|
|
this->jobLevel->SetFitText(0);
|
|
this->jobLevel->SetAlign(0, 0);
|
|
const std::uint8_t jobLevelFontSource[] = {0x70, 0x32, 0xC1, 0x50, 0xD2, 0xE5};
|
|
// GLOBAL: gl_25127
|
|
thread_local EncryptedName<sizeof(jobLevelFontSource), 0x17A9E5BF39AD4737ULL> jobLevelFont(jobLevelFontSource);
|
|
this->jobLevel->SetFont(std::string(jobLevelFont.Text()));
|
|
this->jobLevel->SetFontHeight(12);
|
|
this->jobLevel->SetBold(0);
|
|
this->jobLevel->SetColor(0);
|
|
this->jobLevel->SetShadow(1, 0xFFFFFF);
|
|
this->jobLevel->SetOutline(0, 0xFFFFFF);
|
|
this->AddChild(this->jobLevel);
|
|
|
|
this->name = new CUIStaticText(*this->m_context);
|
|
this->name->SetSize(100, 12);
|
|
this->name->Move(45, 22);
|
|
this->name->SetText("", 0);
|
|
this->name->SetFitText(1);
|
|
this->name->SetAlign(0, 0);
|
|
const std::uint8_t nameFontSource[] = {0x20, 0xDE, 0xFD, 0xCC, 0xCC, 0x3F};
|
|
// GLOBAL: gl_25128
|
|
thread_local EncryptedName<sizeof(nameFontSource), 0x13E33FA1A591AB67ULL> nameFont(nameFontSource);
|
|
this->name->SetFont(std::string(nameFont.Text()));
|
|
this->name->SetFontHeight(12);
|
|
this->name->SetBold(0);
|
|
this->name->SetColor(0);
|
|
this->name->SetShadow(1, 0xFFFFFF);
|
|
this->name->SetOutline(0, 0xFFFFFF);
|
|
this->AddChild(this->name);
|
|
}
|
|
|
|
// 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<std::intptr_t>(&info), 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009DC720
|
|
// FUNCTION: fn_14322
|
|
void CUIMonster::BindMonster(CUIMonsterInfo* item, const CMonsterData& data) {
|
|
item->SetMonster(data.name);
|
|
reinterpret_cast<CUITextViewer*>(item->unknown_00F0)->Clear();
|
|
for (const std::string& value : data.values) {
|
|
reinterpret_cast<CUITextViewer*>(item->unknown_00F0)->AddLine(value);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x009DFCB0
|
|
// FUNCTION: fn_14360
|
|
void CUIMonsterInfo::SetMonster(const std::string& title) {
|
|
CUITextViewer* details = reinterpret_cast<CUITextViewer*>(this->unknown_00EC);
|
|
details->Clear();
|
|
|
|
std::string name;
|
|
std::string spriteName;
|
|
int x = 0;
|
|
int size = 0;
|
|
int element = 0;
|
|
int elementLevel = 0;
|
|
int race = 0;
|
|
int type = 0;
|
|
if (!g_navigationManager.GetMobInfo(title, &name, &spriteName, &x, &size, &element, &elementLevel, &race, &type)) {
|
|
this->unknown_00E8->SetText(title.c_str(), title.size());
|
|
return;
|
|
}
|
|
|
|
this->unknown_00E8->SetText(name.c_str(), name.size());
|
|
this->sprite = static_cast<CSprRes*>(ResourceMgr::Instance().Load(spriteName + ".spr"));
|
|
this->action = static_cast<CActRes*>(ResourceMgr::Instance().Load(spriteName + ".act"));
|
|
|
|
if (element == 1) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8D7), elementLevel));
|
|
} else if (element == 2) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8D8), elementLevel));
|
|
} else if (element == 3) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8D9), elementLevel));
|
|
} else if (element == 4) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8DA), elementLevel));
|
|
} else if (element == 5) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8DB), elementLevel));
|
|
} else if (element == 6) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8DC), elementLevel));
|
|
} else if (element == 7) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8DD), elementLevel));
|
|
} else if (element == 8) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8DE), elementLevel));
|
|
} else if (element == 9) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8DF), elementLevel));
|
|
} else {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E0), elementLevel));
|
|
}
|
|
|
|
if (race == 1) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E4)));
|
|
} else if (race == 2) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E5)));
|
|
} else if (race == 3) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E6)));
|
|
} else if (race == 4) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E7)));
|
|
} else if (race == 5) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E8)));
|
|
} else if (race == 6) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E9)));
|
|
} else if (race == 7) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8EA)));
|
|
} else if (race == 8) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8EB)));
|
|
} else if (race == 9) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8EC)));
|
|
} else {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8ED)));
|
|
}
|
|
|
|
if (size == 1) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E1)));
|
|
} else if (size == 2) {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E2)));
|
|
} else {
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8E3)));
|
|
}
|
|
|
|
if (type == 0x12D) {
|
|
details->SetTextColor(0x6464FFu);
|
|
details->AddLine(FormatOwnedString(LookupMessage(0x8B6)));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// OFFSET: 0x009DC910
|
|
// FUNCTION: fn_14327
|
|
void AdventureGuide::CUIMonsterInfo::Paint() {
|
|
CUIListItem::Paint();
|
|
this->DrawActionSprite(this->sprite, this->action, 16, 2, 124, 124, 0, true, nullptr);
|
|
}
|
|
|
|
namespace AdventureGuide {
|
|
|
|
// OFFSET: 0x009C1550
|
|
// FUNCTION: fn_13992
|
|
CUIListBox<CUISubTab>* CUITab::CreateSubTabList() {
|
|
this->subTabs = new CUIListBox<CUISubTab>(*this->m_context);
|
|
this->subTabs->SetSize(98, 26);
|
|
this->subTabs->Move(0, 40);
|
|
this->subTabs->SetOnSelect([this](CUISubTab* subTab) { this->OnSelectSubTab(subTab); });
|
|
|
|
CUIListBox<CUISubTab>* list = this->subTabs;
|
|
{
|
|
const std::uint8_t disabledImageSource[] = {
|
|
0x97, 0x50, 0x2D, 0xB5, 0x6F, 0x7B, 0x12, 0x78, 0x91, 0x1B, 0x2D, 0x83, 0x12, 0x0F, 0x8B, 0xF4, 0x33, 0x89, 0x88, 0x21, 0xDB, 0xC0, 0xA5, 0xD0,
|
|
0x10, 0x8A, 0x84, 0x2B, 0xCA, 0xE9, 0xA3, 0xD4, 0x35, 0xA0, 0x8F, 0x3B, 0xC1, 0xEA, 0xA4, 0xC0, 0x35, 0xA0, 0x83, 0x20, 0xDD, 0xD8, 0xB6, 0xD9,
|
|
0x79, 0x9D, 0x80, 0x3F, 0xAF};
|
|
thread_local EncryptedName<sizeof(disabledImageSource), 0xB5D7B5AF4FEDFF57ULL> disabledImageName(disabledImageSource);
|
|
const std::string disabledImage(disabledImageName.Text());
|
|
const std::uint8_t pressedImageSource[] = {
|
|
0x11, 0x76, 0xD9, 0xE3, 0x6B, 0x95, 0x18, 0xAA, 0x17, 0x3D, 0xD9, 0xD5, 0x16, 0xE1, 0x81, 0x26, 0xB5, 0xAF, 0x7C, 0x77, 0xDF, 0x2E, 0xAF, 0x02,
|
|
0x96, 0xAC, 0x70, 0x7D, 0xCE, 0x07, 0xA9, 0x06, 0xB3, 0x86, 0x7B, 0x6D, 0xC5, 0x04, 0xAE, 0x12, 0xB3, 0x86, 0x76, 0x6F, 0xCE, 0x29, 0xF3, 0x05,
|
|
0xBC, 0xA9, 0x19};
|
|
thread_local EncryptedName<sizeof(pressedImageSource), 0x67DD5BAB1919D9D1ULL> pressedImageName(pressedImageSource);
|
|
const std::string pressedImage(pressedImageName.Text());
|
|
const std::uint8_t hoverImageSource[] = {
|
|
0x33, 0xBA, 0xB3, 0xD9, 0xB9, 0x39, 0x36, 0x78, 0x35, 0xF1, 0xB3, 0xEF, 0xC4, 0x4D, 0xAF, 0xF4, 0x97, 0x63, 0x16, 0x4D, 0x0D, 0x82, 0x81, 0xD0,
|
|
0xB4, 0x60, 0x1A, 0x47, 0x1C, 0xAB, 0x87, 0xD4, 0x91, 0x4A, 0x11, 0x57, 0x17, 0xA8, 0x80, 0xC0, 0x91, 0x4A, 0x03, 0x51, 0x1C, 0x84, 0x80, 0x9B,
|
|
0x91, 0x78, 0x03, 0x23};
|
|
thread_local EncryptedName<sizeof(hoverImageSource), 0xB5F3F779237315F3ULL> hoverImageName(hoverImageSource);
|
|
const std::string hoverImage(hoverImageName.Text());
|
|
const std::uint8_t normalImageSource[] = {
|
|
0xC3, 0x9A, 0x59, 0x4F, 0x73, 0xB9, 0x0C, 0xA6, 0xC5, 0xD1, 0x59, 0x79, 0x0E, 0xCD, 0x95, 0x2A, 0x67, 0x43, 0xFC, 0xDB, 0xC7, 0x02, 0xBB, 0x0E,
|
|
0x44, 0x40, 0xF0, 0xD1, 0xD6, 0x2B, 0xBD, 0x0A, 0x61, 0x6A, 0xFB, 0xC1, 0xDD, 0x28, 0xBA, 0x1E, 0x61, 0x6A, 0xF7, 0xDA, 0xC1, 0x1A, 0xA8, 0x07,
|
|
0x2D, 0x57, 0xF4, 0xC5, 0xB3};
|
|
thread_local EncryptedName<sizeof(normalImageSource), 0x6BC977B3B5993503ULL> normalImageName(normalImageSource);
|
|
const std::string normalImage(normalImageName.Text());
|
|
list->SetImages(normalImage, hoverImage, pressedImage, disabledImage);
|
|
}
|
|
|
|
this->subTabs->itemWidth = 98;
|
|
this->subTabs->rowHeight = 26;
|
|
this->subTabs->itemX = 0;
|
|
this->subTabs->itemY = 0;
|
|
this->subTabs->scrollBar->SetSize(9, 26);
|
|
this->subTabs->scrollBar->Move(89, 0);
|
|
this->subTabs->scrollBar->step = 20;
|
|
{
|
|
const std::uint8_t downImageSource[] = {
|
|
0x77, 0x9C, 0xE5, 0xF3, 0x7B, 0xFB, 0x40, 0xCE, 0x71, 0xD7, 0xE5, 0xC5, 0x06, 0x8F, 0xD9, 0x42, 0xD3, 0x45, 0x40, 0x67, 0xCF, 0x40, 0xF7, 0x66,
|
|
0xF0, 0x46, 0x4C, 0x6D, 0xDE, 0x69, 0xF6, 0x60, 0xC5, 0x5C, 0x49, 0x65, 0xE4, 0x54, 0xF7, 0x71, 0xD8, 0x44, 0x7A, 0x6D, 0xD4, 0x42, 0xEB, 0x2D,
|
|
0xD5, 0x5E, 0x55, 0x09};
|
|
thread_local EncryptedName<sizeof(downImageSource), 0x038535BB092533B7ULL> downImageName(downImageSource);
|
|
const std::string downImage(downImageName.Text());
|
|
const std::uint8_t upImageSource[] = {
|
|
0xB9, 0x58, 0xD5, 0xCF, 0x6D, 0x9F, 0x58, 0x56, 0xBF, 0x13, 0xD5, 0xF9, 0x10, 0xEB, 0xC1, 0xDA, 0x1D, 0x81, 0x70, 0x5B, 0xD9, 0x24, 0xEF, 0xFE,
|
|
0x3E, 0x82, 0x7C, 0x51, 0xC8, 0x0D, 0xEE, 0xF8, 0x0B, 0x98, 0x79, 0x59, 0xF2, 0x30, 0xEF, 0xE9, 0x16, 0x80, 0x4A, 0x40, 0xDD, 0x7F, 0xFF, 0xF6,
|
|
0x09, 0xF7};
|
|
thread_local EncryptedName<sizeof(upImageSource), 0x9B9D51AD3515F779ULL> upImageName(upImageSource);
|
|
const std::string upImage(upImageName.Text());
|
|
this->subTabs->scrollBar->SetButtonImages(upImage, downImage);
|
|
}
|
|
{
|
|
const std::uint8_t backgroundImageSource[] = {
|
|
0x13, 0xD8, 0x27, 0x93, 0x97, 0x09, 0xEE, 0x36, 0x15, 0x93, 0x27, 0xA5, 0xEA, 0x7D, 0x77, 0xBA, 0xB7, 0x01, 0x82, 0x07, 0x23, 0xB2, 0x59, 0x9E,
|
|
0x94, 0x02, 0x8E, 0x0D, 0x32, 0x9B, 0x58, 0x98, 0xA1, 0x18, 0x8B, 0x05, 0x08, 0xA5, 0x4C, 0xA4, 0xBE, 0x1E, 0x83, 0x47, 0x35, 0xAA, 0x5B, 0xFB};
|
|
thread_local EncryptedName<sizeof(backgroundImageSource), 0xFB2BC75769E777D3ULL> backgroundImageName(backgroundImageSource);
|
|
const std::string backgroundImage(backgroundImageName.Text());
|
|
this->subTabs->scrollBar->SetBackground(backgroundImage);
|
|
}
|
|
{
|
|
const std::uint8_t thumbBottomSource[] = {
|
|
0xB3, 0x8E, 0x27, 0xBD, 0xEB, 0xB7, 0x7A, 0x46, 0xB5, 0xC5, 0x27, 0x8B, 0x96, 0xC3, 0xE3, 0xCA, 0x17, 0x57, 0x82, 0x29, 0x5F, 0x0C, 0xCD, 0xEE,
|
|
0x34, 0x54, 0x8E, 0x23, 0x4E, 0x25, 0xCC, 0xE8, 0x01, 0x4E, 0x8B, 0x2B, 0x74, 0x0D, 0xD7, 0xFE, 0x1E, 0x43, 0xB8, 0x23, 0x44, 0x0E, 0xD1, 0xA5,
|
|
0x11, 0x4C, 0x97, 0x47};
|
|
thread_local EncryptedName<sizeof(thumbBottomSource), 0x8BBF792B47E72173ULL> thumbBottomName(thumbBottomSource);
|
|
const std::string thumbBottom(thumbBottomName.Text());
|
|
const std::uint8_t thumbMiddleSource[] = {
|
|
0xBD, 0xFC, 0x4F, 0x5B, 0x3F, 0x23, 0xAC, 0x10, 0xBB, 0xB7, 0x4F, 0x6D, 0x42, 0x57, 0x35, 0x9C, 0x19, 0x25, 0xEA, 0xCF, 0x8B, 0x98, 0x1B, 0xB8,
|
|
0x3A, 0x26, 0xE6, 0xC5, 0x9A, 0xB1, 0x1A, 0xBE, 0x0F, 0x3C, 0xE3, 0xCD, 0xA0, 0x99, 0x01, 0xA8, 0x10, 0x31, 0xD0, 0xCC, 0x96, 0x89, 0x47, 0xBF,
|
|
0x10, 0x23, 0x8F};
|
|
thread_local EncryptedName<sizeof(thumbMiddleSource), 0xDD69EDFFA18F537DULL> thumbMiddleName(thumbMiddleSource);
|
|
const std::string thumbMiddle(thumbMiddleName.Text());
|
|
const std::uint8_t thumbTopSource[] = {
|
|
0x51, 0x86, 0xB9, 0xB9, 0x1B, 0xC7, 0x60, 0xBC, 0x57, 0xCD, 0xB9, 0x8F, 0x66, 0xB3, 0xF9, 0x30, 0xF5, 0x5F, 0x1C, 0x2D, 0xAF, 0x7C, 0xD7, 0x14,
|
|
0xD6, 0x5C, 0x10, 0x27, 0xBE, 0x55, 0xD6, 0x12, 0xE3, 0x46, 0x15, 0x2F, 0x84, 0x7D, 0xCD, 0x04, 0xFC, 0x4B, 0x26, 0x36, 0xAB, 0x27, 0xC7, 0x1C,
|
|
0xE1, 0x29};
|
|
thread_local EncryptedName<sizeof(thumbTopSource), 0x71A509DB43792991ULL> thumbTopName(thumbTopSource);
|
|
const std::string thumbTop(thumbTopName.Text());
|
|
this->subTabs->scrollBar->SetThumbImages(thumbTop, thumbMiddle, thumbBottom);
|
|
}
|
|
|
|
this->AddChild(this->subTabs);
|
|
return this->subTabs;
|
|
}
|
|
|
|
}
|