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

WeakAuras.WatchUnitChange & UnitIsUnit #5029

Merged
merged 7 commits into from
Jun 2, 2024
Merged

Conversation

mrbuds
Copy link
Contributor

@mrbuds mrbuds commented Apr 25, 2024

No description provided.

@Stanzilla Stanzilla requested a review from InfusOnWoW May 3, 2024 21:10
WeakAuras/Prototypes.lua Outdated Show resolved Hide resolved
WeakAuras/GenericTrigger.lua Outdated Show resolved Hide resolved
@mrbuds mrbuds changed the title fix WeakAuras.WatchUnitChange & UnitIsUnit May 13, 2024
@@ -3365,6 +3365,7 @@ function WeakAuras.WatchUnitChange(unit)
if not watchUnitChange then
---@class UnitChangeFrame: FrameScriptObject
watchUnitChange = CreateFrame("Frame");
watchUnitChange.trackedUnits = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this to quickly check whether we are even interested in this specific unit. This avoids e.g. tracking all nameplates if there's no unit characteristics trigger for nameplates.


local function markerClear(unit)
watchUnitChange.raidmark[unit] = nil
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For almost every event, e.g. PLAYER_TARGET_CHANGED, we don't need to actually check whether the mark has changed, because we if the guid is different we'll send a UNIT_CHANGED anyway, and if it isn't different (e.g. a bogus event) then presumably the mark hasn't either.

elseif event == "RAID_TARGET_UPDATE" then
for unit in pairs(watchUnitChange.raidmark) do
markerUpdate(unit, eventsToSend)
end
elseif event == "UNIT_FACTION" then
if unit:sub(1, 9) == "nameplate" then
if watchUnitChange.trackedUnits[unit] then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the reaction was initially introduced it was only supposed to be only available on the nameplate unit, though it turns out that the option was not disabled/hidden for other unit types in the Unit Characteristics trigger.

Thus, fix that by removing this check, and making the reaction option available in all triggers.

roleUpdate(unit, eventsToSend)
elseif event == "UNIT_TARGET" then
-- i dont know why this event is register
local unitTarget = unit .. "target"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows e.g. checking whether boss1target == player.

WeakAuras/GenericTrigger.lua Outdated Show resolved Hide resolved
WeakAuras/GenericTrigger.lua Outdated Show resolved Hide resolved
@mrbuds
Copy link
Contributor Author

mrbuds commented Jun 1, 2024

WeakAuras.WatchUnitChange could exit sooner if watchUnitChange.trackedUnits[unit] ~= nil (as this function is called more often now)

and IsWrath needs to be go for rebase

@InfusOnWoW InfusOnWoW merged commit 0c7088b into WeakAuras:main Jun 2, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants