1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/*
* Info.h, 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
*
*/
#pragma once
#include "../json/JsonNode.h"
#include "../mapObjectConstructors/IObjectInfo.h"
VCMI_LIB_NAMESPACE_BEGIN
namespace vstd
{
class RNG;
}
class MetaString;
class IGameCallback;
namespace Rewardable
{
struct Limiter;
using LimitersList = std::vector<std::shared_ptr<Rewardable::Limiter>>;
struct Reward;
struct Configuration;
struct Variables;
struct VisitInfo;
struct ResetInfo;
enum class EEventType;
class DLL_LINKAGE Info : public IObjectInfo
{
JsonNode parameters;
std::string objectTextID;
void replaceTextPlaceholders(MetaString & target, const Variables & variables) const;
void replaceTextPlaceholders(MetaString & target, const Variables & variables, const VisitInfo & info) const;
void configureVariables(Rewardable::Configuration & object, vstd::RNG & rng, IGameCallback * cb, const JsonNode & source) const;
void configureRewards(Rewardable::Configuration & object, vstd::RNG & rng, IGameCallback * cb, const JsonNode & source, Rewardable::EEventType mode, const std::string & textPrefix) const;
void configureLimiter(Rewardable::Configuration & object, vstd::RNG & rng, IGameCallback * cb, Rewardable::Limiter & limiter, const JsonNode & source) const;
Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, vstd::RNG & rng, IGameCallback * cb, const JsonNode & source) const;
void configureReward(Rewardable::Configuration & object, vstd::RNG & rng, IGameCallback * cb, Rewardable::Reward & info, const JsonNode & source) const;
void configureResetInfo(Rewardable::Configuration & object, vstd::RNG & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
public:
const JsonNode & getParameters() const;
bool givesResources() const override;
bool givesExperience() const override;
bool givesMana() const override;
bool givesMovement() const override;
bool givesPrimarySkills() const override;
bool givesSecondarySkills() const override;
bool givesArtifacts() const override;
bool givesCreatures() const override;
bool givesSpells() const override;
bool givesBonuses() const override;
bool hasGuards() const override;
void configureObject(Rewardable::Configuration & object, vstd::RNG & rng, IGameCallback * cb) const;
void init(const JsonNode & objectConfig, const std::string & objectTextID);
template <typename Handler> void serialize(Handler &h)
{
h & parameters;
}
};
}
VCMI_LIB_NAMESPACE_END
|