Decompile 2 functions in Source/Contents/ReputeMgr.cpp

Batch #15408 by youko: 0 byte-identical, 2 confirmed by peer review.

- fn_00894 JsonCppLoader::GetReputeGroupData: logic confirmed by peer review
- fn_00895 JsonCppLoader::GetReputeInfoData: logic confirmed by peer review

Peer-reviewed-by: eAthena, gordaoprogramas
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-09 23:30:53 +00:00
commit bdaef583f5

View file

@ -15,6 +15,24 @@
#include <cstring>
#include <utility>
extern "C" void JsonDestroy();
struct JsonValueCopy {
/* 0000 */ JsonValue value;
// INLINED
JsonValueCopy(const JsonValue& other) {
reinterpret_cast<void(__thiscall*)(JsonValue*, const JsonValue*)>(JsonCopyConstruct)(&this->value, &other);
}
JsonValueCopy(const JsonValueCopy&) = delete;
// INLINED
~JsonValueCopy() {
reinterpret_cast<void(__thiscall*)(JsonValue*)>(JsonDestroy)(&this->value);
}
};
// OFFSET: 0x0050AE30
// FUNCTION: fn_00894
bool JsonCppLoader::GetReputeGroupData(std::map<int, ReputeGroupRecord>* out) {
@ -38,19 +56,19 @@ bool JsonCppLoader::GetReputeGroupData(std::map<int, ReputeGroupRecord>* out) {
return false;
}
const JsonObject* members = groups->ObjectRange();
const JsonObject none;
for (const JsonMember& member : members ? *members : none) {
const std::string name = member.first;
const JsonValue node = member.second;
ReputeGroupRecord record;
this->GetStringValue(node, "ID", &record.id);
this->GetStringValue(node, "Name", &record.name);
this->GetIntVectorValue(node, "ReputeList", &record.reputes);
if (const JsonObject* members = groups->ObjectRange()) {
for (const JsonMember& member : *members) {
const std::string name = member.first;
const JsonValueCopy node(member.second);
ReputeGroupRecord record;
this->GetStringValue(node.value, "ID", &record.id);
this->GetStringValue(node.value, "Name", &record.name);
this->GetIntVectorValue(node.value, "ReputeList", &record.reputes);
if (!out->insert(std::make_pair(std::stoi(name), record)).second) {
this->Fail("중복키가 입력되었습니다. (name : %s)", name.c_str());
return false;
if (!out->insert(std::pair<int, ReputeGroupRecord>(std::stoi(name), record)).second) {
this->Fail("중복키가 입력되었습니다. (name : %s)", name.c_str());
return false;
}
}
}
@ -80,20 +98,20 @@ bool JsonCppLoader::GetReputeInfoData(std::map<int, ReputeInfoRecord>* out) {
return false;
}
const JsonObject* members = infos->ObjectRange();
const JsonObject none;
for (const JsonMember& member : members ? *members : none) {
const std::string name = member.first;
const JsonValue node = member.second;
ReputeInfoRecord record;
this->GetStringValue(node, "Name", &record.name);
this->GetIntValue(node, "MaxPoint_Positive", &record.maxPointPositive);
this->GetIntValue(node, "MaxPoint_Negative", &record.maxPointNegative);
this->GetStringValue(node, "Invisible", &record.invisible);
if (const JsonObject* members = infos->ObjectRange()) {
for (const JsonMember& member : *members) {
const std::string name = member.first;
const JsonValueCopy node(member.second);
ReputeInfoRecord record;
this->GetStringValue(node.value, "Name", &record.name);
this->GetIntValue(node.value, "MaxPoint_Positive", &record.maxPointPositive);
this->GetIntValue(node.value, "MaxPoint_Negative", &record.maxPointNegative);
this->GetStringValue(node.value, "Invisible", &record.invisible);
if (!out->insert(std::make_pair(std::stoi(name), record)).second) {
this->Fail("중복키가 입력되었습니다. (key : %s)", name.c_str());
return false;
if (!out->insert(std::pair<int, ReputeInfoRecord>(std::stoi(name), record)).second) {
this->Fail("중복키가 입력되었습니다. (key : %s)", name.c_str());
return false;
}
}
}