Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-06-17, 01:18 PM   #1
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,029
Nameplate tracking SPELL_CAST_START destination unit

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 nameplateNtarget
Lua Code:
  1. local np = C_NamePlate
  2. local f = CreateFrame("Frame")
  3.  
  4. function f:OnEvent(event, timestamp, subevent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _, spellID, spellName)
  5.     if subevent == "SPELL_CAST_START" then
  6.         for _, v in pairs(np.GetNamePlates()) do
  7.             if np.GetNamePlateForUnit(v.namePlateUnitToken.."target") == np.GetNamePlateForUnit("player") then
  8.                 print(format("%s is casting %s on me", sourceName, GetSpellLink(spellID)))
  9.             end
  10.         end
  11.     end
  12. end
  13.  
  14. f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  15. 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.


Last edited by Ketho : 03-06-17 at 01:25 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Nameplate tracking SPELL_CAST_START destination unit


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off