OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
Inventory Class Referencefinal

#include <inventory.h>

Classes

class  Iterator
 

Public Types

enum  IteratorType : uint8_t { T_Inventory , T_Trade , T_Ransack }
 

Public Member Functions

 Inventory ()
 
 Inventory (Inventory &&)=default
 
Inventoryoperator= (Inventory &&)=default
 
 ~Inventory ()
 
bool isEmpty () const
 
void load (Serialize &s, Npc &owner)
 
void load (Serialize &s, Interactive &owner, World &w)
 
void save (Serialize &s) const
 
Iterator iterator (IteratorType t) const
 
int32_t priceOf (size_t item) const
 
int32_t sellPriceOf (size_t item) const
 
size_t goldCount () const
 
size_t itemCount (const size_t id) const
 
ItemgetItem (size_t instance)
 
ItemaddItem (std::unique_ptr< Item > &&p)
 
ItemaddItem (std::string_view name, size_t count, World &owner)
 
ItemaddItem (size_t cls, size_t count, World &owner)
 
void delItem (size_t cls, size_t count, Npc &owner)
 
bool use (size_t cls, Npc &owner, uint8_t slotHint, bool force)
 
bool equip (size_t cls, Npc &owner, bool force)
 
bool unequip (size_t cls, Npc &owner)
 
void unequip (Item *cls, Npc &owner)
 
void invalidateCond (Npc &owner)
 
void autoEquipWeapons (Npc &owner)
 
void equipArmor (int32_t cls, Npc &owner)
 
void equipBestArmor (Npc &owner)
 
void equipBestMeleeWeapon (Npc &owner)
 
void equipBestRangedWeapon (Npc &owner)
 
void unequipWeapons (GameScript &vm, Npc &owner)
 
void unequipArmor (GameScript &vm, Npc &owner)
 
void clear (GameScript &vm, Npc &owner, bool includeMissionItm=false)
 
void clear (GameScript &vm, Interactive &owner, bool includeMissionItm=false)
 
bool hasSpell (int32_t spl) const
 
bool hasMissionItems () const
 
bool hasRangedWeaponWithAmmo () const
 
void updateArmorView (Npc &owner)
 
void updateSwordView (Npc &owner)
 
void updateBowView (Npc &owner)
 
void updateShieldView (Npc &owner)
 
void updateRuneView (Npc &owner)
 
void updateView (Npc &owner)
 
const ItemactiveWeapon () const
 
ItemactiveWeapon ()
 
void switchActiveWeaponFist ()
 
void switchActiveWeapon (Npc &owner, uint8_t slot)
 
void switchActiveSpell (int32_t spell, Npc &owner)
 
ItemcurrentArmor ()
 
ItemcurrentMeleeWeapon ()
 
ItemcurrentRangedWeapon ()
 
ItemcurrentShield ()
 
ItemcurrentSpell (uint8_t s)
 
const ItemcurrentSpell (uint8_t s) const
 
ItemfindByFlags (ItmFlags f, uint32_t num) const
 
uint8_t currentSpellSlot () const
 
bool hasStateItem () const
 
void putCurrentToSlot (Npc &owner, std::string_view slot)
 
void putToSlot (Npc &owner, size_t cls, std::string_view slot)
 
bool clearSlot (Npc &owner, std::string_view slot, bool remove)
 
void putAmmunition (Npc &owner, size_t cls, std::string_view slot)
 
bool putState (Npc &owner, size_t cls, int state)
 
void setCurrentItem (size_t cls)
 
void setStateItem (size_t cls)
 

Static Public Member Functions

static void transfer (Inventory &to, Inventory &from, Npc *fromNpc, size_t cls, size_t count, World &wrld)
 
static void moveItem (Npc &owner, Inventory &invNpc, Interactive &mobsi)
 

Detailed Description

Definition at line 17 of file inventory.h.

Member Enumeration Documentation

◆ IteratorType

enum Inventory::IteratorType : uint8_t
Enumerator
T_Inventory 
T_Trade 
T_Ransack 

Definition at line 30 of file inventory.h.

Constructor & Destructor Documentation

◆ Inventory() [1/2]

Inventory::Inventory ( )

Definition at line 84 of file inventory.cpp.

◆ Inventory() [2/2]

Inventory::Inventory ( Inventory &&  )
default

◆ ~Inventory()

Inventory::~Inventory ( )

Definition at line 87 of file inventory.cpp.

Member Function Documentation

◆ activeWeapon() [1/2]

