mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-09 17:58:20 +00:00
41 lines
692 B
C++
41 lines
692 B
C++
#include "ModifierScale.h"
|
|
|
|
nejlika::ModifierScale::ModifierScale(const nlohmann::json & json)
|
|
{
|
|
level = json["level"].get<int32_t>();
|
|
|
|
const auto rasio = 1; //45.0f / 85.0f;
|
|
|
|
level = std::max(1, static_cast<int32_t>(level * rasio));
|
|
|
|
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>();
|
|
}
|
|
}
|
|
|
|
nlohmann::json nejlika::ModifierScale::ToJson() const
|
|
{
|
|
nlohmann::json json;
|
|
|
|
json["level"] = level;
|
|
json["min"] = min;
|
|
json["max"] = max;
|
|
|
|
return json;
|
|
}
|