|
Planeshift
|
This class stores an array of LootModifiers and randomizes loot stats. More...
#include <lootrandomizer.h>
Public Member Functions | |
| void | AddLootModifier (LootModifier *entry) |
| This adds another item to the entries array. | |
| void | ApplyModifier (psItemStats *baseItem, RandomizedOverlay *overlay, csArray< uint32_t > &modifiersIds) |
| Applies modifications to a randomized overlay depending on the requested ids. | |
| float | CalcModifierCostCap (psCharacter *chr) |
| Runs the LootModifierCap mathscript and returns the result, used by other function to determine if a modifier can be added. | |
| LootModifier * | GetModifier (uint32_t id) |
| Gets a loot modifier from it's id. | |
| float | GetModifierPercentProbability (int modifierID, int modifierType) |
| Returns the percent probability of a modifier based on the total number of modifiers available of that type. | |
| bool | GetModifiers (uint32_t itemID, csArray< psGMSpawnMods::ItemModifier > &mods) |
| Gets a loot modifier from it's id. | |
| LootRandomizer (CacheManager *cachemanager) | |
| Constructor. | |
| psItem * | RandomizeItem (psItem *item, float cost, bool lootTesting=false, size_t numModifiers=0) |
| This randomizes the current loot item and returns the item with the modifiers applied. | |
| psItem * | SetModifiers (psItem *item, csArray< uint32_t > &mods) |
| Validates and sets the loot modifiers with the given ids. | |
| ~LootRandomizer () | |
| Destructor. | |
Protected Attributes | |
| float | adjective_max |
| csArray< LootModifier * > | adjectives |
| Keeps all the loot modifiers of type "adjective". | |
| CacheManager * | cacheManager |
| A reference to the cachemanager. | |
| csHash< LootModifier *, uint32_t > | LootModifiersById |
| Keeps all the lootmodifiers for faster access when we know the id. | |
| MathScript * | modifierCostCalc |
| A cached reference to the LootModifierCap math script. | |
| float | prefix_max |
| csArray< LootModifier * > | prefixes |
| Keeps all the loot modifiers of type "prefix". | |
| float | suffix_max |
| csArray< LootModifier * > | suffixes |
| Keeps all the loot modifiers of type "suffix". | |
This class stores an array of LootModifiers and randomizes loot stats.
Definition at line 69 of file lootrandomizer.h.
| LootRandomizer::LootRandomizer | ( | CacheManager * | cachemanager | ) |
Constructor.
| cachemanager | A pointer to the cache manager. |
| LootRandomizer::~LootRandomizer | ( | ) |
Destructor.
| void LootRandomizer::AddLootModifier | ( | LootModifier * | entry | ) |
This adds another item to the entries array.
| void LootRandomizer::ApplyModifier | ( | psItemStats * | baseItem, |
| RandomizedOverlay * | overlay, | ||
| csArray< uint32_t > & | modifiersIds | ||
| ) |
Applies modifications to a randomized overlay depending on the requested ids.
| baseItem | The basic item which will have the overlay generated for. |
| overlay | A pointer to the overlay where we will save the modifications to apply to this item. |
| modifiersIds | An array with all the ids of the modifiers which we will need to apply to the overlay. |
| float LootRandomizer::CalcModifierCostCap | ( | psCharacter * | chr | ) |
Runs the LootModifierCap mathscript and returns the result, used by other function to determine if a modifier can be added.
| chr | The psCharacter which is being analyzed. |
| LootModifier* LootRandomizer::GetModifier | ( | uint32_t | id | ) |
Gets a loot modifier from it's id.
| id | The id of the item we are searching for. |
Returns the percent probability of a modifier based on the total number of modifiers available of that type.
| modifierID | the ID of the modifier to evaluate. |
| modifierType | 0=prefix, 1=suffix, 2=adjective |
| bool LootRandomizer::GetModifiers | ( | uint32_t | itemID, |
| csArray< psGMSpawnMods::ItemModifier > & | mods | ||
| ) |
Gets a loot modifier from it's id.
| id | The id of the basic item stats we are searching for. |
| mods | The list of modifiers returned |
| psItem* LootRandomizer::RandomizeItem | ( | psItem * | item, |
| float | cost, | ||
| bool | lootTesting = false, |
||
| size_t | numModifiers = 0 |
||
| ) |
This randomizes the current loot item and returns the item with the modifiers applied.
| item | The item instance which we will be randomizing. |
| cost | The maximum "cost" of the randomization we can apply |
| lootTesting | Says if we really are applying the modifiers. |
| numModifiers | Forces the amount of modifiers to apply. |
Validates and sets the loot modifiers with the given ids.
| item | The item instance being modified. |
| mods | The ids of the item modifiers to set. |
float LootRandomizer::adjective_max [protected] |
Definition at line 79 of file lootrandomizer.h.
csArray<LootModifier*> LootRandomizer::adjectives [protected] |
Keeps all the loot modifiers of type "adjective".
Definition at line 74 of file lootrandomizer.h.
CacheManager* LootRandomizer::cacheManager [protected] |
A reference to the cachemanager.
Definition at line 168 of file lootrandomizer.h.
csHash<LootModifier*, uint32_t> LootRandomizer::LootModifiersById [protected] |
Keeps all the lootmodifiers for faster access when we know the id.
Definition at line 75 of file lootrandomizer.h.
MathScript* LootRandomizer::modifierCostCalc [protected] |
A cached reference to the LootModifierCap math script.
Definition at line 167 of file lootrandomizer.h.
float LootRandomizer::prefix_max [protected] |
Definition at line 78 of file lootrandomizer.h.
csArray<LootModifier*> LootRandomizer::prefixes [protected] |
Keeps all the loot modifiers of type "prefix".
Definition at line 72 of file lootrandomizer.h.
float LootRandomizer::suffix_max [protected] |
Definition at line 80 of file lootrandomizer.h.
csArray<LootModifier*> LootRandomizer::suffixes [protected] |
Keeps all the loot modifiers of type "suffix".
Definition at line 73 of file lootrandomizer.h.
1.7.3