Planeshift
psCharacterInventory Class Reference

This class handles the details behind a character's inventory system. More...

#include <pscharinventory.h>

Classes

class  psCharacterInventoryItem
 
struct  psEquipInfo
 

Public Member Functions

bool Add (psItem *&item, bool test=false, bool stack=true, INVENTORY_SLOT_NUMBER slot=PSCHARACTER_SLOT_NONE, gemContainer *container=NULL, bool precise=true, bool skip_requirements=false)
 Put an item into the bulk inventory, and stack if needed. More...
 
bool AddLoadedItem (uint32 parentID, INVENTORY_SLOT_NUMBER slot, psItem *item)
 Places loaded items into the correct locations when loading from database. More...
 
bool AddOrDrop (psItem *&item, bool stack=true)
 Add an item to the inventory, or drop if inventory is full. More...
 
psItemAddStacked (psItem *&item, int &added)
 Attempt to stack an item on an existing one if Add failed. More...
 
void AddStorageItem (psItem *&item)
 Adds the passed item to the storage. More...
 
bool BeginExchange ()
 Copies current inventory to backup inventory. More...
 
void CalculateLimits ()
 Uses Mathscript formulas to determine the proper max weight and max space limits. More...
 
bool CanItemAttack (INVENTORY_SLOT_NUMBER slot)
 Check to see if a particular slot can be attacked. More...
 
bool CheckSlotRequirements (psItem *item, INVENTORY_SLOT_NUMBER proposedSlot, unsigned short stackCount=0)
 
void CommitExchange ()
 Make sure inventory knows that an exchange is completed. More...
 
void CreateGlyphList (csArray< glyphSlotInfo > &slots)
 Make an array of types of glyphs in the inventory - prefer purified. More...
 
void Equip (psItem *item)
 
bool EquipItem (psItem *newItem, INVENTORY_SLOT_NUMBER slotID)
 Track what is equipped where here. More...
 
psCharacterInventoryItemFindExchangeSlotOffered (int slotID)
 
INVENTORY_SLOT_NUMBER FindFreeEquipSlot (psItem *itemToPlace)
 Return a free equipment slot which the proposed item will fit in. More...
 
psItemFindItemID (uint32 itemID, bool storage=false)
 Finds an item inside the bulk inventory or the storage. More...
 
size_t FindItemStatIndex (psItemStats *itemstats, size_t startAt=1)
 Return the direct index into inventory of the defined item. More...
 
INVENTORY_SLOT_NUMBER FindSlotHoldingItem (psItem *item)
 Get the equip slot of the specified item, if equipped. More...
 
psCharacterInventoryItemGetCharInventoryItem (INVENTORY_SLOT_NUMBER slot)
 
size_t GetContainedItemCount (psItem *container)
 
float GetContainedSize (psItem *container)
 
float GetContainedWeight (psItem *container)
 
int GetCurrentMaxSpace ()
 Returns the max space in units this character can carry calculated by mathscript + containers size. More...
 
int GetCurrentTotalSpace ()
 Sums up all the items in inventory with GetItemSize() to calculate the totale space currently used by your inventory items. More...
 
float GetCurrentTotalWeight ()
 
bool GetDoRestrictions ()
 Get the status of the weight/capacity restrictions. More...
 
psItemGetEffectiveArmorInSlot (INVENTORY_SLOT_NUMBER slot)
 Gets the item in the slot. More...
 
psItemGetEffectiveWeaponInSlot (INVENTORY_SLOT_NUMBER slot, bool includeShield=false)
 Checks the equipment slot to see if it is a weapon. More...
 
psEquipInfoGetEquipmentObject (INVENTORY_SLOT_NUMBER idx)
 Acquire a reference to the equipment object inside inventory. More...
 
psCharacterInventoryItemGetIndexCharInventoryItem (size_t index)
 Returns the exchange info and the item in the index specified. More...
 
psInventoryCacheServerGetInventoryCacheServer (void)
 Get the inventory cache handler. More...
 
