API:AddItemEnhancement
From RoR Wiki
UI Lua API · ItemEnhancement functions
Version: WAR 1.4.8
Asks the server to put an enhancement item from the backpack into a slot of the item being enhanced.
AddItemEnhancement(enhancementSlot, inventorySlot)
Arguments
- enhancementSlot
number– Enhancement slot on the item,1to3.- inventorySlot
number– Slot of the enhancement item in the main inventory backpack, starting at 1.
Returns
Nothing.
Details
- Nothing is sent if
enhancementSlotis not 1, 2 or 3, or ifinventorySlotis less than 1 or above the inventory slot limit the client stores for the player. - Otherwise an "add enhancement" request is sent to the server. The client does not check that a session is open or that the item fits the slot; the stock UI checks the slot type itself before calling.
- If one of the player's state flags blocks item enhancement, no request is sent and a built-in error message is printed to the Chat log instead.
- The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
Dropping an enhancement from the cursor onto a slot, from default/ea_itemenhancementwindow/source/itemenhancementwindow.lua:
if DataUtils.SlotIsAllowedForItem(itemEquipSlot, enhancementData) then
-- Request that the server slot this enhancement here (and calculate bonus, etc...)
AddItemEnhancement (g_clickedEnhSlotId, Cursor.Data.SourceSlot)
else
EnhancementPlacementError (StringTables.Default.INVALID_LOCATION)
end
