123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #pragma once
- #include <Array.h>
- #include <JSON.h>
- #include "ItemFilter.h"
- #include "ItemModifier.h"
- class CraftingStorage;
- class ShapedCraftingStorage;
- struct ItemInfo
- {
- int type;
- int count;
- float hp;
- float maxHp;
- float durability;
- float maxDurability;
- };
- class Recipie : public virtual Framework::ReferenceCounter
- {
- protected:
- Framework::RCArray<Item> outputs;
- Framework::Array<int> outputAmount;
- public:
- Recipie();
- virtual void addOutput(Item* item, int amount);
- virtual bool testApplicability(CraftingStorage* zStorage) = 0;
- virtual void apply(CraftingStorage* zStorage) = 0;
- virtual Framework::Text getRecipieUIML() = 0;
- virtual Framework::Array<ItemInfo> getOutput(
- CraftingStorage* zStorage) const;
- virtual bool createsOutput(ItemType* zType);
- };
- class UnshapedRecipie : public Recipie
- {
- private:
- Framework::RCArray<ItemFilter> filters;
- Framework::RCArray<ItemModifier> modifiers;
- Framework::Array<int> inputAmount;
- public:
- UnshapedRecipie();
- void addIngredient(ItemFilter* filter, int amount, ItemModifier* modifier);
- bool testApplicability(CraftingStorage* zStorage) override;
- void apply(CraftingStorage* zStorage) override;
- Framework::Text getRecipieUIML() override;
- };
- class ShapedRecipie : public Recipie
- {
- private:
- Framework::RCArray<ItemFilter> filters;
- Framework::RCArray<ItemModifier> modifiers;
- Framework::Array<int> inputAmount;
- int width;
- int height;
- public:
- ShapedRecipie(int width, int height);
- void setIngredient(
- int x, int y, ItemFilter* filter, ItemModifier* modifier);
- bool testApplicability(CraftingStorage* zStorage) override;
- void apply(CraftingStorage* zStorage) override;
- Framework::Text getRecipieUIML() override;
- };
|