size_t GetInventoryIndexCount ()
 Return a count of items in the base inventory array. More...
 
psItemGetInventoryIndexItem (size_t which)
 Return the psItem at the inventory index specified. More...
 
psItemGetInventoryItem (INVENTORY_SLOT_NUMBER slot)
 Get an item that is in the equipment inventory. More...
 
uint32 GetInventoryVersion () const
 
psItemGetItem (psItem *container, INVENTORY_SLOT_NUMBER slot)
 Get an item that is in the bulk inventory. More...
 
psItemGetItemHeld ()
 Get item held, either in right or left hand. More...
 
csArray< psItem * > GetItemsInCategory (psItemCategory *category, bool storage=false)
 Iterates over the entire inventory to get a list of all the items from a particular category. More...
 
int GetOfferedStackCount (psItem *item)
 
float GetTotalSizeOfItemsInContainer (psItem *container=NULL)
 
bool HasEnoughUnusedSpace (float desiredSpace)
 Check to see if the player has a required amount of carrying capacity. More...
 
bool HasEnoughUnusedWeight (float requiredWeight)
 Check to see if the player has the ability to carry and additional weight. More...
 
bool hasItemCategory (psItemCategory *category, bool includeEquipment, bool includeBulk, bool includeStorage=false)
 Check if the item of a certain category is in the character inventory. More...
 
bool hasItemCategory (csString &categoryname, bool includeEquipment, bool includeBulk, bool includeStorage=false, int amountMin=1, int amountMax=-1, float qualityMin=0, float qualityMax=0)
 Check if the item of a certain category is in the character inventory. More...
 
bool hasItemsWithName (csString &itemname, bool includeEquipment, bool includeBulk, int amountMin=1, int amountMax=-1, float qualityMin=0, float qualityMax=0)
 Check if the item of a certain name is in the character inventory. More...
 
bool HasPurifiedGlyphs (const glyphList_t glyphsToCheck)
 Check if the character has a list of required purified glyphs. More...
 
bool HaveKeyForLock (uint32 lock)
 Checks to see if anything in inventoy counts as the key for a lock. More...
 
size_t HowManyCanFit (psItem *item)
 How may items can fit. More...
 
void IncreaseInventoryVersion ()
 Updates (increases) the current inventory version. More...
 
bool IsItemAutoAttack (INVENTORY_SLOT_NUMBER slot)
 Query if a slot is auto attack. More...
 
bool Load ()
 Load the inventory for the owner. More...
 
bool Load (PID id)
 Load the inventory using a particular ID. More...
 
float MaxWeight ()
 
 psCharacterInventory (psCharacter *owner)
 
void PurgeOffered ()
 
bool QuickLoad (PID id)
 Load the bare minimum to know what this character is looks like. More...
 
psItemRemoveInventoryItem (INVENTORY_SLOT_NUMBER slot, int count=-1)
 Removes an item that is in the equipment inventory. More...
 
psItemRemoveItem (psItem *container, INVENTORY_SLOT_NUMBER bulkslot, int count=-1)
 Remove an item from the bulk slots. More...
 
psItemRemoveItemID (uint32 itemID, int count=-1, bool storage=false)
 Remove an item from the bulk slots. More...
 
psItemRemoveItemIndex (size_t index, int count=-1, bool storage=false)
 The one true way to remove an item or split a stack from inventory. More...
 
void RestoreAllInventoryQuality ()
 Restore all items in this inventory to their max quality. More...
 
void RollbackExchange ()
 Cancel pending inventory exchange and rollback to original start point of inv. More...
 
void RunEquipScripts ()
 Iterates over the equipped items running any scripts on them. More...
 
void SetBasicArmor (psRaceInfo *race=NULL)
 Sets the basic armor when not equipped depending on the passed race. More...
 
void SetBasicWeapon (psRaceInfo *race=NULL)
 Sets the basic weapon when not equipped depending on the passed race. More...
 
void SetDoRestrictions (bool v)
 Changes this inventories handling of weight/capacity restrictions. More...
 