Item * Inventory::activeWeapon ( )

Definition at line 616 of file inventory.cpp.

◆ activeWeapon() [2/2]

const Item * Inventory::activeWeapon ( ) const

Definition at line 596 of file inventory.cpp.

◆ addItem() [1/3]

Item * Inventory::addItem ( size_t  cls,
size_t  count,
World owner 
)

Definition at line 251 of file inventory.cpp.

◆ addItem() [2/3]

Item * Inventory::addItem ( std::string_view  name,
size_t  count,
World owner 
)

Definition at line 243 of file inventory.cpp.

◆ addItem() [3/3]

Item * Inventory::addItem ( std::unique_ptr< Item > &&  p)

Definition at line 223 of file inventory.cpp.

◆ autoEquipWeapons()

void Inventory::autoEquipWeapons ( Npc owner)

Definition at line 936 of file inventory.cpp.

◆ clear() [1/2]

void Inventory::clear ( GameScript vm,
Interactive owner,
bool  includeMissionItm = false 
)

Definition at line 573 of file inventory.cpp.

◆ clear() [2/2]

void Inventory::clear ( GameScript vm,
Npc owner,
bool  includeMissionItm = false 
)

Definition at line 564 of file inventory.cpp.

◆ clearSlot()

bool Inventory::clearSlot ( Npc owner,
std::string_view  slot,
bool  remove 
)

Definition at line 716 of file inventory.cpp.

◆ currentArmor()

Item * Inventory::currentArmor ( )
inline

Definition at line 105 of file inventory.h.

◆ currentMeleeWeapon()

Item * Inventory::currentMeleeWeapon ( )
inline

Definition at line 106 of file inventory.h.

◆ currentRangedWeapon()

Item * Inventory::currentRangedWeapon ( )
inline

Definition at line 107 of file inventory.h.

◆ currentShield()

Item * Inventory::currentShield ( )
inline

Definition at line 108 of file inventory.h.

◆ currentSpell() [1/2]

Item * Inventory::currentSpell ( uint8_t  s)
inline

Definition at line 109 of file inventory.h.

◆ currentSpell() [2/2]

const Item * Inventory::currentSpell ( uint8_t  s) const
inline

Definition at line 110 of file inventory.h.

◆ currentSpellSlot()

uint8_t Inventory::currentSpellSlot ( ) const

Definition at line 671 of file inventory.cpp.

◆ delItem()

void Inventory::delItem ( size_t  cls,
size_t  count,
Npc owner 
)

Definition at line 274 of file inventory.cpp.

◆ equip()

bool Inventory::equip ( size_t  cls,
Npc owner,
bool  force 
)

Definition at line 908 of file inventory.cpp.

◆ equipArmor()

void Inventory::equipArmor ( int32_t  cls,
Npc owner 
)

Definition at line 943 of file inventory.cpp.

◆ equipBestArmor()

void Inventory::equipBestArmor ( Npc owner)

Definition at line 955 of file inventory.cpp.

◆ equipBestMeleeWeapon()

void Inventory::equipBestMeleeWeapon ( Npc owner)

Definition at line 542 of file inventory.cpp.

◆ equipBestRangedWeapon()

void Inventory::equipBestRangedWeapon ( Npc owner)

Definition at line 548 of file inventory.cpp.

◆ findByFlags()

Item * Inventory::findByFlags ( ItmFlags  f,
uint32_t  num 
) const

Definition at line 970 of file inventory.cpp.

◆ getItem()

Item * Inventory::getItem ( size_t  instance)

Definition at line 341 of file inventory.cpp.

◆ goldCount()

size_t Inventory::goldCount ( ) const

Definition at line 209 of file inventory.cpp.

◆ hasMissionItems()

bool Inventory::hasMissionItems ( ) const

Definition at line 589 of file inventory.cpp.

◆ hasRangedWeaponWithAmmo()

bool Inventory::hasRangedWeaponWithAmmo ( ) const

Definition at line 602 of file inventory.cpp.

◆ hasSpell()

bool Inventory::hasSpell ( int32_t  spl) const

Definition at line 582 of file inventory.cpp.

◆ hasStateItem()

bool Inventory::hasStateItem ( ) const

Definition at line 679 of file inventory.cpp.

◆ invalidateCond()

void Inventory::invalidateCond ( Npc owner)

Definition at line 915 of file inventory.cpp.

◆ isEmpty()

bool Inventory::isEmpty ( ) const

