123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #pragma once
- #include <JSON.h>
- #include <Text.h>
- #include <Trie.h>
- #include <Writer.h>
- #include "BlockType.h"
- #include "Effect.h"
- #include "ModelInfo.h"
- #include "StaticRegistry.h"
- class Item;
- class ItemStack;
- class ItemSkill;
- class ItemSkillLevelUpRule;
- class ItemTypeEnum : public BlockTypeEnum
- {
- public:
- static const int WOOD_STICK = BlockTypeEnum::MAX_VALUE + 1;
- static const int STONE_TOOL = BlockTypeEnum::MAX_VALUE + 2;
- static const int RESIN = BlockTypeEnum::MAX_VALUE + 3;
- static const int PLAYER_HAND = BlockTypeEnum::MAX_VALUE + 4;
- static const int STONE_TOOL_BROKEN = BlockTypeEnum::MAX_VALUE + 5;
- };
- class ItemType : public virtual Framework::ReferenceCounter
- {
- protected:
- const int id;
- const Framework::Text name;
- ItemSkillLevelUpRule* levelUpRule;
- int brokenTypeId;
- const ModelInfo model;
- ItemType(int id,
- const char* name,
- ItemSkillLevelUpRule* levelUpRule,
- int brokenTypeId,
- ModelInfo model);
- virtual void loadSuperItem(
- Item* zItem, Framework::StreamReader* zReader) const;
- virtual void saveSuperItem(
- const Item* zItem, Framework::StreamWriter* zWriter) const;
- virtual void loadSuperItemSkill(
- ItemSkill* zSkill, Framework::StreamReader* zReader) const;
- virtual void saveSuperItemSkill(
- const ItemSkill* zSkill, Framework::StreamWriter* zWriter) const;
- public:
- ~ItemType();
- int getId() const;
- const Framework::Text& getName() const;
- const ItemType* zBrokenItemType() const;
- virtual Item* createItem() const = 0;
- virtual ItemStack* createItemStack(int size) const;
- virtual ItemSkill* createDefaultItemSkill() const;
- virtual void levelUpItemSkill(ItemSkill* zSkill) const;
- virtual Item* loadItem(Framework::StreamReader* zReader) const;
- virtual void saveItem(
- const Item* zItem, Framework::StreamWriter* zWriter) const;
- virtual ItemSkill* loadItemSkill(Framework::StreamReader* zReader) const;
- virtual void saveItemSkill(
- const ItemSkill* zSkill, Framework::StreamWriter* zWriter) const;
- virtual Item* cloneItem(const Item* zItem) const;
- virtual Item* breakItem(const Item* zItem) const;
- const ModelInfo& getModel() const;
- static Item* createBasicItem(int id,
- const char* name,
- float hp,
- float maxHp,
- float durability,
- float maxDurability,
- bool eatable,
- bool placeable,
- bool equippable,
- bool solid,
- bool usable,
- int maxStackSize);
- };
|