diff --git a/WeakAuras/AuraEnvironment.lua b/WeakAuras/AuraEnvironment.lua index fa5f8cb..e6eacd9 100644 --- a/WeakAuras/AuraEnvironment.lua +++ b/WeakAuras/AuraEnvironment.lua @@ -148,7 +148,7 @@ local blockedFunctions = { GuildUninvite = true, securecall = true, DeleteCursorItem = true, - ChatEdit_SendText = true + ChatEdit_SendText = true, } local blockedTables = { @@ -263,7 +263,6 @@ end function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) local data = id and WeakAuras.GetData(id) - local region = id and Private.EnsureRegion(id, cloneId) if not data then -- Pop the last aura_env from the stack, and update current_aura_env appropriately. tremove(aura_env_stack) @@ -276,6 +275,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) else -- Existing config is initialized to a high enough value if environment_initialized[id] == 2 or (onlyConfig and environment_initialized[id] == 1) then + local region = WeakAuras.GetRegion(id, cloneId) -- Point the current environment to the correct table current_uid = data.uid current_aura_env = aura_environments[id] @@ -296,7 +296,6 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) current_aura_env.cloneId = cloneId current_aura_env.state = state current_aura_env.states = states - current_aura_env.region = region tinsert(aura_env_stack, {current_aura_env, data.uid}) if not data.controlledChildren then @@ -304,6 +303,7 @@ function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) end else -- Either this aura environment has not yet been initialized, or it was reset via an edit in WeakaurasOptions + local region = id and Private.EnsureRegion(id, cloneId) environment_initialized[id] = 2 aura_environments[id] = aura_environments[id] or {} getDataCallCounts[id] = getDataCallCounts[id] or 0 diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 305f54d..fa15030 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -251,11 +251,11 @@ local function UpdateToolTipDataInMatchData(matchData, time) local changed = false if matchData.unit and matchData.index and matchData.filter then - local tooltip, _, tooltip1, tooltip2, tooltip3 = WeakAuras.GetAuraTooltipInfo(matchData.unit, matchData.index, matchData.filter) + local tooltip, _, tooltip1, tooltip2, tooltip3, tooltip4 = WeakAuras.GetAuraTooltipInfo(matchData.unit, matchData.index, matchData.filter) changed = matchData.tooltip ~= tooltip or matchData.tooltip1 ~= tooltip1 - or matchData.tooltip2 ~= tooltip2 or matchData.tooltip3 ~= tooltip3 - matchData.tooltip, matchData.tooltip1, matchData.tooltip2, matchData.tooltip3 = tooltip, tooltip1, tooltip2, tooltip3 + or matchData.tooltip2 ~= tooltip2 or matchData.tooltip3 ~= tooltip3 or matchData.tooltip4 ~= tooltip4 + matchData.tooltip, matchData.tooltip1, matchData.tooltip2, matchData.tooltip3, matchData.tooltip4 = tooltip, tooltip1, tooltip2, tooltip3, tooltip4 end matchData.tooltipUpdated = time @@ -491,6 +491,7 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat tooltip1 = bestMatch.tooltip1, tooltip2 = bestMatch.tooltip2, tooltip3 = bestMatch.tooltip3, + tooltip4 = bestMatch.tooltip4, affected = affected, unaffected = unaffected, totalStacks = totalStacks, @@ -626,6 +627,11 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat changed = true end + if state.tooltip4 ~= bestMatch.tooltip4 then + state.tooltip4 = bestMatch.tooltip4 + changed = true + end + if state.matchCount ~= matchCount then state.matchCount = matchCount changed = true @@ -790,8 +796,8 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, changed = true end - if state.tooltip or state.tooltip1 or state.tooltip2 or state.tooltip3 then - state.tooltip, state.tooltip1, state.tooltip2, state.tooltip3 = nil, nil, nil, nil + if state.tooltip or state.tooltip1 or state.tooltip2 or state.tooltip3 or state.tooltip4 then + state.tooltip, state.tooltip1, state.tooltip2, state.tooltip3, state.tooltip4 = nil, nil, nil, nil, nil changed = true end @@ -1864,6 +1870,8 @@ local function UnloadAura(scanFuncName, id) if triggerInfo.id == id or not id then if triggerInfo.nextScheduledCheckHandle then timer:CancelTimer(triggerInfo.nextScheduledCheckHandle) + triggerInfo.nextScheduledCheck = nil + triggerInfo.nextScheduledCheckHandle = nil end nameData[triggerInfo] = nil end @@ -1890,6 +1898,8 @@ local function UnloadGeneral(scanFuncGeneral, id) if triggerInfo.id == id or not id then if triggerInfo.nextScheduledCheckHandle then timer:CancelTimer(triggerInfo.nextScheduledCheckHandle) + triggerInfo.nextScheduledCheck = nil + triggerInfo.nextScheduledCheckHandle = nil end debuffData[triggerInfo] = nil end @@ -2619,6 +2629,7 @@ function BuffTrigger.GetAdditionalProperties(data, triggernum) ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip1|r - " .. L["First Value of Tooltip Text"] .. "\n" ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip2|r - " .. L["Second Value of Tooltip Text"] .. "\n" ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip3|r - " .. L["Third Value of Tooltip Text"] .. "\n" + ret = ret .. "|cFFFF0000%".. triggernum .. ".tooltip4|r - " .. L["Fourth Value of Tooltip Text"] .. "\n" end if trigger.unit ~= "multi" and trigger.fetchRaidMark then @@ -2726,6 +2737,10 @@ function BuffTrigger.GetTriggerConditions(data, triggernum) display = L["Tooltip Value 3"], type = "number" } + result["tooltip4"] = { + display = L["Tooltip Value 4"], + type = "number" + } end if trigger.unit ~= "multi" then @@ -3362,6 +3377,11 @@ function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) local trigger = data.triggers[triggernum].trigger if trigger.useName and trigger.auranames then for index, name in pairs(trigger.auranames) do + if index > 10 then + tinsert(namestable, {" ", "[...]"}) + break + end + local left = " " if(index == 1) then if(#trigger.auranames > 0) then @@ -3386,6 +3406,11 @@ function BuffTrigger.GetTriggerDescription(data, triggernum, namestable) if trigger.useExactSpellId and trigger.auraspellids then for index, spellId in pairs(trigger.auraspellids) do + if index > 10 then + tinsert(namestable, {" ", "[...]"}) + break + end + local left = " " if index == 1 then if #trigger.auraspellids > 0 then diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 72a63a1..207929d 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -3136,10 +3136,8 @@ do end end WeakAuras.ScanEvents("DBM_TimerUpdate", id) - elseif event == "DBM_SetStage" then - local mod, modId, stage = ... - currentStage = stage - WeakAuras.ScanEvents("DBM_SetStage", ...) + elseif event == "DBM_SetStage" or event == "DBM_Pull" or event == "DBM_Wipe" or event == "DBM_Kill" then + WeakAuras.ScanEvents("DBM_SetStage") else -- DBM_Announce WeakAuras.ScanEvents(event, ...) end @@ -3185,7 +3183,7 @@ do end function WeakAuras.GetDBMStage() - return currentStage + return DBM:GetStage() end function WeakAuras.GetDBMTimerById(id) @@ -3349,6 +3347,18 @@ do if BigWigsLoader then BigWigsLoader.RegisterMessage(WeakAuras, event, bigWigsEventCallback) registeredBigWigsEvents[event] = true + if event == "BigWigs_SetStage" then + -- on init of BigWigs_SetStage callback, we want to fetch currentStage in case we are already in an encounter when this is run + if BigWigs and BigWigs.IterateBossModules then + local stage = 0 + for _, module in BigWigs:IterateBossModules() do + if module:IsEngaged() then + stage = math.max(stage, module:GetStage() or 1) + end + end + currentStage = stage + end + end end end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 9e6f476..0f7477f 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -3868,9 +3868,12 @@ Private.event_prototypes = { internal_events = { "DBM_SetStage" }, + force_events = "DBM_SetStage", name = L["DBM Stage"], init = function(trigger) - WeakAuras.RegisterDBMCallback("DBM_SetStage"); + WeakAuras.RegisterDBMCallback("DBM_SetStage") + WeakAuras.RegisterDBMCallback("DBM_Pull") + WeakAuras.RegisterDBMCallback("DBM_Kill") return "" end, args = { @@ -4150,7 +4153,8 @@ Private.event_prototypes = { { name = "spellId", init = "arg", - display = L["Spell Id"], + display = L["Key"], + desc = L["The 'Key' value can be found in the BigWigs options of a specific spell"], type = "longstring" }, { @@ -4306,7 +4310,7 @@ Private.event_prototypes = { trigger.use_cloneId and "true" or "false", trigger.use_extend and tonumber(trigger.extend or 0) or 0, trigger.use_remaining and "true" or "false", - trigger.remaining or 0, + type(trigger.remaining) == "number" and trigger.remaining or 0, trigger.use_emphasized == nil and "nil" or trigger.use_emphasized and "true" or "false", trigger.use_cast == nil and "nil" or trigger.use_cast and "true" or "false", trigger.use_isCooldown == nil and "nil" or trigger.use_isCooldown and "true" or "false", @@ -4317,7 +4321,8 @@ Private.event_prototypes = { args = { { name = "spellId", - display = L["Spell Id"], + display = L["Key"], + desc = L["The 'Key' value can be found in the BigWigs options of a specific spell"], type = "string", conditionType = "string", }, @@ -6420,7 +6425,7 @@ Private.event_prototypes = { type = "toggle", test = "true", enable = function(trigger) - return trigger.unit == "player" + return trigger.unit == "player" and not trigger.use_inverse end, reloadOptions = true }, diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index 7d1b923..7ab84e8 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -160,6 +160,16 @@ local function SoundRepeatStop(self) Private.StopProfileSystem("sound"); end +--[[ +local function SoundStop(self) + Private.StartProfileSystem("sound"); + if (self.soundHandle) then + StopSound(self.soundHandle); + end + Private.StopProfileSystem("sound"); +end +]] + local function SoundPlayHelper(self) Private.StartProfileSystem("sound"); local options = self.soundOptions; @@ -174,24 +184,52 @@ local function SoundPlayHelper(self) end if (options.sound == " custom") then - if (options.sound_path) then - pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master"); - end + local ok, _, handle = pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master") + --if ok then + --self.soundHandle = handle + --end elseif (options.sound == " KitID") then - if (options.sound_kit_id) then - pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master"); - end + local ok, _, handle = pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master") + --if ok then + --self.soundHandle = handle + --end else - pcall(PlaySoundFile, options.sound, options.sound_channel or "Master"); + local ok, _, handle = pcall(PlaySoundFile, options.sound, options.sound_channel or "Master") + --if ok then + --self.soundHandle = handle + --end end Private.StopProfileSystem("sound"); end +local function hasSound(options) + if (options.sound == " custom") then + if (options.sound_path and options.sound_path ~= "") then + return true + end + elseif (options.sound == " KitID") then + if (options.sound_kit_id and options.sound_kit_id ~= "") then + return true + end + else + if options.sound and options.sound ~= "" then + return true + end + end + return false +end + local function SoundPlay(self, options) if (not options or WeakAuras.IsOptionsOpen()) then return end Private.StartProfileSystem("sound"); + if not hasSound(options) then + Private.StopProfileSystem("sound") + return + end + + --self:SoundStop(); self:SoundRepeatStop(); self.soundOptions = options; diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index e9d54d8..e537f46 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1392,8 +1392,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) local inCombat = UnitAffectingCombat("player") -- or UnitAffectingCombat("pet"); local alive = not UnitIsDeadOrGhost('player') local pvp = UnitIsPVPFreeForAll("player") or UnitIsPVP("player") - local vehicle = UnitInVehicle("player") or UnitOnTaxi("player") - local vehicleUi = UnitHasVehicleUI("player") + local vehicle = UnitInVehicle("player") or UnitOnTaxi("player") or false + local vehicleUi = UnitHasVehicleUI("player") or false local raidMemberType = 0 if UnitIsPartyLeader("player") then @@ -2691,7 +2691,7 @@ local function pAdd(data, simpleChange) end end - -- If the aura has a onHide animation we need to cancel it to ensure it's truely hidden now + -- If the aura has a onHide animation we need to cancel it to ensure it's truly hidden now if Private.regions[id] then Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true) end @@ -5012,11 +5012,11 @@ local function GetAnchorFrame(data, region, parent) if unit then local frame = unit and WeakAuras.GetNamePlateForUnit(unit) if frame then return frame end - if WeakAuras.IsOptionsOpen() then - Private.ensurePRDFrame() - personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType) - return personalRessourceDisplayFrame - end + end + if WeakAuras.IsOptionsOpen() then + Private.ensurePRDFrame() + personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType) + return personalRessourceDisplayFrame end end diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua index e475d98..e3d48bd 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua @@ -5,7 +5,7 @@ local L = WeakAuras.L local pairs, next, type, unpack = pairs, next, type, unpack -local Type, Version = "WeakAurasPendingUpdateButton", 3 +local Type, Version = "WeakAurasPendingUpdateButton", 5 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then @@ -100,7 +100,7 @@ local methods = { local auraData = WeakAuras.GetData(auraId) if auraData then local success, error = WeakAuras.Import(self.companionData.encoded, auraData) - if not success then + if not success and error ~= nil then WeakAuras.prettyPrint(error) end end diff --git a/WeakAurasOptions/BuffTrigger2.lua b/WeakAurasOptions/BuffTrigger2.lua index f82efc4..821c299 100644 --- a/WeakAurasOptions/BuffTrigger2.lua +++ b/WeakAurasOptions/BuffTrigger2.lua @@ -587,7 +587,7 @@ local function GetBuffTriggerOptions(data, triggernum) fetchTooltip = { type = "toggle", name = L["Fetch Tooltip Information"], - desc = L["This adds %tooltip, %tooltip1, %tooltip2, %tooltip3 as text replacements and also allows filtering based on the tooltip content/values."], + desc = L["This adds %tooltip, %tooltip1, %tooltip2, %tooltip3 and %tooltip4 as text replacements and also allows filtering based on the tooltip content/values."], order = 64.5, width = WeakAuras.doubleWidth, hidden = function() return not (trigger.type == "aura2" and trigger.unit ~= "multi" and not IsSingleMissing(trigger)) end diff --git a/WeakAurasOptions/InformationOptions.lua b/WeakAurasOptions/InformationOptions.lua index ff0bb37..f8a58f3 100644 --- a/WeakAurasOptions/InformationOptions.lua +++ b/WeakAurasOptions/InformationOptions.lua @@ -91,6 +91,35 @@ function OptionsPrivate.GetInformationOptions(data) } order = order + 1 end + if OptionsPrivate.HasWagoUrl(data.id) then + args.ignoreWagoUpdate = { + type = "toggle", + name = L["Ignore Wago updates"], + desc = OptionsPrivate.IsWagoUpdateIgnored(data.id) and L["Do you want to enable updates for this aura"] or L["Do you want to ignore updates for this aura"], + width = WeakAuras.doubleWidth, + get = function() return OptionsPrivate.IsWagoUpdateIgnored(data.id) end, + set = function(info, v) + local auraData = WeakAuras.GetData(data.id) + if auraData then + local ignoreUpdate + if OptionsPrivate.IsWagoUpdateIgnored(data.id) then + ignoreUpdate = nil + else + ignoreUpdate = true + end + for child in OptionsPrivate.Private.TraverseAll(auraData) do + child.ignoreWagoUpdate = ignoreUpdate + OptionsPrivate.ClearOptions(child.id) + end + WeakAuras.ClearAndUpdateOptions(data.id) + end + OptionsPrivate.SortDisplayButtons(nil, true) + + end, + order = order + } + order = order + 1 + end -- Description diff --git a/WeakAurasOptions/OptionsFrames/TextEditor.lua b/WeakAurasOptions/OptionsFrames/TextEditor.lua index 884d554..82e7bd7 100644 --- a/WeakAurasOptions/OptionsFrames/TextEditor.lua +++ b/WeakAurasOptions/OptionsFrames/TextEditor.lua @@ -765,6 +765,7 @@ local function ConstructTextEditor(frame) editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged) editor:ClearFocus() + frame.window = "default" frame:UpdateFrameVisible() WeakAuras.FillOptions() diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index c67c5ae..b5b75b3 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -479,25 +479,29 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { preferredindex = STATICPOPUP_NUMDIALOGS, } -StaticPopupDialogs["WEAKAURAS_CONFIRM_IGNORE_UPDATES"] = { - text = L["Do you want to ignore all future updates for this aura"], - button1 = L["Yes"], - button2 = L["Cancel"], - OnAccept = function(self) - if self.data then - local auraData = WeakAuras.GetData(self.data) - if auraData then - for child in OptionsPrivate.Private.TraverseAll(auraData) do - child.ignoreWagoUpdate = true +function OptionsPrivate.IsWagoUpdateIgnored(auraId) + local auraData = WeakAuras.GetData(auraId) + if auraData then + for child in OptionsPrivate.Private.TraverseAll(auraData) do + if child.ignoreWagoUpdate then + return true end end - OptionsPrivate.SortDisplayButtons(nil, true) end - end, - OnCancel = function(self) end, - whileDead = true, - preferredindex = STATICPOPUP_NUMDIALOGS, -} + return false +end + +function OptionsPrivate.HasWagoUrl(auraId) +local auraData = WeakAuras.GetData(auraId) + if auraData then + for child in OptionsPrivate.Private.TraverseAll(auraData) do + if child.url and child.url ~= "" then + return true + end + end + end +return false +end function OptionsPrivate.ConfirmDelete(toDelete, parents) if toDelete then