--NAME_PLATE_UNIT_ADDED NAME_PLATE_UNIT_REMOVED REMOVE_UNIT
function(allstates, e, unit)
	if e == "NAME_PLATE_UNIT_ADDED" and unit then
		if UnitIsPlayer(unit) then
			if UnitIsEnemy("player", unit) then
				local _, _, class = UnitClass(unit)
				allstates[unit] = 
				{
					changed = true,
					show = true,
					unit = unit,
					class = class,
				}
				return true
			end
		end
	elseif e == "NAME_PLATE_UNIT_REMOVED" and unit then
		if allstates[unit] then
			local LCG = LibStub("LibCustomGlow-1.0")
			allstates[unit].show = false
			allstates[unit].changed = true
			local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
			LCG.PixelGlow_Stop(nameplate)
			return true
		end
	elseif e == "REMOVE_UNIT" then
		if allstates[unit] then
			allstates[unit].show = false
			allstates[unit].changed = true
			return true
		end
	end
end

--ON SHOW
local LCG = LibStub("LibCustomGlow-1.0")
local nameplate = C_NamePlate.GetNamePlateForUnit(aura_env.statee.unit)
local aura_env = aura_env
local unit = aura_env.statee.unit
LCG.PixelGlow_Start(nameplate, {aura_env.classColor(aura_env.statee.class)}, nil, 0, 8, 4, 0, -4)
C_Timer.After(4, function() WeakAuras.ScanEvents("REMOVE_UNIT", unit); LCG.PixelGlow_Stop(nameplate) end)

--INIT
aura_env.classColor = function(class)
      if class == 1 then return 0.78, 0.61, 0.43, 1 elseif
      class == 2 then return 0.96, 0.55, 0.73, 1 elseif
      class == 3 then return 0.67, 0.83, 0.45, 1 elseif
      class == 4 then return 1, 0.96, 0.41, 1  elseif
      class == 5 then return 1, 1, 1, 1  elseif
      class == 6 then return 0.77, 0.12, 0.23, 1 elseif
      class == 7 then return 0, 0.44, 0.87, 1 elseif
      class == 8 then return 0.25, 0.78, 0.92, 1 elseif
      class == 9 then return 0.53, 0.53, 0.93, 1 elseif
      class == 10 then return 0, 1, 0.59, 1 elseif
      class == 11 then return 1, 0.49, 0.04, 1 elseif
      class == 12 then return 0.64, 0.19, 0.79, 1 else
      return 1, 1, 1, 1 end
end