WoWInterface - View Single Post - Nameplate hacking and unit IDs
View Single Post
05-15-16, 04:15 PM   #6
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by MunkDev View Post
I'm confused by these answers. Did I ramble too much? The point of the post was that secure references to the unit frames attached to name plates seem to not be accessible in combat. That has nothing to do with styling them or storing them insecurely.
I've tried this and it's working fine for me:

Lua Code:
  1. Plates = wipe(Plates)
  2. Visible = 0
  4. for i, frame in pairs({WorldFrame:GetChildren()}) do
  5.     local name = frame:GetName()
  6.     if name and strmatch(name, "NamePlate") and frame:IsShown() then
  7.         local unitFrame = frame:GetChildren()
  8.         local unit = unitFrame and unitFrame:GetAttribute("unit")
  9.         if unitFrame and unit then
  10.             Plates[unitFrame] = true
  11.         end
  12.         Visible = Visible + 1
  13.     end
  14. end

I have used it as a plain function tho. How does your hook looks like, when do you run the attribute itself?

Edit: The weird thing is the unit attribute seems to be like "nameplate1-30", you can get the proper unit attribute with a hack from the nameplate's buff/debuff frame like reaching this value: unitFrame.BuffFrame.unit, however that unit value seems to be broken too almost all the time.

Last edited by Resike : 05-15-16 at 04:40 PM.