Thread Tools Display Modes
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:	64
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:	60
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:	63
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:	49
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
01-19-23, 05:02 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,325
I'd add the highlighted part to this line.

Code:
if event == "NAME_PLATE_UNIT_ADDED" and UnitIsFriend("player", unit) and UnitIsPlayer(unit) and not UnitIsUnit(unit,"player") then
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-19-23, 06:39 AM   #3
dbespoy
A Defias Bandit
Join Date: Jun 2011
Posts: 2
Oh my god this works perfectly. Thank you so much. Hopefully this will help me from running out of line of sight in solo shuffle haha.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Trying to remove icon from personal resource display


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off