API:SelectItemRollChoice
From RoR Wiki
UI Lua API · Loot functions
Version: WAR 1.4.8
Sends the player's need/greed/pass choice for an item that is being rolled for.
SelectItemRollChoice(sourceId, lootSlot, rollChoice)
Arguments
- sourceId
number– Source ID of the roll, as given in the loot roll data (rollData.sourceIdin the stock UI).- lootSlot
number– Loot slot of the roll, as given in the loot roll data (rollData.lootSlot).- rollChoice
number–GameData.LootRoll.NEED,GameData.LootRoll.GREEDorGameData.LootRoll.PASS.
Returns
Nothing.
Details
rollChoicevalues of 3 or more are ignored and nothing happens.- The client looks up its pending roll with the same
sourceIdandlootSlot. If there is none, nothing happens. - The choice is stored in that roll entry and sent to the server.
- Nothing is sent if the connection is not ready, or if the entry's source ID is 0. The choice is still stored in those cases.
- The client does not check whether "need" is allowed for the item. The stock UI checks
rollData.allowNeeditself. - The function needs at least three arguments and only reads the last three.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
From default/ea_lootwindow/source/lootrollwindow.lua:
function EA_Window_LootRoll.SelectRollOption( lootIndex, rollChoice )
EA_Window_LootRoll.lootData[lootIndex].rollChoice = rollChoice
SelectItemRollChoice( EA_Window_LootRoll.lootData[lootIndex].sourceId, EA_Window_LootRoll.lootData[lootIndex].lootSlot, rollChoice )
EA_Window_LootRoll.UpdateLootRollData()
end
