From c68d5ad6f155f8c4738f4691eaf4bc94c1c10c48 Mon Sep 17 00:00:00 2001 From: Buds Date: Mon, 7 Oct 2024 18:14:04 +0200 Subject: [PATCH 1/2] Disable CLEU triggers without filters --- WeakAuras/GenericTrigger.lua | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index fe9240bba5..d59a150d43 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -892,13 +892,6 @@ function Private.ScanEvents(event, arg1, arg2, ...) return; end Private.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); - - elseif (event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then - -- This reverts the COMBAT_LOG_EVENT_UNFILTERED_CUSTOM workaround so that custom triggers that check the event argument will work as expected - if(event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then - event = "COMBAT_LOG_EVENT_UNFILTERED"; - end - Private.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); else Private.ScanEventsInternal(event_list, event, arg1, arg2, ...); end @@ -1162,9 +1155,6 @@ function GenericTrigger.ScanWithFakeEvent(id, fake) end elseif (type(event.force_events) == "boolean" and event.force_events) then for i, eventName in pairs(event.events) do - if eventName == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" then - eventName = "COMBAT_LOG_EVENT_UNFILTERED" - end updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, eventName) or updateTriggerState; end for unit, unitData in pairs(event.unit_events) do @@ -1193,9 +1183,6 @@ function HandleEvent(frame, event, arg1, arg2, ...) if not(WeakAuras.IsPaused()) then if(event == "COMBAT_LOG_EVENT_UNFILTERED") then Private.ScanEvents(event); - -- This triggers the scanning of "hacked" COMBAT_LOG_EVENT_UNFILTERED events that were renamed in order to circumvent - -- the "proper" COMBAT_LOG_EVENT_UNFILTERED checks - Private.ScanEvents("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM"); else Private.ScanEvents(event, arg1, arg2, ...); end @@ -1445,18 +1432,10 @@ function GenericTrigger.LoadDisplays(toLoad, loadEvent, ...) for triggernum, data in pairs(events[id]) do if data.events then for index, event in pairs(data.events) do - if (event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then - if not genericTriggerRegisteredEvents["COMBAT_LOG_EVENT_UNFILTERED"] then - eventsToRegister["COMBAT_LOG_EVENT_UNFILTERED"] = true; - end - elseif (event == "FRAME_UPDATE") then + if (event == "FRAME_UPDATE") then register_for_frame_updates = true; - else - if (genericTriggerRegisteredEvents[event]) then - -- Already registered event - else - eventsToRegister[event] = true; - end + elseif not genericTriggerRegisteredEvents[event] then + eventsToRegister[event] = true; end end end @@ -1834,12 +1813,7 @@ function GenericTrigger.Add(data, region) if isCLEU then if hasParam then tinsert(trigger_events, "COMBAT_LOG_EVENT_UNFILTERED") - else - -- This is a dirty, lazy, dirty hack. "Proper" COMBAT_LOG_EVENT_UNFILTERED events are indexed by their sub-event types (e.g. SPELL_PERIODIC_DAMAGE), - -- but custom COMBAT_LOG_EVENT_UNFILTERED events are not guaranteed to have sub-event types. Thus, if the user specifies that they want to use - -- COMBAT_LOG_EVENT_UNFILTERED, this hack renames the event to COMBAT_LOG_EVENT_UNFILTERED_CUSTOM to circumvent the COMBAT_LOG_EVENT_UNFILTERED checks - -- that are already in place. Replacing all those checks would be a pain in the ass. - tinsert(trigger_events, "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") + -- We don't register CLEU events without parameters anymore end elseif isUnitEvent then -- not added to trigger_events @@ -1900,7 +1874,7 @@ function GenericTrigger.Add(data, region) if warnAboutCLEUEvents then Private.AuraWarnings.UpdateWarning(data.uid, "spammy_event_warning", "error", - L["|cFFFF0000Support for unfiltered COMBAT_LOG_EVENT_UNFILTERED is deprecated|r\nCOMBAT_LOG_EVENT_UNFILTERED without a filter is advised against as it’s very performance costly.\nFind more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"], true) + L["|cFFFF0000Support for unfiltered COMBAT_LOG_EVENT_UNFILTERED is deprecated|r\nCOMBAT_LOG_EVENT_UNFILTERED without a filter are disabled as it’s very performance costly.\nFind more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Custom-Triggers#events"]) else Private.AuraWarnings.UpdateWarning(data.uid, "spammy_event_warning") end From 3640f33717face04a08baddfdb492654e0f931c2 Mon Sep 17 00:00:00 2001 From: Buds Date: Mon, 7 Oct 2024 18:57:39 +0200 Subject: [PATCH 2/2] Don't pre-load in raid init scripts for auras with an encounterId load option --- WeakAuras/WeakAuras.lua | 53 +---------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 99c2a35c1f..58c7d6f476 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1364,7 +1364,6 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) db.migrationCutoff = db.migrationCutoff or 730 db.historyCutoff = db.historyCutoff or 730 - Private.UpdateCurrentInstanceType(); Private.SyncParentChildRelationships(); local isFirstUIDValidation = db.dbVersion == nil or db.dbVersion < 26; Private.ValidateUniqueDataIds(isFirstUIDValidation); @@ -1419,7 +1418,6 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) timer:ScheduleTimer(function() squelch_actions = false; end, remainingSquelch); -- No sounds while loading end CreateTalentCache() -- It seems that GetTalentInfo might give info about whatever class was previously being played, until PLAYER_ENTERING_WORLD - Private.UpdateCurrentInstanceType(); Private.InitializeEncounterAndZoneLists() end Private.PostAddCompanion() @@ -1547,48 +1545,6 @@ local function CreateEncounterTable(encounter_id) return WeakAuras.CurrentEncounter end -local encounterScriptsDeferred = {} -local function LoadEncounterInitScriptsImpl(id) - if (currentInstanceType ~= "raid") then - return - end - if (id) then - local data = db.displays[id] - if (data and data.load.use_encounterid and not Private.IsEnvironmentInitialized(id) and data.actions.init and data.actions.init.do_custom) then - Private.ActivateAuraEnvironment(id) - Private.ActivateAuraEnvironment(nil) - end - encounterScriptsDeferred[id] = nil - else - for id, data in pairs(db.displays) do - if (data.load.use_encounterid and not Private.IsEnvironmentInitialized(id) and data.actions.init and data.actions.init.do_custom) then - Private.ActivateAuraEnvironment(id) - Private.ActivateAuraEnvironment(nil) - end - end - end -end - -local function LoadEncounterInitScripts(id) - if not WeakAuras.IsLoginFinished() then - if encounterScriptsDeferred[id] then - return - end - loginQueue[#loginQueue + 1] = {LoadEncounterInitScriptsImpl, {id}} - encounterScriptsDeferred[id] = true - return - end - LoadEncounterInitScriptsImpl(id) -end - -function Private.UpdateCurrentInstanceType(instanceType) - if (not IsInInstance()) then - currentInstanceType = "none" - else - currentInstanceType = instanceType or select (2, GetInstanceInfo()) - end -end - local pausedOptionsProcessing = false; function Private.pauseOptionsProcessing(enable) pausedOptionsProcessing = enable; @@ -1736,8 +1692,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) specId, role, position = Private.LibSpecWrapper.SpecRolePositionForUnit("player") end - local size, difficulty, instanceType, instanceId, difficultyIndex= GetInstanceTypeAndSize() - Private.UpdateCurrentInstanceType(instanceType) + local size, difficulty, instanceType, instanceId, difficultyIndex = GetInstanceTypeAndSize() if (WeakAuras.CurrentEncounter) then if (instanceId ~= WeakAuras.CurrentEncounter.zone_id and not inCombat) then @@ -1746,10 +1701,6 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) end end - if (event == "ZONE_CHANGED_NEW_AREA") then - LoadEncounterInitScripts(); - end - local group = Private.ExecEnv.GroupType() local groupSize = GetNumGroupMembers() @@ -3280,8 +3231,6 @@ function pAdd(data, simpleChange) activatedConditions = {}, }; - LoadEncounterInitScripts(id); - if (WeakAuras.IsOptionsOpen()) then Private.FakeStatesFor(id, visible) end