CEL

Public API Reference

iPcInventory Struct Reference

This is an inventory property class. More...

#include <propclass/inv.h>

Inheritance diagram for iPcInventory:

List of all members.

Public Member Functions

virtual void AddAllowedClass (csStringID cls)=0
 Add an entity class which is allowed for this inventory.
virtual bool AddEntity (iCelEntity *entity, iCelParameterBlock *params=0)=0
 Add an entity.
virtual bool AddEntityTemplate (iCelEntityTemplate *tpl, int amount)=0
 Add an entity template.
virtual void AddInventoryListener (iPcInventoryListener *listener)=0
 Add an inventory listener.
virtual void ClearAllowedClasses ()=0
 Clear the allowed entity classes which makes sure that all entities are allowed.
virtual void Dump ()=0
 This is a debugging function to dump the contents of the inventory and all constraints.
virtual size_t FindEntity (csStringID classid) const =0
 Find the index of some entity in the inventory by class.
virtual size_t FindEntity (const char *name) const =0
 Find the index of some entity in the inventory by name.
virtual size_t FindEntity (iCelEntity *entity) const =0
 Find the index of some entity in the inventory.
virtual size_t FindEntityTemplate (csStringID classid) const =0
 Find the index of some entity template in the inventory by class.
virtual size_t FindEntityTemplate (const char *name) const =0
 Find the index of some entity template in the inventory by name.
virtual size_t FindEntityTemplate (iCelEntityTemplate *tpl) const =0
 Find the index of some entity template in the inventory.
virtual bool GenerateLoot ()=0
 Generate the loot (if any) in this inventory.
virtual bool GetConstraints (const char *charName, float &minValue, float &maxValue, float &totalMaxValue) const =0
 Get the constraints for some characteristic.
virtual float GetCurrentCharacteristic (const char *charName) const =0
 Get the current value for some characteristic.
virtual iCelEntityGetEntity (size_t idx) const =0
 Get some entity.
virtual size_t GetEntityCount () const =0
 Get the number of entities in this inventory (not templates!).
virtual iCelEntityGetEntitySlot (iCelParameterBlock *params) const =0
 Get an entity from a generic slot (space system).
virtual iCelEntityTemplateGetEntityTemplate (size_t idx) const =0
 Get some entity template.
virtual int GetEntityTemplateAmount (size_t idx) const =0
 Get the amount of instances for a given template.
virtual size_t GetEntityTemplateCount () const =0
 Get the number of templates in this inventory.
virtual iLootGeneratorGetLootGenerator () const =0
 Get the loot generator for this inventory.
virtual iCelInventorySpaceGetSpace ()=0
 Get the used space manager.
virtual bool HasStrictCharacteristics (const char *charName) const =0
 Return the value of 'strict characteristics'.
virtual bool In (iCelEntityTemplate *tpl) const =0
 Test if some entity template is in the inventory.
virtual bool In (const char *name) const =0
 Test if some entity or template is in the inventory by name.
virtual bool In (iCelEntity *entity) const =0
 Test if some entity is in the inventory.
virtual bool IsClassAllowed (csStringID cls) const =0
 Return true if a given class is allowed.
virtual void MarkDirty (const char *charName)=0
 Mark this characteristic as dirty for this inventory and all inventories this entity is in.
virtual bool RemoveAll ()=0
 Remove all entities and templates.
virtual void RemoveAllConstraints ()=0
 Remove all constraints.
virtual void RemoveConstraints (const char *charName)=0
 Remove constraints for a characteristic.
virtual bool RemoveEntity (iCelParameterBlock *params)=0
 Remove an entity on a slot using the space system.
virtual bool RemoveEntity (iCelEntity *entity)=0
 Remove an entity.
virtual bool RemoveEntityTemplate (iCelEntityTemplate *tpl, int amount)=0
 Remove an entity template.
virtual void RemoveInventoryListener (iPcInventoryListener *listener)=0
 Remove an inventory listener.
virtual bool SetConstraints (const char *charName, float minValue, float maxValue, float totalMaxValue)=0
 Set the constraints for some characteristic.
virtual void SetLootGenerator (iLootGenerator *generator)=0
 Set a loot generator for this inventory.
virtual void SetSpace (iCelInventorySpace *space)=0
 Set an optional space manager for this inventory.
virtual bool SetStrictCharacteristics (const char *charName, bool strict)=0
 If true reject any entities that don't have this characteristic.
