WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Trying to remove icon from personal resource display (https://www.wowinterface.com/forums/showthread.php?t=59476)

dbespoy 01-18-23 12:23 PM

Trying to remove icon from personal resource display
 
4 Attachment(s)
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;

Attachment 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;

Attachment 9785

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

Attachment 9784

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

Attachment 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

SDPhantom 01-19-23 05:02 AM

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

dbespoy 01-19-23 06:39 AM

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.


All times are GMT -6. The time now is 04:14 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI