API:GetLootRollData
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the items currently up for a group loot roll (Need / Greed / Pass).
rolls = GetLootRollData()
Arguments
None.
Returns
- rolls
table– Array of 10 roll tables, indexed from 1 to 10.
Each roll table has these fields:
| Key | Type | Meaning |
|---|---|---|
itemData |
table |
The item, as an item data table. |
timer |
number |
Time left to roll. |
lootSlot |
number |
Slot of the item in its loot source. Passed to SelectItemRollChoice. |
rollChoice |
number |
The player's choice so far. -1 if no choice has been made.
|
sourceId |
number |
Id of the loot source. Passed to SelectItemRollChoice. |
allowNeed |
boolean |
true if the player may roll Need.
|
Details
- The pending rolls come first. The rest of the 10 entries are blank: an empty item (
itemData.id0),timer0,lootSlot0,rollChoice-1,sourceId0 andallowNeedtrue. - If the Lua state is not available, the function returns nothing.
Errors
None.
Example
From ea_lootwindow/source/lootrollwindow.lua:
EA_Window_LootRoll.lootData = GetLootRollData()
...
for lootIndex, rollData in ipairs( EA_Window_LootRoll.lootData )
do
if( rollData.itemData.id ~= 0 and rollData.rollChoice == EA_Window_LootRoll.ROLL_CHOICE_INAVLID)
Passing automatically when the timer runs out, from the same file:
SelectItemRollChoice( rollData.sourceId, rollData.lootSlot, EA_Window_LootRoll.ROLL_CHOICE_PASS )
