API:RequestMoveItem
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Asks the server to move an item (or part of a stack) from one item location to another.
RequestMoveItem(sourceLocation, sourceSlot, destinationLocation, destinationSlot, count)
Arguments
- sourceLocation
number– Where the item is now. AGameData.ItemLocsvalue (the stock UI uses the matchingCursor.SOURCE_*constants).- sourceSlot
number– Slot of the item insourceLocation, starting at 1.- destinationLocation
number– Where the item should go. AGameData.ItemLocsvalue.- destinationSlot
number– Slot indestinationLocation. The stock UI passesGameData.Inventory.FIRST_AVAILABLE_INVENTORY_SLOTorGameData.Inventory.FIRST_AVAILABLE_BANK_SLOTto let the item go to the first free slot.- count
number– Number of items to move from the stack.
Returns
Nothing.
Details
- Accepted locations:
| Location | As source | As destination |
|---|---|---|
GameData.ItemLocs.EQUIPPED |
yes | yes |
GameData.ItemLocs.INVENTORY |
yes | yes |
GameData.ItemLocs.BANK |
yes | yes |
GameData.ItemLocs.QUEST_ITEM |
yes | yes |
GameData.ItemLocs.CRAFTING_ITEM |
yes | yes |
GameData.ItemLocs.CURRENCY_ITEM |
yes | yes |
GameData.ItemLocs.INVENTORY_OVERFLOW |
yes | no |
- Any other location (for example a guild vault) makes the call do nothing.
- With
INVENTORY_OVERFLOWas the source, nothing is sent if the overflow holds no item. - While the client's inventory lock flag is set, moves from or to
EQUIPPEDare not sent. The same flag blocks AutoEquipItem. - The client does not check that the source slot holds an item, that the destination is free, or that the item fits there. The server decides.
- The function needs at least five arguments and only reads the last five.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
Moving an item from the cursor into the bank, from default/ea_bankwindow/source/bankwindow.lua:
RequestMoveItem( Cursor.Data.Source, Cursor.Data.SourceSlot, Cursor.SOURCE_BANK, slot, Cursor.Data.StackAmount )
Unequipping an item into the first free backpack slot, from default/ea_characterwindow/source/characterwindow.lua:
RequestMoveItem( Cursor.SOURCE_EQUIPMENT, slot, Cursor.SOURCE_INVENTORY, CharacterWindow.FIRST_AVAILABLE_INVENTORY_SLOT, CharacterWindow.equipmentData[slot].stackCount)
