rodecomp/Source/Contents/UserData/CharacterConfigLoad.cpp
ragnarok-clanker 3a61c47517 Decompile fn_03932 (CCharacterLinkedUserDataMgr::Load)
Batch #17758 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_03932 CCharacterLinkedUserDataMgr::Load: logic confirmed by peer review

Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-12 03:16:02 +00:00

71 lines
2 KiB
C++

#include "Client/Session/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;
if (!reader.parse(std::string(response.c_str()), root, true)) {
return;
}
switch (root["Type"].asInt()) {
case 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;
break;
}
case 4:
LoadSkillUseLevelRegistry();
g_session.SetOption(7, 1, 0);
g_session.SetOption(8, 1, 0);
this->m_loaded = true;
break;
}
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;
}
CAsyncWorkMgr* manager = g_asyncWorkMgr;
manager->LoadCharacter(
accountId, characterId, accountName, this->LoadUrl(), std::string(reinterpret_cast<const char*>(&g_session.webServiceLoginData[0x08]), 16)
);
}