Quantcast WoWInterface - View Single Post - Nameplate hacking and unit IDs
View Single Post
05-14-16, 06:08 PM   #1
A Scalebane Royal Guard
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
Nameplate hacking and unit IDs

In the Live version of my addon ConsolePort, I'm using a nameplate cursor that deviously hacks the nameplates by caching them securely and scaling them up to cover the entire screen. Coupled with a mouseover macro, this gave me control over targeting without using a mouse cursor. Here's a video of how it used to work:

Now in Legion, I changed up my code to cache the unit frames associated with nameplates instead, thinking I could utilize the unit IDs. This works out of combat, but when I'm in combat, the frame handles are no longer accessible. My raid cursor (works the same way, but with raid frames) still works as intended, which probably means it's only related to the name plates. Either that, or I'm missing something vital here.

Tab-targeting seems to be better than ever, but I would ideally like to get this system working again with the new nameplate unit frames, because it gives much better control over tab-targeting when you can actually choose the direction in which it should look for the next target.

Here's the code that no longer works:
Lua Code:
  1. Cursor:SetAttribute("GetPlates", [[
  2.     Plates = wipe(Plates)
  3.     Visible = 0
  5.     for i, frame in pairs(newtable(WorldFrame:GetChildren())) do
  6.         local name = frame:GetName()
  7.         if name and strmatch(name, "NamePlate") and frame:IsShown() then
  8.             local unitFrame = frame:GetChildren() -- returns nil in combat
  9.             local unit = unitFrame and unitFrame:GetAttribute("unit")
  10.             if unitFrame and unit and PlayerCanAttack(unit) then
  11.                 Plates[unitFrame] = true
  12.             end
  13.             Visible = Visible + 1
  14.         end
  15.     end
  16. ]])

Any suggestions on how to solve this, if it's even possible?

Last edited by MunkDev : 05-19-16 at 06:14 PM.