Rework LibGroupTalents now also returns function returns additionally, add Spec Role triggers to load/generic/bt2, fix WeakAuras.GetRegion
- **WeakAuras.SpecForUnit(unit)** = Returns: `classFileName..spec`, `Dominant Tree`, `spent1`, `spent2`, `spent3` - **WeakAuras.GetUnitRole(unit)** = Returns one of: `"melee"`, `"caster"`, `"healer"`, `"tank"` - **WeakAuras.SpecRolePositionForUnit(unit)** = Returns: `Dominant Tree`, `spent1`, `spent2`, `spent3` - **WeakAuras.CheckTalentForUnit(unit, talentId)** = Returns: `"Points spent"` in talent or `nil` - **WeakAuras.CheckGlyphForUnit(unit, glyphId)** = Returns: `true` if the player has the glyph associated with `spellID` or `spellName`, we can only see the glyphs of players running `LibGroupTalents-1.0`
This commit is contained in:
+93
-10
@@ -76,6 +76,9 @@ local unitExistScanFunc = {}
|
||||
-- Which units exist
|
||||
local existingUnits = {}
|
||||
|
||||
-- Contains all scanFuncs that fetch the role + roleIcon
|
||||
local groupRoleScanFunc = {}
|
||||
|
||||
-- Loaded ScanFuncs per unit type
|
||||
local groupScanFuncs = {}
|
||||
--Active ScanFuncs per actual unit id
|
||||
@@ -468,7 +471,29 @@ local function FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit)
|
||||
return bestMatch, matchCount, stackCount, nextCheck
|
||||
end
|
||||
|
||||
local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, raidMark)
|
||||
local GetTexCoordsForRole = function(role)
|
||||
local textureHeight, textureWidth = 256, 256;
|
||||
local roleHeight, roleWidth = 67, 67;
|
||||
|
||||
if ( role == "GUIDE" ) then
|
||||
return GetTexCoordsByGrid(1, 1, textureWidth, textureHeight, roleWidth, roleHeight);
|
||||
elseif ( role == "TANK" ) then
|
||||
return GetTexCoordsByGrid(1, 2, textureWidth, textureHeight, roleWidth, roleHeight);
|
||||
elseif ( role == "HEALER" ) then
|
||||
return GetTexCoordsByGrid(2, 1, textureWidth, textureHeight, roleWidth, roleHeight);
|
||||
elseif ( role == "DAMAGER" ) then
|
||||
return GetTexCoordsByGrid(2, 2, textureWidth, textureHeight, roleWidth, roleHeight);
|
||||
end
|
||||
end
|
||||
|
||||
local roleIcons = {
|
||||
melee = CreateTextureMarkup([=[Interface\LFGFrame\UI-LFG-ICON-ROLES]=], 256, 256, 0, 0, GetTexCoordsForRole("DAMAGER")),
|
||||
caster = CreateTextureMarkup([=[Interface\LFGFrame\UI-LFG-ICON-ROLES]=], 256, 256, 0, 0, GetTexCoordsForRole("DAMAGER")),
|
||||
healer = CreateTextureMarkup([=[Interface\LFGFrame\UI-LFG-ICON-ROLES]=], 256, 256, 0, 0, GetTexCoordsForRole("HEALER")),
|
||||
tank = CreateTextureMarkup([=[Interface\LFGFrame\UI-LFG-ICON-ROLES]=], 256, 256, 0, 0, GetTexCoordsForRole("TANK"))
|
||||
}
|
||||
|
||||
local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, role, raidMark)
|
||||
if not triggerStates[cloneId] then
|
||||
triggerStates[cloneId] = {
|
||||
show = true,
|
||||
@@ -488,6 +513,8 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat
|
||||
unit = bestMatch.unit,
|
||||
unitName = bestMatch.unitName,
|
||||
GUID = bestMatch.unit and UnitGUID(bestMatch.unit) or bestMatch.GUID,
|
||||
role = role,
|
||||
roleIcon = role and roleIcons[role],
|
||||
raidMark = raidMark,
|
||||
matchCount = matchCount,
|
||||
unitCount = unitCount,
|
||||
@@ -525,6 +552,12 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat
|
||||
changed = true
|
||||
end
|
||||
|
||||
if state.role ~= role then
|
||||
state.role = role
|
||||
state.roleIcon = roleIcons[role]
|
||||
changed = true
|
||||
end
|
||||
|
||||
if state.raidMark ~= raidMark then
|
||||
state.raidMark = raidMark
|
||||
changed = true
|
||||
@@ -689,7 +722,7 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, raidMark)
|
||||
local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, role, raidMark)
|
||||
local fallbackName, fallbackIcon = BuffTrigger.GetNameAndIconSimple(WeakAuras.GetData(triggerInfo.id), triggerInfo.triggernum)
|
||||
if not triggerStates[cloneId] then
|
||||
triggerStates[cloneId] = {
|
||||
@@ -709,7 +742,9 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
|
||||
unaffected = unaffected,
|
||||
unaffectedUnits = unaffectedUnits,
|
||||
unit = unit,
|
||||
role = role,
|
||||
raidMark = raidMark,
|
||||
roleIcon = role and roleIcons[role],
|
||||
unitName = unit and GetUnitName(unit, false) or "",
|
||||
destName = "",
|
||||
name = fallbackName,
|
||||
@@ -777,6 +812,12 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
|
||||
changed = true
|
||||
end
|
||||
|
||||
if state.role ~= role then
|
||||
state.role = role
|
||||
state.roleIcon = roleIcons[role]
|
||||
changed = true
|
||||
end
|
||||
|
||||
if state.raidMark ~= raidMark then
|
||||
state.raidMark = raidMark
|
||||
changed = true
|
||||
@@ -1068,7 +1109,12 @@ local function TriggerInfoApplies(triggerInfo, unit)
|
||||
return false
|
||||
end
|
||||
|
||||
if triggerInfo.raidRole and not triggerInfo.raidRole[WeakAuras.UnitRaidRole(unit) or ""] then
|
||||
local unitRole = WeakAuras.GetUnitRole(controllingUnit)
|
||||
if triggerInfo.groupRole and unitRole and not triggerInfo.groupRole[unitRole or ""] then
|
||||
return false
|
||||
end
|
||||
|
||||
if triggerInfo.raidRole and not triggerInfo.raidRole[WeakAuras.UnitRaidRole(controllingUnit) or ""] then
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -1175,6 +1221,12 @@ local function bestUnit(triggerInfo, bestMatch)
|
||||
end
|
||||
end
|
||||
|
||||
local function roleForTriggerInfo(triggerInfo, unit)
|
||||
if triggerInfo.fetchRole then
|
||||
return WeakAuras.GetUnitRole(unit)
|
||||
end
|
||||
end
|
||||
|
||||
local function markForTriggerInfo(triggerInfo, unit)
|
||||
if triggerInfo.fetchRaidMark then
|
||||
local rt = unit and GetRaidTargetIndex(unit)
|
||||
@@ -1226,12 +1278,13 @@ local function UpdateTriggerState(time, id, triggernum)
|
||||
end
|
||||
|
||||
local unit = bestUnit(triggerInfo, bestMatch)
|
||||
local role = roleForTriggerInfo(triggerInfo, unit)
|
||||
local mark = markForTriggerInfo(triggerInfo, unit)
|
||||
|
||||
if bestMatch then
|
||||
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCount, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark)
|
||||
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCount, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, role, mark)
|
||||
else
|
||||
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, 0, 0, maxUnitCount, 0, 0, affected, affectedUnits, unaffected, unaffectedUnits, mark)
|
||||
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, 0, 0, maxUnitCount, 0, 0, affected, affectedUnits, unaffected, unaffectedUnits, role, mark)
|
||||
end
|
||||
else
|
||||
updated = RemoveState(triggerStates, cloneId)
|
||||
@@ -1293,17 +1346,19 @@ local function UpdateTriggerState(time, id, triggernum)
|
||||
usedCloneIds[cloneId] = 1
|
||||
end
|
||||
|
||||
local role = roleForTriggerInfo(triggerInfo, auraData.unit)
|
||||
local mark = markForTriggerInfo(triggerInfo, auraData.unit)
|
||||
updated = UpdateStateWithMatch(time, auraData, triggerStates, cloneId, matchCount, unitCount, maxUnitCount,
|
||||
matchCountPerUnit[auraData.unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark) or updated
|
||||
matchCountPerUnit[auraData.unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, role, mark) or updated
|
||||
cloneIds[cloneId] = true
|
||||
end
|
||||
|
||||
if matchCount == 0 then
|
||||
local unit = bestUnit(triggerInfo, nil)
|
||||
local role = roleForTriggerInfo(triggerInfo, unit)
|
||||
local mark = markForTriggerInfo(triggerInfo, unit)
|
||||
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, "", nil, 0, 0, maxUnitCount, 0, totalStacks,
|
||||
affected, affectedUnits, unaffected, unaffectedUnits, mark) or updated
|
||||
affected, affectedUnits, unaffected, unaffectedUnits, role, mark) or updated
|
||||
cloneIds[""] = true
|
||||
end
|
||||
end
|
||||
@@ -1350,9 +1405,10 @@ local function UpdateTriggerState(time, id, triggernum)
|
||||
if triggerInfo.perUnitMode == "affected" then
|
||||
for unit, bestMatch in pairs(matches) do
|
||||
if bestMatch then
|
||||
local role = roleForTriggerInfo(triggerInfo, unit)
|
||||
local mark = markForTriggerInfo(triggerInfo, unit)
|
||||
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount,
|
||||
matchCountPerUnit[unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark)
|
||||
matchCountPerUnit[unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, role, mark)
|
||||
or updated
|
||||
cloneIds[unit] = true
|
||||
end
|
||||
@@ -1362,18 +1418,19 @@ local function UpdateTriggerState(time, id, triggernum)
|
||||
for unit in GetAllUnits(triggerInfo.unit, nil, triggerInfo.includePets) do
|
||||
if activeGroupScanFuncs[unit] and activeGroupScanFuncs[unit][triggerInfo] then
|
||||
local bestMatch = matches[unit]
|
||||
local role = roleForTriggerInfo(triggerInfo, unit)
|
||||
local mark = markForTriggerInfo(triggerInfo, unit)
|
||||
if bestMatch then
|
||||
if triggerInfo.perUnitMode == "all" then
|
||||
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount,
|
||||
matchCountPerUnit[unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark)
|
||||
matchCountPerUnit[unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, role, mark)
|
||||
or updated
|
||||
cloneIds[unit] = true
|
||||
end
|
||||
else
|
||||
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, unit, unit, matchCount,
|
||||
unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks,
|
||||
affected, affectedUnits, unaffected, unaffectedUnits)
|
||||
affected, affectedUnits, unaffected, unaffectedUnits, role)
|
||||
or updated
|
||||
cloneIds[unit] = true
|
||||
end
|
||||
@@ -1584,6 +1641,15 @@ local function UpdateStates(matchDataChanged, time)
|
||||
end
|
||||
end
|
||||
|
||||
local function ScanGroupRoleScanFunc(matchDataChanged)
|
||||
for id, idData in pairs(groupRoleScanFunc) do
|
||||
matchDataChanged[id] = matchDataChanged[id] or {}
|
||||
for _, triggerInfo in ipairs(idData) do
|
||||
matchDataChanged[id][triggerInfo.triggernum] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ScanRaidMarkScanFunc(matchDataChanged)
|
||||
for id, idData in pairs(raidMarkScanFuncs) do
|
||||
matchDataChanged[id] = matchDataChanged[id] or {}
|
||||
@@ -1830,6 +1896,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
|
||||
ScanGroupUnit(time, matchDataChanged, "group", unit)
|
||||
end
|
||||
end
|
||||
ScanGroupRoleScanFunc(matchDataChanged)
|
||||
elseif event == "UNIT_FLAGS" or event == "UNIT_NAME_UPDATE" or event == "PLAYER_FLAGS_CHANGED" then
|
||||
if Private.multiUnitUnits.group[arg1] then
|
||||
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
|
||||
@@ -1994,6 +2061,7 @@ function BuffTrigger.UnloadAll()
|
||||
wipe(scanFuncNameMulti)
|
||||
wipe(scanFuncSpellIdMulti)
|
||||
wipe(unitExistScanFunc)
|
||||
wipe(groupRoleScanFunc)
|
||||
wipe(groupScanFuncs)
|
||||
wipe(raidMarkScanFuncs)
|
||||
wipe(matchDataByTrigger)
|
||||
@@ -2043,6 +2111,11 @@ local function LoadAura(id, triggernum, triggerInfo)
|
||||
end
|
||||
end
|
||||
|
||||
if triggerInfo.fetchRole then
|
||||
groupRoleScanFunc[id] = groupRoleScanFunc[id] or {}
|
||||
tinsert(groupRoleScanFunc[id], triggerInfo)
|
||||
end
|
||||
|
||||
if triggerInfo.fetchRaidMark then
|
||||
raidMarkScanFuncs[id] = raidMarkScanFuncs[id] or {}
|
||||
tinsert(raidMarkScanFuncs[id], triggerInfo)
|
||||
@@ -2086,6 +2159,7 @@ function BuffTrigger.UnloadDisplays(toUnload)
|
||||
unitData[id] = nil
|
||||
end
|
||||
|
||||
groupRoleScanFunc[id] = nil
|
||||
raidMarkScanFuncs[id] = nil
|
||||
|
||||
for unit, unitData in pairs(matchData) do
|
||||
@@ -2165,6 +2239,8 @@ function BuffTrigger.Rename(oldid, newid)
|
||||
unitData[newid] = unitData[oldid]
|
||||
unitData[oldid] = nil
|
||||
end
|
||||
groupRoleScanFunc[newid] = groupRoleScanFunc[oldid]
|
||||
groupRoleScanFunc[oldid] = nil
|
||||
raidMarkScanFuncs[newid] = raidMarkScanFuncs[oldid]
|
||||
raidMarkScanFuncs[oldid] = nil
|
||||
matchDataChanged[newid] = matchDataChanged[oldid]
|
||||
@@ -2486,6 +2562,7 @@ function BuffTrigger.Add(data)
|
||||
|
||||
local groupTrigger = trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
|
||||
local effectiveIgnoreSelf = (groupTrigger or trigger.unit == "nameplate") and trigger.ignoreSelf
|
||||
local effectiveGroupRole = groupTrigger and trigger.useGroupRole and trigger.group_role or nil
|
||||
local effectiveRaidRole = groupTrigger and trigger.useRaidRole and trigger.raid_role or nil
|
||||
local effectiveClass = groupTrigger and trigger.useClass and trigger.class
|
||||
local effectiveSpecId = groupTrigger and trigger.useActualSpec and trigger.actualSpec or nil
|
||||
@@ -2549,6 +2626,7 @@ function BuffTrigger.Add(data)
|
||||
ignoreDead = effectiveIgnoreDead,
|
||||
ignoreDisconnected = effectiveIgnoreDisconnected,
|
||||
ignoreInvisible = effectiveIgnoreInvisible,
|
||||
groupRole = effectiveGroupRole,
|
||||
raidRole = effectiveRaidRole,
|
||||
specId = effectiveSpecId,
|
||||
groupSubType = groupSubType,
|
||||
@@ -2707,6 +2785,11 @@ function BuffTrigger.GetAdditionalProperties(data, triggernum)
|
||||
props["refreshTime"] = L["Since Apply/Refresh"]
|
||||
end
|
||||
|
||||
if trigger.unit ~= "multi" and trigger.fetchRole then
|
||||
props["role"] = L["Assigned Role"]
|
||||
props["roleIcon"] = L["Assigned Role Icon"]
|
||||
end
|
||||
|
||||
if trigger.unit ~= "multi" and trigger.fetchRaidMark then
|
||||
props["raidMark"] = L["Raid Mark"]
|
||||
end
|
||||
|
||||
@@ -115,6 +115,22 @@ RAID_CLASS_COLORS.SHAMAN.colorStr = "ff0070de"
|
||||
RAID_CLASS_COLORS.WARRIOR.colorStr = "ffc79c6e"
|
||||
RAID_CLASS_COLORS.DEATHKNIGHT.colorStr = "ffc41f3b"
|
||||
|
||||
function CreateTextureMarkup(file, fileWidth, fileHeight, width, height, left, right, top, bottom, xOffset, yOffset)
|
||||
return ("|T%s:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d|t"):format(
|
||||
file
|
||||
, height
|
||||
, width
|
||||
, xOffset or 0
|
||||
, yOffset or 0
|
||||
, fileWidth
|
||||
, fileHeight
|
||||
, left * fileWidth
|
||||
, right * fileWidth
|
||||
, top * fileHeight
|
||||
, bottom * fileHeight
|
||||
);
|
||||
end
|
||||
|
||||
function Clamp(value, min, max)
|
||||
if value > max then
|
||||
return max;
|
||||
|
||||
@@ -3025,6 +3025,12 @@ function WeakAuras.WatchUnitChange(unit)
|
||||
eventsToSend["UNIT_ROLE_CHANGED_" .. unit] = unit
|
||||
watchUnitChange.unitRaidRole[unit] = newRaidRole
|
||||
end
|
||||
local oldRole = watchUnitChange.unitRoles[unit]
|
||||
local newRole = WeakAuras.GetUnitRole(unit)
|
||||
if oldRole ~= newRole then
|
||||
eventsToSend["UNIT_ROLE_CHANGED_" .. unit] = unit
|
||||
watchUnitChange.unitRoles[unit] = newRole
|
||||
end
|
||||
end
|
||||
|
||||
local function handleUnit(unit, eventsToSend, ...)
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ WeakAuras.doubleWidth = WeakAuras.normalWidth * 2
|
||||
local versionStringFromToc = GetAddOnMetadata("WeakAuras", "Version")
|
||||
local versionString = "5.19.0 Beta"
|
||||
local buildTime = "20250127040000"
|
||||
local isAwesomeEnabled = C_NamePlate and C_NamePlate.GetNamePlateForUnit or false
|
||||
local isAwesomeEnabled = C_NamePlate and C_NamePlate.GetNamePlateForUnit and true or false
|
||||
|
||||
WeakAuras.versionString = versionString
|
||||
WeakAuras.buildTime = buildTime
|
||||
@@ -18,7 +18,7 @@ WeakAuras.newFeatureString = "|TInterface\\OptionsFrame\\UI-OptionsFrame-NewFeat
|
||||
WeakAuras.BuildInfo = select(4, GetBuildInfo())
|
||||
|
||||
function WeakAuras.isAwesomeEnabled()
|
||||
return isAwesomeEnabled
|
||||
return isAwesomeEnabled or false
|
||||
end
|
||||
|
||||
function WeakAuras.IsCorrectVersion()
|
||||
|
||||
@@ -8,8 +8,11 @@ local unpack = unpack
|
||||
-- WoW APIs
|
||||
local UnitName, UnitIsUnit, UnitClass, GetNumGroupMembers = UnitName, UnitIsUnit, UnitClass, GetNumGroupMembers
|
||||
|
||||
local LibGroupTalents = LibStub("LibGroupTalents-1.0")
|
||||
|
||||
local nameToGlyphs = {}
|
||||
local nameToSpecMap = {}
|
||||
local nameToUnitRole = {}
|
||||
local nameToUnitMap = {
|
||||
[UnitName("player")] = "player"
|
||||
}
|
||||
@@ -17,14 +20,14 @@ local nameToUnitMap = {
|
||||
local subscribers = {}
|
||||
|
||||
Private.LibGroupTalentsWrapper = {
|
||||
Register = function(callback) end,
|
||||
Register = function(f) end,
|
||||
SpecForUnit = function(unit) end,
|
||||
GetUnitRole = function(unit) end,
|
||||
SpecRolePositionForUnit = function(unit) end,
|
||||
CheckTalentForUnit = function(unit, talentId) end,
|
||||
CheckGlyphForUnit = function(unit, glyphId) end,
|
||||
CheckTalentForUnit = function(unit) end,
|
||||
CheckGlyphForUnit = function(unit) end,
|
||||
}
|
||||
|
||||
local LibGroupTalents = LibStub("LibGroupTalents-1.0")
|
||||
if LibGroupTalents then
|
||||
--- LibGroupTalents callback for talents and glyphs
|
||||
function Private.LibGroupTalentsWrapper:LibGroupTalentsCallback(_, _, unit)
|
||||
@@ -58,14 +61,21 @@ if LibGroupTalents then
|
||||
if not nameToUnitMap[storedName] then
|
||||
nameToSpecMap[storedName] = nil
|
||||
nameToGlyphs[storedName] = nil
|
||||
nameToUnitRole[storedName] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local specInfo = { LibGroupTalents:GetUnitTalentSpec(unit) }
|
||||
if specInfo and #specInfo > 0 then
|
||||
local class = select(2, UnitClass(unit))
|
||||
if specInfo and #specInfo > 0 and class then
|
||||
nameToSpecMap[unitName] = class .. specInfo[1]
|
||||
nameToSpecMap[unitName] = {
|
||||
class .. specInfo[1], unpack(specInfo)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
nameToUnitRole[unitName] = LibGroupTalents:GetUnitRole(unit)
|
||||
|
||||
local glyphs = { LibGroupTalents:GetUnitGlyphs(unit) }
|
||||
if glyphs and #glyphs > 0 then
|
||||
@@ -83,6 +93,8 @@ if LibGroupTalents then
|
||||
end
|
||||
|
||||
LibGroupTalents.RegisterCallback(Private.LibGroupTalentsWrapper, "LibGroupTalents_Update", "LibGroupTalentsCallback")
|
||||
LibGroupTalents.RegisterCallback(Private.LibGroupTalentsWrapper, "LibGroupTalents_RoleChange", "LibGroupTalentsCallback")
|
||||
LibGroupTalents.RegisterCallback(Private.LibGroupTalentsWrapper, "LibGroupTalents_GlyphUpdate", "LibGroupTalentsCallback")
|
||||
|
||||
function Private.LibGroupTalentsWrapper.Register(f)
|
||||
table.insert(subscribers, f)
|
||||
@@ -97,17 +109,30 @@ if LibGroupTalents then
|
||||
end
|
||||
|
||||
if UnitIsUnit(unit, "player") and class then
|
||||
local specInfo = LibGroupTalents:GetUnitTalentSpec(unit)
|
||||
local specInfo = { LibGroupTalents:GetUnitTalentSpec(unit) }
|
||||
if specInfo and #specInfo > 0 then
|
||||
return class .. specInfo[1]
|
||||
return class .. specInfo[1], unpack(specInfo)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Private.LibGroupTalentsWrapper.GetUnitRole(unit)
|
||||
local unitName = UnitName(unit)
|
||||
|
||||
if nameToUnitRole[unitName] then
|
||||
return nameToUnitRole[unitName]
|
||||
end
|
||||
|
||||
if UnitIsUnit(unit, "player") then
|
||||
local unitRole = LibGroupTalents:GetUnitRole(unit)
|
||||
return unitRole
|
||||
end
|
||||
end
|
||||
|
||||
function Private.LibGroupTalentsWrapper.SpecRolePositionForUnit(unit)
|
||||
local data = nameToSpecMap[UnitName(unit)]
|
||||
if data then
|
||||
return unpack(data)
|
||||
return unpack(data, 2)
|
||||
end
|
||||
|
||||
if UnitIsUnit(unit, "player") then
|
||||
@@ -116,7 +141,7 @@ if LibGroupTalents then
|
||||
end
|
||||
|
||||
function Private.LibGroupTalentsWrapper.CheckTalentForUnit(unit, talentId)
|
||||
return UnitIsUnit(unit, "player") and LibGroupTalents:UnitHasTalent(unit, talentId) and true or false
|
||||
return UnitIsUnit(unit, "player") and LibGroupTalents:UnitHasTalent(unit, talentId) and true or nil
|
||||
end
|
||||
|
||||
function Private.LibGroupTalentsWrapper.CheckGlyphForUnit(unit, glyphId)
|
||||
@@ -127,6 +152,7 @@ if LibGroupTalents then
|
||||
|
||||
if UnitIsUnit(unit, "player") then
|
||||
local glyphs = { LibGroupTalents:GetUnitGlyphs(unit) }
|
||||
if glyphs then
|
||||
for _, id in ipairs(glyphs) do
|
||||
if id == glyphId then
|
||||
return true
|
||||
@@ -134,16 +160,12 @@ if LibGroupTalents then
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
function Private.LibGroupTalentsWrapper.Register(f) end
|
||||
function Private.LibGroupTalentsWrapper.SpecForUnit(unit) return nil end
|
||||
function Private.LibGroupTalentsWrapper.SpecRolePositionForUnit(unit) return nil end
|
||||
function Private.LibGroupTalentsWrapper.CheckTalentForUnit(unit) return nil end
|
||||
function Private.LibGroupTalentsWrapper.CheckGlyphForUnit(unit) return nil end
|
||||
end
|
||||
end
|
||||
|
||||
-- Export for GenericTrigger
|
||||
-- Export for GenericTrigger/Custom Code
|
||||
WeakAuras.SpecForUnit = Private.LibGroupTalentsWrapper.SpecForUnit
|
||||
WeakAuras.GetUnitRole = Private.LibGroupTalentsWrapper.GetUnitRole
|
||||
WeakAuras.SpecRolePositionForUnit = Private.LibGroupTalentsWrapper.SpecRolePositionForUnit
|
||||
WeakAuras.CheckTalentForUnit = Private.LibGroupTalentsWrapper.CheckTalentForUnit
|
||||
WeakAuras.CheckGlyphForUnit = Private.LibGroupTalentsWrapper.CheckGlyphForUnit
|
||||
|
||||
@@ -1094,6 +1094,14 @@ Private.load_prototype = {
|
||||
limit = 2
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "role",
|
||||
display = L["Spec Role"],
|
||||
type = "multiselect",
|
||||
values = "role_types",
|
||||
init = "arg",
|
||||
events = {"PLAYER_TALENT_UPDATE", "PLAYER_ROLES_ASSIGNED", "SPELL_UPDATE_USABLE", "WA_DELAYED_PLAYER_ENTERING_WORLD"}
|
||||
},
|
||||
{
|
||||
name = "raid_role",
|
||||
display = L["Raid Role"],
|
||||
@@ -1474,9 +1482,8 @@ Private.event_prototypes = {
|
||||
local unit = trigger.unit
|
||||
local result = {}
|
||||
AddUnitChangeInternalEvents(unit, result, nil, trigger.use_unitisunit and trigger.unitisunit or nil)
|
||||
if trigger.use_specId then
|
||||
AddUnitRoleChangeInternalEvents(unit, result)
|
||||
AddUnitSpecChangeInternalEvents(unit, result)
|
||||
end
|
||||
return result
|
||||
end,
|
||||
loadFunc = function(trigger)
|
||||
@@ -1587,6 +1594,18 @@ Private.event_prototypes = {
|
||||
store = true,
|
||||
conditionType = "select"
|
||||
},
|
||||
{
|
||||
name = "role",
|
||||
display = L["Spec Role"],
|
||||
type = "select",
|
||||
init = "WeakAuras.GetUnitRole(unit)",
|
||||
values = "role_types",
|
||||
store = true,
|
||||
conditionType = "select",
|
||||
enable = function(trigger)
|
||||
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "raid_role",
|
||||
display = L["Raid Role"],
|
||||
@@ -1912,9 +1931,7 @@ Private.event_prototypes = {
|
||||
if includePets ~= "PetsOnly" then
|
||||
AddUnitRoleChangeInternalEvents(unit, result)
|
||||
end
|
||||
if trigger.use_specId then
|
||||
AddUnitSpecChangeInternalEvents(unit, result)
|
||||
end
|
||||
return result
|
||||
end,
|
||||
loadFunc = function(trigger)
|
||||
@@ -2101,6 +2118,18 @@ Private.event_prototypes = {
|
||||
end,
|
||||
desc = L["Requires syncing the specialization via LibGroupTalents."],
|
||||
},
|
||||
{
|
||||
name = "role",
|
||||
display = L["Spec Role"],
|
||||
type = "select",
|
||||
init = "WeakAuras.GetUnitRole(unit)",
|
||||
values = "role_types",
|
||||
store = true,
|
||||
conditionType = "select",
|
||||
enable = function(trigger)
|
||||
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "raid_role",
|
||||
display = L["Raid Role"],
|
||||
@@ -2260,9 +2289,7 @@ Private.event_prototypes = {
|
||||
if includePets ~= "PetsOnly" then
|
||||
AddUnitRoleChangeInternalEvents(unit, result)
|
||||
end
|
||||
if trigger.use_specId then
|
||||
AddUnitSpecChangeInternalEvents(unit, result)
|
||||
end
|
||||
if trigger.use_showCost and trigger.unit == "player" then
|
||||
tinsert(result, "WA_UNIT_QUEUED_SPELL_CHANGED");
|
||||
end
|
||||
@@ -2515,6 +2542,18 @@ Private.event_prototypes = {
|
||||
end,
|
||||
desc = L["Requires syncing the specialization via LibGroupTalents."],
|
||||
},
|
||||
{
|
||||
name = "role",
|
||||
display = L["Spec Role"],
|
||||
type = "select",
|
||||
init = "WeakAuras.GetUnitRole(unit)",
|
||||
values = "role_types",
|
||||
store = true,
|
||||
conditionType = "select",
|
||||
enable = function(trigger)
|
||||
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "raid_role",
|
||||
display = L["Raid Role"],
|
||||
@@ -6446,6 +6485,18 @@ Private.event_prototypes = {
|
||||
return not trigger.use_inverse
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "role",
|
||||
display = L["Spec Role"],
|
||||
type = "select",
|
||||
init = "WeakAuras.GetUnitRole(unit)",
|
||||
values = "role_types",
|
||||
store = true,
|
||||
conditionType = "select",
|
||||
enable = function(trigger)
|
||||
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "raid_role",
|
||||
display = L["Raid Role"],
|
||||
|
||||
@@ -2315,6 +2315,13 @@ Private.raid_role_types = {
|
||||
NONE = L["Other"]
|
||||
}
|
||||
|
||||
Private.role_types = {
|
||||
tank = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:16:16:0:0:64:64:0:19:22:41|t "..TANK,
|
||||
melee = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:16:16:0:0:64:64:20:39:22:41|t "..MELEE,
|
||||
caster = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:16:16:0:0:64:64:20:39:22:41|t "..L["Caster"],
|
||||
healer = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES:16:16:0:0:64:64:20:39:1:20|t "..HEALER,
|
||||
}
|
||||
|
||||
Private.group_member_types = {
|
||||
LEADER = L["Leader"],
|
||||
ASSIST = L["Assist"],
|
||||
|
||||
@@ -236,7 +236,6 @@ local loadEvents = {}
|
||||
|
||||
-- All regions keyed on id, has properties: region, regionType, also see clones
|
||||
Private.regions = {};
|
||||
local regions = Private.regions;
|
||||
|
||||
-- keyed on id, contains bool indicating whether the aura is loaded
|
||||
Private.loaded = {};
|
||||
@@ -1384,6 +1383,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
|
||||
local _, race = UnitRace("player")
|
||||
local faction = UnitFactionGroup("player")
|
||||
local zoneId = GetCurrentMapAreaID()
|
||||
local role = WeakAuras.GetUnitRole("player")
|
||||
local raidRole = false;
|
||||
local raidID = UnitInRaid("player")
|
||||
if raidID then
|
||||
@@ -1391,7 +1391,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
|
||||
end
|
||||
local _, class = UnitClass("player");
|
||||
|
||||
local inCombat = UnitAffectingCombat("player") -- or UnitAffectingCombat("pet");
|
||||
local inCombat = UnitAffectingCombat("player")
|
||||
local alive = not UnitIsDeadOrGhost('player')
|
||||
local pvp = UnitIsPVPFreeForAll("player") or UnitIsPVP("player")
|
||||
local vehicle = UnitInVehicle("player") or UnitOnTaxi("player") or false
|
||||
@@ -1422,8 +1422,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
|
||||
if (data and not data.controlledChildren) then
|
||||
local loadFunc = loadFuncs[id];
|
||||
local loadOpt = loadFuncsForOptions[id];
|
||||
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, class, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
|
||||
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, class, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
|
||||
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, class, race, faction, playerLevel, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
|
||||
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, class, race, faction, playerLevel, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
|
||||
|
||||
if(shouldBeLoaded and not loaded[id]) then
|
||||
changed = changed + 1;
|
||||
@@ -2888,9 +2888,9 @@ function Private.SetRegion(data, cloneId)
|
||||
region = clones[id][cloneId];
|
||||
end
|
||||
else
|
||||
if((not regions[id]) or (not regions[id].region) or regions[id].regionType ~= regionType) then
|
||||
if((not Private.regions[id]) or (not Private.regions[id].region) or Private.regions[id].regionType ~= regionType) then
|
||||
region = regionTypes[regionType].create(WeakAurasFrame, data);
|
||||
regions[id] = {
|
||||
Private.regions[id] = {
|
||||
regionType = regionType,
|
||||
region = region
|
||||
};
|
||||
@@ -2901,7 +2901,7 @@ function Private.SetRegion(data, cloneId)
|
||||
region.toShow = true
|
||||
end
|
||||
else
|
||||
region = regions[id].region
|
||||
region = Private.regions[id].region
|
||||
end
|
||||
end
|
||||
region.id = id;
|
||||
|
||||
@@ -32,6 +32,7 @@ DefaultOptions.lua
|
||||
|
||||
# Core files
|
||||
Types.lua
|
||||
LibGroupTalentsWrapper.lua
|
||||
Prototypes.lua
|
||||
Profiling.lua
|
||||
WeakAuras.lua
|
||||
@@ -43,7 +44,6 @@ Conditions.lua
|
||||
AnchorToWeakAuras.lua
|
||||
|
||||
# Trigger systems
|
||||
LibGroupTalentsWrapper.lua
|
||||
BuffTrigger2.lua
|
||||
GenericTrigger.lua
|
||||
BossMods.lua
|
||||
|
||||
@@ -745,6 +745,35 @@ local function GetBuffTriggerOptions(data, triggernum)
|
||||
and not trigger.useActualSpec)
|
||||
end
|
||||
},
|
||||
|
||||
useGroupRole = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Filter by Group Role"],
|
||||
order = 67.1,
|
||||
hidden = function() return
|
||||
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"))
|
||||
end
|
||||
},
|
||||
group_role = {
|
||||
type = "multiselect",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Group Role"],
|
||||
values = OptionsPrivate.Private.role_types,
|
||||
hidden = function() return
|
||||
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useGroupRole)
|
||||
end,
|
||||
order = 67.2
|
||||
},
|
||||
group_roleSpace = {
|
||||
type = "description",
|
||||
name = "",
|
||||
order = 67.3,
|
||||
width = WeakAuras.normalWidth,
|
||||
hidden = function() return
|
||||
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useGroupRole)
|
||||
end
|
||||
},
|
||||
useRaidRole = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
|
||||
@@ -507,7 +507,7 @@ function OptionsPrivate.CreateFrame()
|
||||
local awesomeWotlkButton
|
||||
if not WeakAuras.isAwesomeEnabled() then
|
||||
awesomeWotlkButton = addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk/releases",
|
||||
L["Unlock nameplate anchoring & units in WeakAuras with the awesome_wotlk client patch"])
|
||||
L["Unlock nameplate anchoring & units in WeakAuras with the Awesome WotLK client patch"])
|
||||
awesomeWotlkButton:SetParent(tipFrame)
|
||||
awesomeWotlkButton:SetPoint("LEFT", changelogButton or thanksButton, "RIGHT", 10, 0)
|
||||
end
|
||||
|
||||
@@ -249,11 +249,6 @@ local function createOptions(id, data)
|
||||
desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\edge-example:30|t\n"..L["Enable \"Edge\" part of the overlay"],
|
||||
hidden = function() return not data.cooldown end,
|
||||
},
|
||||
endHeader = {
|
||||
type = "header",
|
||||
order = 100,
|
||||
name = "",
|
||||
},
|
||||
ccWarning = {
|
||||
type = "description",
|
||||
width = WeakAuras.doubleWidth,
|
||||
@@ -269,6 +264,11 @@ local function createOptions(id, data)
|
||||
order = 11.7,
|
||||
hidden = function() return data.cooldownTextDisabled end
|
||||
},
|
||||
endHeader = {
|
||||
type = "header",
|
||||
order = 100,
|
||||
name = "",
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user