diff --git a/Source/UI/Guild/UIGuild_Storage_Log.cpp b/Source/UI/Guild/UIGuild_Storage_Log.cpp new file mode 100644 index 00000000..aeb8e955 --- /dev/null +++ b/Source/UI/Guild/UIGuild_Storage_Log.cpp @@ -0,0 +1,90 @@ +#include "UI/Guild/UIGuild_Storage_Log.h" +#include "UI/Text/UIStaticText.h" +#include "UI/Window/WindowManagerWindows.h" + +#include + +// OFFSET: 0x00950450 +// FUNCTION: fn_12941 +int UIGuild_Storage_Log::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + switch (message) { + case 6: + switch (a) { + case 184: + this->m_frameContext->windows.CloseWindow(253); + break; + + case 218: { + const unsigned page = this->m_page; + bool hasNext; + + if (this->m_category == 0) { + hasNext = page < this->m_pageCounts[0]; + } else if (this->m_category == 1) { + hasNext = page < this->m_pageCounts[1]; + } else { + hasNext = page < this->m_pageCounts[2]; + } + + if (hasNext) { + this->m_state = 1; + this->m_page = page + 1; + this->unknown_0174 = 0; + this->unknown_0188 = this->unknown_0184; + this->SendMsg(this, 60, 0, 0, 0, 0); + return 0; + } + break; + } + + case 246: { + const unsigned page = this->m_page; + if (page > 1) { + const int state = this->m_state; + this->m_state = 1; + this->unknown_0174 = 0; + + unsigned offset = this->m_offset; + if (state == 11) { + offset -= 20; + } else { + offset = offset - offset % 10 - 10; + } + + this->m_offset = std::max(0u, offset); + this->m_page = std::max(1u, page - 1); + this->unknown_0188 = this->unknown_0184; + this->SendMsg(this, 60, 0, 0, 0, 0); + return 0; + } + break; + } + } + + return 0; + + case 22: + this->m_category = static_cast(a); + this->m_page = 1; + this->m_state = 1; + this->unknown_0174 = 0; + this->m_offset = 0; + this->unknown_0188 = this->unknown_0184; + this->SendMsg(this, 60, 0, 0, 0, 0); + return 0; + + case 60: + for (int i = 0; i < 10; ++i) { + this->m_dateTexts[i]->SetText("", 0); + this->m_nameTexts[i]->SetText("", 0); + this->m_itemTexts[i]->SetText("", 0); + this->m_countTexts[i]->SetText("", 0); + } + + this->Invalidate(); + return 0; + + default: + return this->UIWindow::SendMsg(sender, message, a, b, c, d); + } +} diff --git a/Source/UI/Guild/UIGuild_Storage_Log.h b/Source/UI/Guild/UIGuild_Storage_Log.h new file mode 100644 index 00000000..9b5ddb85 --- /dev/null +++ b/Source/UI/Guild/UIGuild_Storage_Log.h @@ -0,0 +1,29 @@ +#ifndef RAGNAROK_SOURCE_UI_GUILD_UIGUILD_STORAGE_LOG_H +#define RAGNAROK_SOURCE_UI_GUILD_UIGUILD_STORAGE_LOG_H + +#include "UI/Window/UIFrameWnd.h" + +class UIStaticText; + +class UIGuild_Storage_Log : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; + +protected: + /* 00B4 */ UIStaticText* m_dateTexts[10]; + /* 00DC */ UIStaticText* m_nameTexts[10]; + /* 0104 */ UIStaticText* m_itemTexts[10]; + /* 012C */ UIStaticText* m_countTexts[10]; + /* 0154 */ int m_category; + /* 0158 */ std::uint32_t unknown_0158; + /* 015C */ unsigned m_page; + /* 0160 */ unsigned m_pageCounts[3]; + /* 016C */ unsigned m_offset; + /* 0170 */ int m_state; + /* 0174 */ int unknown_0174; + /* 0178 */ std::uint32_t unknown_0178[3]; + /* 0184 */ int unknown_0184; + /* 0188 */ int unknown_0188; +}; + +#endif diff --git a/Source/UI/Quest/UIQuestDisplay.cpp b/Source/UI/Quest/UIQuestDisplay.cpp new file mode 100644 index 00000000..959861b4 --- /dev/null +++ b/Source/UI/Quest/UIQuestDisplay.cpp @@ -0,0 +1,9 @@ +#include "UI/Quest/UIQuestDisplay.h" + +// OFFSET: 0x009515D0 +// FUNCTION: fn_12953 +void UIQuestDisplay::Slot11() { + if (this->m_visibleSetting) { + *this->m_visibleSetting = this->geometry.visible; + } +} diff --git a/Source/UI/Quest/UIQuestDisplay.h b/Source/UI/Quest/UIQuestDisplay.h new file mode 100644 index 00000000..609021d0 --- /dev/null +++ b/Source/UI/Quest/UIQuestDisplay.h @@ -0,0 +1,15 @@ +#ifndef RAGNAROK_SOURCE_UI_QUEST_UIQUESTDISPLAY_H +#define RAGNAROK_SOURCE_UI_QUEST_UIQUESTDISPLAY_H + +#include "UI/Window/UIWindow.h" + +class UIQuestDisplay : public UIWindow { +public: + void Slot11() override; + +protected: + /* 007C */ unsigned char unknown_007C[0x14]; + /* 0090 */ int* m_visibleSetting; +}; + +#endif diff --git a/Source/UI/Window/UIDebuffRemoveWnd.cpp b/Source/UI/Window/UIDebuffRemoveWnd.cpp new file mode 100644 index 00000000..8ed0506b --- /dev/null +++ b/Source/UI/Window/UIDebuffRemoveWnd.cpp @@ -0,0 +1,30 @@ +#include "UI/Window/UIDebuffRemoveWnd.h" +#include "Network/Connection/Connection.h" +#include "Network/Packets/PacketLengths.h" + +#include + +namespace { +#pragma pack(push, 1) +struct DebuffRemovePacket { + /* 0000 */ std::int16_t id; +}; +#pragma pack(pop) +} + +// OFFSET: 0x00950400 +// FUNCTION: fn_12940 +int UIDebuffRemoveWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message != 6) { + return this->UIFrameWnd::SendMsg(sender, message, a, b, c, d); + } + + if (a == 184) { + DebuffRemovePacket packet; + packet.id = 0xC2A; + CRagConnection& connection = GetRagConnection(); + connection.Send(g_packetLengths.FixedLength(packet.id), &packet); + } + + return 0; +} diff --git a/Source/UI/Window/UIDebuffRemoveWnd.h b/Source/UI/Window/UIDebuffRemoveWnd.h new file mode 100644 index 00000000..0011e51e --- /dev/null +++ b/Source/UI/Window/UIDebuffRemoveWnd.h @@ -0,0 +1,11 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UIDEBUFFREMOVEWND_H +#define RAGNAROK_SOURCE_UI_WINDOW_UIDEBUFFREMOVEWND_H + +#include "UI/Window/UIFrameWnd.h" + +class UIDebuffRemoveWnd : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; +}; + +#endif diff --git a/Source/UI/Window/UIMileageWnd.cpp b/Source/UI/Window/UIMileageWnd.cpp new file mode 100644 index 00000000..a2fab14d --- /dev/null +++ b/Source/UI/Window/UIMileageWnd.cpp @@ -0,0 +1,44 @@ +#include "UI/Window/UIMileageWnd.h" +#include "Contents/Configuration/ServiceOptions.h" + +#include +#include + +// GLOBAL: gl_24859 +int g_mileageWndActive; + +// GLOBAL: gl_24860 +int g_mileageWndPoint; + +// GLOBAL: gl_24861 +int g_mileageWndBonus; + +// OFFSET: 0x00950690 +// FUNCTION: fn_12942 +int UIMileageWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message != 34) { + return this->UIWindow::SendMsg(sender, message, a, b, c, d); + } + + g_mileageWndActive = static_cast(a); + this->Show(static_cast(a)); + + if (a != 0) { + this->m_point = static_cast(b); + g_mileageWndPoint = static_cast(b); + this->m_bonus = static_cast(d); + g_mileageWndBonus = static_cast(d); + + int remaining = 3600 - static_cast(c); + if (remaining < 0) { + remaining = 0; + } + + this->m_remaining = remaining; + this->m_startTime = timeGetTime(); + this->Show(g_serviceOptions.Get(219)); + } + + this->Invalidate(); + return 0; +} diff --git a/Source/UI/Window/UIMileageWnd.h b/Source/UI/Window/UIMileageWnd.h new file mode 100644 index 00000000..fdcf67ae --- /dev/null +++ b/Source/UI/Window/UIMileageWnd.h @@ -0,0 +1,23 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UIMILEAGEWND_H +#define RAGNAROK_SOURCE_UI_WINDOW_UIMILEAGEWND_H + +#include "UI/Window/UIFrameWnd.h" + +#include + +class UIMileageWnd : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; + +protected: + /* 00B4 */ std::uint32_t m_startTime; + /* 00B8 */ int m_point; + /* 00BC */ int m_remaining; + /* 00C0 */ int m_bonus; +}; + +extern int g_mileageWndActive; +extern int g_mileageWndPoint; +extern int g_mileageWndBonus; + +#endif diff --git a/Source/UI/Window/UINormalMB.cpp b/Source/UI/Window/UINormalMB.cpp new file mode 100644 index 00000000..b30ff03b --- /dev/null +++ b/Source/UI/Window/UINormalMB.cpp @@ -0,0 +1,38 @@ +#include "UI/Window/UINormalMB.h" +#include "UI/Text/UITextViewer.h" +#include "UI/Window/UIWindowMgr.h" + +// OFFSET: 0x00950740 +// FUNCTION: fn_12943 +int UINormalMB::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + switch (message) { + case 6: { + const int id = static_cast(a); + const auto action = this->m_actions.find(id); + + if (action != this->m_actions.end()) { + action->second(); + } else { + if (this->m_owner) { + this->m_owner->SendMsg(this, 6, 488, id, 0, 0); + } + + if (this->m_keepOpen) { + g_windowMgr.unknown_0474 = id; + return 0; + } + } + + g_windowMgr.Schedule(this); + return 0; + } + + case 57: + this->m_viewer->Clear(); + this->m_viewer->SendMsg(nullptr, 29, a, 38, 0, 0); + return 0; + + default: + return this->UIFrameWnd::SendMsg(sender, message, a, b, c, d); + } +} diff --git a/Source/UI/Window/UINormalMB.h b/Source/UI/Window/UINormalMB.h new file mode 100644 index 00000000..00786455 --- /dev/null +++ b/Source/UI/Window/UINormalMB.h @@ -0,0 +1,22 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UINORMALMB_H +#define RAGNAROK_SOURCE_UI_WINDOW_UINORMALMB_H + +#include "UI/Window/UIFrameWnd.h" + +#include + +class UITextViewer; + +class UINormalMB : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; + +protected: + /* 00B4 */ UIWindow* m_owner; + /* 00B8 */ UITextViewer* m_viewer; + /* 00BC */ unsigned char unknown_00BC[0x30]; + /* 00EC */ unsigned char m_keepOpen; + /* 00F0 */ std::map m_actions; +}; + +#endif diff --git a/Source/UI/Window/UIOpenMailBoxWnd.cpp b/Source/UI/Window/UIOpenMailBoxWnd.cpp new file mode 100644 index 00000000..c741a125 --- /dev/null +++ b/Source/UI/Window/UIOpenMailBoxWnd.cpp @@ -0,0 +1,42 @@ +#include "UI/Window/UIOpenMailBoxWnd.h" +#include "Contents/MessageTable.h" +#include "UI/Window/UIWindowMgr.h" +#include "UI/Window/WindowManagerWindows.h" + +// OFFSET: 0x00950A60 +// FUNCTION: fn_12945 +int UIOpenMailBoxWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message != 6) { + return this->UIWindow::SendMsg(sender, message, a, b, c, d); + } + + if (a != 192) { + return 0; + } + + if (g_windowMgr.LookupWindow(295)) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(2992)), 0xFF, 0, 0, 0); + return 0; + } + + if (g_windowMgr.LookupWindow(343)) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3715)), 0xFF, 0, 0, 0); + return 0; + } + + if (g_windowMgr.LookupWindow(10006)) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3843)), 0xFF, 0, 0, 0); + return 0; + } + + if (g_windowMgr.LookupWindow(361)) { + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(4054)), 0xFF, 0, 0, 0); + return 0; + } + + if (!this->m_frameContext->windows.CloseWindow(263)) { + this->m_frameContext->windows.EnsureWindow(263); + } + + return 0; +} diff --git a/Source/UI/Window/UIOpenMailBoxWnd.h b/Source/UI/Window/UIOpenMailBoxWnd.h new file mode 100644 index 00000000..ea999fa1 --- /dev/null +++ b/Source/UI/Window/UIOpenMailBoxWnd.h @@ -0,0 +1,11 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UIOPENMAILBOXWND_H +#define RAGNAROK_SOURCE_UI_WINDOW_UIOPENMAILBOXWND_H + +#include "UI/Window/UIFrameWnd.h" + +class UIOpenMailBoxWnd : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; +}; + +#endif diff --git a/Source/UI/Window/UIOpenRoulletteWnd.cpp b/Source/UI/Window/UIOpenRoulletteWnd.cpp new file mode 100644 index 00000000..1e74c9f5 --- /dev/null +++ b/Source/UI/Window/UIOpenRoulletteWnd.cpp @@ -0,0 +1,32 @@ +#include "UI/Window/UIOpenRoulletteWnd.h" +#include "Network/Connection/Connection.h" +#include "Network/Packets/PacketId.h" +#include "Network/Packets/PacketLengths.h" +#include "UI/Window/UIWindowMgr.h" + +#include + +namespace { +#pragma pack(push, 1) +struct RouletteOpenPacket { + /* 0000 */ std::int16_t id; +}; +#pragma pack(pop) +} + +// OFFSET: 0x00950B60 +// FUNCTION: fn_12946 +int UIOpenRoulletteWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message != 6) { + return this->UIWindow::SendMsg(sender, message, a, b, c, d); + } + + if (a == 192 && g_windowMgr.unknown_0464 == nullptr) { + RouletteOpenPacket packet; + packet.id = ID_CZ_REQ_OPEN_ROULETTE; + CRagConnection& connection = GetRagConnection(); + connection.Send(g_packetLengths.FixedLength(packet.id), &packet); + } + + return 0; +} diff --git a/Source/UI/Window/UIOpenRoulletteWnd.h b/Source/UI/Window/UIOpenRoulletteWnd.h new file mode 100644 index 00000000..e1a53eb0 --- /dev/null +++ b/Source/UI/Window/UIOpenRoulletteWnd.h @@ -0,0 +1,11 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UIOPENROULLETTEWND_H +#define RAGNAROK_SOURCE_UI_WINDOW_UIOPENROULLETTEWND_H + +#include "UI/Window/UIFrameWnd.h" + +class UIOpenRoulletteWnd : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; +}; + +#endif diff --git a/Source/UI/Window/UISecondCostumeWnd.cpp b/Source/UI/Window/UISecondCostumeWnd.cpp new file mode 100644 index 00000000..39ce5f9d --- /dev/null +++ b/Source/UI/Window/UISecondCostumeWnd.cpp @@ -0,0 +1,63 @@ +#include "UI/Window/UISecondCostumeWnd.h" +#include "UI/Lists/UIListBox.h" +#include "UI/Window/WindowManagerWindows.h" + +// OFFSET: 0x00951060 +// FUNCTION: fn_12948 +int UISecondCostumeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + switch (message) { + case 6: + switch (a) { + case 201: + this->m_frameContext->windows.CloseWindow(259); + break; + + case 226: + if (this->m_page < 1) { + this->m_page = 7; + } else { + --this->m_page; + } + + this->Invalidate(); + return 0; + + case 227: + this->m_page = this->m_page < 7 ? this->m_page + 1 : 0; + this->Invalidate(); + return 0; + + case 336: + if (this->m_list->selected != -1) { + this->m_selected[this->m_tab] = this->m_list->selected; + this->Invalidate(); + return 0; + } + break; + } + + return 0; + + case 39: + this->m_tab = static_cast(a); + this->RefreshList(static_cast(a)); + return 0; + + default: + return this->UIWindow::SendMsg(sender, message, a, b, c, d); + } +} + +// OFFSET: 0x009514F0 +// FUNCTION: fn_12952 +void UISecondCostumeWnd::RefreshList(int tab) { + this->m_list->Clear(); + + for (unsigned i = 0; i < this->m_entries[tab].size(); ++i) { + this->m_list->AddLine(this->m_entries[tab][i].name.c_str()); + } + + this->m_list->selected = this->m_selected[tab]; + this->m_list->Invalidate(); + this->Invalidate(); +} diff --git a/Source/UI/Window/UISecondCostumeWnd.h b/Source/UI/Window/UISecondCostumeWnd.h new file mode 100644 index 00000000..1d3c35ff --- /dev/null +++ b/Source/UI/Window/UISecondCostumeWnd.h @@ -0,0 +1,35 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UISECONDCOSTUMEWND_H +#define RAGNAROK_SOURCE_UI_WINDOW_UISECONDCOSTUMEWND_H + +#include "UI/Window/UIFrameWnd.h" + +#include +#include + +class UIListBox; + +struct SecondCostumeEntry { + /* 0000 */ std::string name; + /* 0018 */ int unknown_0018; +}; + +class UISecondCostumeWnd : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; + __declspec(noinline) void RefreshList(int tab); + +protected: + /* 00B4 */ std::uint32_t unknown_00B4; + /* 00B8 */ UIListBox* m_list; + /* 00BC */ int m_tab; + /* 00C0 */ int m_selected[4]; + /* 00D0 */ std::vector m_entries[4]; + /* 0100 */ std::uint32_t unknown_0100; + /* 0104 */ int m_page; +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(SecondCostumeEntry) == 0x1C); +#endif + +#endif diff --git a/Source/UI/Window/UITransMenuWnd.cpp b/Source/UI/Window/UITransMenuWnd.cpp new file mode 100644 index 00000000..770fcd77 --- /dev/null +++ b/Source/UI/Window/UITransMenuWnd.cpp @@ -0,0 +1,11 @@ +#include "UI/Window/UITransMenuWnd.h" + +// OFFSET: 0x00951440 +// FUNCTION: fn_12950 +int UITransMenuWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { + if (message != 48) { + this->UIWindow::SendMsg(sender, message, a, b, c, d); + } + + return 0; +} diff --git a/Source/UI/Window/UITransMenuWnd.h b/Source/UI/Window/UITransMenuWnd.h new file mode 100644 index 00000000..732d2b7e --- /dev/null +++ b/Source/UI/Window/UITransMenuWnd.h @@ -0,0 +1,11 @@ +#ifndef RAGNAROK_SOURCE_UI_WINDOW_UITRANSMENUWND_H +#define RAGNAROK_SOURCE_UI_WINDOW_UITRANSMENUWND_H + +#include "UI/Window/UIFrameWnd.h" + +class UITransMenuWnd : public UIFrameWnd { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; +}; + +#endif diff --git a/data/compile.json b/data/compile.json index 282e8160..303f7010 100644 --- a/data/compile.json +++ b/data/compile.json @@ -703,6 +703,7 @@ "Source/UI/Guild/UIAgitWnd.cpp": 2, "Source/UI/Guild/UIGuildHelperWnd.cpp": 2, "Source/UI/Guild/UIGuildWnd.cpp": 2, + "Source/UI/Guild/UIGuild_Storage_Log.cpp": 2, "Source/UI/Item/UIEquipmentPropertiesWnd.cpp": 2, "Source/UI/Items/UIItemRepairWnd.cpp": 2, "Source/UI/Items/UIMakeTargetListWnd.cpp": 2, @@ -731,6 +732,7 @@ "Source/UI/Party/UIRequestJoinPartyWnd.cpp": 2, "Source/UI/PriceCommission.cpp": 2, "Source/UI/Quest/UIOngoingQuestInfo.cpp": 2, + "Source/UI/Quest/UIQuestDisplay.cpp": 2, "Source/UI/Quest/UIRecommendedQuestInfo.cpp": 2, "Source/UI/Quest/UIRenewQuestUI.cpp": 2, "Source/UI/Shop/ItemDrawing.cpp": 2, @@ -780,9 +782,16 @@ "Source/UI/Window/InputFocus.cpp": 2, "Source/UI/Window/UIBasicInfoWnd.cpp": 2, "Source/UI/Window/UIControl.cpp": 2, + "Source/UI/Window/UIDebuffRemoveWnd.cpp": 2, "Source/UI/Window/UIFrameWnd.cpp": 2, "Source/UI/Window/UIMessageBox.cpp": 2, + "Source/UI/Window/UIMileageWnd.cpp": 2, + "Source/UI/Window/UINormalMB.cpp": 2, + "Source/UI/Window/UIOpenMailBoxWnd.cpp": 2, + "Source/UI/Window/UIOpenRoulletteWnd.cpp": 2, + "Source/UI/Window/UISecondCostumeWnd.cpp": 2, "Source/UI/Window/UISeekPartyListWnd.cpp": 2, + "Source/UI/Window/UITransMenuWnd.cpp": 2, "Source/UI/Window/UIWindow.cpp": 2, "Source/UI/Window/UIWindowMgr.cpp": 2, "Source/UI/Window/WindowAncestry.cpp": 2,