This is a Lib for the Elder Scrolls Online "Guild Roster" list. There are numerous popular addons that inject custom columns into the Guild Roster, which causes a bit of chaos as they typically conflict with one another. LibGuildRoster hopes to act as a standardisation for addons to create these columns and to prevent UI failures. The traditional way to piece into the Roster is via hijacking the vanilla ZO process, if multiple addons are doing this at the same time, we have issues of layer placement, anchor recycling and in-general render tearing. All of the above degrades performance and obviously, the experience.
Addons running through one 'channel' will introduce a level of compatibility that benefits everyone. This also brings up a few additional benefits, such as fixing the background texture of the Roster window. The Lib calculates how the texture should render, based on the relative content available for the current guild in the Scene.
An extreme example 🤣 of ITTDB, ATT, MM3 and a dummy addon, side by side through the Lib.
✔️ Compatibility
✔️ Working window background
✔️ Option to hide columns per guild
LibGuildRoster:AddColumn({
key = 'MyAddon_CarrotCount',
width = 80,
header = {
title = 'Carrots'
},
row = {
align = TEXT_ALIGN_RIGHT,
data = function( guildId, data, index )
-- Return an unformated raw value
return MyAddon:GetCarrotCount( guildId, data.displayName )
end,
format = function( value )
return zo_strformat("<<1>>", ZO_LocalizeDecimalNumber(tonumber(value)))..' carrots'
end
}
})
Type: String
Example: 'MyAddon_CarrotCount'
Type: Number
Example: 80
Default: 110
🏳️ this is optional
Type: String
Example: Carrots
Type: GLOBAL
Requires: TEXT_ALIGN_LEFT
, TEXT_ALIGN_RIGHT
, TEXT_ALIGN_CENTER
Default: TEXT_ALIGN_LEFT
🏳️ this is optional
Type: STRING
Example: 'A total of each member\'s carrots'
🏳️ this is optional
❓ This is for the tooltip when hovering over a column header, a string value can be displayed
Type: GLOBAL
Requires: TEXT_ALIGN_LEFT
, TEXT_ALIGN_RIGHT
, TEXT_ALIGN_CENTER
Default: TEXT_ALIGN_LEFT
🏳️ this is optional
Type: FUNCTION
Args: guildId
Number, rowData
Object, rowIndex
Number
Example:
...
data = function( guildId, data, index )
-- Return an unformated raw value
return MyAddon:GetCarrotCount( guildId, data.displayName )
end,
...
row.format
below
🏳️ this is optional - See LibGuildRoster:SetBulkData()
for other approach
Type: FUNCTION
Args: rowCallValue
String
Example:
...
format = function( value )
return zo_strformat("<<1>>", ZO_LocalizeDecimalNumber(tonumber(value)))..' carrots'
end,
...
value
will always be passed in as a String
🏳️ this is optional
Type: FUNCTION
Args: guildId
Number, rowData
Object, rowCellValue
( Number, String )
Example:
...
mouseEnabled = function( guildId, data, value )
local condition = false
if value >= 1 then
condition = true
end
return condition
end,
...
🏳️ this is optional
Type: FUNCTION
Args: guildId
Number, rowData
Object, control
Object / GUI
Example:
...
OnMouseEnter = function( guildId, data, control )
InitializeTooltip(MyAddonTooltip)
MyAddonTooltip:SetDimensionConstraints(380,-1,440,-1)
MyAddonTooltip:ClearAnchors()
MyAddonTooltip:SetAnchor(BOTTOMRIGHT, control, TOPLEFT, 100, 0)
MyAddonTooltip_GetInfo(MyAddonTooltip, data.displayName)
end,
...
🏳️ this is optional
Type: FUNCTION
Args: guildId
Number, rowData
object, control
object/GUI
Example:
...
OnMouseExit = function( guildId, data, control )
ClearTooltip(MyAddonTooltip)
end,
...
🏳️ this is optional
Type: OBJECT
Requires: Object of guildId's
Example: { 10156, 117856, 39891 }
🏳️ this is optional
❓ This allows you to set what guilds your column will display in, this can be set further with Column:SetGuildFilter()
( as seen below )
Type: FUNCTION
Example:
...
beforeList = function()
-- Do something before the column renders
end,
...
🏳️ this is optional
❓ This function is fired before the column renders its data
Type: FUNCTION
Example:
...
afterList = function()
-- Do something after the column renders
end,
...
🏳️ this is optional
❓ This function is fired after the column renders its data
Args: settingsObject
Object
Example: See main Example up above
Returns: A Column
instance
❓ Alias for GUILD_ROSTER_MANAGER:RefreshData()
Args: callback
Function
Example:
LibGuildRoster:OnRosterReady(function()
-- Roster has finished rendering, do something
end
❓ Handy if you have additional UI and need to anchor it to your custom column
Args: columnList
Object, callback
Function ( SetRowData args )
Example:
local purchasesColumn = LibGuildRoster:AddColumn({
key = 'MyAddon_Purchases',
header = {
title = 'Purchases'
},
row = {
...
}
})
local salesColumn = LibGuildRoster:AddColumn({
key = 'MyAddon_Sales',
header = {
title = 'Sales'
},
row = {
...
}
})
LibGuildRoster:SetBulkData({ purchasesColumn, salesColumn }, function( guildId, data, index)
local purchases, sales = MyAddon.GetNumbers( guildId, data.displayName )
-- Add multiple values to the data object, use your defined column keys as the object key
data['MyAddon_Purchases'] = purchases
data['MyAddon_Sales'] = sales
-- Return the data object that was passed through
return data
end)
❓ This is a useful approach if you have multiple columns and your logic is repeative. Going through the bulk method, your logic only fires once, rather than per column.
Example:
local carrotColumn = LibGuildRoster:AddColumn({
key = 'MyAddon_Carrots',
header = {
title = 'Carrots'
},
row = {
...
}
})
-- Fire when the Roster has finished rendering
LibGuildRoster:OnRosterReady(function()
MyAddon_CarrotDropdown:SetAnchor(TOP, carrotColumn:GetHeader(), CENTER, 0, 582)
end)
Args: Object of guildId's
Example:
-- Inside callback of your Addons settings
carrotColumn:SetGuildFilter({ 10156, 117856, 39891 })
-- carrotColumn will not only display in the guilds with the ID of 10156, 117856, 39891
❓ This gives you some flexibility in making some nice filter settings on which guild should display which column(s)
Args: callback
Function
Example:
carrotColumn:UpdateRowData(function( guildId, data, index )
-- do stuff
end)
❓ This method allows you to update the function for getting the data of a rowCell