void SetExchangeOfferSlot (psItem *Container, INVENTORY_SLOT_NUMBER slot, int toSlot, int stackCount)
 
psItemStackNumberItems (const csString &itemname, int count, bool container)
 Iterates over the inventory, stacking items. More...
 
unsigned int TotalStackOfItem (psItemStats *item)
 Find the total stack count in inventory for a particular type of item. More...
 
void Unequip (psItem *item)
 
void UpdateEncumbrance ()
 Update encumbrance/OVERWEIGHT mode to match current status. More...
 
void WriteAllInventory (iDocumentNode *npcRoot)
 This creates an xml tree for npcloader saving. More...
 
 ~psCharacterInventory ()
 

Static Public Member Functions

static psItemGetItemFactory (psItemStats *stats)
 Allocate either a psItem or a psGlyph. More...
 

Public Attributes

csString lastError
 Contain error messge for last function failing. More...
 
psCharacterowner
 Current owner of the inventory. More...
 

Protected Attributes

bool doRestrictions
 Do weight/capacity restrictions? More...
 
psEquipInfo equipment [PSCHARACTER_SLOT_BULK1]
 Items player is using in various slots. More...
 
bool inExchangeMode
 Exchange mode flag. More...
 
csArray< psCharacterInventoryIteminventory
 Flat array of all items owned in this inventory. More...
 
bool loaded
 Has this inventory been fully loaded yet? More...
 
float maxSize
 Max capacity in inventory. More...
 
float maxWeight
 Max weight the inventory can hold. More...
 
csArray< psItem * > storageInventory
 Array with all the items stored by the character. More...
 
uint32 version
 Inventory version. More...
 

Detailed Description

This class handles the details behind a character's inventory system.

Definition at line 81 of file pscharinventory.h.

Constructor & Destructor Documentation

psCharacterInventory::psCharacterInventory ( psCharacter owner)
psCharacterInventory::~psCharacterInventory ( )

Member Function Documentation

bool psCharacterInventory::Add ( psItem *&  item,
bool  test = false,
bool  stack = true,
INVENTORY_SLOT_NUMBER  slot = PSCHARACTER_SLOT_NONE,
gemContainer container = NULL,
bool  precise = true,
bool  skip_requirements = false 
)

Put an item into the bulk inventory, and stack if needed.

Parameters
itemThe item we want to place into the slot.
testAre we just testing if we can put this into the slot
stackShould the item be stacked?
slotThe slot in which we want to place an item. (may be a slot number, or PSCHARACTER_SLOT_NONE)
containerPointer to container.
preciseSays whatever if the stacking should be precise and not ignore properties like quality.
skip_requirementsIf set, don't check the slot requirements in order to place the item in the slot.
Returns
true if the item could be placed fully in the slot. false if the item could not be placed.
bool psCharacterInventory::AddLoadedItem ( uint32  parentID,
INVENTORY_SLOT_NUMBER  slot,
psItem item 
)

Places loaded items into the correct locations when loading from database.

Parameters
parentIDThe parent.
slotName where item should go.
itemThe item we are placing.
Returns
Item was placed correctly.
bool psCharacterInventory::AddOrDrop ( psItem *&  item,
bool  stack = true 
)

Add an item to the inventory, or drop if inventory is full.

psItem* psCharacterInventory::AddStacked ( psItem *&  item,
int added 
)

Attempt to stack an item on an existing one if Add failed.

Parameters
itemThe item we want to place into the slot.
addednumber of items that have been taken off the stack
Returns
The item if the item could be placed partially in the slot. else NULL.
void psCharacterInventory::AddStorageItem ( psItem *&  item)

Adds the passed item to the storage.

The item will be accessible only from storage npc.

Parameters
itemThe item to be added to the storage.
bool psCharacterInventory::BeginExchange ( )

Copies current inventory to backup inventory.

void psCharacterInventory::CalculateLimits ( )

Uses Mathscript formulas to determine the proper max weight and max space limits.

