rodecomp/Source/Contents/Party/StopRecruitingAsyncWork.cpp
ragnarok-clanker 8b3ba20b56 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
2026-11-02 22:46:30 +00:00

78 lines
2.6 KiB
C++

#include "Contents/Party/AdventurerAgencyMgr.h"
#include "Contents/Party/StopRecruitingAsyncWork.h"
#include "Network/Http/CURLPostHander.h"
#include "Network/TextEncoding.h"
#include <cstdio>
#include <windows.h>
#include <timeapi.h>
namespace {
constexpr char sourceFile[] = "C:\\repositories\\RagnarokClient\\RagnarokClient\\Contents\\AdventurerAgency\\CStopRecruitingAsyncWork.cpp";
// INLINED
AsyncDiagnostic Diagnostic(bool success, const char* text, std::uint32_t line) {
std::string message = text;
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
}
// OFFSET: 0x005D5D70
// FUNCTION: fn_03711
CStopRecruitingAsyncWork::CStopRecruitingAsyncWork()
: NAsyncWork("Stop_Recruiting"), m_accountId(0), m_masterAccountId(0), m_diagnostic(Diagnostic(false, "unknwon", 28)) {
}
// INLINED
CStopRecruitingAsyncWork::~CStopRecruitingAsyncWork() = default;
// OFFSET: 0x005D64A0
// FUNCTION: fn_03714
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) {
this->m_group = timeGetTime();
this->m_accountId = accountId;
this->m_masterAccountId = masterAccountId;
this->m_key = 0;
this->m_world = world;
this->m_url = url;
this->m_token = token;
AsyncDiagnostic diagnostic = Diagnostic(false, "unknwon", 50);
this->m_diagnostic.MoveFrom(diagnostic);
}
// OFFSET: 0x005D6570
// FUNCTION: fn_03716
bool CStopRecruitingAsyncWork::Execute() {
char account[64] = {};
char master[64] = {};
_snprintf_s(account, sizeof(account), _TRUNCATE, "%lu", static_cast<unsigned long>(this->m_accountId));
_snprintf_s(master, sizeof(master), _TRUNCATE, "%lu", static_cast<unsigned long>(this->m_masterAccountId));
const std::string world = ToUtf8(this->m_world);
CCURLPostHander handler(this->m_url);
handler.AddField("AID", account, 4);
handler.AddField("WorldName", world, 4);
handler.AddField("AuthToken", this->m_token, 4);
handler.AddField("MasterAID", master, 4);
if (handler.Perform() != 0) {
AsyncDiagnostic diagnostic = Diagnostic(false, "fail", 92);
this->m_diagnostic.MoveFrom(diagnostic);
} else {
this->m_response = FromUtf8(handler.Response());
AsyncDiagnostic diagnostic = Diagnostic(true, "success", 101);
this->m_diagnostic.MoveFrom(diagnostic);
}
return false;
}
// OFFSET: 0x005D64B0
// FUNCTION: fn_03715
void CStopRecruitingAsyncWork::Complete() {
g_adventurerAgencyMgr->CompleteStopRecruiting(this->m_diagnostic, this->m_response);
}