View Single Post
11-15-17, 08:44 AM   #2
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
With more tinkering, I've come to this function for my tag
lua Code:
  1. oUF.Tags.Methods["diablo:name"] = function(unit)
  2.     local color = oUF.Tags.Methods["diablo:color"](unit)
  3.     local name = UnitName(unit)
  4.     if IsAddOnLoaded("Totalrp3") then
  5.         local UnitID = TRP3_API.utils.str.getUnitID(unit)
  6.         if UnitID == nil then
  7.             local name = UnitName(unit)
  8.             return "|cff"..color..(name or "").."|r"
  9.         else
  10.             local name = TRP3_API.chat.getFullnameForUnitUsingChatMethod(UnitID)
  11.             return "|cff"..color..(name or "").."|r"
  12.         end
  13.     end
  14. end

However, it misbehaves.

If I target someone with a TRP profile, it works 100% as expected, however, whenever I target someone without a profile, or an NPC, it doesn't display a name.
The "if UnitID == nil" /should/ work around this issue, but for some reason it does now, and i'm confused as to why.
__________________
My Addons | "If someone says something is impossible, they lack either imagination, or determination."
  Reply With Quote