bool psCharacterInventory::CanItemAttack ( INVENTORY_SLOT_NUMBER  slot)

Check to see if a particular slot can be attacked.

Parameters
slotThe slot to query.
Returns
true if the slot can be attacked.
bool psCharacterInventory::CheckSlotRequirements ( psItem item,
INVENTORY_SLOT_NUMBER  proposedSlot,
unsigned short  stackCount = 0 
)
void psCharacterInventory::CommitExchange ( )

Make sure inventory knows that an exchange is completed.

void psCharacterInventory::CreateGlyphList ( csArray< glyphSlotInfo > &  slots)

Make an array of types of glyphs in the inventory - prefer purified.

void psCharacterInventory::Equip ( psItem item)
bool psCharacterInventory::EquipItem ( psItem newItem,
INVENTORY_SLOT_NUMBER  slotID 
)

Track what is equipped where here.

The item must already be in inventory to equip, and if something is in the equip slot already, it is removed with no effect on anything else.

psCharacterInventoryItem* psCharacterInventory::FindExchangeSlotOffered ( int  slotID)
INVENTORY_SLOT_NUMBER psCharacterInventory::FindFreeEquipSlot ( psItem itemToPlace)

Return a free equipment slot which the proposed item will fit in.

psItem* psCharacterInventory::FindItemID ( uint32  itemID,
bool  storage = false 
)

Finds an item inside the bulk inventory or the storage.

Parameters
itemIDThe UID of the item we are looking for.
storageTRUE if we have to look in the item storage.
Returns
The item if found, NULL otherwise.
size_t psCharacterInventory::FindItemStatIndex ( psItemStats itemstats,
size_t  startAt = 1 
)

Return the direct index into inventory of the defined item.

INVENTORY_SLOT_NUMBER psCharacterInventory::FindSlotHoldingItem ( psItem item)

Get the equip slot of the specified item, if equipped.

Parameters
itemThe item that we want to find.
Returns
The index of the slot where the item is equipped. -1 if no item was found.
psCharacterInventoryItem* psCharacterInventory::GetCharInventoryItem ( INVENTORY_SLOT_NUMBER  slot)
size_t psCharacterInventory::GetContainedItemCount ( psItem container)
float psCharacterInventory::GetContainedSize ( psItem container)
float psCharacterInventory::GetContainedWeight ( psItem container)
int psCharacterInventory::GetCurrentMaxSpace ( )

Returns the max space in units this character can carry calculated by mathscript + containers size.

Returns
max space
int psCharacterInventory::GetCurrentTotalSpace ( )

Sums up all the items in inventory with GetItemSize() to calculate the totale space currently used by your inventory items.

Returns
inventory size
float psCharacterInventory::GetCurrentTotalWeight ( )
bool psCharacterInventory::GetDoRestrictions ( )
inline

Get the status of the weight/capacity restrictions.

Definition at line 511 of file pscharinventory.h.

psItem* psCharacterInventory::GetEffectiveArmorInSlot ( INVENTORY_SLOT_NUMBER  slot)

Gets the item in the slot.

Parameters
slotThe equipment slot to checks.
Returns
a pointer to the item if one is there. Uses base_cloths otherwise.
psItem* psCharacterInventory::GetEffectiveWeaponInSlot ( INVENTORY_SLOT_NUMBER  slot,
bool  includeShield = false 
)

Checks the equipment slot to see if it is a weapon.

An item is considered a weapon if: IsMeleeWeapon() || GetIsRangeWeapon()

Parameters
slotThe equipment slot to check weapon status.
includeShieldTell if a shield can be returned as a weapon, useful when calculating the shield blocking like a weapon.
Returns
a pointer to the item if it is a weapon. If no weapon found will use default fists.
psEquipInfo& psCharacterInventory::GetEquipmentObject ( INVENTORY_SLOT_NUMBER  idx)

Acquire a reference to the equipment object inside inventory.

This function does NOT do bounds checking so idx has to be in range.

