62 int32_t
priceOf(
size_t item)
const;
73 void delItem(
size_t cls,
size_t count,
Npc &owner);
74 bool use (
size_t cls,
Npc &owner, uint8_t slotHint,
bool force);
75 bool equip (
size_t cls,
Npc &owner,
bool force);
117 void putToSlot (
Npc& owner,
size_t cls, std::string_view slot);
118 bool clearSlot (
Npc& owner, std::string_view slot,
bool remove);
128 struct MdlSlot final {
130 Item* item =
nullptr;
134 void implPutState(
Npc& owner,
size_t cls, std::string_view slot);
136 bool setSlot (
Item*& slot,
Item *next,
Npc &owner,
bool force);
137 bool equipNumSlot(
Item *next, uint8_t slotHint,
Npc &owner,
bool force);
138 void applyArmor (
Item& it,
Npc &owner, int32_t sgn);
140 Item* findByClass(
size_t cls);
146 Item* bestMeleeWeapon(
Npc &owner);
147 Item* bestRangedWeapon(
Npc &owner);
149 void applyWeaponStats(
Npc &owner,
const Item& weap,
int sgn);
151 void sortItems()
const;
152 static bool less (
const Item &il,
const Item &ir);
153 static int orderId(
const Item& l);
154 uint8_t slotId (
Item*& slt)
const;
156 mutable std::vector<std::unique_ptr<Item>> items;
157 mutable bool sorted=
false;
159 uint32_t indexOf(
const Item* it)
const;
162 Item* armor =
nullptr;
163 Item* belt =
nullptr;
164 Item* amulet =
nullptr;
165 Item* ringL =
nullptr;
166 Item* ringR =
nullptr;
168 Item** active =
nullptr;
169 Item* melee =
nullptr;
170 Item* range =
nullptr;
171 Item* shield =
nullptr;
172 Item* numslot[8] = {};
173 std::vector<MdlSlot> mdlSlots;
174 MdlSlot ammotSlot, stateSlot;
const Item & operator*() const
const Item * operator->() const
void updateRuneView(Npc &owner)
void unequipArmor(GameScript &vm, Npc &owner)
Item * findByFlags(ItmFlags f, uint32_t num) const
void updateBowView(Npc &owner)
int32_t sellPriceOf(size_t item) const
void clear(GameScript &vm, Npc &owner, bool includeMissionItm=false)
void equipBestArmor(Npc &owner)
void setCurrentItem(size_t cls)
bool hasStateItem() const
bool hasRangedWeaponWithAmmo() const
void equipArmor(int32_t cls, Npc &owner)
bool putState(Npc &owner, size_t cls, int state)
Item * currentSpell(uint8_t s)
void equipBestMeleeWeapon(Npc &owner)
bool equip(size_t cls, Npc &owner, bool force)
void putToSlot(Npc &owner, size_t cls, std::string_view slot)
Item * currentRangedWeapon()
void switchActiveWeaponFist()
Iterator iterator(IteratorType t) const
static void transfer(Inventory &to, Inventory &from, Npc *fromNpc, size_t cls, size_t count, World &wrld)
void invalidateCond(Npc &owner)
const Item * currentSpell(uint8_t s) const
bool unequip(size_t cls, Npc &owner)
bool use(size_t cls, Npc &owner, uint8_t slotHint, bool force)
const Item * activeWeapon() const
Inventory(Inventory &&)=default
void updateArmorView(Npc &owner)
void switchActiveWeapon(Npc &owner, uint8_t slot)
uint8_t currentSpellSlot() const
void switchActiveSpell(int32_t spell, Npc &owner)
void updateSwordView(Npc &owner)
void putAmmunition(Npc &owner, size_t cls, std::string_view slot)
bool hasSpell(int32_t spl) const
Item * addItem(std::unique_ptr< Item > &&p)
Item * currentMeleeWeapon()
void delItem(size_t cls, size_t count, Npc &owner)
Inventory & operator=(Inventory &&)=default
int32_t priceOf(size_t item) const
static void moveItem(Npc &owner, Inventory &invNpc, Interactive &mobsi)
void putCurrentToSlot(Npc &owner, std::string_view slot)
void equipBestRangedWeapon(Npc &owner)
void load(Serialize &s, Npc &owner)
void unequipWeapons(GameScript &vm, Npc &owner)
void autoEquipWeapons(Npc &owner)
bool clearSlot(Npc &owner, std::string_view slot, bool remove)
bool hasMissionItems() const
void setStateItem(size_t cls)
void save(Serialize &s) const
size_t itemCount(const size_t id) const
Item * getItem(size_t instance)
void updateView(Npc &owner)
void updateShieldView(Npc &owner)
static CommandLine * instance