Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetLocationsForTrophies

From RoR Wiki

UI Lua API · Item functions
Version: WAR 1.4.8

Returns the points on the player's character where trophies can be attached.

attachPoints = GetLocationsForTrophies()

Arguments

None.

Returns

attachPoints
table – Array of attachment point tables, indexed from 1. May be empty.

Each attachment point table has these fields:

Key Type Meaning
trophyLocation number Location id of the point. Pass it to AttachTrophyToLocation or RequestEquipTrophy.
trophyLocIndex number Index of the point within its location, starting at 1.
inventorySlotNum number Equipment slot the point belongs to: 10 (GameData.EquipSlots.SHOULDERS) or 14 (GameData.EquipSlots.BELT), depending on the location.

Details

  • The list comes from the client's data for the player's character model, not from the equipped items.
  • If the client cannot find that data, or there is no player object, the function returns nothing. The stock UI works around this with CharacterWindow.RerequestTrophyLocData(), which calls the function again when the cached value is nil.
  • The stock UI compares inventorySlotNum with the slots array of a trophy's item data to decide whether the trophy may go there. It also adds its own inUse field to the tables; the client does not set it.

Errors

None.

Example

From default/ea_characterwindow/source/characterwindowtrophies.lua:

CharacterWindow.trophyLocData = GetLocationsForTrophies()   -- provides list of available attachment points
CharacterWindow.trophyData = DataUtils.GetTrophyData()      -- provides item info for all trophy slots (may be blank data)

Finding an attachment point, from the same file:

for apIndex, attachPoint in pairs( CharacterWindow.trophyLocData ) do
    if attachPoint.trophyLocation == location and attachPoint.trophyLocIndex == index then
        return apIndex, attachPoint
    end
end

See also