1. #1

    Blizzard_NamePlates LUA - UnitAura / BuffContainer?

    Hello,

    I've experimented in the LUA with the functions listed in the title but am nowhere close to getting the results I would like, so I came here for help; I have zero programming / coding experience ;/

    Basically using the default Blizzard NamePlates as a base, I was curious if there was a way to modify the LUA to track more (de)buffs through either a /run or function command (for mini-addon creation,) which would have the ability to filter personal vs all, whitelisting through either spell name or spell ID, and permanently saving upon log out.

    The closest to optimal result came from whatisxml's post in an earlier thread (June, I didn't want to necro.) Using his 4th suggestion I was able to show all (de)buffs on target + player nameplates and whitelist specifics with spell IDs, but the downside was my noBuffDebuffFilterOnTarget console setting would not save: making me see (de)buffs from all players on target nameplates.

    Code:
    /run local b={196608,126896};local gn=UnitAura;local function fn(...)local a={gn(...)};a[15]=a[6]~=nil and not tContains(b,a[11])and abs(a[6]-31)<31;return unpack(a);end UnitAura=fn;

    If anyone could help me out with an edited default template to keep the player only setting as well as permanent save, it would be greatly appreciated; I've already collected the list of spell IDs. Thanks !
    Last edited by trikmastatak; 2017-01-04 at 06:16 AM.

  2. #2
    Deleted
    First of all, there are plenty of great addons that do exactly what you want and only modify the buff container of nameplates while leaving the rest untouched. You can look them up here.

    A minimal solution that doesn't include saving (so the /run command has to be executed after each UI reload) would be:

    Code:
    local whitelist = {
        ["Shadow Word: Pain"] = "player"
    }
    local function newShouldShowBuff(_,name,caster)
         return name and (whitelist[name] == caster or whitelist[name] == "all")
     end
    local function Mixin(baseFrame)
      baseFrame.UnitFrame.BuffFrame.ShouldShowBuff = newShouldShowBuff
    end
    local f = CreateFrame("Frame")
    f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
    f:SetScript("OnEvent", function(_,_,unitId)
      Mixin(C_NamePlate.GetNamePlateForUnit(unitId))
    end)
    for _,baseFrame in pairs(C_NamePlate.GetNamePlates()) do
      Mixin(baseFrame)
    end

    Only spells contained in the whitelist are shown on your nameplates. The values can either be "player" for auras that should only be shown if cast by the player or "all" for auras to be shown irrespective of the aura's source.Still, I can only repeat my initial recommendation of using a proper addon for this purpose.
    Last edited by mmoc5cadf94ec5; 2017-01-05 at 12:37 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •