Thread Tools Display Modes
08-24-24, 12:28 PM   #1
dankanst
A Murloc Raider
Join Date: Aug 2024
Posts: 7
Addon that removes all instaces of "-RealmName" from player names

Hello there good people of wowinterface!

Some time during the beginning of Legion, I had a very kind soul on these forums write me an addon that removed all instances "-RealmName" and "(*)" attached to player names in various UI elements. It was by far my favorite addon, because it simplified and drastically shortened player names, which helped my immersion and gave me an illusion of playing with players from the same realm, like in the old days. I decided to hop back to wow again, and I couldn't live with myself if I didn't ask you guys that same question again, since I cannot find the original forum post, or the account I used for that post on these forums.

Here is what the previous addon did:
1. Removed the "-RealmName" from player nameplates
2. Removed the "(*)" from player portrait frames
3. Removed the "-RealmName" from players in party and raid frames
4. Removed the "-RealmName" player names in the chat
5. Removed the "-RealmName" from player tooltips in the bottom left corner of the screen

I humbly ask if someone could write me a similar addon, or if it already exists, direct me to a place where I can download it, since my research did not produce any meaningful results (I did come across an addon that removes the -RealmName from raid frames, but there are 4 other instances where I would like that -RealmName removed as well, so that's why I'm writing here)

Thank you all so much in advance for any help and support you can offer!
  Reply With Quote
08-25-24, 07:16 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,358
This replaces two key functions responsible for formatting character names. It's the most straightforward way, but it does cause taint.

Lua Code:
  1. function GetUnitName(unit) return (UnitName(unit)); end
  2. do
  3.     local _GetColoredName=GetColoredName;
  4.     function GetColoredName(event,msg,sender,...)
  5.         return _GetColoredName(event,msg,Ambiguate(sender,"short"),...);
  6.     end
  7. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-25-24, 11:47 AM   #3
dankanst
A Murloc Raider
Join Date: Aug 2024
Posts: 7
Can confirm that this did indeed remove the RealmName indication from player portrait frames, as well as the inspect character frame, and player nameplates, and for that you have my thanks!

The RealmName indicator is still present on tooltips, messages (I'm okay if we can't get this to work), and player names shown in the world above their respective characters (by this i mean the (*) symbol, on friendly players where no player nameplates are shown)

I can't thank you enough for this code, but do you think there is a way to target the names shown in these specific elements and remove the additional text/symbols from them as well? I don't know if these elements are hard coded and cannot be modified by addons, but I do recall these realm indicators being able to be removed from them as well, at least in Legion
  Reply With Quote
08-25-24, 12:45 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,358
Forgot about the tooltip, this should do the trick.
Lua Code:
  1. TooltipDataProcessor.AddLinePreCall(Enum.TooltipDataLineType.UnitName,function(tooltip,line)
  2.     if line.unitToken and UnitIsPlayer(line.unitToken) then line.leftText=Ambiguate(line.leftText,"short"); end
  3. end);

I can only test on PTR as I no longer have an active sub. Messages should be handled through GetColoredName(), which I funnel through Ambiguate() with a setting that is documented to trim names from all servers. In-world names are rendered in C code and can't be touched by addons.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 08-25-24 at 01:07 PM.
  Reply With Quote
08-25-24, 03:48 PM   #5
dankanst
A Murloc Raider
Join Date: Aug 2024
Posts: 7
That does the trick! Amazing, thank you so much.

However, I am getting the "interface action failed because of an addon" seemingly at random, so I installed buggrabber, and this is what the error code reads:


