From efdbb3c46df417c92f489225500f6216a1690943 Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Fri, 17 Jan 2025 18:59:10 +0100 Subject: [PATCH] from retail --- WeakAuras/Bindings.xml | 6 +-- WeakAuras/GenericTrigger.lua | 12 +++-- WeakAuras/Modernize.lua | 13 +++--- WeakAuras/Prototypes.lua | 15 ++++++- WeakAuras/RegionTypes/DynamicGroup.lua | 25 +++++++++-- WeakAuras/RegionTypes/Text.lua | 6 +++ WeakAuras/SubRegionTypes/SubText.lua | 6 +++ WeakAuras/Types.lua | 1 + WeakAuras/WeakAuras.lua | 7 +-- .../RegionOptions/DynamicGroup.lua | 44 +++++++++++++++---- 10 files changed, 107 insertions(+), 28 deletions(-) diff --git a/WeakAuras/Bindings.xml b/WeakAuras/Bindings.xml index eb4d252..66ea3e6 100644 --- a/WeakAuras/Bindings.xml +++ b/WeakAuras/Bindings.xml @@ -1,11 +1,11 @@ - + WeakAuras.OpenOptions() - + WeakAuras.RealTimeProfilingWindow:Toggle() - + WeakAuras.PrintProfile() diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 89ce08a..22ab767 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -2381,9 +2381,11 @@ do if (showgcd) then if ((gcdStart or 0) + (gcdDuration or 0) > startTime + duration) then + if startTime == 0 then + gcdCooldown = true + end startTime = gcdStart; duration = gcdDuration; - gcdCooldown = true; end end @@ -2403,9 +2405,11 @@ do end if (showgcd) then if ((gcdStart or 0) + (gcdDuration or 0) > startTime + duration) then + if startTime == 0 then + gcdCooldown = true + end startTime = gcdStart; duration = gcdDuration; - gcdCooldown = true; end end return startTime, duration, enabled, gcdCooldown; @@ -2437,9 +2441,11 @@ do if (showgcd) then if ((gcdStart or 0) + (gcdDuration or 0) > startTime + duration) then + if startTime == 0 then + gcdCooldown = true + end startTime = gcdStart; duration = gcdDuration; - gcdCooldown = true; end end return startTime, duration, enabled, gcdCooldown; diff --git a/WeakAuras/Modernize.lua b/WeakAuras/Modernize.lua index 07bff87..6fbba68 100644 --- a/WeakAuras/Modernize.lua +++ b/WeakAuras/Modernize.lua @@ -1256,15 +1256,16 @@ function Private.Modernize(data) end end + local function migrateToTable(tab, field) + local value = tab[field] + if value ~= nil and type(value) ~= "table" then + tab[field] = { value } + end + end + if data.internalVersion < 67 or data.internalVersion > WeakAuras.InternalVersion() then local castMigrationNeeded = data.internalVersion < 67 data.internalVersion = WeakAuras.InternalVersion() - local function migrateToTable(tab, field) - local value = tab[field] - if value ~= nil and type(value) ~= "table" then - tab[field] = { value } - end - end do local trigger_migration = { diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index f31fca5..13d7972 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -1040,6 +1040,17 @@ Private.load_prototype = { events = {"PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE"}, optional = true, }, + { + name = "groupSize", + display = L["Group Size"], + type = "number", + init = "arg", + events = {"PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE"}, + multiEntry = { + operator = "and", + limit = 2 + }, + }, { name = "group_leader", display = WeakAuras.newFeatureString .. L["Group Leader/Assist"], @@ -3098,7 +3109,7 @@ Private.event_prototypes = { force_events = "SPELL_COOLDOWN_FORCE", name = L["Cooldown/Charges/Count"], loadFunc = function(trigger) - trigger.spellName = trigger.spellName or 0; + trigger.spellName = type(trigger.spellName) ~= "table" and trigger.spellName or 0; local spellName; if (trigger.use_exact_spellName) then spellName = trigger.spellName; @@ -3111,7 +3122,7 @@ Private.event_prototypes = { end end, init = function(trigger) - trigger.spellName = trigger.spellName or 0; + trigger.spellName = type(trigger.spellName) ~= "table" and trigger.spellName or 0; local spellName; if (trigger.use_exact_spellName) then spellName = trigger.spellName; diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 8ab7bde..cec8b5a 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -28,6 +28,7 @@ local default = { yOffset = 0, radius = 200, rotation = 0, + stepAngle = 15, fullCircle = true, arcLength = 360, constantFactor = "RADIUS", @@ -719,6 +720,7 @@ local growers = { local constantFactor = data.constantFactor local space = data.space or 0 local radius = data.radius or 0 + local stepAngle = (data.stepAngle or 0) * math.pi / 180 local limit = data.useLimit and data.limit or math.huge local sAngle = (data.rotation or 0) * math.pi / 180 local arc = (data.fullCircle and 360 or data.arcLength or 0) * math.pi / 180 @@ -736,7 +738,7 @@ local growers = { for frame, regionDatas in pairs(frames) do local numVisible = min(limit, #regionDatas) local r - if constantFactor == "RADIUS" then + if constantFactor == "RADIUS" or constantFactor == "ANGLE" then r = radius else if numVisible <= 1 then @@ -749,6 +751,8 @@ local growers = { local dAngle if numVisible == 1 then dAngle = 0 + elseif constantFactor == "ANGLE" then + dAngle = stepAngle elseif not data.fullCircle then dAngle = arc / (numVisible - 1) else @@ -770,6 +774,7 @@ local growers = { local constantFactor = data.constantFactor local space = data.space or 0 local radius = data.radius or 0 + local stepAngle = (data.stepAngle or 0) * math.pi / 180 local limit = data.useLimit and data.limit or math.huge local sAngle = (data.rotation or 0) * math.pi / 180 local arc = (data.fullCircle and 360 or data.arcLength or 0) * math.pi / 180 @@ -787,7 +792,7 @@ local growers = { for frame, regionDatas in pairs(frames) do local numVisible = min(limit, #regionDatas) local r - if constantFactor == "RADIUS" then + if constantFactor == "RADIUS" or constantFactor == "ANGLE" then r = radius else if numVisible <= 1 then @@ -800,6 +805,8 @@ local growers = { local dAngle if numVisible == 1 then dAngle = 0 + elseif constantFactor == "ANGLE" then + dAngle = -stepAngle elseif not data.fullCircle then dAngle = arc / (1 - numVisible) else @@ -1374,7 +1381,19 @@ local function modify(parent, region, data) or data.anchorFrameType == "MOUSE") )) then - controlPoint:SetParent(frame == "" and self.relativeTo or frame) + local parent + if frame == "" then + parent = self.relativeTo + else + if type(frame) == "string" then + parent = _G[frame] + else + parent = frame + end + end + if parent and parent.IsObjectType and parent:IsObjectType("Frame") then + controlPoint:SetParent(parent) + end else controlPoint:SetParent(self) end diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index 1361e78..f0ed0db 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -81,6 +81,12 @@ local function modify(parent, region, data) local text = region.text; local fontPath = SharedMedia:Fetch("font", data.font); + if not text:GetFont() and fontPath then -- workaround font not loading correctly + local objectName = "WeakAuras-Font-" .. data.font + local fontObject = _G[objectName] or CreateFont(objectName) + fontObject:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline) + text:SetFontObject(fontObject) + end text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline); if not text:GetFont() then -- Font invalid, set the font but keep the setting text:SetFont(STANDARD_TEXT_FONT, data.fontSize <= 33 and data.fontSize or 33, data.outline); diff --git a/WeakAuras/SubRegionTypes/SubText.lua b/WeakAuras/SubRegionTypes/SubText.lua index 5162133..f15ac2a 100644 --- a/WeakAuras/SubRegionTypes/SubText.lua +++ b/WeakAuras/SubRegionTypes/SubText.lua @@ -139,6 +139,12 @@ local function modify(parent, region, parentData, data, first) local fontPath = SharedMedia:Fetch("font", data.text_font); text:SetFont(fontPath, data.text_fontSize < 33 and data.text_fontSize or 33, data.text_fontType); + if not text:GetFont() and fontPath then -- workaround font not loading correctly + local objectName = "WeakAuras-Font-" .. data.text_font + local fontObject = _G[objectName] or CreateFont(objectName) + fontObject:SetFont(fontPath, data.text_fontSize < 33 and data.text_fontSize or 33, data.text_fontType) + text:SetFontObject(fontObject) + end if not text:GetFont() then -- Font invalid, set the font but keep the setting text:SetFont(STANDARD_TEXT_FONT, data.text_fontSize < 33 and data.text_fontSize or 33, data.text_fontType); end diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index 4784246..f97a627 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -32,6 +32,7 @@ if WeakAuras.isAwesomeEnabled() then end Private.circular_group_constant_factor_types = { + ANGLE = L["Angle and Radius"], RADIUS = L["Radius"], SPACING = L["Spacing"] } diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 28fdd65..5ab2ced 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1,6 +1,6 @@ local AddonName, Private = ... -local internalVersion = 68 +local internalVersion = 69 -- Lua APIs local insert = table.insert @@ -1404,6 +1404,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) local size, difficulty, instanceType = GetInstanceTypeAndSize() local group = Private.ExecEnv.GroupType() + local groupSize = GetNumGroupMembers() local changed = 0; local shouldBeLoaded, couldBeLoaded; @@ -1416,8 +1417,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, player, realm, class, race, faction, playerLevel, raidRole, group, raidMemberType, zone, zoneId, subzone, size, difficulty); - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, player, realm, class, race, faction, playerLevel, raidRole, group, raidMemberType, zone, zoneId, subzone, size, difficulty); + shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, 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, player, realm, class, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty); if(shouldBeLoaded and not loaded[id]) then changed = changed + 1; diff --git a/WeakAurasOptions/RegionOptions/DynamicGroup.lua b/WeakAurasOptions/RegionOptions/DynamicGroup.lua index 7bbad45..d93dcdc 100644 --- a/WeakAurasOptions/RegionOptions/DynamicGroup.lua +++ b/WeakAurasOptions/RegionOptions/DynamicGroup.lua @@ -263,7 +263,7 @@ local function createOptions(id, data) name = L["Constant Factor"], order = 4, values = OptionsPrivate.Private.circular_group_constant_factor_types, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() return not(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") end }, rotation = { type = "range", @@ -274,14 +274,31 @@ local function createOptions(id, data) min = 0, max = 360, bigStep = 3, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() return not(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") end }, fullCircle = { type = "toggle", width = WeakAuras.normalWidth, name = L["Full Circle"], order = 7, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() + return not( + (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") + and (data.constantFactor == "RADIUS" or data.constantFactor == "SPACING")) + end + }, + stepAngle = { + type = "range", + control = "WeakAurasSpinBox", + width = WeakAuras.normalWidth, + name = L["Angle Between Auras"], + order = 12, + min = 0, + max = 180, + bigStep = 1, + hidden = function() + return not((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "ANGLE") + end }, arcLength = { type = "range", @@ -293,7 +310,11 @@ local function createOptions(id, data) max = 360, bigStep = 3, disabled = function() return data.fullCircle end, - hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end + hidden = function() + return not( + (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") + and (data.constantFactor == "RADIUS" or data.constantFactor == "SPACING")) + end }, radius = { type = "range", @@ -304,7 +325,11 @@ local function createOptions(id, data) softMin = 0, softMax = 500, bigStep = 1, - hidden = function() return data.grow == "CUSTOM" or not((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") end + hidden = function() + return not( + (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") + and (data.constantFactor == "RADIUS" or data.constantFactor == "ANGLE")) + end }, -- grid grow options gridType = { @@ -372,9 +397,12 @@ local function createOptions(id, data) softMax = 300, bigStep = 1, hidden = function() - return data.grow == "CUSTOM" - or data.grow == "GRID" - or ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") + return not( + data.grow == "LEFT" or data.grow == "RIGHT" + or data.grow == "UP" or data.grow == "DOWN" + or data.grow == "HORIZONTAL" or data.grow == "VERTICAL" + or ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") + and (data.constantFactor == "SPACING"))) end }, stagger = {