Parameters
idxThe equipment slot we want the equipment structure for.
Returns
The equipment data structure.
psCharacterInventoryItem* psCharacterInventory::GetIndexCharInventoryItem ( size_t  index)
inline

Returns the exchange info and the item in the index specified.

Definition at line 577 of file pscharinventory.h.

psInventoryCacheServer* psCharacterInventory::GetInventoryCacheServer ( void  )
inline

Get the inventory cache handler.

Definition at line 517 of file pscharinventory.h.

size_t psCharacterInventory::GetInventoryIndexCount ( )
inline

Return a count of items in the base inventory array.

This should be used only for debug output.

Definition at line 561 of file pscharinventory.h.

psItem* psCharacterInventory::GetInventoryIndexItem ( size_t  which)
inline

Return the psItem at the inventory index specified.

This should be used only for debug output

Definition at line 571 of file pscharinventory.h.

psItem* psCharacterInventory::GetInventoryItem ( INVENTORY_SLOT_NUMBER  slot)

Get an item that is in the equipment inventory.

Parameters
slotThe slot in which we want to retrive the item ( if any ).
Returns
The item in the given slot. NULL if no item was found.
uint32 psCharacterInventory::GetInventoryVersion ( ) const
inline
Returns
The current inventory version.

Definition at line 240 of file pscharinventory.h.

psItem* psCharacterInventory::GetItem ( psItem container,
INVENTORY_SLOT_NUMBER  slot 
)

Get an item that is in the bulk inventory.

Parameters
containerThe container of the slot, if any. NULL if normal bulk.
slotThe slot in which we want to retrive the item ( if any ).
Returns
The item in the given slot. NULL if no item was found.
static psItem* psCharacterInventory::GetItemFactory ( psItemStats stats)
static

Allocate either a psItem or a psGlyph.

psItem* psCharacterInventory::GetItemHeld ( )

Get item held, either in right or left hand.

csArray<psItem*> psCharacterInventory::GetItemsInCategory ( psItemCategory category,
bool  storage = false 
)

Iterates over the entire inventory to get a list of all the items from a particular category.

This is useful for npc merchants/storage when you want to get a list of all the items they have.

Parameters
categoryA pointer to the category that we want to match against.
storageA boolean telling if we have to look in the storage in place of the main inventory.
Returns
The list of all items in category.
int psCharacterInventory::GetOfferedStackCount ( psItem item)
float psCharacterInventory::GetTotalSizeOfItemsInContainer ( psItem container = NULL)
Returns
The max capacity ( ie space ) this inventory can handle. //float MaxCapacity() { return maxSize; }
The current weight level of the inventory.
The current capacity ( ie space ) of the inventory.
bool psCharacterInventory::HasEnoughUnusedSpace ( float  desiredSpace)

Check to see if the player has a required amount of carrying capacity.

Parameters
desiredSpaceThe amount of space that we want to check.
Returns
true if the player has enough capacity for the requiredSpace.
bool psCharacterInventory::HasEnoughUnusedWeight ( float  requiredWeight)

Check to see if the player has the ability to carry and additional weight.

Parameters
requiredWeightThe amount of weight that we want to check.
Returns
true if the player has can carry the additional weight.
bool psCharacterInventory::hasItemCategory ( psItemCategory category,
bool  includeEquipment,
bool  includeBulk,
bool  includeStorage = false 
)

Check if the item of a certain category is in the character inventory.

Parameters
categorypointer to the psItemCategory structure to search for.
includeEquipmentinclude equipment in the search.
includeBulkinclude bulk in the search.
includeStorageinclude storage in the search.
Returns
true if the item was found, false if it wasn't.
bool psCharacterInventory::hasItemCategory ( csString &  categoryname,
bool  includeEquipment,
bool  includeBulk,
bool  includeStorage = false,
int  amountMin = 1,
int  amountMax = -1,
float  qualityMin = 0,
float  qualityMax = 0 
)

Check if the item of a certain category is in the character inventory.

