Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable CLEU custom triggers without subevent filter, and don't pre-load on init in raid #5470

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions WeakAuras/GenericTrigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
53 changes: 1 addition & 52 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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()

Expand Down Expand Up @@ -3280,8 +3231,6 @@ function pAdd(data, simpleChange)
activatedConditions = {},
};

LoadEncounterInitScripts(id);

if (WeakAuras.IsOptionsOpen()) then
Private.FakeStatesFor(id, visible)
end
Expand Down
Loading