-
-
Notifications
You must be signed in to change notification settings - Fork 77
Useful Variables
In GSE Variables are placeholders for dynamic information constructed using the WoW API (functions).
These functions are constructed of pure Lua. They are evaluated out of combat everytime you zone, change target, change talents etc. Each function must return a value and the resulting value is what is placed into the template. Below is the minimum of what is needed for a function variable.
function()
return something
end
Function variables use the WoW API for things like "am I of this race" or "in this covenant". As they are programming code, they can return any Lua datatype, but the most common use is to return a string. The exception to this is Binary functions. To use an IF block, a function variable has to be present, returning a binary true or false value.
function()
if UnitRace("player") == "Orc" then
return true
else
return false
end
end
A Binary Function will only return true or false
A list of functions for the WoW API can be found at https://warcraft.wiki.gg/wiki/World_of_Warcraft_API
To obtain from Details the Highest DPS from the last fight:
function(slot)
if GSE.isEmpty(slot) then
slot = 1
end
local function GetDetailsDamage()
local combat = Details:GetCurrentCombat()
local damageContainer = combat:GetContainer (DETAILS_ATTRIBUTE_DAMAGE)
local actorsAmount = GSE.NewTable()
for i, actor in damageContainer:ListActors() do
local amount = actor.total
if (amount and amount >= 1) then
local tempTable = GSE.NewTable()
tempTable["name"] = actor:name()
tempTable["total"] = amount
tinsert(actorsAmount, tempTable)
end
end
table.sort (actorsAmount, function(a,b) return a.total > b.total end)
return actorsAmount
end
if GetNumGroupMembers() < 1 then
return "player"
end
local detailsUnitName = GetDetailsDamage()[slot].name
local unitName = detailsUnitName
local prefix = IsInRaid() and "raid" or "party"
for k=1, GetNumGroupMembers() do
local unit = prefix..tostring(k)
local unitFullName = UnitName(unit)
if not GSE.isEmpty(unitFullName) then
if string.sub(unitName, 1, string.len(unitFullName)) == unitFullName then
return unit
end
end
end
return "player"
end
Find first Tank in group/raid
function()
if GetNumGroupMembers() < 1 then
return "player"
end
local prefix = IsInRaid() and "raid" or "party"
for k=1, GetNumGroupMembers() do
local unit = prefix..tostring(k)
if UnitGroupRolesAssigned(unit) == "TANK" then
return unit
end
end
end
Add a dispell as a mouseover when doing keys with the Afflicted affix.
function()
If not GSE.isEmpty(GSE.inMythicPlus) then
local affixlist = C_MythicPlus.GetCurrentAffixes()
for _,j in ipairs(affixlist) do
-- The 135 here is the AffixID for Afflicted. From C_MythicPlus.GetCurrentAffixes()
if j.id == 135 then
-- Change the Cleanse Toxins here to your classes Dispel/Decurse/etc
return "/cast [@mouseover,help,exists] Cleanse Toxins"
end
end
end
return " "
end
Note: this last variable works for Dragonflight. Check back later for a TWW version