diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 701fd0c..1064ef5 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -3,13 +3,16 @@ #include "Resource/ResourceMgr.h" #include "Resource/SkinPalette.h" #include "Resource/TextureNames.h" +#include "UI/Buttons/UIBitmapButton.h" #include "UI/Buttons/UICashEmotionSprBtn.h" #include "UI/CashEmotion/UICashEmotionPack.h" #include "UI/CashEmotion/UICashEmotionPiece.h" #include "UI/Chat/ChatSuggestions.h" +#include "UI/Edit/UIEditCtrl.h" #include "UI/Window/WindowBorder.h" #include +#include #include #include #include @@ -23,22 +26,34 @@ CCashEmotionMgr* g_cashEmotionMgr = nullptr; // GLOBAL: gl_24484 ChatSuggestions* g_chatSuggestions = nullptr; +class ICashEmotionAction { +public: + virtual ~ICashEmotionAction(); + virtual void Execute(int packId, int argument) = 0; +}; + class UICashEmotionMiniWnd : public UIWindow { public: - // OFFSET: 0x007C9200 + void Slot15(int width, int height) override; + void Paint() override; + int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; + unsigned int Select(int actionId); + void Select(CashEmotionCommand* command); + void Previous(); void Refresh(int first); + void Next(); + void SetIndex(int index); protected: /* 007C */ CashEmotionCommand* m_selected; - /* 0080 */ UICashEmotionPiece* m_first; - /* 0084 */ UICashEmotionPiece* m_second; - /* 0088 */ UICashEmotionPiece* m_third; - /* 008C */ UIButton* m_previous; - /* 0090 */ UIButton* m_next; - /* 0094 */ void* unknown_0094; + /* 0080 */ std::array m_pieces; + /* 008C */ UIBitmapButton* m_previous; + /* 0090 */ UIBitmapButton* m_next; + /* 0094 */ ICashEmotionAction* m_action; /* 0098 */ int m_page; /* 009C */ int m_selectedIndex; + UICashEmotionPieceContext* m_controls; }; // OFFSET: 0x00592290 @@ -648,42 +663,56 @@ bool CCashEmotionMgr::IsOwnedPack(int packId) { return std::find(this->m_ownedPacks.begin(), this->m_ownedPacks.end(), packId) != this->m_ownedPacks.end(); } +// OFFSET: 0x007C9200 + +// OFFSET: 0x007C9290 + // OFFSET: 0x007C92B0 // FUNCTION: fn_09430 void UICashEmotionMiniWnd::Refresh(int first) { - if (this->m_first) { + if (this->m_pieces[0]) { if (this->m_selected) { std::pair entry = this->m_selected->Get(first); bool owned = entry.first == g_cashEmotionMgr->BasePackId() || g_cashEmotionMgr->IsOwnedPack(entry.first); - this->m_first->Set(entry.first, entry.second, false, false, !owned); + this->m_pieces[0]->Set(entry.first, entry.second, false, false, !owned); } else { - this->m_first->Set(-1, -1, false, false, false); + this->m_pieces[0]->Set(-1, -1, false, false, false); } } - if (this->m_second) { + if (this->m_pieces[1]) { if (this->m_selected) { std::pair entry = this->m_selected->Get(first + 1); bool owned = entry.first == g_cashEmotionMgr->BasePackId() || g_cashEmotionMgr->IsOwnedPack(entry.first); - this->m_second->Set(entry.first, entry.second, false, false, !owned); + this->m_pieces[1]->Set(entry.first, entry.second, false, false, !owned); } else { - this->m_second->Set(-1, -1, false, false, false); + this->m_pieces[1]->Set(-1, -1, false, false, false); } } - if (this->m_third) { + if (this->m_pieces[2]) { if (this->m_selected) { std::pair entry = this->m_selected->Get(first + 2); bool owned = entry.first == g_cashEmotionMgr->BasePackId() || g_cashEmotionMgr->IsOwnedPack(entry.first); - this->m_third->Set(entry.first, entry.second, false, false, !owned); + this->m_pieces[2]->Set(entry.first, entry.second, false, false, !owned); } else { - this->m_third->Set(-1, -1, false, false, false); + this->m_pieces[2]->Set(-1, -1, false, false, false); } } this->Invalidate(); } +// OFFSET: 0x007C94A0 + +// OFFSET: 0x007C96E0 + +// OFFSET: 0x007C9790 + +// OFFSET: 0x007C97C0 + +// OFFSET: 0x007C98A0 + // OFFSET: 0x007C9D60 // FUNCTION: fn_09439 UICashEmotionPack::~UICashEmotionPack() { diff --git a/Source/Contents/CashEmotionMgr.h b/Source/Contents/CashEmotionMgr.h index b82206c..5543943 100644 --- a/Source/Contents/CashEmotionMgr.h +++ b/Source/Contents/CashEmotionMgr.h @@ -26,6 +26,10 @@ public: void Add(int packId, int emotionId); std::pair Get(int index) const; + // INLINED + int Count() const { + return static_cast(this->entries.size()); + } /* 0000 */ std::string name; /* 0018 */ std::vector> entries; diff --git a/Source/UI/Chat/ChatSuggestions.h b/Source/UI/Chat/ChatSuggestions.h index 22b0258..6738103 100644 --- a/Source/UI/Chat/ChatSuggestions.h +++ b/Source/UI/Chat/ChatSuggestions.h @@ -14,6 +14,7 @@ struct ItemTagRetirement; struct ChatSuggestions { UIWindow& chat; UIWindow* const& window; + UIEditCtrl* const& input; bool Visible() const; diff --git a/Source/Utility/Timestamp.h b/Source/Utility/Timestamp.h index 8eb2f15..20bf56f 100644 --- a/Source/Utility/Timestamp.h +++ b/Source/Utility/Timestamp.h @@ -7,7 +7,9 @@ class Timestamp { public: + Timestamp(__time32_t value); ~Timestamp(); + void Set(__time32_t value); TIMESTAMP_STRUCT ToSqlTimestamp(); int IsBefore(__time32_t other) const; int IsBeforeNow() const;