virtual bool TestConstraints (const char *charName)=0
 Test constraints for this characteristic for this inventory and all inventories * this entity is in.

Detailed Description

This is an inventory property class.

This property class supports the following actions (add prefix 'cel.inventory.action.' if you want to access this action through a message):

This property class can send out the following messages (possibly to the containing entity as well as the child entity):

Definition at line 179 of file inv.h.


Member Function Documentation

virtual void iPcInventory::AddAllowedClass ( csStringID  cls  )  [pure virtual]

Add an entity class which is allowed for this inventory.

If no entity classes are added then there is no restriction.

virtual bool iPcInventory::AddEntity ( iCelEntity entity,
iCelParameterBlock params = 0 
) [pure virtual]

Add an entity.

Returns false if the entity could not be added (capacity exceeded for example). Note that it is safe to add entities that are already in the inventory. Nothing will happen then and true will be returned. If 'params' is given then this will be given to the space system.

Parameters:
params is a generic slot specification (used by iCelInventorySpace).
virtual bool iPcInventory::AddEntityTemplate ( iCelEntityTemplate tpl,
int  amount 
) [pure virtual]

Add an entity template.

Returns false if the template could not be added (capacity exceeded for example). If the given template is already in the inventory then the amount will be updated. The space/slot system is currently not yet supported for entity templates.

virtual void iPcInventory::AddInventoryListener ( iPcInventoryListener listener  )  [pure virtual]

Add an inventory listener.

Inventory listeners are called right before the behaviour is called.

virtual void iPcInventory::ClearAllowedClasses (  )  [pure virtual]

Clear the allowed entity classes which makes sure that all entities are allowed.

virtual void iPcInventory::Dump (  )  [pure virtual]

This is a debugging function to dump the contents of the inventory and all constraints.

virtual size_t iPcInventory::FindEntity ( csStringID  classid  )  const [pure virtual]

Find the index of some entity in the inventory by class.

The first entity with given class will be returned. Return csArrayItemNotFound if not in inventory.

virtual size_t iPcInventory::FindEntity ( const char *  name  )  const [pure virtual]

Find the index of some entity in the inventory by name.

Return csArrayItemNotFound if not in inventory.

virtual size_t iPcInventory::FindEntity ( iCelEntity entity  )  const [pure virtual]

Find the index of some entity in the inventory.

Return csArrayItemNotFound if not in inventory.

virtual size_t iPcInventory::FindEntityTemplate ( csStringID  classid  )  const [pure virtual]

Find the index of some entity template in the inventory by class.

The first template with given class will be returned. Return csArrayItemNotFound if not in inventory.

virtual size_t iPcInventory::FindEntityTemplate ( const char *  name  )  const [pure virtual]

Find the index of some entity template in the inventory by name.

Return csArrayItemNotFound if not in inventory.

virtual size_t iPcInventory::FindEntityTemplate ( iCelEntityTemplate tpl  )  const [pure virtual]

Find the index of some entity template in the inventory.

Return csArrayItemNotFound if not in inventory.

virtual bool iPcInventory::GenerateLoot (  )  [pure virtual]

Generate the loot (if any) in this inventory.

The application would typically call this before opening the inventory.

virtual bool iPcInventory::GetConstraints ( const char *  charName,
float &  minValue,
float &  maxValue,
float &  totalMaxValue 
) const [pure virtual]

Get the constraints for some characteristic.

Returns false if there are no constraints defined.

virtual float iPcInventory::GetCurrentCharacteristic ( const char *  charName  )  const [pure virtual]

Get the current value for some characteristic.

virtual iCelEntity* iPcInventory::GetEntity ( size_t  idx  )  const [pure virtual]

Get some entity.

virtual size_t iPcInventory::GetEntityCount (  )  const [pure virtual]

Get the number of entities in this inventory (not templates!).

virtual iCelEntity* iPcInventory::GetEntitySlot ( iCelParameterBlock params  )  const [pure virtual]

Get an entity from a generic slot (space system).

virtual iCelEntityTemplate* iPcInventory::GetEntityTemplate ( size_t  idx  )  const [pure virtual]

Get some entity template.

virtual int iPcInventory::GetEntityTemplateAmount ( size_t  idx  )  const [pure virtual]

Get the amount of instances for a given template.

virtual size_t iPcInventory::GetEntityTemplateCount (  )  const [pure virtual]

