DarkflameServer/dGame/ModifierScale.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
692 B
C++
Raw Normal View History

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
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;
}