1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #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 AXE = BlockTypeEnum::MAX_VALUE + 2;
- static const int RESIN = BlockTypeEnum::MAX_VALUE + 3;
- static const int PLAYER_HAND = BlockTypeEnum::MAX_VALUE + 4;
- static const int AXE_BROKEN = BlockTypeEnum::MAX_VALUE + 5;
- static const int HOE = BlockTypeEnum::MAX_VALUE + 6;
- static const int BROKEN_HOE = BlockTypeEnum::MAX_VALUE + 7;
- static const int FLINT = BlockTypeEnum::MAX_VALUE + 8;
- };
- class ItemType : public virtual Framework::ReferenceCounter
- {
- protected:
- const int id;
- const Framework::Text name;
- Framework::Text tooltipUIML;
- 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 Framework::Text& getTooltipUIML() 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);
- };
|