Quantcast Add realm region info to the group info tooltips in the group finder - WoWInterface
Thread Tools Display Modes
09-22-16, 03:11 AM   #1
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Add realm region info to the group info tooltips in the group finder

Let me use a screenshot to help me explain:



Basically what I'm asking for is an addon that would, in this screenshot for example, add "(Br)" after "Nemesis", indicating that the group leader's region is Brazil.

(Edit: Alternatively, you could just add a new line under the "Leader: Playername-Servername" line which simply reads: "Region: US/Brazil/Lat. America/Oceanic". That might look a bit cleaner.)

I need an easy way to see what region the group leaders are from, because when I get pulled to realms outside of the US I usually get around 250 ms, and that's not something I want if I'm trying to do something which is at all challenging.

The following realms would need a (Br) tag added to them:

Azralon
Gallywix
Goldrinn
Nemesis
Tol Barad

The following realms would need a (LatAm) tag:

Drakkari
Quel'Thalas
Ragnaros

The following realms would need an (Oce) tag:

Aman'Thul
Barthilas
Caelestrasz
Dath'Remar
Dreadmaul
Frostmourne
Gundrak
Jubei'Thos
Khaz'goroth
Nagrand
Saurfang
Thaurissan

This would help me out a lot and would be very much appreciated.

Last edited by kingnothing7 : 09-22-16 at 05:51 AM.
  Reply With Quote
09-22-16, 04:45 AM   #2
Voyager
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 22
Use http://www.wowinterface.com/download...adeFilter.html

it can filter out other "regions".
  Reply With Quote
09-22-16, 05:24 AM   #3
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Originally Posted by Voyager View Post
Use http://www.wowinterface.com/download...adeFilter.html

it can filter out other "regions".
It doesn't seem to be able to do what I'm needing it to do. It almost does, but not quite. When I have it set like this:



It ONLY shows Eye of Azshara groups (or w/e dungeon is selected in the drop down). There's no "show all" option in that drop down. I can't take the time to go through all the dungeons in the drop down and scan them one by one individually. By the time I've done that, I've probably missed out out on several Mythic+ DPS slots that I could've otherwise signed up for.
  Reply With Quote
09-24-16, 02:35 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
This will probably (I don't have an active subscription and can't actualy test it) do what you want:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()

	local myLang, _, _, myTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName()))
	myLang = myTimezone == "AEST" and "AU" or myLang:sub(3)

	hooksecurefunc("LFGListSearchEntry_Update", function(self)
		local leaderName = select(13, C_LFGList.GetSearchResultInfo(self.resultID))
		local realmName = leaderName and leaderName:match("%-(.+)")
		if realmName then
			local realmLang, _, _, realmTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(realmName))
			realmLang = realmTimezone == "AEST" and "AU" or realmLang:sub(3)
			if realmLang and realmLang ~= myLang then
				self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang, self.ActivityName:GetText())
			end
		end
	end)

end)
Use Vlad's addon creator tool to turn the code into an addon package.

You'll also need to install the LibRealmInfo library as a separate addon to provide the data.

Rather than hiding the info away in a tooltip, it will just add "BR" (for Brazil, etc.) in orange right before the dungeon name (or other zone/activity name) in the main list so you can easily see it while scrolling. It won't add anything for realms in the same region/language as you.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 09-30-16 at 10:42 PM. Reason: Fixed an issue in the code
  Reply With Quote
09-25-16, 04:41 PM   #5
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Thank you, Phanx. It doesn't seem to be working currently, though. Here's the error my BugSack picked up:

Code:
1x RegionInfo\code.lua:3: attempt to call method 'GetRealmInfoByName' (a nil value)
RegionInfo\code.lua:3: in main chunk

Locals:
(*temporary) = <function> defined =[C]:-1
(*temporary) = 5
(*temporary) = nil
(*temporary) = <table> {
 GetRealmInfoByUnit = <function> defined @LibRealmInfo\LibRealmInfo.lua:117
 GetRealmInfoByGUID = <function> defined @LibRealmInfo\LibRealmInfo.lua:103
 GetRealmInfoByID = <function> defined @LibRealmInfo\LibRealmInfo.lua:84
 GetCurrentRegion = <function> defined @LibRealmInfo\LibRealmInfo.lua:31
 GetRealmInfo = <function> defined @LibRealmInfo\LibRealmInfo.lua:57
}
(*temporary) = "Bleeding Hollow"
(*temporary) = "attempt to call method 'GetRealmInfoByName' (a nil value)"

