-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
Conversation
@@ -3365,6 +3365,7 @@ function WeakAuras.WatchUnitChange(unit) | |||
if not watchUnitChange then | |||
---@class UnitChangeFrame: FrameScriptObject | |||
watchUnitChange = CreateFrame("Frame"); | |||
watchUnitChange.trackedUnits = {} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.WatchUnitChange could exit sooner if watchUnitChange.trackedUnits[unit] ~= nil (as this function is called more often now) and |
This allows for exemple to get the nameplate for your current target, focus, or softtarget
No description provided.