From fb989bf116b822110d78e6ed6e7b9bf65e7d6b93 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 23 Apr 2017 22:48:04 +0200 Subject: [PATCH] nameplates: always refresh elite/rare indicator --- modules/nameplates.lua | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index cc9c109f..fa357d29 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -5,7 +5,6 @@ pfUI:RegisterModule("nameplates", function () -- catch all nameplates pfUI.nameplates.scanner = CreateFrame("Frame", "pfNameplateScanner", UIParent) - pfUI.nameplates.scanner.objects = {} pfUI.nameplates.scanner:SetScript("OnUpdate", function() for _, nameplate in ipairs({WorldFrame:GetChildren()}) do if not nameplate.done and nameplate:GetObjectType() == "Button" then @@ -15,7 +14,6 @@ pfUI:RegisterModule("nameplates", function () nameplate:SetScript("OnShow", function() pfUI.nameplates:CreateNameplate() end) nameplate:SetScript("OnUpdate", function() pfUI.nameplates:UpdateNameplate() end) nameplate:Show() - table.insert(this.objects, nameplate) nameplate.done = true end end @@ -74,17 +72,6 @@ pfUI:RegisterModule("nameplates", function () levelicon:ClearAllPoints() levelicon:SetPoint("RIGHT", healthbar, "LEFT", -1, 0) - -- show indicator for elite/rare mobs - if level:GetText() ~= nil then - if pfUI.nameplates.mobs[name:GetText()] and pfUI.nameplates.mobs[name:GetText()] == "elite" and not string.find(level:GetText(), "+", 1) then - level:SetText(level:GetText() .. "+") - elseif pfUI.nameplates.mobs[name:GetText()] and pfUI.nameplates.mobs[name:GetText()] == "rareelite" and not string.find(level:GetText(), "R+", 1) then - level:SetText(level:GetText() .. "R+") - elseif pfUI.nameplates.mobs[name:GetText()] and pfUI.nameplates.mobs[name:GetText()] == "rare" and not string.find(level:GetText(), "R", 1) then - level:SetText(level:GetText() .. "R") - end - end - pfUI.nameplates:CreateDebuffs(this) pfUI.nameplates:CreateCastbar(healthbar) pfUI.nameplates:CreateHP(healthbar) @@ -194,6 +181,17 @@ pfUI:RegisterModule("nameplates", function () local healthbar = this:GetChildren() local border, glow, name, level, levelicon , raidicon = this:GetRegions() + -- show indicator for elite/rare mobs + if level:GetText() ~= nil then + if pfUI.nameplates.mobs[name:GetText()] and pfUI.nameplates.mobs[name:GetText()] == "elite" and not string.find(level:GetText(), "+", 1) then + level:SetText(level:GetText() .. "+") + elseif pfUI.nameplates.mobs[name:GetText()] and pfUI.nameplates.mobs[name:GetText()] == "rareelite" and not string.find(level:GetText(), "R+", 1) then + level:SetText(level:GetText() .. "R+") + elseif pfUI.nameplates.mobs[name:GetText()] and pfUI.nameplates.mobs[name:GetText()] == "rare" and not string.find(level:GetText(), "R", 1) then + level:SetText(level:GetText() .. "R") + end + end + if C.nameplates.players == "1" then if not pfUI_playerDB[name:GetText()] or not pfUI_playerDB[name:GetText()]["class"] then this:Hide()