Sorry, but i don't understand what you wanted to do with COMBAT_LOG_EVENT_UNFILTERED.
I also don't understand what you are tying todo with your table moblist. If you want the desired mobnames in a table its better to just make the table like
Lua Code:
local mobs = {
["Eredar Summoner"] = true,
["Wrathguard Dreadblade"] = true,
}
This way you can easily check if the new added nameplate belongs to a unit whose name is in your table.
Exmaple Code:
Lua Code:
local moblist = {
["Eredar Summoner"] = true,
["Wrathguard Dreadblade"] = true,
}
local frame = CreateFrame("frame")
frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
frame:SetScript("OnEvent", function(self, event, ...)
if event == "NAME_PLATE_UNIT_ADDED" then
local unitID = ...
if moblist[UnitName(unitID)] then-- modify his nameplates
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
if not nameplate.myIndicator then
nameplate.myIndicator = nameplate:CreateTexture(nil, "OVERLAY")
nameplate.myIndicator:SetTexture("whatEverTextureYouLike")
end
nameplate.myIndicator:Show()
end
elseif event == "NAME_PLATE_UNIT_REMOVED" then
local unitID = ...
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
if nameplate.myIndicator then
nameplate.myIndicator:Hide()
end
end
end)