API:UpgradeEquipment
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Sends an equipment upgrade request for an item, optionally with a second item used for the upgrade.
UpgradeEquipment(isTest, mainBackpack, mainSlot, secondBackpack, secondSlot)
Arguments
- isTest
boolean– Sent with the request. The stock UI passes theisTestflag of its upgrade window.- mainBackpack
number– Backpack of the item to upgrade, as anEA_Window_Backpack.TYPE_*value: 2 (TYPE_INVENTORY), 3 (TYPE_CURRENCY) or 4 (TYPE_CRAFTING).- mainSlot
number– Slot of that item inside the backpack, starting at 1.- secondBackpack
number– Backpack of the second item, same values asmainBackpack, or 0 for no second item.- secondSlot
number– Slot of the second item, or 0.
Returns
Nothing.
Details
mainBackpackmust be 2, 3 or 4, or the error below is raised and nothing is sent.- If
secondBackpackis not 2, 3 or 4, the request is sent without a second item. - Both items are converted to absolute inventory slots before sending.
isTestmust be a real boolean. Passingnilor a number raises an Invalid Parameters error.- If there is no player object or the Lua state is not available, nothing happens.
- The function needs at least five arguments and only reads the last five.
Errors
Error in function call 'UpgradeEquipment': Invalid main item backpack.- The generic Invalid Parameters message when an argument has the wrong type.
Example
From default/ea_craftingwindow/source/equipmentupgradewindow.lua:
UpgradeEquipment( isTest, currentItems[SLOT_MAINITEM].sourceBackpack, currentItems[SLOT_MAINITEM].sourceSlot, currentItems[SLOT_REFINEMENT].sourceBackpack, currentItems[SLOT_REFINEMENT].sourceSlot )
Without a second item:
UpgradeEquipment( isTest, currentItems[SLOT_MAINITEM].sourceBackpack, currentItems[SLOT_MAINITEM].sourceSlot, 0, 0 )
