API:GetTrophyData
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Returns the items in the player's five trophy slots.
trophies = GetTrophyData()
Arguments
None.
Returns
- trophies
table– Array of 5 item data tables, indexed by trophy position from 1 to 5.
Details
- The table always has 5 entries. An empty trophy slot gets a blank item table (
id0, emptyname). trophyLocationandtrophyLocIndexin each table say where the trophy is attached. Compare them with the entries of GetLocationsForTrophies.- If there is no player object, or the Lua state is not available, the function returns nothing.
- A new table is built on every call. The stock UI caches it in
DataUtils.GetTrophyData()(easystem_utils/source/datautils.lua) and rebuilds it only whenGameData.Player.trophyItemsDirtyis set.
Errors
None.
Example
From default/easystem_utils/source/datautils.lua:
function DataUtils.GetTrophyData ()
if (GameData.Player.trophyItemsDirty)
then
GameData.Player.trophyItemsDirty = false
DataUtilsData.trophyItems = GetTrophyData()
end
return DataUtilsData.trophyItems
end
