55 lines
1.5 KiB
Lua
55 lines
1.5 KiB
Lua
--NAME_PLATE_UNIT_ADDED NAME_PLATE_UNIT_REMOVED PLAYER_TARGET_CHANGED
|
|
function(e,id)
|
|
if e == "NAME_PLATE_UNIT_ADDED" then
|
|
local race = UnitRace(id)
|
|
local sex = UnitSex(id)
|
|
if sex == 3 and aura_env.races[race] == 1 then
|
|
table.insert(aura_env.targets, UnitName(id) .. " " .. race)
|
|
end
|
|
end
|
|
if e == "NAME_PLATE_UNIT_REMOVED" then
|
|
local race = UnitRace(id)
|
|
local sex = UnitSex(id)
|
|
if sex == 3 and aura_env.races[race] == 1 then
|
|
for k,v in ipairs(aura_env.targets) do
|
|
if v:match(UnitName(id)) then
|
|
table.remove(aura_env.targets, k)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if e == "PLAYER_TARGET_CHANGED" and UnitExists("target") then
|
|
local race = UnitRace(id)
|
|
local sex = UnitSex(id)
|
|
if sex == 3 and aura_env.races[race] == 1 then
|
|
table.insert(aura_env.targets, UnitName(id) .. " " .. race)
|
|
end
|
|
end
|
|
if e == "PLAYER_TARGET_CHANGED" and not UnitExists("target") then
|
|
aura_env.targets = {}
|
|
end
|
|
end
|
|
|
|
--DISPLAY
|
|
function()
|
|
local output = ""
|
|
for k,v in ipairs(aura_env.targets) do
|
|
output = output .. v .. "\n"
|
|
end
|
|
return output
|
|
end
|
|
|
|
--INIT
|
|
aura_env.races =
|
|
{
|
|
["Gnome"] = 1,
|
|
["Night Elf"] = 0,
|
|
["Draenei"] = 0,
|
|
["Orc"] = 0,
|
|
["Undead"] = 0,
|
|
["Dwarf"] = 1,
|
|
["Human"] = 0,
|
|
["Tauren"] = 0,
|
|
["Worgen"] = 0,
|
|
}
|
|
aura_env.targets = {} |