This class stores an array of LootModifiers and randomizes loot stats.
More...
#include <lootrandomizer.h>
This class stores an array of LootModifiers and randomizes loot stats.
Definition at line 69 of file lootrandomizer.h.
LootRandomizer::LootRandomizer |
( |
CacheManager * |
cachemanager | ) |
|
Constructor.
- Parameters
-
cachemanager | A pointer to the cache manager. |
LootRandomizer::~LootRandomizer |
( |
| ) |
|
void LootRandomizer::AddLootModifier |
( |
LootModifier * |
entry | ) |
|
This adds another item to the entries array.
Applies modifications to a randomized overlay depending on the requested ids.
- Parameters
-
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. |
Runs the LootModifierCap mathscript and returns the result, used by other function to determine if a modifier can be added.
- Parameters
-
- Returns
- A number determining the cost cap for the random modifiers.
Gets a loot modifier from it's id.
- Parameters
-
id | The id of the item we are searching for. |
- Returns
- A pointer to the loot modifier which is referenced by the id we were searching for.
float LootRandomizer::GetModifierPercentProbability |
( |
int |
modifierID, |
|
|
int |
modifierType |
|
) |
| |
Returns the percent probability of a modifier based on the total number of modifiers available of that type.
- Parameters
-
modifierID | the ID of the modifier to evaluate. |
modifierType | 0=prefix, 1=suffix, 2=adjective |
- Returns
- the float percentage, or 0 if the modifier is invalid or has no probability
Gets a loot modifier from it's id.
- Parameters
-
id | The id of the basic item stats we are searching for. |
mods | The list of modifiers returned |
- Returns
- True if the array was filled in.
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.
- Parameters
-
item | The item instance which we will be randomizing. |
cost | The maximum "cost" of the randomization we can apply |
- See also
- CalcModifierCostCap
- Parameters
-
lootTesting | Says if we really are applying the modifiers. |
numModifiers | Forces the amount of modifiers to apply. |
- Returns
- A pointer to the resulting item (it's the same pointer which was passed to the function).
psItem* LootRandomizer::SetModifiers |
( |
psItem * |
item, |
|
|
csArray< uint32_t > & |
mods |
|
) |
| |
Validates and sets the loot modifiers with the given ids.
- Parameters
-
item | The item instance being modified. |
mods | The ids of the item modifiers to set. |
- Returns
- A pointer to the modified item.
float LootRandomizer::adjective_max |
|
protected |
Keeps all the loot modifiers of type "adjective".
Definition at line 74 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.
A cached reference to the LootModifierCap math script.
Definition at line 167 of file lootrandomizer.h.
float LootRandomizer::prefix_max |
|
protected |
Keeps all the loot modifiers of type "prefix".
Definition at line 72 of file lootrandomizer.h.
float LootRandomizer::suffix_max |
|
protected |
Keeps all the loot modifiers of type "suffix".
Definition at line 73 of file lootrandomizer.h.
The documentation for this class was generated from the following file: