ItemType.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <Text.h>
  3. #include <JSON.h>
  4. #include <Trie.h>
  5. #include <Writer.h>
  6. #include "Effect.h"
  7. #include "StaticRegistry.h"
  8. class Item;
  9. class ItemStack;
  10. class ItemSkill;
  11. class ItemSkillLevelUpRule;
  12. class ItemType : public virtual Framework::ReferenceCounter
  13. {
  14. protected:
  15. const int id;
  16. ItemSkillLevelUpRule *levelUpRule;
  17. ItemType *zBrokenType;
  18. ItemType( int id, ItemSkillLevelUpRule *levelUpRule, ItemType *zBrokenType );
  19. virtual void loadSuperItem( Item *zItem, Framework::Reader *zReader ) const;
  20. virtual void saveSuperItem( Item *zItem, Framework::Writer *zWriter ) const;
  21. public:
  22. ~ItemType();
  23. int getId() const;
  24. ItemType *zBrokenItemType() const;
  25. virtual Item *createItem() const = 0;
  26. virtual ItemStack *createItemStack( int size ) const;
  27. virtual ItemSkill *createDefaultItemSkill() const;
  28. virtual void levelUpItemSkill( ItemSkill *zSkill ) const;
  29. virtual Item *loadItem( Framework::Reader *zReader ) const;
  30. virtual void saveItem( Item *zItem, Framework::Writer *zWriter ) const;
  31. };