2024-06-02 07:53:56 +00:00
|
|
|
#include "ModifierScale.h"
|
|
|
|
|
|
|
|
nejlika::ModifierScale::ModifierScale(const nlohmann::json & json)
|
|
|
|
{
|
|
|
|
level = json["level"].get<int32_t>();
|
2024-06-02 13:43:35 +00:00
|
|
|
|
2024-07-17 18:59:11 +00:00
|
|
|
const auto rasio = 1; //45.0f / 85.0f;
|
|
|
|
|
|
|
|
level = std::max(1, static_cast<int32_t>(level * rasio));
|
|
|
|
|
2024-06-02 13:43:35 +00:00
|
|
|
if (json.contains("min")) {
|
|
|
|
min = json["min"].get<float>();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
min = 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (json.contains("max")) {
|
|
|
|
max = json["max"].get<float>();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
max = 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (json.contains("value")) {
|
|
|
|
min = json["value"].get<float>();
|
|
|
|
max = json["value"].get<float>();
|
|
|
|
}
|
2024-06-02 07:53:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nlohmann::json nejlika::ModifierScale::ToJson() const
|
|
|
|
{
|
|
|
|
nlohmann::json json;
|
|
|
|
|
|
|
|
json["level"] = level;
|
|
|
|
json["min"] = min;
|
|
|
|
json["max"] = max;
|
|
|
|
|
|
|
|
return json;
|
|
|
|
}
|