API:RequestEquipTrophy
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Asks the server to move a trophy into one of the player's trophy slots and, optionally, to attach it to a point on the character.
RequestEquipTrophy(sourceLocation, sourceSlot, trophySlot, trophyLocation, trophyLocIndex)
Arguments
- sourceLocation
number– Where the trophy is now, as aGameData.ItemLocsvalue.- sourceSlot
number– Slot of the trophy insourceLocation, starting at 1.- trophySlot
number– The equipment slot to put it in. Must be one of the five trophy slots; the stock UI computes it asposition + GameData.Player.c_TROPHY_START_INDEX - 1.- trophyLocation
number– Attachment point location, as returned introphyLocationby GetLocationsForTrophies.- trophyLocIndex
number– Attachment point index (trophyLocIndexfrom the same table), starting at 1. 0 means "do not attach".
Returns
Nothing.
Details
- If
trophySlotis not one of the trophy slots, nothing is sent. - Otherwise the client first sends a move request from the source slot to the trophy slot.
- Then, if
trophyLocIndexis not 0, it looks at the item currently in the source slot. A second request, to set the attachment point of the trophy slot, is sent only when:- the item is a trophy (
GameData.ItemTypes.TROPHY); - its current
trophyLocation/trophyLocIndexdiffer from the requested ones; - the requested location passes the client's check against the trophy's allowed locations.
- the item is a trophy (
GameData.ItemLocs.BANKis not supported as a source location by the slot conversion this function uses.- 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
From default/ea_characterwindow/source/characterwindowtrophies.lua (CharacterWindow.AutoAttachTrophy):
local trophyLocation = GameData.Player.c_INVALID_TROPHY_LOCATION
local trophyLocIndex = 0
...
local index, attachPointData = CharacterWindow.GetNextAvailableAttachmentPoint( itemData )
if index ~= 0 then
trophyLocation = attachPointData.trophyLocation
trophyLocIndex = attachPointData.trophyLocIndex
end
...
RequestEquipTrophy( sourceLocation, sourceSlot, trophySlot, trophyLocation, trophyLocIndex )
