Detect Current Region
I've been looking for ways of an addon to detect wether it is on the US, European or Chinese regions. One method I found was using the cvar "portal":
Code:
local region = GetCVar('portal') |
GetCVar("installLocale") isnt better?
But it's flaw its returns enUS for enGB clients too. Actually i have no portal named cvar so i'm not sure what it that. |
I've been using
Code:
local realmlist = GetCVar("realmList") Edit: Install locale is irrelevant, you can be playing in the eu region and have a deDE or frFR locale client. |
Quote:
Quote:
|
Blizzard define your realmList to a domain where your login server is located.
Luckily they prefix it, but they CAN use an IP directly breaking the code. It might also be different for Chinese servers. For example http://wowchina.com/ don't even use the prefix like the us/eu does, so keep this in mind. The Chinese realmlist is cn#.grunt.wowchina.com |
I would guess the API to use would depend on what you need it for. I too use the portal value in Grail:
self.portal = GetCVar("portal") because specific quests are not available to the European servers. Since this covers Europe and not a specific language the portal value seems to be the right way to go. However, I have not checked on whether this is still set since I originally put in in place many moons ago. |
But for any EU realm, the EU realm list will be used, no? Am I missing the point?
|
Quote:
Quote:
|
Is it possible to get the server locale? Like deDE or something if it is a german server.
Btw: GetCVar("installLocale") is the same as GetLocale(). If you need to diffentiate between enUS/enGB then use GetCVar("locale") instead. Those are just the language preference of the client though. |
Quote:
The GetCVar("locale") could work that was my second tought. |
I think realmlist is really the way to go, and has been working son far for me. I'm want to detect connected servers, so I don't care about languages. If one really wants to know if a server is enUS or enGB, or if it is esES or esMX, I guess the solution is to use the realmlist and GetLocale in conjunction.
|
Quote:
However, it does return "enUS" in an enGB client, and "ptBR" in a ptPT client, as there are not actually separate localizations for the EU variants of English and Portuguese; they just use the enUS and ptBR translations, so in those cases you would need to use the realmlist if you need to distinguish between them. Quote:
|
I bought my German physical discs in Germany. I chose enGB (you can't choose enUS in europe) and I play on a German server. "installLocale" is still enUS for me for whatever reason. It is common to meet people playing in English. It is not uncommon to even see Russian. I can even take Italian and am still able to login to my German server. I think automated responses like those about boss encounter progress are better delivered in the server language as I can expect that the large majority of players on a German server can understand German. I can't expect them to know Italian. That would be my reason to look for the exact server locale and not just the region.
|
Well, the server language is really just a human protocol. See for instance Aggra EU, it's even in the english category but it's a portuguese server.
Anyway, given the region you can have a table mapping every realm to it's language. You only need to check the region because names in EU and US servers are shared. |
A heads-up to users of GetCVar("realmList") - you will need another solution for WoD. That CVar is managed by the BNet app and is deprecated. Fresh installs will no longer have it set.
GetCVar("portal") does seem to still work. It returns "public-test" on PTRs/beta realms though, so make sure to account for that (I would test the returned value and call test realms 'xx' personally, since that's what realmList did). This change breaks many addons, including part of Ace3. |
I've got a new alpha build out of Ace3 that addresses this cvar change.
Let me know if there's any issues with it. :) |
Portal appears to be incomplete solution
One of my testers has a Battlenet account with WoW accounts in both US and EU regions.
The tester confirmed the following query of her exact setup and results. Just to make sure I fully understand.. from your home in the UK You have one Battlenet accountID in that account you have two EU-Wow accounts. a US-Wow account starter account, and a WoD beta account You have a single copy of WoW installed for the live accounts and a copy for the WoD beta account. You launch with battlenet desktop app you login using your battlenet accountID At the battlenet games starter screen... with Wow selected you select your desired WoW account and press the PLAY button launching the WoW client. On launch you are logged into the WoW client and are at the character selection screen of the realm you last played. Assuming you want to play on a different realm you press the CHANGE REALM button and get the realm list for the region associated with your selected WoW account Once in game on a character selected running our addon or running the script /script local rk = GetCVar("portal") == "public-test" and "PTR" or GetCVar("portal"); print(rk) You get the expected output of EU while in the EU region, but you still get the output of EU when in the US region? While looking at WoD beta the script prints PTR Changing the Battlenet region before logging on to Battlenet has no impact on the results. |
It sounds like that CVAR may get set once on first install? or perhaps it's based on geographics rather than the other?
If we could get someone who's never had WoW installed on an EU computer go and sign into the US first that'd help us know more. |
I can only confirm that my portal is set to EU when I log my US trial, normally playing on EU accounts.
|
Quote:
/dump GetCVar("portal") -> "EU" /dump GetCVar("realmList") -> "eu.logon.worldofwarcraft.com" When logging in directly through Wow.exe it seems to automatically pick US or EU depending on the value of theinstallLocale CVar in Config.wtf -- eg. "deDE" logs into EU servers, or "enUS" to log into US servers. A setting of "enGB" still logs into US servers. The value of the locale CVar doesn't seem to make any difference. |
All times are GMT -6. The time now is 03:11 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI