View Single Post
03-30-21, 04:56 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
The first parameter in the payload for UNIT_xxx events is the unit that is the target of the event

Code:
local unit , x, x = ...
if unit == "player" then
   -- you started casting, sent the cast, failed at casting, stopped casting or got the job done.
end
In your code, "UNIT_SPELLCAST_SENT is the only event where you check for the unit
Code:
local function OnEvent(self, event, ...)
	local unit, arg2, arg3, arg4 = ...
	if unit ~= "player" then
		return
	end
	if event == "zzz"  then
		if arg2 == yyy then
			-- whatever for event zzz
		end
	elseif event == "ddd" then
		if arg3 == nnn then
			-- whatever for event ddd
		end
	end
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-30-21 at 05:07 PM.
  Reply With Quote