nameplates: detect players with npc names by level

This commit is contained in:
shagu
2022-07-17 12:31:54 +02:00
parent 50836a3cd0
commit 367b47288a
+5 -1
View File
@@ -473,12 +473,16 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
local hpmin, hpmax = plate.original.healthbar:GetMinMaxValues()
local name = plate.original.name:GetText()
local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??"
local class, _, elite, player = GetUnitData(name, true)
local class, ulevel, elite, player = GetUnitData(name, true)
local target = plate.istarget
local mouseover = UnitExists("mouseover") and plate.original.glow:IsShown() or nil
local unitstr = target and "target" or mouseover and "mouseover" or nil
local red, green, blue = plate.original.healthbar:GetStatusBarColor()
local unittype = GetUnitType(red, green, blue) or "ENEMY_NPC"
-- ignore players with npc names if plate level is lower than player level
if ulevel and ulevel > (level == "??" and "-1" or level) then player = nil end
if player and unittype == "ENEMY_NPC" then unittype = "ENEMY_PLAYER" end
elite = plate.original.levelicon:IsShown() and not player and "boss" or elite
if not class then plate.wait_for_scan = true end