Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-15-17, 06:25 AM   #1
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
Adding TRP3 'full names' to UI target frame

Title says it all, I want to add TRP3's last names (when applicable) to my target frame's name, however, I'm not entierly sure how to do this.

I started by simply trying to replace the default name with the one supplied by the TRP chatframe functions, but it just shows blank, no errors, just no name either.

lua Code:
  1. oUF.Tags.Methods["diablo:name"] = function(unit)
  2.     local color = oUF.Tags.Methods["diablo:color"](unit)
  3.     if IsAddOnLoaded("Totalrp3") then
  4.         local UnitID = TRP3_API.utils.str.getUnitID(unit)
  5.         local name = TRP3_API.chat.getFullnameForUnitUsingChatMethod(UnitID)
  6.     else
  7.         local name = UnitName(unit)
  8.     end
  9.     return "|cff"..color..(name or "").."|r"
  10. end
I've based the UnitID local off what I've gathered going through trp's code. for example: the chatframe.lua never generates the UnitID, but uses it, thus it must come from a global function.
Looking in register_main.lua I fine the mouseover function for tooltips:
lua Code:
  1. local function onMouseOver(...)
  2.     local unitID, unitRealm = getUnitID("mouseover");
  3.     if unitID and isUnitIDKnown(unitID) then
  4.         local _, race = UnitRace("mouseover");
  5.         local _, class, _ = UnitClass("mouseover");
  6.         local englishFaction = UnitFactionGroup("mouseover");
  7.         saveCharacterInformation(unitID, race, class, UnitSex("mouseover"), englishFaction, time(), buildZoneText(), GetGuildInfo("mouseover"));
  8.     end
  9. end
which tells me UnitID comes from 'getUnitID', which is a local import of 'utils.str.getUnidID', the utils are globally declared as "TRP3_API.utils" in the utils.lua file, which also has this function in it:
lua Code:
  1. function Utils.str.getUnitID(unit)
  2.     local playerName, realm = UnitFullName(unit);
  3.     if not playerName or playerName:len() == 0 or playerName == UNKNOWNOBJECT then
  4.         return nil;
  5.     end
  6.     if not realm then
  7.         realm = Globals.player_realm_id;
  8.     end
  9.     return playerName .. "-" .. realm;
  10. end

From this, I can gather feeding a unit into "TRP3_API.utils.str.getUnitID()" should get me the UnitID I require for the next function "TRP3_API.chat.getFullnameForUnitUsingChatMethod(UnitID)"

However, upon doing this, I get no character name.
I also get no errors, so I know i'm calling the right functions with the right information, I'm just not getting back anything.

I found another function aswell
lua Code:
  1. function TRP3_API.register.getUnitRPName(targetType)
  2.     local unitName = UnitName(targetType);
  3.     local unitID = getUnitID(targetType);
  4.     return getUnitRPNameWithID(unitID, unitName);
  5. end
  6.  
  7. TRP3_API.r.name = TRP3_API.register.getUnitRPName;
However setting name = TRP3_API.r.name or TRP3_API.register.getUnitRPName also, gives me no name to display.

I'm utterly confused by all of this, tbh :S
__________________
My Addons | "If someone says something is impossible, they lack either imagination, or determination."
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Adding TRP3 'full names' to UI target frame


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off