From 367b47288a329716b44c9ad7fb1b5b678d63fece Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 17 Jul 2022 12:22:50 +0200 Subject: [PATCH] nameplates: detect players with npc names by level --- modules/nameplates.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 8fad31e5..c822bce8 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -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