Skip to content

Commit

Permalink
LibSpecialization support on Cataclysm
Browse files Browse the repository at this point in the history
Require lib with minor 9
  • Loading branch information
mrbuds authored and InfusOnWoW committed May 26, 2024
1 parent d0d3543 commit f197584
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 35 deletions.
4 changes: 2 additions & 2 deletions WeakAuras/BuffTrigger2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
Private.StopProfileSystem("bufftrigger2")
end

if WeakAuras.IsRetail() then
if WeakAuras.IsCataOrRetail() then
Private.LibSpecWrapper.Register(function(unit)
Private.StartProfileSystem("bufftrigger2")

Expand Down Expand Up @@ -3147,7 +3147,7 @@ function BuffTrigger.Add(data)
local effectiveGroupRole = WeakAuras.IsCataOrRetail() and (groupTrigger and trigger.useGroupRole and trigger.group_role) or nil
local effectiveRaidRole = WeakAuras.IsClassicOrCata() and (groupTrigger and trigger.useRaidRole and trigger.raid_role) or nil
local effectiveClass = groupTrigger and trigger.useClass and trigger.class
local effectiveSpecId = WeakAuras.IsRetail() and (groupTrigger and trigger.useActualSpec and trigger.actualSpec) or nil
local effectiveSpecId = WeakAuras.IsCataOrRetail() and (groupTrigger and trigger.useActualSpec and trigger.actualSpec) or nil
local effectiveArenaSpec = WeakAuras.IsRetail() and (trigger.unit == "arena" and trigger.useArenaSpec and trigger.arena_spec) or nil
local effectiveHostility = trigger.unit == "nameplate" and trigger.useHostility and trigger.hostility
local effectiveIgnoreDead = groupTrigger and trigger.ignoreDead
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/GenericTrigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3923,7 +3923,7 @@ end
-- LibSpecWrapper
-- We always register, because it's probably not that often called, and ScanEvents checks
-- early if anyone wants the event
if WeakAuras.IsRetail() then
if WeakAuras.IsCataOrRetail() then
Private.LibSpecWrapper.Register(function(unit)
WeakAuras.ScanEvents("UNIT_SPEC_CHANGED_" .. unit, unit)
end)
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/LibSpecializationWrapper.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if not WeakAuras.IsLibsOK() then return end
if not WeakAuras.IsRetail() then return end
if not WeakAuras.IsCataOrRetail() then return end
---@type string
local AddonName = ...
---@class Private
Expand Down
16 changes: 8 additions & 8 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ Private.load_prototype = {
},
{
name = "role",
display = WeakAuras.IsCataClassic() and L["Assigned Role"] or L["Spec Role"],
display = L["Spec Role"],
type = "multiselect",
values = "role_types",
init = WeakAuras.IsCataOrRetail() and "arg" or nil,
Expand All @@ -1735,9 +1735,9 @@ Private.load_prototype = {
display = WeakAuras.newFeatureString .. L["Spec Position"],
type = "multiselect",
values = "spec_position_types",
init = WeakAuras.IsRetail() and "arg" or nil,
enable = WeakAuras.IsRetail(),
hidden = not WeakAuras.IsRetail(),
init = WeakAuras.IsCataOrRetail() and "arg" or nil,
enable = WeakAuras.IsCataOrRetail(),
hidden = not WeakAuras.IsCataOrRetail(),
events = {"ACTIVE_TALENT_GROUP_CHANGED"}
},
{
Expand Down Expand Up @@ -2244,7 +2244,7 @@ Private.event_prototypes = {
store = true,
conditionType = "select",
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
},
Expand Down Expand Up @@ -3217,7 +3217,7 @@ Private.event_prototypes = {
store = true,
conditionType = "select",
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
},
Expand Down Expand Up @@ -3843,7 +3843,7 @@ Private.event_prototypes = {
store = true,
conditionType = "select",
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
},
Expand Down Expand Up @@ -4175,7 +4175,7 @@ Private.event_prototypes = {
store = true,
conditionType = "select",
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
},
Expand Down
19 changes: 6 additions & 13 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1713,29 +1713,22 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
end
role = "none"
if WeakAuras.IsCataClassic() then
role = UnitGroupRolesAssigned("player")
if role == "NONE" then
role = GetTalentGroupRole(GetActiveTalentGroup()) or "NONE"
end
vehicle = UnitInVehicle('player') or UnitOnTaxi('player') or false
vehicleUi = UnitHasVehicleUI('player') or HasOverrideActionBar() or HasVehicleActionBar() or false
else
vehicle = UnitOnTaxi('player')
end
if WeakAuras.IsCataClassic() then
local specIndex = GetPrimaryTalentTree()
if specIndex then
specId = GetTalentTabInfo(specIndex)
end
end
else
dragonriding = Private.IsDragonriding()
specId, role, position = Private.LibSpecWrapper.SpecRolePositionForUnit("player")
inPetBattle = C_PetBattles.IsInBattle()
vehicle = UnitInVehicle('player') or UnitOnTaxi('player') or false
vehicleUi = UnitHasVehicleUI('player') or HasOverrideActionBar() or HasVehicleActionBar() or false
end

if WeakAuras.IsCataOrRetail() then
specId, role, position = Private.LibSpecWrapper.SpecRolePositionForUnit("player")
end

local size, difficulty, instanceType, instanceId, difficultyIndex= GetInstanceTypeAndSize()
Private.UpdateCurrentInstanceType(instanceType)

Expand Down Expand Up @@ -1775,8 +1768,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, class, player, realm, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size)
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, class, player, realm, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size)
elseif WeakAuras.IsCataClassic() then
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, vehicleUi, class, specId, player, realm, race, faction, playerLevel, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex)
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, vehicleUi, class, specId, player, realm, race, faction, playerLevel, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex)
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, vehicleUi, class, specId, player, realm, race, faction, playerLevel, role, position, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex)
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, vehicleUi, class, specId, player, realm, race, faction, playerLevel, role, position, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex)
elseif WeakAuras.IsRetail() then
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, warmodeActive, inPetBattle, vehicle, vehicleUi, dragonriding, specId, player, realm, race, faction, playerLevel, effectiveLevel, role, position, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex, affixes)
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, warmodeActive, inPetBattle, vehicle, vehicleUi, dragonriding, specId, player, realm, race, faction, playerLevel, effectiveLevel, role, position, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex, affixes)
Expand Down
4 changes: 4 additions & 0 deletions WeakAuras/WeakAuras_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ embeds.xml
# TaintLess
Libs\TaintLess\TaintLess.xml

