Commit 0b01c88b authored by Simpy's avatar Simpy 🐹
Browse files

limit the "Display Target" on nameplates to Player nameplate only (because the...

limit the "Display Target" on nameplates to Player nameplate only (because the event only seems to work for player and is the only actual way to get the correct "destination" for a spell this early)
parent 51c4779a
......@@ -87,7 +87,7 @@ function mod:UpdateElement_Cast(frame, event, ...)
end
end
if ( event == "UNIT_SPELLCAST_SENT" ) then
if ( unit == 'player' and event == "UNIT_SPELLCAST_SENT") then
frame.CastBar.curTarget = (arg2 and arg2 ~= "" and self.db.units[frame.UnitType].castbar.displayTarget) and arg2 or nil
end
......
......@@ -896,9 +896,12 @@ function mod:OnEvent(event, unit, ...)
end
function mod:RegisterEvents(frame, unit)
local displayedUnit;
if ( unit ~= frame.displayedUnit ) then
displayedUnit = frame.displayedUnit;
local displayedUnit
if unit ~= frame.displayedUnit then
displayedUnit = frame.displayedUnit
end
if not unit then
unit = frame.unit
end
if(self.db.units[frame.UnitType].healthbar.enable or (frame.isTarget and self.db.alwaysShowTargetHealth)) then
......@@ -939,10 +942,13 @@ function mod:RegisterEvents(frame, unit)
frame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP");
frame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
frame:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
frame:RegisterUnitEvent("UNIT_SPELLCAST_SENT", unit, displayedUnit);
frame:RegisterUnitEvent("UNIT_SPELLCAST_START", unit, displayedUnit);
frame:RegisterUnitEvent("UNIT_SPELLCAST_STOP", unit, displayedUnit);
frame:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", unit, displayedUnit);
if unit == 'player' then
frame:RegisterUnitEvent("UNIT_SPELLCAST_SENT", unit, displayedUnit);
end
end
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
......@@ -950,7 +956,7 @@ function mod:RegisterEvents(frame, unit)
if(self.db.units[frame.UnitType].buffs.enable or self.db.units[frame.UnitType].debuffs.enable) then
frame:RegisterUnitEvent("UNIT_AURA", unit, displayedUnit)
end
mod.OnEvent(frame, "PLAYER_ENTERING_WORLD", unit or frame.unit)
mod.OnEvent(frame, "PLAYER_ENTERING_WORLD", frame.unit)
end
frame:RegisterEvent("RAID_TARGET_UPDATE")
......
......@@ -2005,12 +2005,7 @@ local function GetUnitSettings(unit, name)
name = L["Show Interrupt Source in Class Color"],
disabled = function() return not E.db.nameplates.units[unit].castbar.sourceInterrupt end,
},
displayTarget = {
order = 5,
type = 'toggle',
name = L["Display Target"],
desc = L["Display the target of your current cast. Useful for mouseover casts."],
},
-- order 5 is player Display Target
height = {
order = 6,
name = L["Height"],
......@@ -2565,6 +2560,12 @@ local function GetUnitSettings(unit, name)
type = "toggle",
name = L["Use Class Color"],
}
group.args.castGroup.args.displayTarget = {
order = 5,
type = 'toggle',
name = L["Display Target"],
desc = L["Display the target of your current cast. Useful for mouseover casts."],
}
elseif unit == "FRIENDLY_PLAYER" or unit == "ENEMY_PLAYER" then
group.args.minions = {
order = 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment