2
0

Info.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. class MetaString;
  16. namespace Rewardable
  17. {
  18. struct Limiter;
  19. using LimitersList = std::vector<std::shared_ptr<Rewardable::Limiter>>;
  20. struct Reward;
  21. struct Configuration;
  22. struct Variables;
  23. struct VisitInfo;
  24. struct ResetInfo;
  25. enum class EEventType;
  26. class DLL_LINKAGE Info : public IObjectInfo
  27. {
  28. JsonNode parameters;
  29. std::string objectTextID;
  30. void replaceTextPlaceholders(MetaString & target, const Variables & variables) const;
  31. void replaceTextPlaceholders(MetaString & target, const Variables & variables, const VisitInfo & info) const;
  32. void configureVariables(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source) const;
  33. void configureRewards(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source, Rewardable::EEventType mode, const std::string & textPrefix) const;
  34. void configureLimiter(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Limiter & limiter, const JsonNode & source) const;
  35. Rewardable::LimitersList configureSublimiters(Rewardable::Configuration & object, CRandomGenerator & rng, const JsonNode & source) const;
  36. void configureReward(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::Reward & info, const JsonNode & source) const;
  37. void configureResetInfo(Rewardable::Configuration & object, CRandomGenerator & rng, Rewardable::ResetInfo & info, const JsonNode & source) const;
  38. public:
  39. const JsonNode & getParameters() const;
  40. bool givesResources() const override;
  41. bool givesExperience() const override;
  42. bool givesMana() const override;
  43. bool givesMovement() const override;
  44. bool givesPrimarySkills() const override;
  45. bool givesSecondarySkills() const override;
  46. bool givesArtifacts() const override;
  47. bool givesCreatures() const override;
  48. bool givesSpells() const override;
  49. bool givesBonuses() const override;
  50. void configureObject(Rewardable::Configuration & object, CRandomGenerator & rng) const;
  51. void init(const JsonNode & objectConfig, const std::string & objectTextID);
  52. template <typename Handler> void serialize(Handler &h, const int version)
  53. {
  54. h & parameters;
  55. }
  56. };
  57. }
  58. VCMI_LIB_NAMESPACE_END