Recently there was this question which I was wondering for years.
The
SPELL_CAST_START CLEU event doesn't include a destination.
http://wow.gamepedia.com/COMBAT_LOG_EVENT
But now with the Legion nameplate unit ids we can kind of still get that information.
With the added footnote that it won't work for most cases, like
- mouseover casting
- @unit macros
- AoE casts
- most boss abilities
- when the nameplates are toggled off
Rough example where unit(s) are casting a spell and they are "targeting" the player; by comparing nameplate
Ntarget
Lua Code:
local np = C_NamePlate
local f = CreateFrame("Frame")
function f:OnEvent(event, timestamp, subevent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _, spellID, spellName)
if subevent == "SPELL_CAST_START" then
for _, v in pairs(np.GetNamePlates()) do
if np.GetNamePlateForUnit(v.namePlateUnitToken.."target") == np.GetNamePlateForUnit("player") then
print(format("%s is casting %s on me", sourceName, GetSpellLink(spellID)))
end
end
end
end
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", f.OnEvent)
So I'm wondering if this is already sort of implemented in WeakAuras or Boss Mods? It would probably be handy if not.