Parameters
categorynameThe name of the category of item to search for.
includeEquipmentinclude equipment in the search.
includeBulksearches for the item only in the equipment if true.
includeStorageinclude storage in the search.
amountMinThe minimum amount of this item that the inventory must have, 1 is default.
amountMaxThe maximum amount of this item that the inventory can have, -1 to ignore.
qualityMinThe minimum quality the item must have, 0 to ignore.
qualityMaxThe maximum quality the item must have, 0 to ignore.
Returns
true if the item was found, false if it wasn't.
bool psCharacterInventory::hasItemsWithName ( csString &  itemname,
bool  includeEquipment,
bool  includeBulk,
int  amountMin = 1,
int  amountMax = -1,
float  qualityMin = 0,
float  qualityMax = 0 
)

Check if the item of a certain name is in the character inventory.

Parameters
itemnameThe name of the item to search for.
includeEquipmentinclude equipment in the search.
includeBulkinclude bulk in the search.
amountMinThe minimum amount of items that must be in the inventory
amountMaxThe maximum amount of items that can be in the inventory, -1 to ignore
qualityMinThe minimum quality the item must have, 0 to ignore.
qualityMaxThe maximum quality the item must have, 0 to ignore.
Returns
The item in the given slot. NULL if no item was found.
bool psCharacterInventory::HasPurifiedGlyphs ( const glyphList_t  glyphsToCheck)

Check if the character has a list of required purified glyphs.

bool psCharacterInventory::HaveKeyForLock ( uint32  lock)

Checks to see if anything in inventoy counts as the key for a lock.

Parameters
lockThe lock we want to try and open.
Returns
true if a key was found that can open the lock.
size_t psCharacterInventory::HowManyCanFit ( psItem item)

How may items can fit.

Parameters
itemthe item to check for.
Returns
the max number of the given item that can fit.
void psCharacterInventory::IncreaseInventoryVersion ( )
inline

Updates (increases) the current inventory version.

Definition at line 248 of file pscharinventory.h.

bool psCharacterInventory::IsItemAutoAttack ( INVENTORY_SLOT_NUMBER  slot)

Query if a slot is auto attack.

Parameters
slotThe slot to query.
Returns
true if the slot can auto attack.
bool psCharacterInventory::Load ( )

Load the inventory for the owner.

bool psCharacterInventory::Load ( PID  id)

Load the inventory using a particular ID.

This is useful for NPCs that have their own inventory as well as a common base one they need to load.

Parameters
idThe key into the character table for the character who's inventory we should load.
Returns
true if the inventory was loaded without error.
float psCharacterInventory::MaxWeight ( )
inline
Returns
the number of empty bulk slots / int HasEmptyBulkSlots();
The max allowable weight for this inventory.

Definition at line 221 of file pscharinventory.h.

void psCharacterInventory::PurgeOffered ( )
bool psCharacterInventory::QuickLoad ( PID  id)

Load the bare minimum to know what this character is looks like.

psItem* psCharacterInventory::RemoveInventoryItem ( INVENTORY_SLOT_NUMBER  slot,
int  count = -1 
)

Removes an item that is in the equipment inventory.

Parameters
slotThe slot we want to remove the item from.
countThe number we want to take. -1 Means the entire stack.
Returns
pointer to the item that was removed.
psItem* psCharacterInventory::RemoveItem ( psItem container,
INVENTORY_SLOT_NUMBER  bulkslot,
int  count = -1 
)

Remove an item from the bulk slots.

Parameters
container
bulkslotThe slot we want to remove the item from.
countThe number we want to take. -1 Means the entire stack.
Returns
pointer to the item that was removed.
psItem* psCharacterInventory::RemoveItemID ( uint32  itemID,
int  count = -1,
bool  storage = false 
)

Remove an item from the bulk slots.

Parameters
itemIDThe UID of the item we are looking for.
countThe number we want to take. -1 Means the entire stack.
storageTRUE if we are looking in the storage.
Returns
pointer to the item that was removed.
psItem* psCharacterInventory::RemoveItemIndex ( size_t  index,
int  count = -1,
bool  storage = false 
)

