123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #pragma once
- #include <Array.h>
- #include <functional>
- #include <ReferenceCounter.h>
- class Item;
- class ItemType;
- class ItemSlot;
- class ItemFilter : public virtual Framework::ReferenceCounter
- {
- public:
- ItemFilter();
- virtual bool matchItem(const Item* zItem) const;
- virtual bool matchSourceSlot(ItemSlot* zSlot) const;
- virtual bool matchTargetSlot(ItemSlot* zSlot) const;
- virtual Framework::Text getImageUIML() const = 0;
- virtual Framework::Text getLogicUIML() const = 0;
- };
- class CombinedItemFilter : public ItemFilter
- {
- private:
- ItemFilter* filterA;
- ItemFilter* filterB;
- std::function<bool(bool, bool)> op;
- public:
- CombinedItemFilter(ItemFilter* filterA,
- ItemFilter* filterB,
- std::function<bool(bool, bool)> op);
- ~CombinedItemFilter();
- bool matchItem(const Item* zItem) const override;
- bool matchSourceSlot(ItemSlot* zSlot) const override;
- bool matchTargetSlot(ItemSlot* zSlot) const override;
- Framework::Text getImageUIML() const override;
- Framework::Text getLogicUIML() const override;
- };
- class AnyItemFilter : public ItemFilter
- {
- public:
- AnyItemFilter();
- bool matchItem(const Item* zItem) const override;
- Framework::Text getImageUIML() const override;
- Framework::Text getLogicUIML() const override;
- };
- class TypeItemFilter : public ItemFilter
- {
- private:
- const ItemType* zType;
- public:
- TypeItemFilter(const ItemType* zType);
- bool matchItem(const Item* zItem) const override;
- Framework::Text getImageUIML() const override;
- Framework::Text getLogicUIML() const override;
- };
- class SpecificSlotFilter : public ItemFilter
- {
- private:
- int sourceSlotId;
- int targetSlotId;
- public:
- SpecificSlotFilter(int sourceSlotId, int targetSlotId);
- bool matchSourceSlot(ItemSlot* zSlot) const override;
- bool matchTargetSlot(ItemSlot* zSlot) const override;
- Framework::Text getImageUIML() const override;
- Framework::Text getLogicUIML() const override;
- };
- class SourceSlotBlacklistFilter : public ItemFilter
- {
- private:
- Framework::Array<int> blackList;
- public:
- SourceSlotBlacklistFilter();
- void addBlackListSlotId(int id);
- bool matchSourceSlot(ItemSlot* zSlot) const override;
- bool matchTargetSlot(ItemSlot* zSlot) const override;
- Framework::Text getImageUIML() const override;
- Framework::Text getLogicUIML() const override;
- };
- class TargetSlotBlacklistFilter : public ItemFilter
- {
- private:
- Framework::Array<int> blackList;
- public:
- TargetSlotBlacklistFilter();
- void addBlackListSlotId(int id);
- bool matchSourceSlot(ItemSlot* zSlot) const override;
- bool matchTargetSlot(ItemSlot* zSlot) const override;
- Framework::Text getImageUIML() const override;
- Framework::Text getLogicUIML() const override;
- };
|