diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp index 2386ebda..67b96b34 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp @@ -5,9 +5,19 @@ #include "Resource/SkinPalette.h" #include "Resource/TextureNames.h" +#include #include #include +namespace EquipmentProperties { +class CEquipmentPropertiesMgr { +public: + static CEquipmentPropertiesMgr* GetInstance(); + void SetWindow(UIWindow* window); + void GetDescriptions(const int& group, std::list& lines); +}; +} + template void CUIListBoxEx::Paint(); template void CUIListBoxEx::Slot35(int); template void CUIListBoxEx::ClearItems(); @@ -191,6 +201,12 @@ void EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::Paint() { this->FillRegion(44, 0, 1, this->geometry.height, this->oddRowColor); } +// OFFSET: 0x00A0F1F0 +// FUNCTION: fn_15167 +void CUIEquipmentPropertiesWnd::Slot16() { + EquipmentProperties::CEquipmentPropertiesMgr::GetInstance()->SetWindow(this); +} + // OFFSET: 0x00A0F270 // FUNCTION: fn_15168 void EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::Slot16() { @@ -216,6 +232,41 @@ void EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::Slot53(int resolveS this->oddRowColor = RGB(red, green, blue); } +// OFFSET: 0x00A0F370 +// FUNCTION: fn_15171 +void CUIEquipmentPropertiesWnd::SetTab(const int& tab) { + this->currentTab = tab; + std::list lines; + const int group = this->currentTab; + EquipmentProperties::CEquipmentPropertiesMgr::GetInstance()->GetDescriptions(group, lines); + + auto* listBox = this->list; + if (listBox->data != lines) { + listBox->data.swap(lines); + listBox->UpdateScrollBar(); + } +} + +// OFFSET: 0x00A0F550 +// FUNCTION: fn_15172 +int CUIEquipmentPropertiesWnd::SendMsg( + UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4 +) { + if (message == 60) { + this->SetTab(this->currentTab); + } + return 0; +} + +// OFFSET: 0x00A0F570 +// FUNCTION: fn_15173 +void CUIEquipmentPropertiesWnd::OnChangeTab(CUITabButton* button) { + if (button && button->geometry.id != this->currentTab) { + const int tab = button->geometry.id; + this->SetTab(tab); + } +} + // OFFSET: 0x00A0F5A0 // FUNCTION: fn_15174 void CUIEquipmentPropertiesWnd::OnClickButton2() { diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.h b/Source/UI/Item/UIEquipmentPropertiesWnd.h index b4f96d14..24ef8cae 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.h +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.h @@ -46,6 +46,10 @@ public: void OnClickButton8(); void OnClickButton9(); void OnSelectLine(EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* line, const std::string& text); + void Slot16() override; + int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; + void SetTab(const int& tab); + void OnChangeTab(CUITabButton* button); }; template <>