1x [ADDON_ACTION_BLOCKED] AddOn 'RealmName' tried to call the protected function 'StatusBar:Show()'.
[string "@!BugGrabber/BugGrabber.lua"]:485: in function <!BugGrabber/BugGrabber.lua:485>
[string "=[C]"]: in function `Show'
[string "@Blizzard_TextStatusBar/Mainline/TextStatusBar.lua"]:96: in function `UpdateTextStringWithValues'
[string "@Blizzard_TextStatusBar/Mainline/TextStatusBar.lua"]:82: in function `UpdateTextString'
[string "@Blizzard_UnitFrame/UnitFrame.lua"]:967: in function <Blizzard_UnitFrame/UnitFrame.lua:945>

Locals:
_ = Frame {
}
event = "ADDON_ACTION_BLOCKED"
events = <table> {
}

This is in the live game atm. Do you know what's causing it to break?
  Reply With Quote
08-25-24, 03:56 PM   #6
dankanst
A Murloc Raider
Join Date: Aug 2024
Posts: 7
Forgot to mention this is related to the first code about player portrait frames that you sent me. I got the error another time while trying to use the quest item attached to the quest I was on, from the original quest tracker from blizzard, but I could use the item just fine if I opened my bags and found it, and used it manually, which was weird

I know I'm so annoying with this but it's my fault, I forgot to mention the -RealmName attached to players guilds in the tooltip as well, and seeing that part of the code works wonderfully well, do you think it's possible for us to target the players guilds and funnel them through the Ambiguate() function as well? I promise this is the last thing I'm asking for
  Reply With Quote
08-25-24, 09:23 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,358
This should work in place of replacing GetUnitName(). It should still cover the stock UnitFrames along with the AchievementUI, InspectUI, and TradeFrame.

Lua Code:
  1. local function UpdateNameText(fontstring,unit) if fontstring and unit and UnitIsPlayer(unit) then fontstring:SetText((UnitName(unit))); end end
  2.  
  3. EventUtil.ContinueOnAddOnLoaded("Blizzard_AchievementUI",function()
  4.     hooksecurefunc("AchievementFrameComparison_SetUnit",function(unit) UpdateNameText(AchievementFrameComparisonHeaderName,unit); end);
  5. end);
  6.  
  7. EventUtil.ContinueOnAddOnLoaded("Blizzard_InspectUI",function()
  8.     InspectFrame:HookScript("OnEvent",function(self,event,unit)
  9.         if event=="UNIT_NAME_UPDATE" and unit==self.unit then self:SetTitle((UnitName(unit))); end
  10.     end);
  11.  
  12.     InspectFrame:HookScript("OnShow",function(self)
  13.         if self.unit then self:SetTitle((UnitName(self.unit))); end
  14.     end);
  15. end);
  16.  
  17. EventUtil.ContinueOnAddOnLoaded("Blizzard_UIPanels_Game",function()
  18.     hooksecurefunc("TradeFrame_Update",function(self)
  19.         UpdateNameText(TradeFramePlayerNameText,"player");
  20.         UpdateNameText(TradeFrameRecipientNameText,"NPC");
  21.     end);
  22. end);
  23.  
  24. EventUtil.ContinueOnAddOnLoaded("Blizzard_UnitFrame",function()
  25.     local function _UnitFrame_OnEvent(self,event,unit)
  26.         if event=="UNIT_NAME_UPDATE" and unit==self.unit then UpdateNameText(self.name,unit); end
  27.     end
  28.  
  29.     hooksecurefunc("UnitFrame_Update",function(self) UpdateNameText(self.name,self.overrideName or self.unit); end);
  30.  
  31.     hooksecurefunc("UnitFrame_OnEvent",_UnitFrame_OnEvent);
  32.     for _,frame in ipairs{TargetFrame.totFrame,FocusFrame.totFrame} do
  33.         frame:HookScript("OnEvent",_UnitFrame_OnEvent);
  34.     end
  35.  
  36.     local function StealthedArenaUnitFrameMixin_UpdateName(self,unitclassinfo)
  37.         UpdateNameText(self.NameText,self.unitFrame and self.unitFrame.unitToken);
  38.     end
  39.     hooksecurefunc(StealthedArenaUnitFrameMixin,"UpdateName",StealthedArenaUnitFrameMixin_UpdateName);
  40.     if CompactArenaFrame then
  41.         for i in ipairs(CompactArenaFrame.memberUnitFrames) do
  42.             hooksecurefunc(CompactArenaFrame["StealthedUnitFrame"..i],"UpdateName",StealthedArenaUnitFrameMixin_UpdateName);
  43.         end
  44.     end
  45.  
  46.     hooksecurefunc("CompactUnitFrame_UpdateName",function(self) if self.name:IsShown() then UpdateNameText(self.name,self.unit); end end);
  47. end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Addon that removes all instaces of "-RealmName" from player names


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