rodecomp/Source/Contents/UserData/CharacterConfigLoad.cpp
ragnarok-clanker bd0ade90cd Maintenance: [forced, user-approved] Family G27 (resubmit of 10254 rebased on e235d90a; only conflict was the AsyncWorkMgr.h forward
Batch #10259 by ragnarok-clanker: forced by an admin (1 lower score(s), 11 changed function(s)); checked with 508 compiled unit(s), including every includer of Source/Contents/Async/AsyncWorkMgr.h, Source/Contents/Skills/SkillLevelRegistry.h, Source/Contents/UserData/CharacterLinkedUserDataLoadAsyncWork.h, Source/Contents/UserData/CharacterLinkedUserDataMgr.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl, Source/Contents/Skills/SkillLevelConfig.h, Source/Contents/UserData/CharacterConfigLoad.h, Source/UI/Shortcuts/NormalItemSlotLoad.h.
Deletes: Source/Contents/Skills/SkillLevelConfig.h, Source/Contents/UserData/CharacterConfigLoad.h, Source/UI/Shortcuts/NormalItemSlotLoad.h
2026-11-03 13:32:00 +00:00

65 lines
2 KiB
C++

#include "Client/Session.h"
#include "Contents/Async/AsyncWorkMgr.h"
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
#include "Contents/Configuration/ServiceOptions.h"
#include "Contents/Skills/SkillLevelRegistry.h"
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Async/AsyncDiagnostic.h"
#include <json/reader.h>
#include <json/value.h>
// OFFSET: 0x005E6090
// FUNCTION: fn_03927
void CCharacterLinkedUserDataMgr::CompleteLoad(
AsyncDiagnostic diagnostic, std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string response
) {
if (!diagnostic.success) {
return;
}
Json::Value root;
Json::Reader reader;
const std::string document(response.c_str());
if (!reader.parse(document, root, true)) {
return;
}
const int type = root["Type"].asInt();
if (type == 4) {
LoadSkillUseLevelRegistry();
g_session.SetOption(7, 1, 0);
g_session.SetOption(8, 1, 0);
this->m_loaded = true;
} else if (type == 1) {
this->LoadUseSkillLevels(root["data"]);
this->LoadHomunculusSkillLevels(root["data"]);
const Json::Value comparison = root["data"]["ItemComparison"];
g_serviceOptions.Set(264, comparison.isNull() ? true : comparison.asBool());
const Json::Value sorting = root["data"]["SortPrivateTab"];
g_sortPrivateTab = sorting.isNull() ? false : sorting.asBool();
this->LoadNormalItemSlots(root["data"]);
this->m_loaded = true;
}
this->m_accountId = accountId;
this->m_characterId = characterId;
this->m_accountName = accountName;
}
// OFFSET: 0x005E6E20
// FUNCTION: fn_03932
void CCharacterLinkedUserDataMgr::Load(std::uint32_t accountId, std::uint32_t characterId, std::string accountName) {
if (accountId == 0 || characterId == 0) {
return;
}
const std::string token(reinterpret_cast<const char*>(&g_session.unknown_807C[0x08]), 16);
const std::string url = this->LoadUrl();
g_asyncWorkMgr->LoadCharacter(accountId, characterId, accountName, url, token);
}