Last edited by kingnothing7 : 09-25-16 at 04:44 PM.
  Reply With Quote
09-25-16, 08:00 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,728
Change GetRealInfoByName to just GetRealmInfo.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-25-16, 09:43 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well that's awkward. Apparently I need to update my own API documentation on my own library... >_>
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-26-16, 03:06 AM   #8
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Getting this now:

Code:
2x RegionInfo\code.lua:4: attempt to index local 'myLang' (a nil value)
RegionInfo\code.lua:4: in main chunk

Locals:
myLang = nil
_ = nil
_ = nil
myTimezone = nil
(*temporary) = "Bleeding Hollow"
(*temporary) = nil
(*temporary) = <function> defined @LibRealmInfo\LibRealmInfo.lua:21
(*temporary) = "attempt to index local 'myLang' (a nil value)"
  Reply With Quote
09-26-16, 03:18 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,728
Originally Posted by Phanx View Post
Well that's awkward. Apparently I need to update my own API documentation on my own library... >_>
I was just going by what it says on the Curseforge page. I figured you were thinking "by name" and then accidentally typed it.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-26-16, 08:51 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by kingnothing7 View Post
Getting this now:

Code:
2x RegionInfo\code.lua:4: attempt to index local 'myLang' (a nil value)
Can you post the whole code you're using? Line 4 in the code I posted doesn't refer to "myLang" at all.

(I also updated my last post with corrected code, so you may want to just copy/paste it again.)
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-27-16, 05:59 AM   #11
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Originally Posted by Phanx View Post
Can you post the whole code you're using? Line 4 in the code I posted doesn't refer to "myLang" at all.

(I also updated my last post with corrected code, so you may want to just copy/paste it again.)
Ah, that was due to a comment line that was added when the .lua was created with the addon creator tool.

I just copy and pasted this into the lua file from your first post in this thread:

Code:
local myLang, _, _, myTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName()))
myLang = myTimezone == "AEST" and "AU" or myLang:sub(3)

hooksecurefunc("LFGListSearchEntry_Update", function(self)
	local leaderName = select(13, C_LFGList.GetSearchResultInfo(self.resultID))
	local realmName = leaderName and leaderName:match("%-(.+)")
	if realmName then
		local realmLang, _, _, realmTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(realmName))
		realmLang = realmTimezone == "AEST" and "AU" or realmLang:sub(3)
		if realmLang and realmLang ~= myLang then
			self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang:sub(3), self.ActivityName:GetText())
		end
	end
end)
And this is the error after doing that:

Code:
1x RegionInfo\code.lua:2: attempt to index local 'myLang' (a nil value)
RegionInfo\code.lua:2: in main chunk

Locals:
myLang = nil
_ = nil
_ = nil
myTimezone = nil
(*temporary) = "Bleeding Hollow"
(*temporary) = nil
(*temporary) = <function> defined @LibRealmInfo\LibRealmInfo.lua:21
(*temporary) = "attempt to index local 'myLang' (a nil value)"
  Reply With Quote
09-27-16, 09:22 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
What do you get in the chat frame when you enter this command manually?
/dump LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName())
If you get a bunch of "nil" try adding your region explicitly; it shouldn't be required, but let's just try it:
/dump LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName(), "US")
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-27-16, 11:04 PM   #13
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Originally Posted by Phanx View Post
What do you get in the chat frame when you enter this command manually?
/dump LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName())


Originally Posted by Phanx View Post
If you get a bunch of "nil" try adding your region explicitly; it shouldn't be required, but let's just try it:
/dump LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName(), "US")


Also, when I open the group finder and hover over various groups, it outputs all this stuff:

  Reply With Quote
09-29-16, 09:33 PM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Ah, I think I know what the problem is. In order to figure out what region you're playing in, LibRealmInfo needs to look at your character's GUID, which isn't available before the login process is finished. Try wrapping the code up like this:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
     -- all the other code here
end)
This will delay running the rest of the code until the login process is complete.

