From 8b3ba20b56339885edcd9ff7f046a1868f91de04 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 2 Nov 2026 22:46:30 +0000 Subject: [PATCH] Maintenance: [forced, user-approved] Family G9: remove the adventurer-agency bundle family: AgencyRequestContext, StopRecruitingConte Batch #10208 by ragnarok-clanker: forced by an admin (10 lower score(s), 42 changed function(s)); checked with 119 compiled unit(s), including every includer of Source/Client/ModeBaseEvents.h, Source/Contents/Async/AsyncWorkMgr.h, Source/Contents/Configuration/ServiceConfiguration.h, Source/Contents/Party/AdventurerAgencyMgr.h, Source/Contents/Party/LoadPartyInfoAsyncWork.h, Source/Contents/Party/PartyJoinResult.h, Source/Contents/Party/RegisterPartyAsyncWork.h, Source/Contents/Party/StopRecruitingAsyncWork.h, Source/UI/Party/UIAdvenPartyBoardWnd.h, Source/UI/Party/UIApplyForPartyWnd.h, Source/UI/Party/UIPartyInfoWnd.h, Source/UI/Party/UIRegisterPartyWnd.h, Source/Contents/Party/AgencyRequestContext.h. Deletes: Source/Contents/Party/AgencyRequestContext.h --- Source/Client/ModeBaseEvents.cpp | 2 +- Source/Client/ModeBaseEvents.h | 4 - Source/Contents/Async/AsyncWorkMgr.cpp | 15 +-- Source/Contents/Async/AsyncWorkMgr.h | 14 +-- .../Configuration/ServiceConfiguration.cpp | 9 ++ .../Configuration/ServiceConfiguration.h | 3 + Source/Contents/Party/AdventurerAgencyMgr.cpp | 8 +- Source/Contents/Party/AdventurerAgencyMgr.h | 29 ++--- Source/Contents/Party/AgencyRequestContext.h | 26 ----- Source/Contents/Party/AgencyRequests.cpp | 103 +++++++++--------- .../Contents/Party/LoadPartyInfoAsyncWork.cpp | 8 +- .../Contents/Party/LoadPartyInfoAsyncWork.h | 23 +--- Source/Contents/Party/PartyInfoCompletion.cpp | 30 ++--- Source/Contents/Party/PartyJoinResult.cpp | 19 ++-- Source/Contents/Party/PartyJoinResult.h | 13 +-- .../Party/PartyRegistrationCompletion.cpp | 15 ++- .../Contents/Party/RegisterPartyAsyncWork.cpp | 11 +- .../Contents/Party/RegisterPartyAsyncWork.h | 19 +--- .../Party/StopRecruitingAsyncWork.cpp | 9 +- .../Contents/Party/StopRecruitingAsyncWork.h | 17 +-- .../Party/StopRecruitingCompletion.cpp | 18 +-- Source/UI/Party/UIAdvenPartyBoardWnd.cpp | 76 +++++++------ Source/UI/Party/UIAdvenPartyBoardWnd.h | 22 +--- Source/UI/Party/UIApplyForPartyWnd.cpp | 25 ++--- Source/UI/Party/UIApplyForPartyWnd.h | 21 +--- Source/UI/Party/UIPartyInfoWnd.cpp | 17 +-- Source/UI/Party/UIPartyInfoWnd.h | 24 +--- Source/UI/Party/UIRegisterPartyWnd.cpp | 38 +++---- Source/UI/Party/UIRegisterPartyWnd.h | 20 +--- Source/UI/Window/UIEscOptionWnd.cpp | 4 +- 30 files changed, 232 insertions(+), 410 deletions(-) delete mode 100644 Source/Contents/Party/AgencyRequestContext.h diff --git a/Source/Client/ModeBaseEvents.cpp b/Source/Client/ModeBaseEvents.cpp index df6ddcb7..a08ec622 100644 --- a/Source/Client/ModeBaseEvents.cpp +++ b/Source/Client/ModeBaseEvents.cpp @@ -23,7 +23,7 @@ int ModeBaseEvents::Send(int event, const char* text, int, int, int) { g_modeMgr.gameMode->running = 0; } } else if (g_modeMgr.gameMode) { - g_adventurerAgencyMgr->RequestStop(this->agency, this->stopRecruiting); + g_adventurerAgencyMgr->RequestStop(); if (g_modeMgr.gameMode) { g_modeMgr.gameMode->running = 0; } diff --git a/Source/Client/ModeBaseEvents.h b/Source/Client/ModeBaseEvents.h index 9e9d61cc..3972d2cd 100644 --- a/Source/Client/ModeBaseEvents.h +++ b/Source/Client/ModeBaseEvents.h @@ -10,8 +10,6 @@ class CRenderSystemBase; class LuaScript; struct EmotionHotkeys; struct CharacterConfigSave; -struct AgencyRequestContext; -struct StopRecruitingContext; struct ModeBaseEvents { int& transitionRequested; @@ -23,8 +21,6 @@ struct ModeBaseEvents { const char* token16; CAsyncWorkMgr& work; CharacterConfigSave& characterSave; - AgencyRequestContext& agency; - StopRecruitingContext& stopRecruiting; HWND& window; int Send(int event, const char* text, int argument2, int argument3, int argument4); diff --git a/Source/Contents/Async/AsyncWorkMgr.cpp b/Source/Contents/Async/AsyncWorkMgr.cpp index 7177b5ca..abb02dae 100644 --- a/Source/Contents/Async/AsyncWorkMgr.cpp +++ b/Source/Contents/Async/AsyncWorkMgr.cpp @@ -173,13 +173,12 @@ void CAsyncWorkMgr::LoadMyParty( // OFFSET: 0x00574810 // FUNCTION: fn_02507 void CAsyncWorkMgr::LoadPartyInfo( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId, - PartyInfoContext& context + std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId ) { NAsyncWorkPtr work(this->m_pools, "PartyInfo_Load"); if (work.Get()) { - static_cast(work.Get())->Bind(accountId, characterId, world, url, token, queryAccountId, context); + static_cast(work.Get())->Bind(accountId, characterId, world, url, token, queryAccountId); this->Submit(work); } } @@ -228,25 +227,23 @@ void CAsyncWorkMgr::SaveStore( // OFFSET: 0x00574DD0 // FUNCTION: fn_02511 void CAsyncWorkMgr::RegisterParty( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, CAdvenPartyInfo info, RegisterPartyContext& context + std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, CAdvenPartyInfo info ) { NAsyncWorkPtr work(this->m_pools, "Register_Party"); if (work.Get()) { - static_cast(work.Get())->Bind(accountId, characterId, world, url, token, info, context); + static_cast(work.Get())->Bind(accountId, characterId, world, url, token, info); this->Submit(work); } } // OFFSET: 0x00574F40 // FUNCTION: fn_02512 -void CAsyncWorkMgr::StopRecruiting( - std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId, StopRecruitingContext& context -) { +void CAsyncWorkMgr::StopRecruiting(std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId) { NAsyncWorkPtr work(this->m_pools, "Stop_Recruiting"); if (work.Get()) { - static_cast(work.Get())->Bind(accountId, world, url, token, masterAccountId, context); + static_cast(work.Get())->Bind(accountId, world, url, token, masterAccountId); this->Submit(work); } } diff --git a/Source/Contents/Async/AsyncWorkMgr.h b/Source/Contents/Async/AsyncWorkMgr.h index 4454fe23..645f8fbc 100644 --- a/Source/Contents/Async/AsyncWorkMgr.h +++ b/Source/Contents/Async/AsyncWorkMgr.h @@ -12,9 +12,6 @@ class CMCStoreInfoBackup; struct AccountConfigLoad; struct CharacterConfigLoad; struct StoreBackupContext; -struct RegisterPartyContext; -struct StopRecruitingContext; -struct PartyInfoContext; class CAsyncWorkMgr : public NAsyncWorkMgr { public: @@ -38,8 +35,7 @@ public: void UploadEmblem(std::string url, std::uint32_t accountId, std::string token, std::string world, std::uint32_t guildId, std::string path); void LoadMyParty(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, WindowManagerWindows& windows); void LoadPartyInfo( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId, - PartyInfoContext& context + std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId ); void LoadPartyList( std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, int search, CAdvenPartyInfo filter, int page, @@ -50,12 +46,8 @@ public: StoreBackupContext& context ); void SaveStore(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::string data, int type); - void RegisterParty( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, CAdvenPartyInfo info, - RegisterPartyContext& context - ); - void - StopRecruiting(std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId, StopRecruitingContext& context); + void RegisterParty(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, CAdvenPartyInfo info); + void StopRecruiting(std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId); // INLINED CAsyncWorkRecycleObjectPoolMgr& Pools() { diff --git a/Source/Contents/Configuration/ServiceConfiguration.cpp b/Source/Contents/Configuration/ServiceConfiguration.cpp index a0c0c55f..b022ed68 100644 --- a/Source/Contents/Configuration/ServiceConfiguration.cpp +++ b/Source/Contents/Configuration/ServiceConfiguration.cpp @@ -59,6 +59,15 @@ const char* g_runPatcherMessage = ""; // GLOBAL: gl_21921 const char* g_windowName = ""; +// GLOBAL: gl_24669 +const char* g_serviceHost = ""; + +// GLOBAL: gl_24670 +const char* g_servicePort = ""; + +// GLOBAL: gl_24671 +const char* g_serviceOverrideKey = ""; + // GLOBAL: gl_24974 char g_launchServerName[24]; diff --git a/Source/Contents/Configuration/ServiceConfiguration.h b/Source/Contents/Configuration/ServiceConfiguration.h index c9053bf0..f31a2e69 100644 --- a/Source/Contents/Configuration/ServiceConfiguration.h +++ b/Source/Contents/Configuration/ServiceConfiguration.h @@ -17,6 +17,9 @@ extern const char* g_clientExeName; extern const char* g_patcherExeName; extern const char* g_runPatcherMessage; extern const char* g_windowName; +extern const char* g_serviceHost; +extern const char* g_servicePort; +extern const char* g_serviceOverrideKey; extern char g_launchServerName[24]; extern std::vector g_loadingScreens; diff --git a/Source/Contents/Party/AdventurerAgencyMgr.cpp b/Source/Contents/Party/AdventurerAgencyMgr.cpp index 26561f1e..575ce633 100644 --- a/Source/Contents/Party/AdventurerAgencyMgr.cpp +++ b/Source/Contents/Party/AdventurerAgencyMgr.cpp @@ -1,5 +1,8 @@ +#include "Client/Session.h" +#include "Contents/Configuration/ServiceConfiguration.h" #include "Contents/UserData/AccountService.h" #include "Contents/Party/AdventurerAgencyMgr.h" +#include "Script/LuaScript.h" #include #include @@ -66,9 +69,8 @@ const std::vector& CAdventurerAgencyMgr::Entries() const { // OFFSET: 0x005CAA50 // FUNCTION: fn_03655 -std::string -CAdventurerAgencyMgr::ServiceUrl(int operation, LuaScript& settings, LuaScript& tables, const char* host, const char* port, const char* overrideKey) const { - std::string url = ResolveAccountServiceBase(settings, tables, host, port, overrideKey); +std::string CAdventurerAgencyMgr::ServiceUrl(int operation) const { + std::string url = ResolveAccountServiceBase(*g_luaScript, *g_session.m_hotkeyScript, g_serviceHost, g_servicePort, g_serviceOverrideKey); if (url.empty()) { return url; diff --git a/Source/Contents/Party/AdventurerAgencyMgr.h b/Source/Contents/Party/AdventurerAgencyMgr.h index 486f9ab7..750aae18 100644 --- a/Source/Contents/Party/AdventurerAgencyMgr.h +++ b/Source/Contents/Party/AdventurerAgencyMgr.h @@ -6,12 +6,7 @@ #include struct AsyncDiagnostic; -struct StopRecruitingContext; -struct RegisterPartyContext; -struct PartyInfoContext; -struct AgencyRequestContext; #include "UI/Window/WindowManagerWindows.h" -class LuaScript; class CAdventurerAgencyMgr { public: @@ -21,21 +16,21 @@ public: static void Shutdown(); void LoadList(const Json::Value& value); const std::vector& Entries() const; - void RequestChangeMaster(std::uint32_t targetAccountId, std::uint32_t targetCharacterId, std::string targetName, AgencyRequestContext& context); - void RequestMyParty(AgencyRequestContext& context); - void RequestList(int page, AgencyRequestContext& context); - void RequestInfo(std::uint32_t queryAccountId, AgencyRequestContext& context, PartyInfoContext& completion); - void RequestSearch(const CAdvenPartyInfo& filter, int page, AgencyRequestContext& context); - void RequestRegistration(const CAdvenPartyInfo& info, AgencyRequestContext& context, RegisterPartyContext& completion); - void RequestStop(std::uint32_t masterAccountId, AgencyRequestContext& context, StopRecruitingContext& completion); - void RequestStop(AgencyRequestContext& context, StopRecruitingContext& completion); + void RequestChangeMaster(std::uint32_t targetAccountId, std::uint32_t targetCharacterId, std::string targetName); + void RequestMyParty(); + void RequestList(int page); + void RequestInfo(std::uint32_t queryAccountId); + void RequestSearch(const CAdvenPartyInfo& filter, int page); + void RequestRegistration(const CAdvenPartyInfo& info); + void RequestStop(std::uint32_t masterAccountId); + void RequestStop(); void CompleteChangeMaster(AsyncDiagnostic diagnostic, std::string response, WindowManagerWindows& windows); void CompleteList(AsyncDiagnostic diagnostic, std::string response, WindowManagerWindows& windows); void CompleteMyParty(AsyncDiagnostic diagnostic, std::string response, WindowManagerWindows& windows); - void CompletePartyInfo(AsyncDiagnostic diagnostic, std::string response, PartyInfoContext& context); - void CompleteRegistration(AsyncDiagnostic diagnostic, std::string response, RegisterPartyContext& context); - void CompleteStopRecruiting(AsyncDiagnostic diagnostic, std::string response, StopRecruitingContext& context); - std::string ServiceUrl(int operation, LuaScript& settings, LuaScript& tables, const char* host, const char* port, const char* overrideKey) const; + void CompletePartyInfo(AsyncDiagnostic diagnostic, std::string response); + void CompleteRegistration(AsyncDiagnostic diagnostic, std::string response); + void CompleteStopRecruiting(AsyncDiagnostic diagnostic, std::string response); + std::string ServiceUrl(int operation) const; /* 0004 */ bool enabled; /* 0005 */ bool registered; diff --git a/Source/Contents/Party/AgencyRequestContext.h b/Source/Contents/Party/AgencyRequestContext.h deleted file mode 100644 index 9d8c407a..00000000 --- a/Source/Contents/Party/AgencyRequestContext.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef RAGNAROK_SOURCE_CONTENTS_PARTY_AGENCYREQUESTCONTEXT_H -#define RAGNAROK_SOURCE_CONTENTS_PARTY_AGENCYREQUESTCONTEXT_H - -#include -#include - -class CAsyncWorkMgr; -class LuaScript; -#include "UI/Window/WindowManagerWindows.h" - -struct AgencyRequestContext { - CAsyncWorkMgr& work; - LuaScript& settings; - LuaScript& tables; - WindowManagerWindows& windows; - const std::uint32_t& accountId; - const std::uint32_t& characterId; - const std::string& world; - const std::string& characterName; - const char* token16; - const char* host; - const char* port; - const char* overrideKey; -}; - -#endif diff --git a/Source/Contents/Party/AgencyRequests.cpp b/Source/Contents/Party/AgencyRequests.cpp index 2242a189..1795a767 100644 --- a/Source/Contents/Party/AgencyRequests.cpp +++ b/Source/Contents/Party/AgencyRequests.cpp @@ -1,103 +1,102 @@ +#include "Client/Session.h" #include "Contents/Party/AdventurerAgencyMgr.h" -#include "Contents/Party/AgencyRequestContext.h" #include "Contents/Async/AsyncWorkMgr.h" +#include "UI/Window/UIWindowMgr.h" // OFFSET: 0x005CB3B0 // FUNCTION: fn_03657 -void CAdventurerAgencyMgr::RequestChangeMaster( - std::uint32_t targetAccountId, std::uint32_t targetCharacterId, std::string targetName, AgencyRequestContext& context -) { - const std::uint32_t account = context.accountId; - const std::uint32_t character = context.characterId; - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(6, context.settings, context.tables, context.host, context.port, context.overrideKey); - const std::string world(context.world.c_str()); - context.work.ChangePartyMaster( - account, character, std::string(context.characterName.c_str()), targetAccountId, targetCharacterId, targetName, world, url, token, context.windows +void CAdventurerAgencyMgr::RequestChangeMaster(std::uint32_t targetAccountId, std::uint32_t targetCharacterId, std::string targetName) { + const std::uint32_t account = g_session.m_aid; + const std::uint32_t character = g_session.m_gid; + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(6); + const std::string world(g_session.m_accountName.c_str()); + g_asyncWorkMgr->ChangePartyMaster( + account, character, std::string(g_session.DecodePlayerName()), targetAccountId, targetCharacterId, targetName, world, url, token, g_windowMgr ); ++this->pending; } // OFFSET: 0x005CB710 // FUNCTION: fn_03659 -void CAdventurerAgencyMgr::RequestMyParty(AgencyRequestContext& context) { - const std::uint32_t account = context.accountId; - const std::uint32_t character = context.characterId; - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(5, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.LoadMyParty(account, character, std::string(context.world.c_str()), url, token, context.windows); +void CAdventurerAgencyMgr::RequestMyParty() { + const std::uint32_t account = g_session.m_aid; + const std::uint32_t character = g_session.m_gid; + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(5); + g_asyncWorkMgr->LoadMyParty(account, character, std::string(g_session.m_accountName.c_str()), url, token, g_windowMgr); ++this->pending; } // OFFSET: 0x005CBEE0 // FUNCTION: fn_03661 -void CAdventurerAgencyMgr::RequestList(int page, AgencyRequestContext& context) { - const std::uint32_t account = context.accountId; - const std::uint32_t character = context.characterId; +void CAdventurerAgencyMgr::RequestList(int page) { + const std::uint32_t account = g_session.m_aid; + const std::uint32_t character = g_session.m_gid; CAdvenPartyInfo filter; - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(1, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.LoadPartyList(account, character, std::string(context.world.c_str()), url, token, 0, filter, page, context.windows); + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(1); + g_asyncWorkMgr->LoadPartyList(account, character, std::string(g_session.m_accountName.c_str()), url, token, 0, filter, page, g_windowMgr); ++this->pending; } // OFFSET: 0x005CC290 // FUNCTION: fn_03663 -void CAdventurerAgencyMgr::RequestInfo(std::uint32_t queryAccountId, AgencyRequestContext& context, PartyInfoContext& completion) { - const std::uint32_t account = context.accountId; - const std::uint32_t character = context.characterId; - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(7, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.LoadPartyInfo(account, character, std::string(context.world.c_str()), url, token, queryAccountId, completion); +void CAdventurerAgencyMgr::RequestInfo(std::uint32_t queryAccountId) { + const std::uint32_t account = g_session.m_aid; + const std::uint32_t character = g_session.m_gid; + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(7); + g_asyncWorkMgr->LoadPartyInfo(account, character, std::string(g_session.m_accountName.c_str()), url, token, queryAccountId); ++this->pending; } // OFFSET: 0x005CCC00 // FUNCTION: fn_03665 -void CAdventurerAgencyMgr::RequestRegistration(const CAdvenPartyInfo& info, AgencyRequestContext& context, RegisterPartyContext& completion) { - const std::uint32_t account = context.accountId; - const std::uint32_t character = context.characterId; +void CAdventurerAgencyMgr::RequestRegistration(const CAdvenPartyInfo& info) { + const std::uint32_t account = g_session.m_aid; + const std::uint32_t character = g_session.m_gid; const CAdvenPartyInfo registration(info); - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(0, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.RegisterParty(account, character, std::string(context.world.c_str()), url, token, registration, completion); + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(0); + g_asyncWorkMgr->RegisterParty(account, character, std::string(g_session.m_accountName.c_str()), url, token, registration); ++this->pending; } // OFFSET: 0x005CCF80 // FUNCTION: fn_03667 -void CAdventurerAgencyMgr::RequestSearch(const CAdvenPartyInfo& filter, int page, AgencyRequestContext& context) { - const std::uint32_t account = context.accountId; - const std::uint32_t character = context.characterId; +void CAdventurerAgencyMgr::RequestSearch(const CAdvenPartyInfo& filter, int page) { + const std::uint32_t account = g_session.m_aid; + const std::uint32_t character = g_session.m_gid; const CAdvenPartyInfo search(filter); - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(3, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.LoadPartyList(account, character, std::string(context.world.c_str()), url, token, 1, search, page, context.windows); + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(3); + g_asyncWorkMgr->LoadPartyList(account, character, std::string(g_session.m_accountName.c_str()), url, token, 1, search, page, g_windowMgr); ++this->pending; } // OFFSET: 0x005CD340 // FUNCTION: fn_03669 -void CAdventurerAgencyMgr::RequestStop(std::uint32_t masterAccountId, AgencyRequestContext& context, StopRecruitingContext& completion) { +void CAdventurerAgencyMgr::RequestStop(std::uint32_t masterAccountId) { this->unknown_0008 = masterAccountId; - const std::uint32_t account = context.accountId; - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(4, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.StopRecruiting(account, std::string(context.world.c_str()), url, token, masterAccountId, completion); + const std::uint32_t account = g_session.m_aid; + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(4); + g_asyncWorkMgr->StopRecruiting(account, std::string(g_session.m_accountName.c_str()), url, token, masterAccountId); ++this->pending; } // OFFSET: 0x005CD440 // FUNCTION: fn_03670 -void CAdventurerAgencyMgr::RequestStop(AgencyRequestContext& context, StopRecruitingContext& completion) { +void CAdventurerAgencyMgr::RequestStop() { if (!this->registered) { return; } - this->unknown_0008 = context.accountId; - const std::uint32_t account = context.accountId; - const std::string token(context.token16, 16); - const std::string url = this->ServiceUrl(4, context.settings, context.tables, context.host, context.port, context.overrideKey); - context.work.StopRecruiting(account, std::string(context.world.c_str()), url, token, account, completion); + this->unknown_0008 = g_session.m_aid; + const std::uint32_t account = g_session.m_aid; + const std::string token(reinterpret_cast(&g_session.unknown_807C[8]), 16); + const std::string url = this->ServiceUrl(4); + g_asyncWorkMgr->StopRecruiting(account, std::string(g_session.m_accountName.c_str()), url, token, account); ++this->pending; } diff --git a/Source/Contents/Party/LoadPartyInfoAsyncWork.cpp b/Source/Contents/Party/LoadPartyInfoAsyncWork.cpp index 2fb87095..47a85a4d 100644 --- a/Source/Contents/Party/LoadPartyInfoAsyncWork.cpp +++ b/Source/Contents/Party/LoadPartyInfoAsyncWork.cpp @@ -20,7 +20,7 @@ namespace { // OFFSET: 0x005D0470 // FUNCTION: fn_03692 CLoadPartyInfoAsyncWork::CLoadPartyInfoAsyncWork() - : NAsyncWork("PartyInfo_Load"), m_accountId(0), m_characterId(0), m_diagnostic(Diagnostic(false, "unknwon", 25)), m_context(nullptr) { + : NAsyncWork("PartyInfo_Load"), m_accountId(0), m_characterId(0), m_diagnostic(Diagnostic(false, "unknwon", 25)) { } // INLINED @@ -34,8 +34,7 @@ void CLoadPartyInfoAsyncWork::Reset() { // OFFSET: 0x005D0930 // FUNCTION: fn_03694 void CLoadPartyInfoAsyncWork::Bind( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId, - PartyInfoContext& context + std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId ) { this->m_group = timeGetTime(); this->m_accountId = accountId; @@ -47,7 +46,6 @@ void CLoadPartyInfoAsyncWork::Bind( this->m_queryAccountId = queryAccountId; AsyncDiagnostic diagnostic = Diagnostic(false, "unknwon", 52); this->m_diagnostic.MoveFrom(diagnostic); - this->m_context = &context; } // OFFSET: 0x005D0C80 @@ -79,5 +77,5 @@ bool CLoadPartyInfoAsyncWork::Execute() { // OFFSET: 0x005D0BC0 // FUNCTION: fn_03696 void CLoadPartyInfoAsyncWork::Complete() { - g_adventurerAgencyMgr->CompletePartyInfo(this->m_diagnostic, this->m_response, *this->m_context); + g_adventurerAgencyMgr->CompletePartyInfo(this->m_diagnostic, this->m_response); } diff --git a/Source/Contents/Party/LoadPartyInfoAsyncWork.h b/Source/Contents/Party/LoadPartyInfoAsyncWork.h index 1b757710..75fad653 100644 --- a/Source/Contents/Party/LoadPartyInfoAsyncWork.h +++ b/Source/Contents/Party/LoadPartyInfoAsyncWork.h @@ -4,23 +4,6 @@ #include "Utility/Async/AsyncDiagnostic.h" #include "Utility/Async/NAsyncWork.h" -#include "UI/Window/WindowManagerWindows.h" -class ResourceMessages; -class ModeEvents; -struct WindowOrdering; - -struct PartyInfoContext { - WindowManagerWindows& windows; - WindowOrdering& ordering; - ResourceMessages& messages; - ModeEvents*& mode; - const int& playerLevel; - const int& partyCount; - const bool& languagePrefix; - const int& service; - const unsigned short& language; -}; - class alignas(8) CLoadPartyInfoAsyncWork : public NAsyncWork { public: CLoadPartyInfoAsyncWork(); @@ -28,10 +11,7 @@ public: void Reset() override; bool Execute() override; void Complete() override; - void Bind( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId, - PartyInfoContext& context - ); + void Bind(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::uint32_t queryAccountId); protected: /* 0028 */ std::uint32_t m_accountId; @@ -42,7 +22,6 @@ protected: /* 0078 */ std::string m_token; /* 0090 */ std::uint32_t m_queryAccountId; /* 0094 */ AsyncDiagnostic m_diagnostic; - PartyInfoContext* m_context; }; #if defined(_WIN32) && !defined(_WIN64) diff --git a/Source/Contents/Party/PartyInfoCompletion.cpp b/Source/Contents/Party/PartyInfoCompletion.cpp index e9dac375..44464a55 100644 --- a/Source/Contents/Party/PartyInfoCompletion.cpp +++ b/Source/Contents/Party/PartyInfoCompletion.cpp @@ -1,11 +1,13 @@ -#include "Client/Mode/ModeEvents.h" +#include "Client/Session.h" +#include "Client/Mode/CMode.h" +#include "Contents/Messenger/ClientMessenger.h" #include "Contents/Party/AdventurerAgencyMgr.h" -#include "Contents/Party/LoadPartyInfoAsyncWork.h" +#include "Utility/Async/AsyncDiagnostic.h" #include "Contents/MessageTable.h" -#include "Resource/ResourceFailures.h" #include "UI/Party/UIAdvenPartyBoardWnd.h" #include "UI/Party/UIApplyForPartyWnd.h" -#include "UI/Window/WindowManagerWindows.h" +#include "UI/Window/UINewSelectCharWnd.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowOrdering.h" #include @@ -13,7 +15,7 @@ // OFFSET: 0x005CC3A0 // FUNCTION: fn_03664 -void CAdventurerAgencyMgr::CompletePartyInfo(AsyncDiagnostic diagnostic, std::string response, PartyInfoContext& context) { +void CAdventurerAgencyMgr::CompletePartyInfo(AsyncDiagnostic diagnostic, std::string response) { --this->pending; if (!diagnostic.success) { @@ -32,12 +34,12 @@ void CAdventurerAgencyMgr::CompletePartyInfo(AsyncDiagnostic diagnostic, std::st return; } - const auto notify = [&](int id) { context.messages.Message(LookupMessage(id), 0xFF); }; + const auto notify = [&](int id) { g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(id)), 0xFF, 0, 0, 0); }; auto entry = root["data"].begin(); if (entry == root["data"].end()) { notify(3443); - context.windows.CloseWindow(345); + g_windowMgr.CloseWindow(345); return; } @@ -53,7 +55,7 @@ void CAdventurerAgencyMgr::CompletePartyInfo(AsyncDiagnostic diagnostic, std::st info.maximumLevel = (*entry).get("MaxLV", 999).asInt(); info.type = (*entry).get("Type", 1).asInt(); info.memo = (*entry).get("Memo", "").asString(); - UIWindow* board = context.windows.LookupWindow(324); + UIWindow* board = g_windowMgr.LookupWindow(324); if (board) { for (auto& value : this->entries) { @@ -66,19 +68,19 @@ void CAdventurerAgencyMgr::CompletePartyInfo(AsyncDiagnostic diagnostic, std::st board->SendMsg(nullptr, 60, 0, 0, 0, 0); } - auto* application = static_cast(context.windows.LookupWindow(345)); + auto* application = static_cast(g_windowMgr.LookupWindow(345)); if (application) { application->SetInfo(info); - context.ordering.Promote(application); + reinterpret_cast(g_windowMgr).Promote(application); } - if (info.minimumLevel > context.playerLevel || info.maximumLevel < context.playerLevel) { + if (info.minimumLevel > g_session.m_level || info.maximumLevel < g_session.m_level) { notify(3416); - } else if (context.partyCount > 0) { + } else if (ClientMessenger{g_session.m_partyMembers, g_session.m_friends}.PartyCount() > 0) { notify(79); } else { - context.mode->SendModeMessage(265, reinterpret_cast(&info.accountId), reinterpret_cast(&info.characterId), 0, 0); - context.windows.CloseWindow(345); + static_cast(g_charViewMode)->SendMsg(265, reinterpret_cast(&info.accountId), reinterpret_cast(&info.characterId), 0, 0); + g_windowMgr.CloseWindow(345); } } diff --git a/Source/Contents/Party/PartyJoinResult.cpp b/Source/Contents/Party/PartyJoinResult.cpp index 4f0a32e4..b83eea19 100644 --- a/Source/Contents/Party/PartyJoinResult.cpp +++ b/Source/Contents/Party/PartyJoinResult.cpp @@ -1,34 +1,33 @@ +#include "Client/Session.h" #include "Contents/Party/AdventurerAgencyMgr.h" -#include "Contents/Party/AgencyRequestContext.h" #include "Contents/MessageTable.h" #include "Contents/Party/PartyJoinResult.h" -#include "Contents/Party/StopRecruitingAsyncWork.h" -#include "UI/Window/WindowNotifications.h" +#include "UI/Window/UIWindowMgr.h" #include #include // OFFSET: 0x00D3B9E0 // FUNCTION: fn_21788 -void ReceivePartyJoinResult(const void* packet, PartyJoinResultContext& context) { +void ReceivePartyJoinResult(const void* packet) { const auto* bytes = static_cast(packet); - context.notifications.Notify(3, nullptr, 0); + g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); std::uint32_t status; std::memcpy(&status, bytes + 54, sizeof(status)); const auto message = [&](int id) { return LookupMessage(id); }; - const auto notify = [&](int id) { context.notifications.Notify(1, message(id), 0xFF); }; + const auto notify = [&](int id) { g_windowMgr.SendNotice(1, reinterpret_cast(message(id)), 0xFF, 0, 0, 0); }; const auto format = [&](int id, unsigned offset, unsigned color) { char text[500] = {}; _snprintf_s(text, sizeof(text), _TRUNCATE, message(id), reinterpret_cast(bytes + offset)); - context.notifications.Notify(1, text, color); + g_windowMgr.SendNotice(1, reinterpret_cast(text), color, 0, 0, 0); }; switch (status) { case 0: - format(context.partyMember == 1 ? 3501 : 3498, context.partyMember == 1 ? 2 : 26, 0xFFFF64); + format(g_session.unknown_5464 == 1 ? 3501 : 3498, g_session.unknown_5464 == 1 ? 2 : 26, 0xFFFF64); break; case 1: - format(context.partyMember == 1 ? 3502 : 3499, context.partyMember == 1 ? 2 : 26, 0xFF); + format(g_session.unknown_5464 == 1 ? 3502 : 3499, g_session.unknown_5464 == 1 ? 2 : 26, 0xFF); break; case 2: notify(3497); @@ -53,7 +52,7 @@ void ReceivePartyJoinResult(const void* packet, PartyJoinResultContext& context) notify(3494); std::uint32_t master; std::memcpy(&master, bytes + 50, sizeof(master)); - g_adventurerAgencyMgr->RequestStop(master, context.requests, context.stop); + g_adventurerAgencyMgr->RequestStop(master); break; } case 10: diff --git a/Source/Contents/Party/PartyJoinResult.h b/Source/Contents/Party/PartyJoinResult.h index 7a7d0ea0..65d64c10 100644 --- a/Source/Contents/Party/PartyJoinResult.h +++ b/Source/Contents/Party/PartyJoinResult.h @@ -1,17 +1,6 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_PARTY_PARTYJOINRESULT_H #define RAGNAROK_SOURCE_CONTENTS_PARTY_PARTYJOINRESULT_H -struct AgencyRequestContext; -struct StopRecruitingContext; -class WindowNotifications; - -struct PartyJoinResultContext { - WindowNotifications& notifications; - AgencyRequestContext& requests; - StopRecruitingContext& stop; - const int& partyMember; -}; - -void ReceivePartyJoinResult(const void* packet, PartyJoinResultContext& context); +void ReceivePartyJoinResult(const void* packet); #endif diff --git a/Source/Contents/Party/PartyRegistrationCompletion.cpp b/Source/Contents/Party/PartyRegistrationCompletion.cpp index bafd304f..782fce5a 100644 --- a/Source/Contents/Party/PartyRegistrationCompletion.cpp +++ b/Source/Contents/Party/PartyRegistrationCompletion.cpp @@ -1,16 +1,15 @@ #include "Contents/Party/AdventurerAgencyMgr.h" +#include "Utility/Async/AsyncDiagnostic.h" #include "Contents/MessageTable.h" -#include "Contents/Party/RegisterPartyAsyncWork.h" -#include "Resource/ResourceFailures.h" #include "UI/Window/UIWindow.h" -#include "UI/Window/WindowManagerWindows.h" +#include "UI/Window/UIWindowMgr.h" #include #include // OFFSET: 0x005CCD20 // FUNCTION: fn_03666 -void CAdventurerAgencyMgr::CompleteRegistration(AsyncDiagnostic diagnostic, std::string response, RegisterPartyContext& context) { +void CAdventurerAgencyMgr::CompleteRegistration(AsyncDiagnostic diagnostic, std::string response) { --this->pending; if (!diagnostic.success) { @@ -28,17 +27,17 @@ void CAdventurerAgencyMgr::CompleteRegistration(AsyncDiagnostic diagnostic, std: const int type = root["Type"].asInt(); if (type == 2 || type == 3) { - context.messages.Message(LookupMessage(3417), 0xFF); + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3417)), 0xFF, 0, 0, 0); return; } this->registered = true; - context.messages.Message(LookupMessage(3418), 0xFFFF64); - UIWindow* board = context.windows.LookupWindow(324); + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3418)), 0xFFFF64, 0, 0, 0); + UIWindow* board = g_windowMgr.LookupWindow(324); if (board) { board->SendMsg(nullptr, 6, 415, 0, 0, 0); } else { - context.windows.EnsureWindow(324); + g_windowMgr.EnsureWindow(324); } } diff --git a/Source/Contents/Party/RegisterPartyAsyncWork.cpp b/Source/Contents/Party/RegisterPartyAsyncWork.cpp index 97bb73ed..e11652fe 100644 --- a/Source/Contents/Party/RegisterPartyAsyncWork.cpp +++ b/Source/Contents/Party/RegisterPartyAsyncWork.cpp @@ -1,3 +1,4 @@ +#include "Client/Session.h" #include "Contents/Party/AdventurerAgencyMgr.h" #include "Contents/Party/RegisterPartyAsyncWork.h" #include "Network/Http/CURLPostHander.h" @@ -20,7 +21,7 @@ namespace { // OFFSET: 0x005D3600 // FUNCTION: fn_03704 CRegisterPartyAsyncWork::CRegisterPartyAsyncWork() - : NAsyncWork("Register_Party"), m_accountId(0), m_characterId(0), m_diagnostic(Diagnostic(false, "unknwon", 26)), m_context(nullptr) { + : NAsyncWork("Register_Party"), m_accountId(0), m_characterId(0), m_diagnostic(Diagnostic(false, "unknwon", 26)) { } // INLINED @@ -34,8 +35,7 @@ void CRegisterPartyAsyncWork::Reset() { // OFFSET: 0x005D3B80 // FUNCTION: fn_03706 void CRegisterPartyAsyncWork::Bind( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, const CAdvenPartyInfo& info, - RegisterPartyContext& context + std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, const CAdvenPartyInfo& info ) { this->m_group = timeGetTime(); this->m_accountId = accountId; @@ -47,7 +47,6 @@ void CRegisterPartyAsyncWork::Bind( this->m_info = info; AsyncDiagnostic diagnostic = Diagnostic(false, "unknwon", 50); this->m_diagnostic.MoveFrom(diagnostic); - this->m_context = &context; } // OFFSET: 0x005D3F50 @@ -64,7 +63,7 @@ bool CRegisterPartyAsyncWork::Execute() { _snprintf_s(maximum, sizeof(maximum), _TRUNCATE, "%d", this->m_info.maximumLevel); _snprintf_s(type, sizeof(type), _TRUNCATE, "%d", this->m_info.type); const std::string world = ToUtf8(this->m_world); - const std::string name = ToUtf8(this->m_context->characterName); + const std::string name = ToUtf8(std::string(g_session.DecodePlayerName())); const std::string memo = ToUtf8(this->m_info.memo); CCURLPostHander handler(this->m_url); handler.AddField("AID", account, 4); @@ -96,5 +95,5 @@ bool CRegisterPartyAsyncWork::Execute() { // OFFSET: 0x005D3E90 // FUNCTION: fn_03708 void CRegisterPartyAsyncWork::Complete() { - g_adventurerAgencyMgr->CompleteRegistration(this->m_diagnostic, this->m_response, *this->m_context); + g_adventurerAgencyMgr->CompleteRegistration(this->m_diagnostic, this->m_response); } diff --git a/Source/Contents/Party/RegisterPartyAsyncWork.h b/Source/Contents/Party/RegisterPartyAsyncWork.h index bc70462b..a1de1b75 100644 --- a/Source/Contents/Party/RegisterPartyAsyncWork.h +++ b/Source/Contents/Party/RegisterPartyAsyncWork.h @@ -5,18 +5,6 @@ #include "Utility/Async/AsyncDiagnostic.h" #include "Utility/Async/NAsyncWork.h" -#include "UI/Window/WindowManagerWindows.h" -class ResourceMessages; - -struct RegisterPartyContext { - WindowManagerWindows& windows; - ResourceMessages& messages; - const std::string& characterName; - const bool& languagePrefix; - const int& service; - const unsigned short& language; -}; - class alignas(8) CRegisterPartyAsyncWork : public NAsyncWork { public: CRegisterPartyAsyncWork(); @@ -24,10 +12,7 @@ public: void Reset() override; bool Execute() override; void Complete() override; - void Bind( - std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, const CAdvenPartyInfo& info, - RegisterPartyContext& context - ); + void Bind(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, const CAdvenPartyInfo& info); protected: /* 0028 */ std::uint32_t m_accountId; @@ -38,12 +23,10 @@ protected: /* 0078 */ CAdvenPartyInfo m_info; /* 00C4 */ AsyncDiagnostic m_diagnostic; /* 00FC */ std::string m_response; - RegisterPartyContext* m_context; }; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(CRegisterPartyAsyncWork) == 280); - #endif #endif diff --git a/Source/Contents/Party/StopRecruitingAsyncWork.cpp b/Source/Contents/Party/StopRecruitingAsyncWork.cpp index aaa9848e..de50dfa9 100644 --- a/Source/Contents/Party/StopRecruitingAsyncWork.cpp +++ b/Source/Contents/Party/StopRecruitingAsyncWork.cpp @@ -20,7 +20,7 @@ namespace { // OFFSET: 0x005D5D70 // FUNCTION: fn_03711 CStopRecruitingAsyncWork::CStopRecruitingAsyncWork() - : NAsyncWork("Stop_Recruiting"), m_accountId(0), m_masterAccountId(0), m_diagnostic(Diagnostic(false, "unknwon", 28)), m_context(nullptr) { + : NAsyncWork("Stop_Recruiting"), m_accountId(0), m_masterAccountId(0), m_diagnostic(Diagnostic(false, "unknwon", 28)) { } // INLINED @@ -33,9 +33,7 @@ void CStopRecruitingAsyncWork::Reset() { // OFFSET: 0x005D6230 // FUNCTION: fn_03713 -void CStopRecruitingAsyncWork::Bind( - std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId, StopRecruitingContext& context -) { +void CStopRecruitingAsyncWork::Bind(std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId) { this->m_group = timeGetTime(); this->m_accountId = accountId; this->m_masterAccountId = masterAccountId; @@ -45,7 +43,6 @@ void CStopRecruitingAsyncWork::Bind( this->m_token = token; AsyncDiagnostic diagnostic = Diagnostic(false, "unknwon", 50); this->m_diagnostic.MoveFrom(diagnostic); - this->m_context = &context; } // OFFSET: 0x005D6570 @@ -77,5 +74,5 @@ bool CStopRecruitingAsyncWork::Execute() { // OFFSET: 0x005D64B0 // FUNCTION: fn_03715 void CStopRecruitingAsyncWork::Complete() { - g_adventurerAgencyMgr->CompleteStopRecruiting(this->m_diagnostic, this->m_response, *this->m_context); + g_adventurerAgencyMgr->CompleteStopRecruiting(this->m_diagnostic, this->m_response); } diff --git a/Source/Contents/Party/StopRecruitingAsyncWork.h b/Source/Contents/Party/StopRecruitingAsyncWork.h index b95fea0a..2dc0bbc8 100644 --- a/Source/Contents/Party/StopRecruitingAsyncWork.h +++ b/Source/Contents/Party/StopRecruitingAsyncWork.h @@ -4,18 +4,6 @@ #include "Utility/Async/AsyncDiagnostic.h" #include "Utility/Async/NAsyncWork.h" -#include "UI/Window/WindowManagerWindows.h" -class ResourceMessages; - -struct StopRecruitingContext { - WindowManagerWindows& windows; - ResourceMessages& messages; - const std::uint32_t& accountId; - const bool& languagePrefix; - const int& service; - const unsigned short& language; -}; - class CStopRecruitingAsyncWork : public NAsyncWork { public: CStopRecruitingAsyncWork(); @@ -23,7 +11,7 @@ public: void Reset() override; bool Execute() override; void Complete() override; - void Bind(std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId, StopRecruitingContext& context); + void Bind(std::uint32_t accountId, std::string world, std::string url, std::string token, std::uint32_t masterAccountId); protected: /* 0028 */ std::uint32_t m_accountId; @@ -33,11 +21,10 @@ protected: /* 0060 */ std::string m_response; /* 0078 */ std::string m_url; /* 0090 */ AsyncDiagnostic m_diagnostic; - StopRecruitingContext* m_context; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(sizeof(CStopRecruitingAsyncWork) == 204); +static_assert(sizeof(CStopRecruitingAsyncWork) == 0xC8); #endif #endif diff --git a/Source/Contents/Party/StopRecruitingCompletion.cpp b/Source/Contents/Party/StopRecruitingCompletion.cpp index f362eac4..c8d4867e 100644 --- a/Source/Contents/Party/StopRecruitingCompletion.cpp +++ b/Source/Contents/Party/StopRecruitingCompletion.cpp @@ -1,24 +1,24 @@ +#include "Client/Session.h" #include "Contents/Party/AdventurerAgencyMgr.h" +#include "Utility/Async/AsyncDiagnostic.h" #include "Contents/MessageTable.h" -#include "Contents/Party/StopRecruitingAsyncWork.h" -#include "Resource/ResourceFailures.h" #include "UI/Party/UIAdvenPartyBoardWnd.h" #include "UI/Buttons/UIBasicButton.h" -#include "UI/Window/WindowManagerWindows.h" +#include "UI/Window/UIWindowMgr.h" #include #include // OFFSET: 0x005CD0A0 // FUNCTION: fn_03668 -void CAdventurerAgencyMgr::CompleteStopRecruiting(AsyncDiagnostic diagnostic, std::string response, StopRecruitingContext& context) { +void CAdventurerAgencyMgr::CompleteStopRecruiting(AsyncDiagnostic diagnostic, std::string response) { --this->pending; const auto notify = [&](int id, unsigned color) { - context.messages.Message(LookupMessage(id), color); + g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(id)), color, 0, 0, 0); }; if (!diagnostic.success) { - if (this->unknown_0008 == context.accountId) { + if (this->unknown_0008 == g_session.m_aid) { notify(3507, 0xFF); } @@ -36,19 +36,19 @@ void CAdventurerAgencyMgr::CompleteStopRecruiting(AsyncDiagnostic diagnostic, st const int type = root["Type"].asInt(); if (type == 2 || type == 3) { - if (this->unknown_0008 == context.accountId) { + if (this->unknown_0008 == g_session.m_aid) { notify(3507, 0xFF); } return; } - if (this->unknown_0008 == context.accountId) { + if (this->unknown_0008 == g_session.m_aid) { notify(3459, 0xFFFF64); } this->registered = false; - auto* board = static_cast(context.windows.LookupWindow(324)); + auto* board = static_cast(g_windowMgr.LookupWindow(324)); if (board) { board->stop->Enable(0); diff --git a/Source/UI/Party/UIAdvenPartyBoardWnd.cpp b/Source/UI/Party/UIAdvenPartyBoardWnd.cpp index 4d3e3985..42337ae0 100644 --- a/Source/UI/Party/UIAdvenPartyBoardWnd.cpp +++ b/Source/UI/Party/UIAdvenPartyBoardWnd.cpp @@ -1,7 +1,7 @@ #include "Contents/MessageTable.h" #include "Client/Input/Language.h" #include "Contents/Party/AdventurerAgencyMgr.h" -#include "Contents/Party/AgencyRequestContext.h" +#include "Client/Session.h" #include "Render/DeviceContext/DeviceContext.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" @@ -16,7 +16,8 @@ #include "UI/Party/UIPartyInfoWnd.h" #include "UI/Party/UIRegisterPartyWnd.h" #include "UI/Text/UIStaticText.h" -#include "UI/Window/WindowManagerWindows.h" +#include "Render/Renderer.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowOrdering.h" #include @@ -30,9 +31,8 @@ namespace { // OFFSET: 0x007BAC40 // FUNCTION: fn_09274 -UIAdvenPartyBoardWnd::UIAdvenPartyBoardWnd(UIWindowContext& windows, UIAdvenPartyBoardContext& board) - : UIFrameWnd(windows, 0), unknown_0104(0), unknown_0108(0), page(1), totalPages(1), unknown_0114(1), unknown_0118(0), selectedType(0), - m_board(&board) { +UIAdvenPartyBoardWnd::UIAdvenPartyBoardWnd(UIWindowContext& windows) + : UIFrameWnd(windows, 0), unknown_0104(0), unknown_0108(0), page(1), totalPages(1), unknown_0114(1), unknown_0118(0), selectedType(0) { } // OFFSET: 0x007BB590 @@ -52,15 +52,13 @@ void UIAdvenPartyBoardWnd::Slot11() { // OFFSET: 0x007BC220 // FUNCTION: fn_09298 void UIAdvenPartyBoardWnd::Slot15(int, int) { - auto& owner = *this->m_board; - this->minimum = new UIEditCtrl2(*this->m_context); this->minimum->SetSize(25, 14); this->minimum->invalidatesParent = 1; this->minimum->maximum = 3; this->minimum->TextColor(0, 0xFFFFFFFFu); char number[10] = {}; - _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((owner.playerLevel - 5), 1)); + _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((g_session.m_level - 5), 1)); this->minimum->SetText(number); this->minimum->Move(10, 24); this->minimum->Background(242, 242, 242); @@ -72,7 +70,7 @@ void UIAdvenPartyBoardWnd::Slot15(int, int) { this->maximum->invalidatesParent = 1; this->maximum->maximum = 3; this->maximum->TextColor(0, 0xFFFFFFFFu); - _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", (owner.playerLevel + 5)); + _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", (g_session.m_level + 5)); this->maximum->SetText(number); this->maximum->Move(46, 24); this->maximum->Background(242, 242, 242); @@ -152,7 +150,7 @@ void UIAdvenPartyBoardWnd::Slot15(int, int) { this->next = arrow("btn_list_right", 218, 265); for (int index = 0; index < 10; ++index) { - auto* row = new UIPartyInfoWnd(*this->m_context, owner.rows); + auto* row = new UIPartyInfoWnd(*this->m_context); this->rows[index] = row; artwork(row, "btn_list"); row->Move(1, 73 + index * 24); @@ -164,7 +162,7 @@ void UIAdvenPartyBoardWnd::Slot15(int, int) { this->AddChild(row); } - this->ownParty = new UIPartyInfoWnd(*this->m_context, owner.rows); + this->ownParty = new UIPartyInfoWnd(*this->m_context); const char* ownImages[] = {"btn_recruit_on.bmp", "btn_recruit_on.bmp", "btn_recruiting_press.bmp", "btn_recruiting_disable.bmp"}; for (int state = 0; state < 4; ++state) { @@ -244,10 +242,10 @@ void UIAdvenPartyBoardWnd::LoadPage(int pageValue) { this->refresh->SetDisabled(1); this->refresh->Invalidate(); this->refresh->Invalidate(); - g_adventurerAgencyMgr->RequestList(pageValue, this->m_board->requests); + g_adventurerAgencyMgr->RequestList(pageValue); - if (this->m_board->partyMember == 1) { - g_adventurerAgencyMgr->RequestMyParty(this->m_board->requests); + if (g_session.unknown_5464 == 1) { + g_adventurerAgencyMgr->RequestMyParty(); } } @@ -255,7 +253,7 @@ void UIAdvenPartyBoardWnd::LoadPage(int pageValue) { // FUNCTION: fn_09322 void UIAdvenPartyBoardWnd::Registration(bool value) { - if (this->m_board->partyMember != 0) { + if (g_session.unknown_5464 != 0) { this->recruit->SetTooltip(""); this->ownParty->Enable(value ? 1 : 0); this->ownParty->SetDisabled(value ? 0 : 1); @@ -332,7 +330,7 @@ void UIAdvenPartyBoardWnd::UpdatePagination() { this->previous->Invalidate(); this->Invalidate(); - if (this->m_board->partyMember == 0) { + if (g_session.unknown_5464 == 0) { this->recruit->geometry.unknown_0030 = 3; this->recruit->Invalidate(); } @@ -345,9 +343,9 @@ void UIAdvenPartyBoardWnd::UpdatePagination() { // INLINED void UIAdvenPartyBoardWnd::ResetSearch() { char number[10] = {}; - _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((this->m_board->playerLevel - 5), 1)); + _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((g_session.m_level - 5), 1)); this->minimum->SetText(number); - _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", (this->m_board->playerLevel + 5)); + _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", (g_session.m_level + 5)); this->maximum->SetText(number); this->types->Select(0); @@ -381,12 +379,12 @@ void UIAdvenPartyBoardWnd::Search(int trigger) { char number[10] = {}; if (!digits(this->minimum->Text())) { - _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((this->m_board->playerLevel - 5), 1)); + _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((g_session.m_level - 5), 1)); this->minimum->SetText(number); } if (!digits(this->maximum->Text())) { - _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", (this->m_board->playerLevel + 5)); + _snprintf_s(number, sizeof(number), _TRUNCATE, "%d", (g_session.m_level + 5)); this->maximum->SetText(number); } @@ -409,7 +407,7 @@ void UIAdvenPartyBoardWnd::Search(int trigger) { } filter.memo = this->memo->Text(); - filter.characterName = this->m_board->characterName; + filter.characterName = g_session.DecodePlayerName(); for (auto* button : {this->previous, this->next, this->refresh}) { button->SetDisabled(1); @@ -421,7 +419,7 @@ void UIAdvenPartyBoardWnd::Search(int trigger) { this->page = 1; } - g_adventurerAgencyMgr->RequestSearch(filter, this->page, this->m_board->requests); + g_adventurerAgencyMgr->RequestSearch(filter, this->page); } // OFFSET: 0x007C0420 @@ -433,7 +431,7 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a case 6: switch (value) { case 201: - this->m_board->requests.windows.CloseWindow(324); + g_windowMgr.CloseWindow(324); break; case 218: this->page = (this->page + 1); @@ -470,28 +468,28 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a case 379: { const auto& info = this->rows[static_cast(b)]->info; - if (info.accountId == this->m_board->rows.accountId) { - this->m_board->requests.windows.CloseWindow(345); - auto* window = static_cast(this->m_board->requests.windows.EnsureWindow(323)); + if (info.accountId == g_session.m_aid) { + g_windowMgr.CloseWindow(345); + auto* window = static_cast(g_windowMgr.EnsureWindow(323)); if (window) { window->SetInfo(info); - this->m_board->ordering.Promote(window); + reinterpret_cast(g_windowMgr).Promote(window); } } else { - this->m_board->requests.windows.CloseWindow(323); - auto* window = static_cast(this->m_board->requests.windows.EnsureWindow(345)); + g_windowMgr.CloseWindow(323); + auto* window = static_cast(g_windowMgr.EnsureWindow(345)); if (window) { window->SetInfo(info); - this->m_board->ordering.Promote(window); + reinterpret_cast(g_windowMgr).Promote(window); } } break; } case 410: - g_adventurerAgencyMgr->RequestStop(this->m_board->requests, this->m_board->stopCompletion); + g_adventurerAgencyMgr->RequestStop(); break; case 415: this->page = 1; @@ -499,22 +497,22 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a this->LoadPage(1); break; case 564: { - this->m_board->requests.windows.CloseWindow(345); - auto* window = static_cast(this->m_board->requests.windows.EnsureWindow(323)); + g_windowMgr.CloseWindow(345); + auto* window = static_cast(g_windowMgr.EnsureWindow(323)); if (window) { window->SetInfo(this->ownParty->info); - this->m_board->ordering.Promote(window); + reinterpret_cast(g_windowMgr).Promote(window); } break; } case 565: { - this->m_board->requests.windows.CloseWindow(345); - UIWindow* window = this->m_board->requests.windows.EnsureWindow(323); + g_windowMgr.CloseWindow(345); + UIWindow* window = g_windowMgr.EnsureWindow(323); if (window) { - this->m_board->ordering.Promote(window); + reinterpret_cast(g_windowMgr).Promote(window); } break; @@ -527,8 +525,8 @@ int UIAdvenPartyBoardWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a case 34: this->saved = reinterpret_cast(a); - if (this->saved->width <= 0 || this->saved->height <= 0 || this->saved->x < 0 || this->saved->x > this->m_board->screenWidth - this->saved->width || - this->saved->y < 0 || this->saved->y > this->m_board->screenHeight - this->saved->height) { + if (this->saved->width <= 0 || this->saved->height <= 0 || this->saved->x < 0 || this->saved->x > g_renderer->viewport.width - this->saved->width || + this->saved->y < 0 || this->saved->y > g_renderer->viewport.height - this->saved->height) { *this->saved = {200, 200, 480, 340}; } diff --git a/Source/UI/Party/UIAdvenPartyBoardWnd.h b/Source/UI/Party/UIAdvenPartyBoardWnd.h index 15b3037b..96db7b20 100644 --- a/Source/UI/Party/UIAdvenPartyBoardWnd.h +++ b/Source/UI/Party/UIAdvenPartyBoardWnd.h @@ -14,7 +14,6 @@ class UIEditCtrl; class UIJobSlotButton; class UIComboBoxDef2Wnd; class UIPartyInfoWnd; -struct PartyRowContext; struct ExtendedListLine; struct PartyBoardPlacement { /* 0000 */ int x; @@ -23,25 +22,9 @@ struct PartyBoardPlacement { /* 000C */ int height; }; -struct AgencyRequestContext; -struct StopRecruitingContext; -struct WindowOrdering; - -struct UIAdvenPartyBoardContext { - PartyRowContext& rows; - AgencyRequestContext& requests; - StopRecruitingContext& stopCompletion; - WindowOrdering& ordering; - const int& playerLevel; - const int& partyMember; - const int& screenWidth; - const int& screenHeight; - const std::string& characterName; -}; - class UIAdvenPartyBoardWnd : public UIFrameWnd { public: - UIAdvenPartyBoardWnd(UIWindowContext& windows, UIAdvenPartyBoardContext& board); + UIAdvenPartyBoardWnd(UIWindowContext& windows); ~UIAdvenPartyBoardWnd() override; void Slot11() override; void Slot15(int width, int height) override; @@ -79,7 +62,6 @@ public: /* 0150 */ unsigned char searching; private: - UIAdvenPartyBoardContext* m_board; void RefreshRows(); void UpdatePagination(); void ResetSearch(); @@ -90,7 +72,7 @@ private: static_assert(offsetof(PartyBoardPlacement, y) == 0x04); static_assert(offsetof(PartyBoardPlacement, width) == 0x08); static_assert(offsetof(PartyBoardPlacement, height) == 0x0C); -static_assert(sizeof(UIAdvenPartyBoardWnd) == 352); +static_assert(sizeof(UIAdvenPartyBoardWnd) == 348); #endif #endif diff --git a/Source/UI/Party/UIApplyForPartyWnd.cpp b/Source/UI/Party/UIApplyForPartyWnd.cpp index cd0d7f77..28356ca6 100644 --- a/Source/UI/Party/UIApplyForPartyWnd.cpp +++ b/Source/UI/Party/UIApplyForPartyWnd.cpp @@ -1,9 +1,11 @@ +#include "Client/Session.h" #include "Client/Mode/ModeTooltip.h" +#include "File/ShortcutFilename.h" +#include "Render/Renderer.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Contents/MessageTable.h" #include "UI/Window/UIWindowMgr.h" #include "Contents/Party/AdventurerAgencyMgr.h" -#include "Contents/Party/AgencyRequestContext.h" #include "Render/DeviceContext/DeviceContext.h" #include "Render/Text/TextContext.h" #include "Resource/Bitmap/BitmapResource.h" @@ -25,8 +27,8 @@ namespace { // OFFSET: 0x007BAD00 // FUNCTION: fn_09275 -UIApplyForPartyWnd::UIApplyForPartyWnd(UIWindowContext& windows, UIApplyForPartyContext& application) - : UIFrameWnd(windows, 0), m_application(&application) { +UIApplyForPartyWnd::UIApplyForPartyWnd(UIWindowContext& windows) + : UIFrameWnd(windows, 0) { } // OFFSET: 0x007BB610 @@ -188,25 +190,23 @@ void UIApplyForPartyWnd::Slot28(int x, int y) { // FUNCTION: fn_09313 int UIApplyForPartyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { if (message == 6) { - auto& owner = *this->m_application; - switch (static_cast(a)) { case 201: g_windowMgr.CloseWindow(345); break; case 271: - g_adventurerAgencyMgr->RequestInfo(this->info.accountId, owner.requests, owner.completion); + g_adventurerAgencyMgr->RequestInfo(this->info.accountId); break; case 381: { const std::string name = this->info.characterName; - const char* relationship = owner.rows.services.IsFriend(name) ? LookupMessage(102) : nullptr; + const char* relationship = g_windowMgr.IsFriend(name.c_str()) ? LookupMessage(102) : nullptr; - if (owner.rows.services.IsGuildMember(this->info.accountId)) { + if (g_session.IsGuildMemberAccount(this->info.accountId)) { relationship = "GuildMember"; } - const std::string code = owner.rows.services.CharacterCode(this->info.characterId); - owner.rows.services.ShowCharacter(name.c_str(), relationship, code.c_str()); + const std::string code = ShortcutFilename(this->info.characterId); + g_windowMgr.SendNotice(14, reinterpret_cast(name.c_str()), reinterpret_cast(relationship), reinterpret_cast(code.c_str()), 0, 0); break; } default: @@ -218,10 +218,9 @@ int UIApplyForPartyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, if (message == 34) { this->saved = reinterpret_cast(a); - const auto& owner = *this->m_application; - if (this->saved->width <= 0 || this->saved->height <= 0 || this->saved->x < 0 || this->saved->x > owner.screenWidth - this->saved->width || - this->saved->y < 0 || this->saved->y > owner.screenHeight - this->saved->height) { + if (this->saved->width <= 0 || this->saved->height <= 0 || this->saved->x < 0 || this->saved->x > g_renderer->viewport.width - this->saved->width || + this->saved->y < 0 || this->saved->y > g_renderer->viewport.height - this->saved->height) { *this->saved = {200, 200, 220, 190}; } diff --git a/Source/UI/Party/UIApplyForPartyWnd.h b/Source/UI/Party/UIApplyForPartyWnd.h index 87bb0094..46e3b0c1 100644 --- a/Source/UI/Party/UIApplyForPartyWnd.h +++ b/Source/UI/Party/UIApplyForPartyWnd.h @@ -4,23 +4,9 @@ #include "UI/Party/UIAdvenPartyBoardWnd.h" #include "UI/Window/UIFrameWnd.h" -struct PartyRowContext; - -struct AgencyRequestContext; -struct PartyInfoContext; - -struct UIApplyForPartyContext { - PartyRowContext& rows; - AgencyRequestContext& requests; - PartyInfoContext& completion; - const unsigned short& codePage; - const int& screenWidth; - const int& screenHeight; -}; - class UIApplyForPartyWnd : public UIFrameWnd { public: - UIApplyForPartyWnd(UIWindowContext& windows, UIApplyForPartyContext& application); + UIApplyForPartyWnd(UIWindowContext& windows); ~UIApplyForPartyWnd() override; void Slot11() override; void Slot15(int width, int height) override; @@ -31,13 +17,10 @@ public: /* 00B4 */ CAdvenPartyInfo info; /* 0100 */ PartyBoardPlacement* saved; - -private: - UIApplyForPartyContext* m_application; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(sizeof(UIApplyForPartyWnd) == 272); +static_assert(sizeof(UIApplyForPartyWnd) == 268); #endif #endif diff --git a/Source/UI/Party/UIPartyInfoWnd.cpp b/Source/UI/Party/UIPartyInfoWnd.cpp index 45e3d941..5b23927a 100644 --- a/Source/UI/Party/UIPartyInfoWnd.cpp +++ b/Source/UI/Party/UIPartyInfoWnd.cpp @@ -1,16 +1,19 @@ +#include "Client/Session.h" #include "Contents/MessageTable.h" +#include "File/ShortcutFilename.h" #include "Render/DeviceContext/DeviceContext.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "UI/Text/TextFitting.h" #include "UI/Party/UIPartyInfoWnd.h" +#include "UI/Window/UIWindowMgr.h" #include // OFFSET: 0x007BAE20 // FUNCTION: fn_09277 -UIPartyInfoWnd::UIPartyInfoWnd(UIWindowContext& windows, PartyRowContext& row) - : UIBitmapButton(windows), tanker(0), dealer(0), healer(0), assist(0), m_row(&row) { +UIPartyInfoWnd::UIPartyInfoWnd(UIWindowContext& windows) + : UIBitmapButton(windows), tanker(0), dealer(0), healer(0), assist(0) { this->m_drawLabel = 0; } @@ -121,17 +124,17 @@ void UIPartyInfoWnd::Slot31(int x, int y) { // OFFSET: 0x007BFE90 // FUNCTION: fn_09310 void UIPartyInfoWnd::Slot33(int, int) { - if (this->m_disabled != 0 || this->info.accountId == this->m_row->accountId || this->info.characterId == this->m_row->characterId) { + if (this->m_disabled != 0 || this->info.accountId == g_session.m_aid || this->info.characterId == g_session.m_gid) { return; } const std::string name = this->info.characterName; - const char* relationship = this->m_row->services.IsFriend(name) ? LookupMessage(102) : nullptr; + const char* relationship = g_windowMgr.IsFriend(name.c_str()) ? LookupMessage(102) : nullptr; - if (this->m_row->services.IsGuildMember(this->info.accountId)) { + if (g_session.IsGuildMemberAccount(this->info.accountId)) { relationship = "GuildMember"; } - const std::string code = this->m_row->services.CharacterCode(this->info.characterId); - this->m_row->services.ShowCharacter(name.c_str(), relationship, code.c_str()); + const std::string code = ShortcutFilename(this->info.characterId); + g_windowMgr.SendNotice(14, reinterpret_cast(name.c_str()), reinterpret_cast(relationship), reinterpret_cast(code.c_str()), 0, 0); } diff --git a/Source/UI/Party/UIPartyInfoWnd.h b/Source/UI/Party/UIPartyInfoWnd.h index fed7f367..92f5141a 100644 --- a/Source/UI/Party/UIPartyInfoWnd.h +++ b/Source/UI/Party/UIPartyInfoWnd.h @@ -4,26 +4,9 @@ #include "Contents/Party/AdvenPartyInfo.h" #include "UI/Buttons/UIBitmapButton.h" -class PartyRowServices { -public: - virtual bool IsFriend(const std::string& name) = 0; - virtual bool IsGuildMember(std::uint32_t accountId) = 0; - virtual std::string CharacterCode(std::uint32_t characterId) = 0; - virtual void ShowCharacter(const char* name, const char* relationship, const char* code) = 0; - -protected: - ~PartyRowServices() = default; -}; - -struct PartyRowContext { - const std::uint32_t& accountId; - const std::uint32_t& characterId; - PartyRowServices& services; -}; - class UIPartyInfoWnd : public UIBitmapButton { public: - UIPartyInfoWnd(UIWindowContext& windows, PartyRowContext& row); + UIPartyInfoWnd(UIWindowContext& windows); ~UIPartyInfoWnd() override; void Paint() override; void Slot31(int x, int y) override; @@ -42,13 +25,10 @@ public: /* 0160 */ int assist; /* 0164 */ std::string name; /* 017C */ CAdvenPartyInfo info; - -private: - PartyRowContext* m_row; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(sizeof(UIPartyInfoWnd) == 468); +static_assert(sizeof(UIPartyInfoWnd) == 464); #endif #endif diff --git a/Source/UI/Party/UIRegisterPartyWnd.cpp b/Source/UI/Party/UIRegisterPartyWnd.cpp index 90eeead2..69e2a6f1 100644 --- a/Source/UI/Party/UIRegisterPartyWnd.cpp +++ b/Source/UI/Party/UIRegisterPartyWnd.cpp @@ -3,13 +3,11 @@ #include "Contents/MessageTable.h" #include "Client/Input/Language.h" #include "Contents/Party/AdventurerAgencyMgr.h" -#include "Contents/Party/AgencyRequestContext.h" +#include "Client/Session.h" #include "Contents/ForbiddenWords.h" -#include "Contents/Party/RegisterPartyAsyncWork.h" #include "Render/DeviceContext/DeviceContext.h" #include "Render/Text/TextContext.h" #include "Resource/Bitmap/BitmapResource.h" -#include "Resource/ResourceFailures.h" #include "Resource/ResourceMgr.h" #include "UI/Window/InputFocus.h" #include "UI/Text/TextFitting.h" @@ -21,7 +19,7 @@ #include "UI/Buttons/UIJobSlotButton.h" #include "UI/Party/UIRegisterPartyWnd.h" #include "UI/Text/UIStaticText.h" -#include "UI/Window/WindowManagerWindows.h" +#include "Render/Renderer.h" #include #include @@ -50,8 +48,8 @@ namespace { // OFFSET: 0x007BAF30 // FUNCTION: fn_09278 -UIRegisterPartyWnd::UIRegisterPartyWnd(UIWindowContext& windows, UIRegisterPartyContext& registration) - : UIFrameWnd(windows, 0), selectedType(0), m_registration(®istration) { +UIRegisterPartyWnd::UIRegisterPartyWnd(UIWindowContext& windows) + : UIFrameWnd(windows, 0), selectedType(0) { } // OFFSET: 0x007BB810 @@ -71,8 +69,6 @@ void UIRegisterPartyWnd::Slot11() { // OFFSET: 0x007BDD10 // FUNCTION: fn_09300 void UIRegisterPartyWnd::Slot15(int, int) { - auto& owner = *this->m_registration; - const auto label = [&](const char* text, int x, int y, int width) { auto* value = new UIStaticText(*this->m_context); value->SetSize(width, 15); @@ -86,11 +82,11 @@ void UIRegisterPartyWnd::Slot15(int, int) { return value; }; label(LookupMessage(3415), 10, 23, 40); - this->character = label(owner.characterName.c_str(), 60, 23, 119); - this->character->text = FitText(*this->character->geometry.surface, owner.characterName, 119); - this->character->tooltipEnabled = this->character->text != owner.characterName; + this->character = label(g_session.DecodePlayerName(), 60, 23, 119); + this->character->text = FitText(*this->character->geometry.surface, std::string(g_session.DecodePlayerName()), 119); + this->character->tooltipEnabled = this->character->text != g_session.DecodePlayerName(); label(LookupMessage(408), 10, 49, 40); - const int level = owner.playerLevel; + const int level = g_session.m_level; const auto edit = [&](int x, int value) { auto* control = new UIEditCtrl(*this->m_context); @@ -226,7 +222,7 @@ const char* UIRegisterPartyWnd::Text(UIEditCtrl& control) const { // OFFSET: 0x007BBA80 // FUNCTION: fn_09290 void UIRegisterPartyWnd::NormalizeLevels() { - const int level = this->m_registration->playerLevel; + const int level = g_session.m_level; char number[10] = {}; if (!Digits(this->Text(*this->minimum))) { @@ -283,8 +279,6 @@ void UIRegisterPartyWnd::Paint() { // OFFSET: 0x007C1410 // FUNCTION: fn_09314 int UIRegisterPartyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { - auto& owner = *this->m_registration; - if (message == 6) { const int value = static_cast(a); @@ -296,10 +290,10 @@ int UIRegisterPartyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, const auto notify = [&](int id) { char text[256] = {}; _snprintf_s(text, sizeof(text), _TRUNCATE, LookupMessage(id)); - owner.completion.messages.Message(text, 0xFF); + g_windowMgr.SendNotice(1, reinterpret_cast(text), 0xFF, 0, 0, 0); }; - if (owner.partyMember != 0) { + if (g_session.unknown_5464 != 0) { if (g_forbiddenWords.Contains(this->Text(*this->memo))) { notify(3372); return 0; @@ -321,22 +315,22 @@ int UIRegisterPartyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, info.maximumLevel = std::atoi(this->Text(*this->maximum)); info.type = this->selectedType; info.memo = this->Text(*this->memo); - info.characterName = owner.characterName; - g_adventurerAgencyMgr->RequestRegistration(info, owner.requests, owner.completion); + info.characterName = g_session.DecodePlayerName(); + g_adventurerAgencyMgr->RequestRegistration(info); } else { notify(3506); } } - owner.requests.windows.CloseWindow(323); + g_windowMgr.CloseWindow(323); return 0; } if (message == 34) { this->saved = reinterpret_cast(a); - if (this->saved->width <= 0 || this->saved->height <= 0 || this->saved->x < 0 || this->saved->x > owner.screenWidth - this->saved->width || - this->saved->y < 0 || this->saved->y > owner.screenHeight - this->saved->height) { + if (this->saved->width <= 0 || this->saved->height <= 0 || this->saved->x < 0 || this->saved->x > g_renderer->viewport.width - this->saved->width || + this->saved->y < 0 || this->saved->y > g_renderer->viewport.height - this->saved->height) { *this->saved = {200, 200, 220, 197}; } diff --git a/Source/UI/Party/UIRegisterPartyWnd.h b/Source/UI/Party/UIRegisterPartyWnd.h index 798360db..fe097b26 100644 --- a/Source/UI/Party/UIRegisterPartyWnd.h +++ b/Source/UI/Party/UIRegisterPartyWnd.h @@ -9,25 +9,10 @@ class UIEditCtrl; class UIJobSlotButton; class UIStaticText; class UIBasicButton; -class ForbiddenWords; -struct AgencyRequestContext; -struct RegisterPartyContext; - -struct UIRegisterPartyContext { - ForbiddenWords& forbidden; - AgencyRequestContext& requests; - RegisterPartyContext& completion; - const int& playerLevel; - const int& partyMember; - const int& screenWidth; - const int& screenHeight; - const std::string& characterName; - const unsigned short& codePage; -}; class UIRegisterPartyWnd : public UIFrameWnd { public: - UIRegisterPartyWnd(UIWindowContext& windows, UIRegisterPartyContext& registration); + UIRegisterPartyWnd(UIWindowContext& windows); ~UIRegisterPartyWnd() override; void Slot11() override; void Slot15(int width, int height) override; @@ -47,13 +32,12 @@ public: /* 00E4 */ PartyBoardPlacement* saved; private: - UIRegisterPartyContext* m_registration; const char* Text(UIEditCtrl& control) const; void NormalizeLevels(); }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(sizeof(UIRegisterPartyWnd) == 244); +static_assert(sizeof(UIRegisterPartyWnd) == 240); #endif #endif diff --git a/Source/UI/Window/UIEscOptionWnd.cpp b/Source/UI/Window/UIEscOptionWnd.cpp index 294e75de..96fbdc58 100644 --- a/Source/UI/Window/UIEscOptionWnd.cpp +++ b/Source/UI/Window/UIEscOptionWnd.cpp @@ -130,11 +130,11 @@ int UIEscOptionWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argumen saveSlot.member = &CCharacterLinkedUserDataMgr::Save; saveSlot.function(g_characterLinkedUserDataMgr); union StopSlot { - void (CAdventurerAgencyMgr::*member)(AgencyRequestContext&, StopRecruitingContext&); + void (CAdventurerAgencyMgr::*member)(); void (__thiscall* function)(CAdventurerAgencyMgr*); }; StopSlot stopSlot; - stopSlot.member = static_cast(&CAdventurerAgencyMgr::RequestStop); + stopSlot.member = static_cast(&CAdventurerAgencyMgr::RequestStop); stopSlot.function(g_adventurerAgencyMgr); mode->SendMsg(0x19, 1, 0, 0, 0); g_windowMgr.CloseWindow(0x9B);