Info.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Info.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../JsonNode.h"
  12. #include "../mapObjectConstructors/IObjectInfo.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CRandomGenerator;
  15. namespace Rewardable
  16. {
  17. struct Limiter;
  18. using LimitersList = std::vector<std::shared_ptr<Rewardable::Limiter>>;
  19. struct Reward;
  20. struct Configuration;
  21. struct ResetInfo;
  22. enum class EEventType;
  23. class DLL_LINKAGE Info : public IObjectInfo
  24. {
  25. JsonNode parameters;
  26. std::string objectTextID;
  27. void configureVariables(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source) const;
  28. void configureRewards(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source, Rewardable::EEventType mode, const std::string & textPrefix) const;
  29. void configureLimiter(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Limiter & limiter, const JsonNode & source) const;
  30. Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source) const;
  31. void configureReward(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Reward & info, const JsonNode & source) const;
  32. void configureResetInfo(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
  33. public:
  34. const JsonNode & getParameters() const;
  35. bool givesResources() const override;
  36. bool givesExperience() const override;
  37. bool givesMana() const override;
  38. bool givesMovement() const override;
  39. bool givesPrimarySkills() const override;
  40. bool givesSecondarySkills() const override;
  41. bool givesArtifacts() const override;
  42. bool givesCreatures() const override;
  43. bool givesSpells() const override;
  44. bool givesBonuses() const override;
  45. void configureObject(Rewardable::Configuration & object, CRandomGenerator & rng) const;
  46. void init(const JsonNode & objectConfig, const std::string & objectTextID);
  47. template <typename Handler> void serialize(Handler &h, const int version)
  48. {
  49. h & parameters;
  50. }
  51. };
  52. }
  53. VCMI_LIB_NAMESPACE_END