1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/lib/rewardable/Configuration.cpp

54 lines
1.6 KiB
C++
Raw Normal View History

2023-04-30 15:13:07 +02:00
/*
* Configuration.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
2023-04-30 20:36:03 +02:00
#include "StdInc.h"
2023-04-30 15:13:07 +02:00
#include "Configuration.h"
2023-09-15 10:06:06 +02:00
#include "../serializer/JsonSerializeFormat.h"
2023-04-30 15:13:07 +02:00
VCMI_LIB_NAMESPACE_BEGIN
Rewardable::EVisitMode Rewardable::Configuration::getVisitMode() const
{
return static_cast<EVisitMode>(visitMode);
}
ui16 Rewardable::Configuration::getResetDuration() const
{
return resetParameters.period;
}
2023-09-15 10:06:06 +02:00
void Rewardable::ResetInfo::serializeJson(JsonSerializeFormat & handler)
{
handler.serializeInt("period", period);
handler.serializeBool("visitors", visitors);
handler.serializeBool("rewards", rewards);
}
void Rewardable::VisitInfo::serializeJson(JsonSerializeFormat & handler)
{
handler.serializeStruct("limiter", limiter);
handler.serializeStruct("reward", reward);
handler.serializeStruct("message", message);
handler.serializeInt("visitType", visitType);
}
void Rewardable::Configuration::serializeJson(JsonSerializeFormat & handler)
{
handler.serializeStruct("onSelect", onSelect);
handler.enterArray("info").serializeStruct(info);
handler.serializeEnum("selectMode", selectMode, std::vector<std::string>{SelectModeString.begin(), SelectModeString.end()});
handler.serializeEnum("visitMode", visitMode, std::vector<std::string>{VisitModeString.begin(), VisitModeString.end()});
handler.serializeStruct("resetParameters", resetParameters);
handler.serializeBool("canRefuse", canRefuse);
handler.serializeInt("infoWindowType", infoWindowType);
}
2023-04-30 15:13:07 +02:00
VCMI_LIB_NAMESPACE_END