2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-13 13:51:41 +00:00

feat: dump leaderboard definitions on IW4/IW5

This commit is contained in:
2024-05-19 08:55:06 +02:00
parent 4139253aac
commit 7ba5a616cd
14 changed files with 423 additions and 4 deletions
@@ -0,0 +1,58 @@
#pragma once
#include "Game/IW4/IW4.h"
#include "Json/JsonCommon.h"
#include "Json/JsonExtension.h"
#include <memory>
#include <nlohmann/json.hpp>
#include <optional>
#include <string>
#include <vector>
namespace IW4
{
NLOHMANN_JSON_SERIALIZE_ENUM(LbColType,
{
{LBCOL_TYPE_NUMBER, "number" },
{LBCOL_TYPE_TIME, "time" },
{LBCOL_TYPE_LEVELXP, "levelxp" },
{LBCOL_TYPE_PRESTIGE, "prestige" },
{LBCOL_TYPE_BIGNUMBER, "bignumber"},
{LBCOL_TYPE_PERCENT, "percent" },
});
NLOHMANN_JSON_SERIALIZE_ENUM(LbAggType,
{
{LBAGG_TYPE_MIN, "min" },
{LBAGG_TYPE_MAX, "max" },
{LBAGG_TYPE_SUM, "sum" },
{LBAGG_TYPE_LAST, "last"},
});
class JsonColumnDef
{
public:
std::string name;
int id;
int propertyId;
bool hidden;
std::string statName;
LbColType type;
int precision;
LbAggType agg;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonColumnDef, name, id, propertyId, hidden, statName, type, precision, agg);
class JsonLeaderboardDef
{
public:
int id;
std::optional<int> xpColId;
std::optional<int> prestigeColId;
std::vector<JsonColumnDef> columns;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonLeaderboardDef, id, xpColId, prestigeColId, columns);
} // namespace IW4