The one true way to remove an item or split a stack from inventory.

Other removal functions all find the index and call this.

Parameters
indexThe index to remove
countThe number of items from that index to remove.
storageA boolean TRUE if we are removing from the storage in place of the inventory.
void psCharacterInventory::RestoreAllInventoryQuality ( )

Restore all items in this inventory to their max quality.

This function is usually used by npc at their respawn after death.

void psCharacterInventory::RollbackExchange ( )

Cancel pending inventory exchange and rollback to original start point of inv.

void psCharacterInventory::RunEquipScripts ( )

Iterates over the equipped items running any scripts on them.

void psCharacterInventory::SetBasicArmor ( psRaceInfo race = NULL)

Sets the basic armor when not equipped depending on the passed race.

Note
if race is NULL or the armor group is 0 it will set the basicloths else the defined ones.
Parameters
racePointer to the race to use to set the basic armor.
void psCharacterInventory::SetBasicWeapon ( psRaceInfo race = NULL)

Sets the basic weapon when not equipped depending on the passed race.

Note
if race is NULL or the armor group is 0 it will set the fist item else the defined ones.
Parameters
racePointer to the race to use to set the basic armor.
void psCharacterInventory::SetDoRestrictions ( bool  v)

Changes this inventories handling of weight/capacity restrictions.

void psCharacterInventory::SetExchangeOfferSlot ( psItem Container,
INVENTORY_SLOT_NUMBER  slot,
int  toSlot,
int  stackCount 
)
psItem* psCharacterInventory::StackNumberItems ( const csString &  itemname,
int  count,
bool  container 
)

Iterates over the inventory, stacking items.

Parameters
itemnameName of the item to be stacked
countquantity up to which items should be stacked
containerdecide whether to look into containers in the inventory
Returns
The pointer to the stacked item, or NULL if nothing is found
unsigned int psCharacterInventory::TotalStackOfItem ( psItemStats item)

Find the total stack count in inventory for a particular type of item.

Parameters
itemThe base stats of the item we want to count.
Returns
the count of the total items matching the stats description.
void psCharacterInventory::Unequip ( psItem item)
void psCharacterInventory::UpdateEncumbrance ( )

Update encumbrance/OVERWEIGHT mode to match current status.

void psCharacterInventory::WriteAllInventory ( iDocumentNode *  npcRoot)

This creates an xml tree for npcloader saving.

Member Data Documentation

bool psCharacterInventory::doRestrictions
protected

Do weight/capacity restrictions?

Definition at line 126 of file pscharinventory.h.

psEquipInfo psCharacterInventory::equipment[PSCHARACTER_SLOT_BULK1]
protected

Items player is using in various slots.

Definition at line 123 of file pscharinventory.h.

bool psCharacterInventory::inExchangeMode
protected

Exchange mode flag.

Definition at line 138 of file pscharinventory.h.

csArray<psCharacterInventoryItem> psCharacterInventory::inventory
protected

Flat array of all items owned in this inventory.

Definition at line 109 of file pscharinventory.h.

csString psCharacterInventory::lastError

Contain error messge for last function failing.

Definition at line 505 of file pscharinventory.h.

bool psCharacterInventory::loaded
protected

Has this inventory been fully loaded yet?

Definition at line 129 of file pscharinventory.h.

float psCharacterInventory::maxSize
protected

Max capacity in inventory.

Definition at line 135 of file pscharinventory.h.

float psCharacterInventory::maxWeight
protected

Max weight the inventory can hold.

Definition at line 132 of file pscharinventory.h.

psCharacter* psCharacterInventory::owner

Current owner of the inventory.

Definition at line 85 of file pscharinventory.h.

csArray<psItem*> psCharacterInventory::storageInventory
protected

Array with all the items stored by the character.

Definition at line 112 of file pscharinventory.h.

uint32 psCharacterInventory::version
protected

Inventory version.

Definition at line 141 of file pscharinventory.h.


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