rodecomp/Source/Contents/Party/AdventurerAgencyMgr.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

129 lines
3.1 KiB
C++

#include "Client/Session.h"
#include "Contents/Configuration/ServiceConfiguration.h"
#include "Contents/UserData/AccountService.h"
#include "Contents/Party/AdventurerAgencyMgr.h"
#include "Script/LuaScript.h"
#include <json/value.h>
#include <new>
// INLINED
std::uint32_t CAdventurerAgencyMgr::Id(double value) {
if (!(value < 4294967296.0) || value <= -1.0) {
return 0xFFFFFFFFu;
}
return static_cast<std::uint32_t>(value);
}
// STATIC: 0x01389848
// GLOBAL: gl_24352
CAdventurerAgencyMgr* g_adventurerAgencyMgr;
// OFFSET: 0x005CA710
// FUNCTION: fn_03648
CAdventurerAgencyMgr::CAdventurerAgencyMgr() : enabled(true), registered(false), unknown_0008(0), pending(0) {
}
// OFFSET: 0x005CA880
// OFFSET: 0x005CA8D0
// FUNCTION: fn_03650
CAdventurerAgencyMgr::~CAdventurerAgencyMgr() = default;
// OFFSET: 0x005CA940
// FUNCTION: fn_03652
bool CAdventurerAgencyMgr::Initialize() {
if (g_adventurerAgencyMgr) {
return false;
}
g_adventurerAgencyMgr = new (std::nothrow) CAdventurerAgencyMgr;
if (!g_adventurerAgencyMgr) {
return false;
}
if (!g_adventurerAgencyMgr->enabled) {
delete g_adventurerAgencyMgr;
g_adventurerAgencyMgr = nullptr;
return false;
}
return true;
}
// OFFSET: 0x005CAA20
// FUNCTION: fn_03653
void CAdventurerAgencyMgr::Shutdown() {
if (g_adventurerAgencyMgr) {
delete g_adventurerAgencyMgr;
g_adventurerAgencyMgr = nullptr;
}
}
// OFFSET: 0x005CAA40
// FUNCTION: fn_03654
const std::vector<CAdvenPartyInfo>& CAdventurerAgencyMgr::Entries() const {
return this->entries;
}
// OFFSET: 0x005CAA50
// FUNCTION: fn_03655
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;
}
switch (operation) {
case 0:
case 2:
url += "/party/add";
break;
case 1:
url += "/party/list";
break;
case 3:
url += "/party/search";
break;
case 4:
url += "/party/del";
break;
case 5:
url += "/party/get";
break;
case 6:
url += "/party/change";
break;
case 7:
url += "/party/info";
break;
default:
break;
}
return url;
}
// OFFSET: 0x005CAC00
// FUNCTION: fn_03656
void CAdventurerAgencyMgr::LoadList(const Json::Value& value) {
this->entries.clear();
for (auto entry = value.begin(); entry != value.end(); ++entry) {
CAdvenPartyInfo info;
info.characterName = (*entry)["CharName"].asString();
info.accountId = Id((*entry).get("AID", 0).asDouble());
info.characterId = Id((*entry).get("GID", 0).asDouble());
info.assist = (*entry).get("Assist", 1).asInt() != 0;
info.healer = (*entry).get("Healer", 1).asInt() != 0;
info.dealer = (*entry).get("Dealer", 1).asInt() != 0;
info.tanker = (*entry).get("Tanker", 1).asInt() != 0;
info.minimumLevel = (*entry).get("MinLV", 0).asInt();
info.maximumLevel = (*entry).get("MaxLV", 999).asInt();
info.type = (*entry).get("Type", 1).asInt();
info.memo = (*entry).get("Memo", "").asString();
this->entries.push_back(info);
}
}