API:RequestSalvageItem
From RoR Wiki
UI Lua API · Crafting functions
Version: WAR 1.4.8
Asks the server to salvage an item from one of the player's backpacks.
sent = RequestSalvageItem(slot, backpackType, salvagingType, stat)
Arguments
- slot
number– Slot of the item inside the backpack, starting at 1.- backpackType
number– Which backpack the item is in, as anEA_Window_Backpack.TYPE_*value: 2 (TYPE_INVENTORY), 3 (TYPE_CURRENCY) or 4 (TYPE_CRAFTING).- salvagingType
number– AGameData.SalvagingTypesvalue (MAGICALorMUNDANEin the stock UI).- stat
number– Which stat to salvage. The stock UI passes the window id of the selected stat button, or 0.
Returns
- sent
number– 1 if the request was sent. Nothing is returned otherwise.
Details
- The request is only sent if the item in that slot has the
GameData.Item.EITEMFLAG_MAGICAL_SALVAGABLEorEITEMFLAG_MUNDANE_SALVAGABLEflag. Otherwise nothing is sent and nothing is returned, soif RequestSalvageItem(...) thenworks as a success test. - For
backpackType2, 3 and 4 the client convertsslotto an absolute inventory slot. For any other value,slotis used as it is. salvagingTypeandstatare sent as single bytes.- The client does not check the player's salvaging skill. The server decides whether the salvage succeeds.
- The function needs at least four arguments and only reads the last four.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
From default/ea_craftingwindow/source/salvagingwindow.lua:
-- Set the action bar text if the salvaing was sent
if( RequestSalvageItem( SalvagingWindow.selectedSlot, SalvagingWindow.selectedBackpack, SalvagingWindow.salvagingType, SalvagingWindow.selectedStat ) )
then
LayerTimerWindow.SetActionName( GetString( StringTables.Default.LABEL_SKILL_SALVAGING ), true )
end