Re: The message spam, I forgot about that... the library is designed to be embedded in the addon using it, so if it's installed as a standalone addon, it assumes you're a developer and want debugging info. The simplest way to fix that is to move the LibRealmInfo.lua file from the LibRealmInfo folder into your addon's folder, then add a line reading "LibRealmInfo.lua" in your addon's TOC file, just before the line that names your addon's Lua file. Then you can delete the LibRealmInfo addon folder.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-30-16, 06:36 AM   #15
Mazzop
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 74
would be great if PVP-realm info could be added to tooltip same way
  Reply With Quote
09-30-16, 02:42 PM   #16
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Ok it's pretty much functional now. Only issue left is there are just red, empty brackets where it should say "[BR]":



Just a minor issue, though. I checked and it is indeed only putting the brackets on the groups with non-US leaders, so it's usable as-is. I don't see any more errors.

Thank you very much!

Last edited by kingnothing7 : 09-30-16 at 02:47 PM.
  Reply With Quote
09-30-16, 06:26 PM   #17
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
Try to replace:
self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang:sub(3), self.ActivityName:GetText())
with:
self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang, self.ActivityName:GetText())

I at least think that would fix it
  Reply With Quote
09-30-16, 08:02 PM   #18
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Originally Posted by sticklord View Post
Try to replace:
self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang:sub(3), self.ActivityName:GetText())
with:
self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang, self.ActivityName:GetText())

I at least think that would fix it
That worked.

Thank you all very, very much!
  Reply With Quote
09-30-16, 10:59 PM   #19
kingnothing7
A Deviate Faerie Dragon
Join Date: Aug 2016
Posts: 11
Another bug has cropped up (the addon is still functioning fine, though):

Code:
20x RegionInfo\code.lua:13: attempt to index local 'realmLang' (a nil value)
RegionInfo\code.lua:13: in function <RegionInfo\code.lua:8>
[C]: in function `LFGListSearchEntry_Update'
FrameXML\LFGList.lua:1622: in function `LFGListSearchPanel_UpdateResults'
FrameXML\LFGList.lua:1483: in function `onEvent'
FrameXML\LFGList.lua:191: in function <FrameXML\LFGList.lua:107>

Locals:
self = LFGListSearchPanelScrollFrameButton9 {
 0 = <userdata>
 Highlight = <unnamed> {
 }
 Spinner = <unnamed> {
 }
 DataDisplay = <unnamed> {
 }
 ActivityName = <unnamed> {
 }
 VoiceChat = <unnamed> {
 }
 ExpirationTime = <unnamed> {
 }
 PendingLabel = <unnamed> {
 }
 Selected = <unnamed> {
 }
 Name = <unnamed> {
 }
 resultID = 26913
 expiration = 655434.169
 ResultBG = <unnamed> {
 }
 ApplicationBG = <unnamed> {
 }
 CancelButton = <unnamed> {
 }
}
leaderName = "Pinkiiepye-AzjolNerub"
realmName = "AzjolNerub"
realmLang = nil
_ = nil
_ = nil
realmTimezone = nil
(*temporary) = "AzjolNerub"
(*temporary) = nil
(*temporary) = <function> defined @RegionInfo\LibRealmInfo.lua:21
(*temporary) = "No info found for realm"
(*temporary) = "AzjolNerub"
(*temporary) = "in region"
(*temporary) = "US"
(*temporary) = "attempt to index local 'realmLang' (a nil value)"
myLang = "US"
This is what the addon code currently looks like:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
     
local myLang, _, _, myTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName()))
myLang = myTimezone == "AEST" and "AU" or myLang:sub(3)

hooksecurefunc("LFGListSearchEntry_Update", function(self)
	local leaderName = select(13, C_LFGList.GetSearchResultInfo(self.resultID))
	local realmName = leaderName and leaderName:match("%-(.+)")
	if realmName then
		local realmLang, _, _, realmTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(realmName))
		realmLang = realmTimezone == "AEST" and "AU" or realmLang:sub(3)
		if realmLang and realmLang ~= myLang then
			self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang, self.ActivityName:GetText())
		end
	end
end)
	 
end)
  Reply With Quote
10-01-16, 01:55 PM   #20
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Grab a new copy of LibRealmInfo:
https://github.com/Phanx/LibRealmInf...bRealmInfo.lua

Apparently the compressed/mangled realm names shown appended to player names don't include dashes, in addition to not including spaces. If you see more of these errors, please post them!
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Add realm region info to the group info tooltips in the group finder

Thread Tools
Display Modes

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