View Single Post
01-18-23, 12:23 PM   #1
dbespoy
A Defias Bandit
Join Date: Jun 2011
Posts: 2
Trying to remove icon from personal resource display

Been trying to find a way to add icons above friendly players. You can do it in threatplates options but I prefer KUI.

So I managed to find one on here that did this and then made it into an addon through addon bool which looks like this;

Click image for larger version

Name:	a7bd3dc555ffb3bc22837164f241954f.png
Views:	72
Size:	68.8 KB
ID:	9783

I managed to change the addon so the icon is in the right place and fits in above KUI as well as adding evokers. (blurred their name here but the KUI name is shown there)

But for some reason it shows an icon above the personal resource display like this;

Click image for larger version

Name:	cc236f035392a85ad2c8d37de3d27d17.png
Views:	68
Size:	57.1 KB
ID:	9785

Which even more annoyingly clips with the buffs that show up like this;

Click image for larger version

Name:	c20dd40e3329c248e3fe2be2a75adec4.png
Views:	71
Size:	111.2 KB
ID:	9784

As well as adding icons on npc's like this;

Click image for larger version

Name:	npcicon.png
Views:	60
Size:	97.8 KB
ID:	9786

Does anyone know how to remove the icon from the personal resource bar and the npc's? Here is the lua

Code:
local addonName = ...

local iconKey = addonName .. "Icon"

local GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit

local iconTexture = {
   ["DEATHKNIGHT"] = 135771,
   ["DEMONHUNTER"] = 1260827,
   ["DRUID"] = 625999,
   ["EVOKER"] = 4574311,
   ["HUNTER"] = 626000,
   ["MAGE"] = 626001,
   ["MONK"] = 626002,
   ["PALADIN"] = 626003,
   ["PRIEST"] = 626004,
   ["ROGUE"] = 626005,
   ["SHAMAN"] = 626006,
   ["WARLOCK"] = 626007,
   ["WARRIOR"] = 626008
}

local frame = CreateFrame("Frame")

frame:SetScript("OnEvent", function(self, event, unit)
      local namePlate = GetNamePlateForUnit(unit)
      if event == "NAME_PLATE_UNIT_ADDED" and UnitIsFriend("player", unit) then
         local _, class = UnitClass(unit)
         if iconTexture[class] then
            local icon = namePlate[iconKey]
            if not icon then
               icon = namePlate:CreateTexture(nil, "OVERLAY")
               icon:SetPoint('CENTER', 0, 18)
               icon:SetSize(20, 20)
               namePlate[iconKey] = icon
            end
            icon:SetTexture(iconTexture[class])
            icon:Show()
            return
         end
      end
      if namePlate[iconKey] then
         namePlate[iconKey]:Hide()
      end
end)

frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
Many Thanks

Last edited by dbespoy : 01-18-23 at 01:47 PM.
  Reply With Quote