I’ve got the base functionality of the BattleGroundEnemies companion addon I am working on up and running - I get a correct, two-line Specialization/Class string to the right of the BGE Enemy Player frame to which it applies.
I’m trying to mirror that on the enemy nameplates.
The logic is complex, but I’ve got enough temporary diagnostic displays in place to have isolated at least WHERE the code is failing.
function f.UpdateNameplateOverlay(frame, unitName)
print('UpdateNameplateOverlay(<input frame>, '..unitName..')')
if not frame.NPOverlay then
frame.NPOverlay = frame:CreateFontString(nil, "HIGH", 5)
frame.NPOverlay:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
frame.NPOverlay:SetJustifyH("CENTER")
frame.NPOverlay:SetJustifyV("CENTER")
frame.NPOverlay:SetTextColor(1, 1, 1, 1)
frame.NPOverlay:SetPoint("CENTER")
end
frame.NPOverlay:SetText(f.SpecClassByPlayerName(unitName))
npFrames[unitName] = frame
end
function f.SpecClassByPlayerName(playerName)
-- return the spec/class string (without mid-newline) from the fixed table
-- based on specID input
-- temporarily returns "Unknown Enemy" when a specID is not found
print('SpecClassByPlayerName('..playerName..')')
return (gsub((specClassByName[unitName] or ''), '\n ', ''))
end
f.UpdateNameplateOverlay(frame,unitName) is correctly receiving a frame and a properly formed unitName (playerName or playerName-realm depending on whether playerName is on my realm or not).
I have a data capture built into a slash command that copies out the specClassByName table into my saved data file. I don’t want to expose that here because it has actual player data in it, but looking at it, it has names that match my diagnostic output with the proper strings in it.
But I am not getting the display I would expect to see overlayed the enemy nameplates.
I’m about convinced I’ve got some trivial error that I’m just not seeing.
Any help would be appreciated.