Get the number of templates in this inventory.

This only counts distinct templates. The number of instances of every template is ignored.

virtual iLootGenerator* iPcInventory::GetLootGenerator (  )  const [pure virtual]

Get the loot generator for this inventory.

virtual iCelInventorySpace* iPcInventory::GetSpace (  )  [pure virtual]

Get the used space manager.

Warning:
You should never remove or add entities to the space directly (by using its api), do it from PcInventory RemoveEntity or AddEntity functions instead.
virtual bool iPcInventory::HasStrictCharacteristics ( const char *  charName  )  const [pure virtual]

Return the value of 'strict characteristics'.

virtual bool iPcInventory::In ( iCelEntityTemplate tpl  )  const [pure virtual]

Test if some entity template is in the inventory.

virtual bool iPcInventory::In ( const char *  name  )  const [pure virtual]

Test if some entity or template is in the inventory by name.

virtual bool iPcInventory::In ( iCelEntity entity  )  const [pure virtual]

Test if some entity is in the inventory.

virtual bool iPcInventory::IsClassAllowed ( csStringID  cls  )  const [pure virtual]

Return true if a given class is allowed.

If no allowed classes were given then this will always return true.

virtual void iPcInventory::MarkDirty ( const char *  charName  )  [pure virtual]

Mark this characteristic as dirty for this inventory and all inventories this entity is in.

If 'charName' == 0 then all characteristics will be marked dirty.

virtual bool iPcInventory::RemoveAll (  )  [pure virtual]

Remove all entities and templates.

This can fail if removing entities causes upstream inventories to fail its constraints. In that case entities are removed until the first failure. To ensure correct removal for this inventory you should first clear all constraints.

virtual void iPcInventory::RemoveAllConstraints (  )  [pure virtual]

Remove all constraints.

virtual void iPcInventory::RemoveConstraints ( const char *  charName  )  [pure virtual]

Remove constraints for a characteristic.

virtual bool iPcInventory::RemoveEntity ( iCelParameterBlock params  )  [pure virtual]

Remove an entity on a slot using the space system.

This can fail if removing an entity causes an upstream inventory to fail its constraints.

Parameters:
params is a generic slot specification (used by iCelInventorySpace). It can also contain additional information to specify which entity to remove from some slot (if stacked items are supported).
virtual bool iPcInventory::RemoveEntity ( iCelEntity entity  )  [pure virtual]

Remove an entity.

This can fail if removing an entity causes an upstream inventory to fail its constraints.

virtual bool iPcInventory::RemoveEntityTemplate ( iCelEntityTemplate tpl,
int  amount 
) [pure virtual]

Remove an entity template.

This can fail if removing a template causes an upstream inventory to fail its constraints. If there are more of a given template in the inventory then the amount will be updated. If there are less then this will fail and nothing will happen.

virtual void iPcInventory::RemoveInventoryListener ( iPcInventoryListener listener  )  [pure virtual]

Remove an inventory listener.

virtual bool iPcInventory::SetConstraints ( const char *  charName,
float  minValue,
float  maxValue,
float  totalMaxValue 
) [pure virtual]

Set the constraints for some characteristic.

There is a min and max value for one entity and also a total max value for the entire inventory.

This function can fail if the new constraints cause current contents to be invalidated.

virtual void iPcInventory::SetLootGenerator ( iLootGenerator generator  )  [pure virtual]

Set a loot generator for this inventory.

As soon as this is set it will be used as soon as the inventory is opened (querried). If the inventory already contains items then the loot will be appended. To reactivate a given loot generator you just have to call this function again.

virtual void iPcInventory::SetSpace ( iCelInventorySpace space  )  [pure virtual]

Set an optional space manager for this inventory.

If you don't do this then the inventory system will use no space/slot system.

virtual bool iPcInventory::SetStrictCharacteristics ( const char *  charName,
bool  strict 
) [pure virtual]

If true reject any entities that don't have this characteristic.

By default this is false which means that the inventory will automatically assume valid values when this characteristic is not present.

This function can fail if this inventory already has contents and entities in this inventory do not satisfy the strict condition.

virtual bool iPcInventory::TestConstraints ( const char *  charName  )  [pure virtual]

Test constraints for this characteristic for this inventory and all inventories * this entity is in.

If 'charName' == 0 then all characteristics will be tested.


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

Generated for CEL: Crystal Entity Layer 2.1 by doxygen 1.6.1