# Client flavor specific libs
Libs\LibSpecialization\LibSpecialization.lua

Init.lua
locales.xml
ArchiveTypes\Repository.lua
Expand All @@ -49,6 +52,7 @@ Conditions.lua
AnchorToWeakAuras.lua

# Trigger systems
LibSpecializationWrapper.lua
BuffTrigger2.lua
GenericTrigger.lua
BossMods.lua
Expand Down
20 changes: 10 additions & 10 deletions WeakAurasOptions/BuffTrigger2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 66.3,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
and WeakAuras.IsRetail())
and WeakAuras.IsCataOrRetail())
end,
},
actualSpec = {
Expand All @@ -801,7 +801,7 @@ local function GetBuffTriggerOptions(data, triggernum)
return not (trigger.type == "aura2"
and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
and trigger.useActualSpec
and WeakAuras.IsRetail())
and WeakAuras.IsCataOrRetail())
end,
order = 66.4
},
Expand All @@ -814,7 +814,7 @@ local function GetBuffTriggerOptions(data, triggernum)
return not (trigger.type == "aura2"
and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
and not trigger.useActualSpec
and WeakAuras.IsRetail())
and WeakAuras.IsCataOrRetail())
end
},

Expand Down Expand Up @@ -842,7 +842,7 @@ local function GetBuffTriggerOptions(data, triggernum)
group_roleSpace = {
type = "description",
name = "",
order = 67.2,
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)
Expand All @@ -853,7 +853,7 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Filter by Raid Role"],
order = 67.1,
order = 67.4,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"))
or WeakAuras.IsRetail()
Expand All @@ -868,12 +868,12 @@ local function GetBuffTriggerOptions(data, triggernum)
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useRaidRole)
or WeakAuras.IsRetail()
end,
order = 67.2
order = 67.5
},
raid_roleSpace = {
type = "description",
name = "",
order = 67.2,
order = 67.6,
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.useRaidRole)
Expand All @@ -884,7 +884,7 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Filter by Arena Spec"],
order = 67.3,
order = 67.8,
hidden = function() return
not (WeakAuras.IsRetail() and trigger.type == "aura2" and trigger.unit == "arena")
end
Expand All @@ -897,12 +897,12 @@ local function GetBuffTriggerOptions(data, triggernum)
hidden = function()
return not (WeakAuras.IsRetail() and trigger.type == "aura2" and trigger.unit == "arena" and trigger.useArenaSpec)
end,
order = 67.4
order = 67.9
},
arena_specSpace = {
type = "description",
name = "",
order = 67.4,
order = 67.91,
width = WeakAuras.normalWidth,
hidden = function()
return not (WeakAuras.IsRetail() and trigger.type == "aura2" and trigger.unit == "arena" and not trigger.useArenaSpec)
Expand Down

0 comments on commit f197584

Please sign in to comment.