CEL

Public API Reference

iLootPackage Struct Reference

A loot package. More...

#include <tools/loot.h>

Inheritance diagram for iLootPackage:

List of all members.

Public Member Functions

virtual void AddLootItem (const char *templateName, float chance, int minamount, int maxamount, iParameter *validatePar=0)=0
 Add a loot item.
virtual iLootGeneratorQueryLootGenerator ()=0
 Get the loot generator that this object represents.
virtual void SetMinLoot (int m)=0
 Set and get the range of items that are allowed.
virtual void SetRandomGeneration (bool r)=0
 If random generation is disabled (default) then at the time loot items are generated, the items are considered in the order with which they were added to this package.

Detailed Description

A loot package.

This represents a set of items that an inventory can obtain as soon as it is opened. A loot package is also a loot generator.

Definition at line 56 of file loot.h.


Member Function Documentation

virtual void iLootPackage::AddLootItem ( const char *  templateName,
float  chance,
int  minamount,
int  maxamount,
iParameter validatePar = 0 
) [pure virtual]

Add a loot item.

Parameters:
templateName is the name of the entity template that will be used for this item. If this template doesn't exist in the CEL system then this is not an error. The item will simply never get generated (unless it comes into live at some point in the future).
chance is the chance (between 0 and 1) that this item will be generated.
minamount is the minimum amount of instances of this item.
maxamount is the maximum amount of instances of this item.
validatePar is an optional validation parameter that will be evaluated at the time this item is considered for addition (so after 'chance' is considered). If this parameter evaluates to true then the item will be used (this parameter is typically implemented with an expression). This expression can use the dynamic parameter to get the current entity containing the inventory that we're generating for.
virtual iLootGenerator* iLootPackage::QueryLootGenerator (  )  [pure virtual]

Get the loot generator that this object represents.

virtual void iLootPackage::SetMinLoot ( int  m  )  [pure virtual]

Set and get the range of items that are allowed.

Default range is 1 to 10 which means that this loot package will generate at least 1 but maximum 10 distinct items (ignoring the individual count for each item).

virtual void iLootPackage::SetRandomGeneration ( bool  r  )  [pure virtual]

If random generation is disabled (default) then at the time loot items are generated, the items are considered in the order with which they were added to this package.

So the first item that was added is considered first and then the second, and so on. This means that items that come first in the list usually have more chance of ending up in a loot package. If random generation is enabled then the loot items are shuffled first.


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

Generated for CEL: Crystal Entity Layer 2.1 by doxygen 1.6.1