ItemType.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. const ItemType* zBrokenType;
  18. ItemType( int id, ItemSkillLevelUpRule* levelUpRule, const ItemType* zBrokenType );
  19. virtual void loadSuperItem( Item* zItem, Framework::StreamReader* zReader ) const;
  20. virtual void saveSuperItem( const Item* zItem, Framework::StreamWriter* zWriter ) const;
  21. virtual void loadSuperItemSkill( ItemSkill* zSkill, Framework::StreamReader* zReader ) const;
  22. virtual void saveSuperItemSkill( const ItemSkill* zSkill, Framework::StreamWriter* zWriter ) const;
  23. public:
  24. ~ItemType();
  25. int getId() const;
  26. const ItemType* zBrokenItemType() const;
  27. virtual Item* createItem() const = 0;
  28. virtual ItemStack* createItemStack( int size ) const;
  29. virtual ItemSkill* createDefaultItemSkill() const;
  30. virtual void levelUpItemSkill( ItemSkill* zSkill ) const;
  31. virtual Item* loadItem( Framework::StreamReader* zReader ) const;
  32. virtual void saveItem( const Item* zItem, Framework::StreamWriter* zWriter ) const;
  33. virtual ItemSkill* loadItemSkill( Framework::StreamReader* zReader ) const;
  34. virtual void saveItemSkill( const ItemSkill* zSkill, Framework::StreamWriter* zWriter ) const;
  35. virtual Item* cloneItem( Item* zItem ) const;
  36. virtual Item* breakItem( Item* zItem ) const;
  37. };