Quantcast
WoWInterface - View Single Post - Events for Ghost, Dead, Offline
View Single Post
02-28-14, 04:58 PM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,703
All of the (if not, atleast a lot of the) PLAYER_* events are something we like to call "unitless events", basically the first argument is not the unit affected, in this case, the first argument would be "player".

The way oUF handles these events is you have to register them in a special way, like so:
Code:
oUF.Tags.SharedEvents['PLAYER_UNGHOST'] = true
oUF.Tags.SharedEvents['PLAYER_DEAD'] = true
oUF.Tags.SharedEvents['PLAYER_ALIVE'] = true

oUF.Tags.Events['enhdead'] = 'UNIT_CONNECTION PLAYER_UNGHOST PLAYER_DEAD PLAYER_ALIVE'
oUF.Tags.Methods['enhdead'] = function(u)
	if(UnitIsDead(u)) then
		return 'Dead'
	elseif(UnitIsGhost(u)) then
		return 'Ghost'
	elseif(not UnitIsConnected(u)) then
		return 'Off'
	end	
end

Last edited by p3lim : 03-01-14 at 02:57 AM.
  Reply With Quote