QuestRequirement.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include "QuestEvent.h"
  3. #include "TypeRegistry.h"
  4. class QuestStorage;
  5. class QuestRequirement : public virtual Framework::ReferenceCounter
  6. {
  7. protected:
  8. Framework::Text id;
  9. Framework::Text description;
  10. public:
  11. QuestRequirement(Framework::Text id, Framework::Text description);
  12. virtual void processEvent(QuestEvent* zEvent, QuestStorage* zStorage) = 0;
  13. virtual void addRequirementUIML(QuestStorage* zStorage,
  14. Framework::XML::Element* zParent,
  15. Framework::Text onClickPrefix)
  16. = 0;
  17. virtual void api(Framework::StreamReader* message,
  18. Framework::XML::Element* zParent,
  19. QuestStorage* zStorage);
  20. const Framework::Text& getRequirementId() const;
  21. const Framework::Text& getDescription() const;
  22. };
  23. class QuestRequirementOpenDialogType;
  24. class QuestRequirementOpenDialog : public QuestRequirement
  25. {
  26. private:
  27. Framework::Text dialogId;
  28. public:
  29. QuestRequirementOpenDialog(Framework::Text id,
  30. Framework::Text description,
  31. Framework::Text dialogId);
  32. void processEvent(QuestEvent* zEvent, QuestStorage* zStorage) override;
  33. void addRequirementUIML(QuestStorage* zStorage,
  34. Framework::XML::Element* zParent,
  35. Framework::Text onClickPrefix) override;
  36. friend QuestRequirementOpenDialogType;
  37. };
  38. class QuestRequirementOpenDialogType
  39. : public SubTypeFactory<QuestRequirement, QuestRequirementOpenDialog>
  40. {
  41. public:
  42. QuestRequirementOpenDialogType();
  43. QuestRequirementOpenDialog* fromJson(
  44. Framework::JSON::JSONObject* zJson) const override;
  45. Framework::JSON::JSONObject* toJson(
  46. QuestRequirementOpenDialog* zObject) const override;
  47. Framework::JSON::Validator::JSONValidator* getValidator(
  48. Framework::JSON::Validator::ObjectValidationBuilder<
  49. Framework::JSON::Validator::JSONValidator>* builder) const override;
  50. Framework::Text getTypeToken() const override;
  51. };
  52. class QuestRequirementBlockBreak : public QuestRequirement
  53. {};
  54. class QuestRequirementBlockPlace : public QuestRequirement
  55. {};
  56. class QuestRequirementBlockInteract : public QuestRequirement
  57. {};
  58. class QuestRequirementCraft : public QuestRequirement
  59. {};
  60. class QuestRequirementItemInInventory : public QuestRequirement
  61. {};