diff --git a/Source/Contents/Emblems/EmblemCache.cpp b/Source/Contents/Emblems/EmblemCache.cpp index e82da8e13..e584c8d86 100644 --- a/Source/Contents/Emblems/EmblemCache.cpp +++ b/Source/Contents/Emblems/EmblemCache.cpp @@ -123,7 +123,7 @@ void __stdcall CGuildMgr::ReceiveEmblem(std::uint16_t state, std::uint32_t guild void CGuildMgr::UpdateEmblemRequests( CEmblemDataMgr& emblems, std::uint32_t accountId, const std::string& accountName, const char* token16, CConnection& connection, CAsyncWorkMgr& manager ) { - this->m_reqBundle->Update(emblems, accountId, accountName, token16, connection, manager); + this->m_reqBundle->Update(); } // OFFSET: 0x0065EE50 diff --git a/Source/Contents/Emblems/EmblemDataMgr.cpp b/Source/Contents/Emblems/EmblemDataMgr.cpp index 34950f109..5dfeb0902 100644 --- a/Source/Contents/Emblems/EmblemDataMgr.cpp +++ b/Source/Contents/Emblems/EmblemDataMgr.cpp @@ -2,6 +2,7 @@ #include "Contents/Async/AsyncWorkMgr.h" #include "Contents/Emblems/EmblemDataMgr.h" #include "Client/Session.h" +#include "Network/Connection/Connection.h" #include "Utility/Cipher/XorBytes.h" @@ -110,12 +111,11 @@ void CEmblemDataMgr::RefreshUrls(LuaScript& settings, LuaScript& tables, const c // OFFSET: 0x005EB260 // FUNCTION: fn_03972 -void CEmblemDataMgr::Download( - std::uint32_t guildId, std::uint32_t version, std::uint32_t accountId, const std::string& accountName, const char* token16, CConnection& connection, - CAsyncWorkMgr& manager -) { - const std::string token(token16, 16); - manager.DownloadEmblem(this->m_downloadUrl, accountId, token, accountName, guildId, version, connection); +void CEmblemDataMgr::Download(std::uint32_t guildId, std::uint32_t version) { + const std::string token(reinterpret_cast(&g_session.unknown_807C[0x08]), 16); + g_asyncWorkMgr->DownloadEmblem( + this->m_downloadUrl, g_session.m_aid, token, g_session.m_accountName, guildId, version, GetRagConnection() + ); } // OFFSET: 0x005EB410 diff --git a/Source/Contents/Emblems/EmblemDataMgr.h b/Source/Contents/Emblems/EmblemDataMgr.h index c96d37701..165f34305 100644 --- a/Source/Contents/Emblems/EmblemDataMgr.h +++ b/Source/Contents/Emblems/EmblemDataMgr.h @@ -16,10 +16,7 @@ public: static bool Initialize(); static void Shutdown(); void RefreshUrls(LuaScript& settings, LuaScript& tables, const char* host, const char* port, const char* overrideKey); - void Download( - std::uint32_t guildId, std::uint32_t version, std::uint32_t accountId, const std::string& accountName, const char* token16, CConnection& connection, - CAsyncWorkMgr& manager - ); + void Download(std::uint32_t guildId, std::uint32_t version); bool Upload(std::uint32_t guildId, std::string path); void CompleteUpload(AsyncDiagnostic diagnostic, std::string response, std::uint32_t guildId); void CompleteDownload(AsyncDiagnostic diagnostic, int responseCode, std::string response, std::uint32_t guildId, std::uint32_t version); diff --git a/Source/Contents/Emblems/GuildEmblemReqBundle.cpp b/Source/Contents/Emblems/GuildEmblemReqBundle.cpp index d7d681352..8b5df3b1b 100644 --- a/Source/Contents/Emblems/GuildEmblemReqBundle.cpp +++ b/Source/Contents/Emblems/GuildEmblemReqBundle.cpp @@ -24,11 +24,11 @@ void CGuildEmblemReqBundle::Add(std::uint32_t guildId, std::uint32_t version) { // OFFSET: 0x0065CB90 // FUNCTION: fn_05155 -void CGuildEmblemReqBundle::Update( - CEmblemDataMgr& emblems, std::uint32_t accountId, const std::string& accountName, const char* token16, CConnection& connection, CAsyncWorkMgr& manager -) { +void CGuildEmblemReqBundle::Update() { while (!this->m_recent.empty()) { - if (timeGetTime() < this->m_recent.front().tick + 60000u) { + const Recent oldest = this->m_recent.front(); + + if (timeGetTime() < oldest.tick + 60000u) { break; } @@ -47,7 +47,7 @@ void CGuildEmblemReqBundle::Update( } if (request.first != 0) { - emblems.Download(request.first, request.second, accountId, accountName, token16, connection, manager); + g_emblemDataMgr->Download(request.first, request.second); this->m_recent.push_back({request.first, request.second, timeGetTime()}); } diff --git a/Source/Contents/Emblems/GuildEmblemReqBundle.h b/Source/Contents/Emblems/GuildEmblemReqBundle.h index 4b657e7de..b4874684a 100644 --- a/Source/Contents/Emblems/GuildEmblemReqBundle.h +++ b/Source/Contents/Emblems/GuildEmblemReqBundle.h @@ -15,15 +15,15 @@ public: CGuildEmblemReqBundle(); virtual ~CGuildEmblemReqBundle(); void Add(std::uint32_t guildId, std::uint32_t version); - void Update( - CEmblemDataMgr& emblems, std::uint32_t accountId, const std::string& accountName, const char* token16, CConnection& connection, CAsyncWorkMgr& manager - ); + void Update(); protected: struct Recent { /* 0000 */ std::uint32_t guildId; /* 0004 */ std::uint32_t version; /* 0008 */ std::uint32_t tick; + + Recent(std::uint32_t guildId, std::uint32_t version, std::uint32_t tick) : guildId(guildId), version(version), tick(tick) {} }; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(Recent) == 0xC);