Definition at line 90 of file inventory.cpp.

◆ itemCount()

size_t Inventory::itemCount ( const size_t  id) const

Definition at line 216 of file inventory.cpp.

◆ iterator()

Inventory::Iterator Inventory::iterator ( IteratorType  t) const

Definition at line 191 of file inventory.cpp.

◆ load() [1/2]

void Inventory::load ( Serialize s,
Interactive owner,
World w 
)

Definition at line 150 of file inventory.cpp.

◆ load() [2/2]

void Inventory::load ( Serialize s,
Npc owner 
)

Definition at line 146 of file inventory.cpp.

◆ moveItem()

void Inventory::moveItem ( Npc owner,
Inventory invNpc,
Interactive mobsi 
)
static

Definition at line 785 of file inventory.cpp.

◆ operator=()

Inventory & Inventory::operator= ( Inventory &&  )
default

◆ priceOf()

int32_t Inventory::priceOf ( size_t  item) const

Definition at line 195 of file inventory.cpp.

◆ putAmmunition()

void Inventory::putAmmunition ( Npc owner,
size_t  cls,
std::string_view  slot 
)

Definition at line 739 of file inventory.cpp.

◆ putCurrentToSlot()

void Inventory::putCurrentToSlot ( Npc owner,
std::string_view  slot 
)

Definition at line 683 of file inventory.cpp.

◆ putState()

bool Inventory::putState ( Npc owner,
size_t  cls,
int  state 
)

Definition at line 770 of file inventory.cpp.

◆ putToSlot()

void Inventory::putToSlot ( Npc owner,
size_t  cls,
std::string_view  slot 
)

Definition at line 693 of file inventory.cpp.

◆ save()

void Inventory::save ( Serialize s) const

Definition at line 154 of file inventory.cpp.

◆ sellPriceOf()

int32_t Inventory::sellPriceOf ( size_t  item) const

Definition at line 202 of file inventory.cpp.

◆ setCurrentItem()

void Inventory::setCurrentItem ( size_t  cls)

Definition at line 809 of file inventory.cpp.

◆ setStateItem()

void Inventory::setStateItem ( size_t  cls)

Definition at line 813 of file inventory.cpp.

◆ switchActiveSpell()

void Inventory::switchActiveSpell ( int32_t  spell,
Npc owner 
)

Definition at line 652 of file inventory.cpp.

◆ switchActiveWeapon()

void Inventory::switchActiveWeapon ( Npc owner,
uint8_t  slot 
)

Definition at line 628 of file inventory.cpp.

◆ switchActiveWeaponFist()

void Inventory::switchActiveWeaponFist ( )

Definition at line 622 of file inventory.cpp.

◆ transfer()

void Inventory::transfer ( Inventory to,
Inventory from,
Npc fromNpc,
size_t  cls,
size_t  count,
World wrld 
)
static

Definition at line 312 of file inventory.cpp.

◆ unequip() [1/2]

void Inventory::unequip ( Item cls,
Npc owner 
)

Definition at line 353 of file inventory.cpp.

◆ unequip() [2/2]

bool Inventory::unequip ( size_t  cls,
Npc owner 
)

Definition at line 345 of file inventory.cpp.

◆ unequipArmor()

void Inventory::unequipArmor ( GameScript vm,
Npc owner 
)

Definition at line 560 of file inventory.cpp.

◆ unequipWeapons()

void Inventory::unequipWeapons ( GameScript vm,
Npc owner 
)

Definition at line 554 of file inventory.cpp.

◆ updateArmorView()

void Inventory::updateArmorView ( Npc owner)

Definition at line 484 of file inventory.cpp.

◆ updateBowView()

void Inventory::updateBowView ( Npc owner)

Definition at line 504 of file inventory.cpp.

◆ updateRuneView()

void Inventory::updateRuneView ( Npc owner)

Definition at line 530 of file inventory.cpp.

◆ updateShieldView()

void Inventory::updateShieldView ( Npc owner)

Definition at line 517 of file inventory.cpp.

◆ updateSwordView()

void Inventory::updateSwordView ( Npc owner)

Definition at line 494 of file inventory.cpp.

◆ updateView()

void Inventory::updateView ( Npc owner)

Definition at line 461 of file inventory.cpp.

◆ use()

bool Inventory::use ( size_t  cls,
Npc owner,
uint8_t  slotHint,
bool  force 
)

Definition at line 838 of file inventory.cpp.


The documentation for this class was generated from the following files: