diff --git a/WeakAuras/Animations.lua b/WeakAuras/Animations.lua index 956b16f..40b5c58 100644 --- a/WeakAuras/Animations.lua +++ b/WeakAuras/Animations.lua @@ -9,8 +9,6 @@ local anim_function_strings = Private.anim_function_strings; local function noopErrorHandler() end -local frame = Private.frames["WeakAuras Main Frame"] - local function RunAnimation(key, anim, elapsed, time) Private.StartProfileUID(anim.auraUID) local finished = false @@ -178,6 +176,9 @@ end local updatingAnimations; local last_update = GetTime(); local function UpdateAnimations() + if not updatingAnimations then + return + end Private.StartProfileSystem("animations"); for groupUid, groupRegion in pairs(pending_controls) do @@ -196,12 +197,15 @@ local function UpdateAnimations() Private.StopProfileSystem("animations"); end +local frame = CreateFrame("Frame") +Private.frames["WeakAuras Animation Frame"] = frame +frame:SetScript("OnUpdate", UpdateAnimations) + function Private.RegisterGroupForPositioning(uid, region) pending_controls[uid] = region if not updatingAnimations then updatingAnimations = true last_update = GetTime() - frame:SetScript("OnUpdate", UpdateAnimations) end end @@ -399,11 +403,9 @@ function Private.Animate(namespace, uid, type, anim, region, inverse, onFinished animation.auraUID = uid if not(updatingAnimations) then - frame:SetScript("OnUpdate", UpdateAnimations); last_update = GetTime() updatingAnimations = true; end - RunAnimation(key, animation, 0, GetTime()) return true; else if(animations[key]) then diff --git a/WeakAuras/BossMods.lua b/WeakAuras/BossMods.lua index f5ff989..32fe029 100644 --- a/WeakAuras/BossMods.lua +++ b/WeakAuras/BossMods.lua @@ -150,7 +150,7 @@ Private.ExecEnv.BossMods.DBM = { end end if self.nextExpire then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, self.nextExpire - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, self.nextExpire - now, self) end end, @@ -214,11 +214,11 @@ Private.ExecEnv.BossMods.DBM = { WeakAuras.ScanEvents("BossMod_TimerStart", timerId) end if self.nextExpire == nil then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, expirationTime - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, expirationTime - now, self) self.nextExpire = expirationTime elseif expirationTime < self.nextExpire then timer:CancelTimer(self.recheckTimer) - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, expirationTime - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, expirationTime - now, self) self.nextExpire = expirationTime end elseif event == "DBM_TimerStop" then @@ -261,11 +261,11 @@ Private.ExecEnv.BossMods.DBM = { WeakAuras.ScanEvents("BossMod_TimerResume", timerId) end if self.nextExpire == nil then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, bar.expirationTime - GetTime(), self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - GetTime(), self) self.nextExpire = bar.expirationTime elseif bar.expirationTime < self.nextExpire then timer:CancelTimer(self.recheckTimer) - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, bar.expirationTime - GetTime(), self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - GetTime(), self) self.nextExpire = bar.expirationTime end end @@ -278,11 +278,11 @@ Private.ExecEnv.BossMods.DBM = { bar.duration = duration bar.expirationTime = expirationTime if self.nextExpire == nil then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, bar.expirationTime - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - now, self) self.nextExpire = expirationTime elseif self.nextExpire == nil or expirationTime < self.nextExpire then timer:CancelTimer(self.recheckTimer) - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, bar.expirationTime - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - now, self) self.nextExpire = expirationTime end end @@ -290,6 +290,16 @@ Private.ExecEnv.BossMods.DBM = { if self.isGeneric then WeakAuras.ScanEvents("BossMod_TimerUpdate", timerId) end + elseif event == "DBM_TimerUpdateIcon" then + local timerId, icon = ... + local bar = self.bars[timerId] + if bar then + bar.icon = icon + end + WeakAuras.ScanEvents("DBM_TimerUpdateIcon", timerId) + if self.isGeneric then + WeakAuras.ScanEvents("BossMod_TimerUpdateIcon", timerId) + end elseif event == "DBM_SetStage" or event == "DBM_Pull" or event == "DBM_Wipe" or event == "DBM_Kill" then WeakAuras.ScanEvents("DBM_SetStage") if self.isGeneric then @@ -314,6 +324,7 @@ Private.ExecEnv.BossMods.DBM = { self:RegisterCallback("DBM_TimerPause") self:RegisterCallback("DBM_TimerResume") self:RegisterCallback("DBM_TimerUpdate") + self:RegisterCallback("DBM_TimerUpdateIcon") end, RegisterMessage = function(self) @@ -338,7 +349,7 @@ Private.ExecEnv.BossMods.DBM = { ScheduleCheck = function(self, fireTime) if not self.scheduled_scans[fireTime] then - self.scheduled_scans[fireTime] = timer:ScheduleTimer(self.DoScan, fireTime - GetTime(), self, fireTime) + self.scheduled_scans[fireTime] = timer:ScheduleTimerFixed(self.DoScan, fireTime - GetTime(), self, fireTime) end end } @@ -443,7 +454,8 @@ Private.event_prototypes["DBM Timer"] = { type = "addons", events = {}, internal_events = { - "DBM_TimerStart", "DBM_TimerStop", "DBM_TimerUpdate", "DBM_TimerForce", "DBM_TimerResume", "DBM_TimerPause" + "DBM_TimerStart", "DBM_TimerStop", "DBM_TimerUpdate", "DBM_TimerForce", "DBM_TimerResume", "DBM_TimerPause", + "DBM_TimerUpdateIcon" }, force_events = "DBM_TimerForce", name = L["DBM Timer"], @@ -530,7 +542,7 @@ Private.event_prototypes["DBM Timer"] = { state.changed = true return true end - elseif event == "DBM_TimerUpdate" then + elseif event == "DBM_TimerUpdate" or event == "DBM_TimerUpdateIcon" then local changed for timerId, bar in pairs(Private.ExecEnv.BossMods.DBM:GetAllTimers()) do if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then @@ -806,7 +818,7 @@ Private.ExecEnv.BossMods.BigWigs = { end if self.nextExpire then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, self.nextExpire - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, self.nextExpire - now, self) end end, @@ -846,11 +858,11 @@ Private.ExecEnv.BossMods.BigWigs = { WeakAuras.ScanEvents("BossMod_TimerStart", text) end if self.nextExpire == nil then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, expirationTime - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, expirationTime - now, self) self.nextExpire = expirationTime elseif expirationTime < self.nextExpire then timer:CancelTimer(self.recheckTimer) - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, expirationTime - now, self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, expirationTime - now, self) self.nextExpire = expirationTime end elseif event == "BigWigs_StopBar" then @@ -892,10 +904,10 @@ Private.ExecEnv.BossMods.BigWigs = { WeakAuras.ScanEvents("BossMod_TimerResume", text) end if self.nextExpire == nil then - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, bar.expirationTime - GetTime(), self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - GetTime(), self) elseif bar.expirationTime < self.nextExpire then timer:CancelTimer(self.recheckTimer) - self.recheckTimer = timer:ScheduleTimer(self.RecheckTimers, bar.expirationTime - GetTime(), self) + self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - GetTime(), self) self.nextExpire = bar.expirationTime end end @@ -982,7 +994,7 @@ Private.ExecEnv.BossMods.BigWigs = { ScheduleCheck = function(self, fireTime) if not self.scheduled_scans[fireTime] then - self.scheduled_scans[fireTime] = timer:ScheduleTimer(self.DoScan, fireTime - GetTime(), self, fireTime) + self.scheduled_scans[fireTime] = timer:ScheduleTimerFixed(self.DoScan, fireTime - GetTime(), self, fireTime) end end } @@ -1478,7 +1490,8 @@ Private.event_prototypes["Boss Mod Timer"] = { type = "addons", events = {}, internal_events = { - "BossMod_TimerStart", "BossMod_TimerStop", "BossMod_TimerUpdate", "BossMod_TimerForce", "BossMod_TimerResume", "BossMod_TimerPause" + "BossMod_TimerStart", "BossMod_TimerStop", "BossMod_TimerUpdate", "BossMod_TimerForce", "BossMod_TimerResume", + "BossMod_TimerPause", "BossMod_TimerUpdateIcon" }, force_events = "BossMod_TimerForce", name = L["Boss Mod Timer"], @@ -1566,7 +1579,7 @@ Private.event_prototypes["Boss Mod Timer"] = { state.changed = true return true end - elseif event == "BossMod_TimerUpdate" then + elseif event == "BossMod_TimerUpdate" or event == "BossMod_TimerUpdateIcon" then local changed for timerId, bar in pairs(Private.ExecEnv.BossMods.Generic:GetAllTimers()) do if Private.ExecEnv.BossMods.Generic:TimerMatchesGeneric(timerId, triggerText, triggerTextOperator, triggerSpellId, counter) then diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 8aea94f..07c8539 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -1015,7 +1015,7 @@ local function ProgressType(data, triggernum) elseif (trigger.customDuration and trigger.customDuration ~= "") then return "timed"; elseif (trigger.custom_type == "stateupdate") then - return "timed"; + return false end end return false @@ -3101,6 +3101,7 @@ end do local mh = GetInventorySlotInfo("MainHandSlot") local oh = GetInventorySlotInfo("SecondaryHandSlot") + local rw = GetInventorySlotInfo("RangedSlot") local mh_name, mh_shortenedName, mh_exp, mh_dur, mh_charges; local mh_icon = GetInventoryItemTexture("player", mh); @@ -3108,6 +3109,9 @@ do local oh_name, oh_shortenedName, oh_exp, oh_dur, oh_charges; local oh_icon = GetInventoryItemTexture("player", oh); + local rw_name, rw_shortenedName, rw_exp, rw_dur, rw_charges; + local rw_icon = GetInventoryItemTexture("player", rw) or "Interface\\Icons\\INV_Misc_QuestionMark" + local tenchFrame = nil Private.frames["Temporary Enchant Handler"] = tenchFrame; local tenchTip; @@ -3140,11 +3144,12 @@ do local function tenchUpdate() Private.StartProfileSystem("generictrigger"); - local _, mh_rem, oh_rem - _, mh_rem, mh_charges, _, oh_rem, oh_charges = GetWeaponEnchantInfo(); + local _, mh_rem, oh_rem, rw_rem, re_charges + _, mh_rem, mh_charges, _, oh_rem, oh_charges, _, rw_rem, rw_charges = GetWeaponEnchantInfo(); local time = GetTime(); local mh_exp_new = mh_rem and (time + (mh_rem / 1000)); local oh_exp_new = oh_rem and (time + (oh_rem / 1000)); + local rw_exp_new = rw_rem and (time + (rw_rem / 1000)); if(math.abs((mh_exp or 0) - (mh_exp_new or 0)) > 1) then mh_exp = mh_exp_new; mh_dur = mh_rem and mh_rem / 1000; @@ -3165,6 +3170,16 @@ do end oh_icon = GetInventoryItemTexture("player", oh) end + if(math.abs((rw_exp or 0) - (rw_exp_new or 0)) > 1) then + rw_exp = rw_exp_new; + rw_dur = rw_rem and rw_rem / 1000; + if rw_exp then + rw_name, rw_shortenedName = getTenchName(rw) + else + rw_name, rw_shortenedName = "None", "None" + end + rw_icon = GetInventoryItemTexture("player", rw) + end WeakAuras.ScanEvents("TENCH_UPDATE"); Private.StopProfileSystem("generictrigger"); end @@ -3186,6 +3201,10 @@ do function WeakAuras.GetOHTenchInfo() return oh_exp, oh_dur, oh_name, oh_shortenedName, oh_icon, oh_charges; end + + function WeakAuras.GetRangeTenchInfo() + return rw_exp, rw_dur, rw_name, rw_shortenedName, rw_icon, rw_charges; + end end -- Pets @@ -3742,7 +3761,7 @@ function GenericTrigger.GetAdditionalProperties(data, triggernum) enable = v.enable end - if (enable and v.store and v.name and v.display) then + if (enable and v.store and v.name and v.display and v.conditionType ~= "bool") then found = true; additional = additional .. "|cFFFFCC00%".. triggernum .. "." .. v.name .. "|r - " .. v.display .. "\n"; end diff --git a/WeakAuras/Modernize.lua b/WeakAuras/Modernize.lua index 02ccb64..dfb0f50 100644 --- a/WeakAuras/Modernize.lua +++ b/WeakAuras/Modernize.lua @@ -1469,7 +1469,7 @@ function Private.Modernize(data) migrateToTable(data.load, "itemequiped") end - --[[if data.internalVersion < 71 then + if data.internalVersion < 71 then if data.regionType == 'icon' or data.regionType == 'aurabar' or data.regionType == 'progresstexture' or data.regionType == 'stopmotion' @@ -1490,7 +1490,19 @@ function Private.Modernize(data) end end - end]] + end + + if data.internalVersion < 73 then + if data.conditions then + for conditionIndex, condition in ipairs(data.conditions) do + for changeIndex, change in ipairs(condition.changes) do + if type(change.property) == "string" then + change.property = string.gsub(change.property, "(sub.%d.tick_placement)(%d)", "%1s.%2") + end + end + end + end + end data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion()) end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index e4031ef..17936ba 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -4794,7 +4794,9 @@ Private.event_prototypes = { if triggerWeaponType == "main" then expirationTime, duration, name, shortenedName, icon, stacks = WeakAuras.GetMHTenchInfo() - else + elseif triggerWeaponType == "off" then + expirationTime, duration, name, shortenedName, icon, stacks = WeakAuras.GetOHTenchInfo() + elseif triggerWeaponType == "ranged" then expirationTime, duration, name, shortenedName, icon, stacks = WeakAuras.GetOHTenchInfo() end @@ -4820,10 +4822,10 @@ Private.event_prototypes = { return ret:format(trigger.weapon or "main", trigger.use_enchant and trigger.enchant or "", - showOnActive and trigger.use_stack and tonumber(trigger.stack or 0) or "nil", + showOnActive and trigger.use_stacks and tonumber(trigger.stacks or 0) or "nil", showOnActive and trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil", trigger.showOn or "showOnActive", - trigger.stack_operator or "<", + trigger.stacks_operator or "<", trigger.remaining_operator or "<") end, args = { @@ -4847,6 +4849,7 @@ Private.event_prototypes = { name = "stacks", display = L["Stack Count"], type = "number", + conditionType = "number", test = "true", store = true }, diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index 36063e8..457f65f 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -1125,7 +1125,12 @@ local function modify(parent, region, data) end -- Update texture settings - local texturePath = SharedMedia:Fetch("statusbar", data.texture) or ""; + local texturePath + if data.textureSource == "Picker" then + texturePath = data.textureInput or "" + else + texturePath = SharedMedia:Fetch("statusbar", data.texture) or ""; + end bar:SetStatusBarTexture(texturePath); bar:SetBackgroundColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]); -- Update spark settings diff --git a/WeakAuras/RegionTypes/Icon.lua b/WeakAuras/RegionTypes/Icon.lua index c50baed..34b3b12 100644 --- a/WeakAuras/RegionTypes/Icon.lua +++ b/WeakAuras/RegionTypes/Icon.lua @@ -631,6 +631,7 @@ local function modify(parent, region, data) region.UpdateTime = nil function region:Update() + region:UpdateProgress() region:UpdateIcon() end end diff --git a/WeakAuras/RegionTypes/ProgressTexture.lua b/WeakAuras/RegionTypes/ProgressTexture.lua index 385d582..196f184 100644 --- a/WeakAuras/RegionTypes/ProgressTexture.lua +++ b/WeakAuras/RegionTypes/ProgressTexture.lua @@ -476,13 +476,14 @@ local function FrameTick(self) if (duration ~= 0) then local remaining = expirationTime - GetTime(); progress = remaining / duration; - local inversed = (not inverse and self.inverseDirection) or (inverse and not self.inverseDirection); + local inversed = not inverse ~= not self.inverseDirection if(inversed) then progress = 1 - progress; end end progress = progress > 0.0001 and progress or 0.0001; + if (self.useSmoothProgress) then self.smoothProgress:SetSmoothedValue(progress); else @@ -861,12 +862,13 @@ local function modify(parent, region, data) region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]); + function region:UpdateTime() local progress = 1; if (self.duration ~= 0) then local remaining = self.expirationTime - GetTime() progress = remaining / self.duration - local inversed = self.inverse ~= region.inverseDirection + local inversed = not self.inverse ~= not region.inverseDirection if(inversed) then progress = 1 - progress; end diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index 2f4b574..96b650c 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -379,8 +379,10 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource local pausedProperty = progressSource[6] local remainingProperty = progressSource[7] if progressType == "number" then - local value = state[property] or 0 - local total = totalProperty and state[totalProperty] or 0 + local value = state[property] + if type(value) ~= "number" then value = 0 end + local total = totalProperty and state[totalProperty] + if type(total) ~= "number" then total = 0 end -- We don't care about inverse or paused local adjustMin if minMaxConfig.adjustedMin then @@ -415,9 +417,12 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource local remaining if paused then remaining = remainingProperty and state[remainingProperty] - expirationTime = GetTime() + (remaining or 0) + expirationTime = GetTime() + (type(remaining) == "number" and remaining or 0) else - expirationTime = state[property] or math.huge + expirationTime = state[property] + if type(expirationTime) ~= "number" then + expirationTime = math.huge + end end local duration = totalProperty and state[totalProperty] or 0 local adjustMin diff --git a/WeakAuras/RegionTypes/Texture.lua b/WeakAuras/RegionTypes/Texture.lua index 264d155..5fffc9a 100644 --- a/WeakAuras/RegionTypes/Texture.lua +++ b/WeakAuras/RegionTypes/Texture.lua @@ -181,6 +181,7 @@ local function modify(parent, region, data) if region.state.texture then region.texture:SetTexture(region.state.texture); end + region:UpdateProgress() end function region:Color(r, g, b, a) diff --git a/WeakAuras/SubRegionTypes/Tick.lua b/WeakAuras/SubRegionTypes/Tick.lua index 4db41ea..93c5244 100644 --- a/WeakAuras/SubRegionTypes/Tick.lua +++ b/WeakAuras/SubRegionTypes/Tick.lua @@ -101,7 +101,7 @@ local function GetProperties(parentData, data) local result = CopyTable(properties) for i in ipairs(data.tick_placements) do - result["tick_placement" .. i] = { + result["tick_placements." .. i] = { display = #data.tick_placements > 1 and L["Placement %i"]:format(i) or L["Placement"], setter = "SetTickPlacementAt", type = "number", @@ -286,8 +286,8 @@ local funcs = { else tick_placement = self.progressData[i].expirationTime - GetTime() + self.tick_placements[i] end - elseif self.progressType == "static" then - tick_placement = self.progressData[i].value + self.progressData[i].tick_placements[i] + elseif self.progressData[i].progressType == "static" then + tick_placement = self.progressData[i].value + self.tick_placements[i] end end end diff --git a/WeakAuras/Transmission.lua b/WeakAuras/Transmission.lua index 5e6f66d..53b6176 100644 --- a/WeakAuras/Transmission.lua +++ b/WeakAuras/Transmission.lua @@ -537,8 +537,9 @@ end local function crossRealmSendCommMessage(prefix, text, target, queueName, callbackFn, callbackArg) local chattype = "WHISPER" ---[[ - if target then + --[[if target and not UnitIsSameServer(target) then + -- WORKAROUND https://github.com/Stanzilla/WoWUIBugs/issues/535, and use RAID/PARTY comms for connected realms + if target and (UnitRealmRelationship(target) or 0) ~= 1 then if UnitInRaid(target) then chattype = "RAID" text = ("§§%s:%s"):format(target, text) @@ -546,8 +547,7 @@ local function crossRealmSendCommMessage(prefix, text, target, queueName, callba chattype = "PARTY" text = ("§§%s:%s"):format(target, text) end - end -]] + end]] Comm:SendCommMessage(prefix, text, chattype, target, queueName, callbackFn, callbackArg) end diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index 1c6862e..df12210 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -25,7 +25,8 @@ Private.glow_action_types = { Private.glow_frame_types = { UNITFRAME = L["Unit Frame"], - FRAMESELECTOR = L["Frame Selector"] + FRAMESELECTOR = L["Frame Selector"], + PARENTFRAME = L["Parent Frame"] } if WeakAuras.isAwesomeEnabled() then Private.glow_frame_types.NAMEPLATE = L["Nameplate"] @@ -159,7 +160,7 @@ Private.format_types = { none = { display = L["None"], AddOptions = function() end, - CreateFormatter = function() end + CreateFormatter = function() return nil end }, string = { display = L["String"], @@ -1849,7 +1850,8 @@ Private.string_operator_types = { Private.weapon_types = { ["main"] = MAINHANDSLOT, - ["off"] = SECONDARYHANDSLOT + ["off"] = SECONDARYHANDSLOT, + ["ranged"] = RANGEDSLOT, } Private.swing_types = { diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 21cf752..8aab8b8 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1,6 +1,6 @@ local AddonName, Private = ... -local internalVersion = 71 +local internalVersion = 73 -- Lua APIs local insert = table.insert @@ -1353,7 +1353,7 @@ local function GetInstanceTypeAndSize() end function WeakAuras.InstanceType() - return GetInstanceTypeAndSize(), nil + return (GetInstanceTypeAndSize()) end function WeakAuras.InstanceDifficulty() @@ -2143,22 +2143,6 @@ local function loadOrder(tbl, idtable) if(data.parent) then if(idtable[data.parent]) then if depends[data.parent] then - -- There was an unfortunate bug in update.lua in 2022 that resulted - -- in auras having a circular dependencies - -- Fix one of the two known cases here - -- We can probably remove this code in 2023 again - for d in pairs(depends) do - local uid = idtable[d].uid - if uid == "fjtz3A6LwBW" then -- Fojji - Deathknight UI, need to fixup a lot - local cycleRoot = d - idtable[cycleRoot].parent = nil - for d in pairs(depends) do - tDeleteItem(idtable[d].controlledChildren, cycleRoot) - end - return loadOrder(tbl, idtable) - end - coroutine.yield() - end error("Circular dependency in Private.AddMany between "..table.concat(depends, ", ")); else if not(loaded[data.parent]) then @@ -2187,6 +2171,7 @@ local function loadOrder(tbl, idtable) return order end +local pAdd function Private.AddMany(tbl, takeSnapshots) local idtable = {}; local anchorTargets = {} @@ -2222,7 +2207,7 @@ function Private.AddMany(tbl, takeSnapshots) else local ok = pcall(WeakAuras.PreAdd, data) if not ok then - geterrorhandler() + Private.GetErrorHandlerUid(data.uid, "PreAdd") prettyPrint(L["Unable to modernize aura '%s'. This is probably due to corrupt data or a bad migration, please report this to the WeakAuras team."]:format(data.id)) if data.regionType == "dynamicgroup" or data.regionType == "group" then prettyPrint(L["All children of this aura will also not be loaded, to minimize the chance of further corruption."]) @@ -2237,9 +2222,17 @@ function Private.AddMany(tbl, takeSnapshots) for _, data in ipairs(order) do if not bads[data.id] then - WeakAuras.Add(data) - coroutine.yield() + if data.parent and bads[data.parent] then + bads[data.id] = true + else + local ok = pcall(pAdd, data) + if not ok then + Private.GetErrorHandlerUid(data.uid, "pAdd") + bads[data.id] = true + end + end end + coroutine.yield() end for id in pairs(anchorTargets) do @@ -2637,7 +2630,7 @@ function WeakAuras.PreAdd(data) data.expanded = nil end -local function pAdd(data, simpleChange) +function pAdd(data, simpleChange) local id = data.id; if not(id) then error("Improper arguments to WeakAuras.Add - id not defined"); @@ -3182,6 +3175,7 @@ function Private.HandleGlowAction(actions, region) and region.state.unit ) or (actions.glow_frame_type == "FRAMESELECTOR" and actions.glow_frame) + or (actions.glow_frame_type == "PARENTFRAME" and region:GetParent()) ) then local glow_frame, should_glow_frame @@ -3206,6 +3200,9 @@ function Private.HandleGlowAction(actions, region) if not(WeakAuras.isAwesomeEnabled()) then return end glow_frame = WeakAuras.GetNamePlateForUnit(region.state.unit) should_glow_frame = true + elseif actions.glow_frame_type == "PARENTFRAME" then + glow_frame = region:GetParent() + should_glow_frame = true end if should_glow_frame then diff --git a/WeakAurasOptions/AceGUI-Widgets/WeakAurasStatusbarAtlasWidget.lua b/WeakAurasOptions/AceGUI-Widgets/WeakAurasStatusbarAtlasWidget.lua new file mode 100644 index 0000000..ff20bb1 --- /dev/null +++ b/WeakAurasOptions/AceGUI-Widgets/WeakAurasStatusbarAtlasWidget.lua @@ -0,0 +1,233 @@ +-- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 +-- Original Widget created by Yssaril, modified by WeakAuras Team to handle Atlas + +local AceGUI = LibStub("AceGUI-3.0") +local Media = LibStub("LibSharedMedia-3.0") + +local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") + +do + local widgetType = "WA_LSM30_StatusbarAtlas" + local widgetVersion = 1 + + local contentFrameCache = {} + local function ReturnSelf(self) + self:ClearAllPoints() + self:Hide() + self.check:Hide() + table.insert(contentFrameCache, self) + end + + local function ContentOnClick(this, button) + local self = this.obj + self:Fire("OnValueChanged", this.text:GetText()) + if self.dropdown then + self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) + end + end + + local function GetContentLine() + local frame + if next(contentFrameCache) then + frame = table.remove(contentFrameCache) + else + frame = CreateFrame("Button", nil, UIParent) + --frame:SetWidth(200) + frame:SetHeight(18) + frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") + frame:SetScript("OnClick", ContentOnClick) + local check = frame:CreateTexture("OVERLAY") + check:SetWidth(16) + check:SetHeight(16) + check:SetPoint("LEFT",frame,"LEFT",1,-1) + check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") + check:Hide() + frame.check = check + local bar = frame:CreateTexture("ARTWORK") + bar:SetHeight(16) + bar:SetPoint("LEFT",check,"RIGHT",1,0) + bar:SetPoint("RIGHT",frame,"RIGHT",-1,0) + frame.bar = bar + local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") + + local font, size = text:GetFont() + text:SetFont(font,size,"OUTLINE") + + text:SetPoint("TOPLEFT", check, "TOPRIGHT", 3, 0) + text:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 0) + text:SetJustifyH("LEFT") + text:SetText("Test Test Test Test Test Test Test") + frame.text = text + frame.ReturnSelf = ReturnSelf + end + frame:Show() + return frame + end + + local function OnAcquire(self) + self:SetHeight(44) + self:SetWidth(200) + end + + local function OnRelease(self) + self:SetText("") + self:SetLabel("") + self:SetDisabled(false) + + self.value = nil + self.list = nil + self.open = nil + self.hasClose = nil + + self.frame:ClearAllPoints() + self.frame:Hide() + end + + local function SetValue(self, value) -- Set the value to an item in the List. + if self.list then + self:SetText(value or "") + end + self.value = value + end + + local function GetValue(self) + return self.value + end + + local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) + self.list = list or Media:HashTable("statusbar") + end + + + local function SetText(self, text) -- Set the text displayed in the box. + self.frame.text:SetText(text or "") + local statusbar = self.list[text] ~= text and self.list[text] or Media:Fetch('statusbar', text) + self.bar:SetTexture(statusbar) + end + + local function SetLabel(self, text) -- Set the text for the label. + self.frame.label:SetText(text or "") + end + + local function AddItem(self, key, value) -- Add an item to the list. + self.list = self.list or {} + self.list[key] = value + end + local SetItemValue = AddItem -- Set the value of a item in the list. <> + + local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> + local function GetMultiselect() return false end-- Query the multi-select flag. <> + local function SetItemDisabled(self, key) end-- Disable one item in the list. <> + + local function SetDisabled(self, disabled) -- Disable the widget. + self.disabled = disabled + if disabled then + self.frame:Disable() + else + self.frame:Enable() + end + end + + local function textSort(a,b) + return string.upper(a) < string.upper(b) + end + + local sortedlist = {} + local function ToggleDrop(this) + local self = this.obj + if self.dropdown then + self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) + AceGUI:ClearFocus() + else + AceGUI:SetFocus(self) + self.dropdown = AGSMW:GetDropDownFrame() + local width = self.frame:GetWidth() + self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") + self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0) + for k, v in pairs(self.list) do + sortedlist[#sortedlist+1] = k + end + table.sort(sortedlist, textSort) + for i, k in ipairs(sortedlist) do + local f = GetContentLine() + f.text:SetText(k) + --print(k) + if k == self.value then + f.check:Show() + end + + local statusbar = self.list[k] ~= k and self.list[k] or Media:Fetch('statusbar',k) + f.bar:SetTexture(statusbar) + f.obj = self + f.dropdown = self.dropdown + self.dropdown:AddFrame(f) + end + wipe(sortedlist) + end + end + + local function ClearFocus(self) + if self.dropdown then + self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) + end + end + + local function OnHide(this) + local self = this.obj + if self.dropdown then + self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) + end + end + + local function Drop_OnEnter(this) + this.obj:Fire("OnEnter") + end + + local function Drop_OnLeave(this) + this.obj:Fire("OnLeave") + end + + local function Constructor() + local frame = AGSMW:GetBaseFrame() + local self = {} + + self.type = widgetType + self.frame = frame + frame.obj = self + frame.dropButton.obj = self + frame.dropButton:SetScript("OnEnter", Drop_OnEnter) + frame.dropButton:SetScript("OnLeave", Drop_OnLeave) + frame.dropButton:SetScript("OnClick",ToggleDrop) + frame:SetScript("OnHide", OnHide) + + local bar = frame:CreateTexture(nil, "OVERLAY") + bar:SetPoint("TOPLEFT", frame,"TOPLEFT",6,-25) + bar:SetPoint("BOTTOMRIGHT", frame,"BOTTOMRIGHT", -21, 5) + bar:SetAlpha(0.5) + self.bar = bar + + self.alignoffset = 31 + + self.OnRelease = OnRelease + self.OnAcquire = OnAcquire + self.ClearFocus = ClearFocus + self.SetText = SetText + self.SetValue = SetValue + self.GetValue = GetValue + self.SetList = SetList + self.SetLabel = SetLabel + self.SetDisabled = SetDisabled + self.AddItem = AddItem + self.SetMultiselect = SetMultiselect + self.GetMultiselect = GetMultiselect + self.SetItemValue = SetItemValue + self.SetItemDisabled = SetItemDisabled + self.ToggleDrop = ToggleDrop + + AceGUI:RegisterAsWidget(self) + return self + end + + AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) + +end diff --git a/WeakAurasOptions/ActionOptions.lua b/WeakAurasOptions/ActionOptions.lua index 6de47c1..5b7c137 100644 --- a/WeakAurasOptions/ActionOptions.lua +++ b/WeakAurasOptions/ActionOptions.lua @@ -649,10 +649,7 @@ function OptionsPrivate.GetActionOptions(data) end, name = L["Glow Frame Type"], order = 30.3, - values = { - UNITFRAME = L["Unit Frame"], - FRAMESELECTOR = L["Frame Selector"] - }, + values = OptionsPrivate.Private.glow_frame_types, hidden = function() return not data.actions.finish.do_glow or data.actions.finish.glow_action == nil diff --git a/WeakAurasOptions/ConditionOptions.lua b/WeakAurasOptions/ConditionOptions.lua index 08b8b4b..22e8da4 100644 --- a/WeakAurasOptions/ConditionOptions.lua +++ b/WeakAurasOptions/ConditionOptions.lua @@ -488,7 +488,6 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA args["condition" .. i .. "value" .. j] = { type = "toggle", width = WeakAuras.normalWidth, - name = blueIfNoValue(data, conditions[i].changes[j], "value", L["Differences"]), desc = descIfNoValue(data, conditions[i].changes[j], "value", propertyType), order = order, get = function() @@ -498,6 +497,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA } order = order + 1; if (propertyType == "number") then + args["condition" .. i .. "value" .. j].name = blueIfNoValue(data, conditions[i].changes[j], "value", L["Differences"]) local properties = allProperties.propertyMap[property]; if (properties.min or properties.softMin) and (properties.max or properties.softMax) then args["condition" .. i .. "value" .. j].type = "range"; @@ -513,6 +513,11 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA args["condition" .. i .. "value" .. j].type = "input"; args["condition" .. i .. "value" .. j].validate = WeakAuras.ValidateNumeric; end + else + args["condition" .. i .. "value" .. j].name = function() + local value = conditions[i].changes[j].value + return blueIfNoValue(data, conditions[i].changes[j], "value", L["Differences"], value and L["ON"] or L["OFF"]) + end end elseif (propertyType == "string" or propertyType == "texture") then args["condition" .. i .. "value" .. j] = { diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index f721f03..31c8bd1 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -1386,8 +1386,10 @@ function OptionsPrivate.CreateFrame() for _, id in ipairs(batchSelection) do if not alreadySelected[id] then - displayButtons[id]:Pick() - tinsert(tempGroup.controlledChildren, id) + if displayButtons[id].frame:IsVisible() then + displayButtons[id]:Pick() + tinsert(tempGroup.controlledChildren, id) + end end end frame:ClearOptions(tempGroup.id) diff --git a/WeakAurasOptions/RegionOptions/AuraBar.lua b/WeakAurasOptions/RegionOptions/AuraBar.lua index abd9179..d3a601b 100644 --- a/WeakAurasOptions/RegionOptions/AuraBar.lua +++ b/WeakAurasOptions/RegionOptions/AuraBar.lua @@ -6,18 +6,70 @@ local L = WeakAuras.L; -- Create region options table local function createOptions(id, data) + local statusbarList = {} + WeakAuras.Mixin(statusbarList, SharedMedia:HashTable("statusbar")) + -- Region options local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; local options = { __title = L["Progress Bar Settings"], __order = 1, - texture = { + textureSource = { type = "select", - dialogControl = "LSM30_Statusbar", order = 1, width = WeakAuras.doubleWidth, + name = L["Texture Selection Mode"], + values = { + LSM = L["LibSharedMedia"], + Picker = L["Texture Picker"] + }, + get = function() + return data.textureSource or "LSM" + end, + }, + texture = { + type = "select", + dialogControl = "WA_LSM30_StatusbarAtlas", + order = 2, + width = WeakAuras.doubleWidth, name = L["Bar Texture"], - values = AceGUIWidgetLSMlists.statusbar + values = statusbarList, + hidden = function() + return data.textureSource == "Picker" + end + }, + textureInput = { + type = "input", + width = WeakAuras.doubleWidth - 0.15, + name = L["Texture"], + order = 3, + hidden = function() + return data.textureSource ~= "Picker" + end + }, + chooseTexture = { + type = "execute", + name = L["Choose"], + width = 0.15, + order = 4, + func = function() + local path = {} + local paths = {} + for child in OptionsPrivate.Private.TraverseLeafsOrAura(data) do + paths[child.id] = path + end + OptionsPrivate.OpenTexturePicker(data, paths, { + texture = "textureInput", + color = "color", + }, OptionsPrivate.Private.texture_types, nil, true) + end, + imageWidth = 24, + imageHeight = 24, + control = "WeakAurasIcon", + image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\browse", + hidden = function() + return data.textureSource ~= "Picker" + end }, orientation = { type = "select", diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index 3dd6e91..24ba71b 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -97,3 +97,4 @@ AceGUI-Widgets\AceGuiWidget-WeakAurasProgressBar.lua AceGUI-Widgets\AceGUIWidget-WeakAurasSpinBox.lua AceGUI-Widgets\AceGUIWidget-WeakAurasInputFocus.lua AceGUI-Widgets\AceGUIWidget-WeakAurasMediaSound.lua +AceGUI-Widgets\WeakAurasStatusbarAtlasWidget.lua