Quantcast Detect Current Region - Page 2 - WoWInterface
Thread Tools Display Modes
07-23-14, 07:26 AM   #21
Ketho
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 847
Same as Lombra

Standard Edition account on EU
Starter Edition account on US, logged on to the starter edition account
Code:
GetCVar("portal") => "EU"
GetCVar("realmList") => "eu.logon.worldofwarcraft.com"
* I did not sign in to the US account first ><
  Reply With Quote
07-23-14, 02:36 PM   #22
Ketho
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 847
I'm in EU

Fresh (Win8+WoW) install and logged into US starter edition account first
Code:
GetCVar("portal") => "US"
GetCVar("realmList") => "us.logon.worldofwarcraft.com"

Afterwards logged in to EU account, it's still the same
Code:
GetCVar("portal") => "US"
GetCVar("realmList") => "us.logon.worldofwarcraft.com"

Are we talking about the CVars on Live servers or the WoD beta servers? I'm a bit confused now

Last edited by Ketho : 07-23-14 at 02:45 PM.
  Reply With Quote
07-23-14, 04:10 PM   #23
Bringer
A Fallenroot Satyr
 
Bringer's Avatar
Join Date: Jul 2012
Posts: 26
info? From Blizzard support

https://us.battle.net/support/en/art...he-game-region

I have 2 different WoW client installs each attached to a different Battlenet ID, my original US and a testing starter EU (Battlenet app installed with newer EU client)
both have SET installLocale "enUS"
both have SET locale US has "enUS" EU has "enGB"
neither have SET portal

All testing on original US client when using Battlenet account.. allowing app to shutdown on game start.
test 1 on US client
edit WTF/Config.wtf add SET portal "EU" change SET local "enGB"
launch wow-64.exe login using my EU test ID
get EU's read TerminationWithoutNotice
after back and forth finally get realm.. and EU realm list. login character.. exit client
WTF/Config.wtf Set portal is gone.

test 2 same client Config.wtf reset to normal
launch World of Warcraft Launcher.exe Battlenet app launches.. login with EU test ID
in game wrong realm get EU realm list .. login character.. exit client
WTF/Config.wtf only changes gametip and realmname .. playing in EU with US settings!

test 3 same client config.wtf reset to normal
launch battlenet desktop app.. battlenet region = US login with EU test account
verify game settings are correct in install and game play directories
{Note with 2 clients the launcher frequently modifies the directories to the wrong client.. and often triggers a 10MB download before client ready to play}
results same as test 2

test 4 same client config.wtf reset to normal then change SET local "enGB"
launch battlenet desktop app .. battlenet region = US login with US existing battlenet account
launch game find WoW client setting up a new account.. region/realm/new character setups
log in on character and exit game.
retart battlenet desktop app find my US test account now has two starter game setups 1 EU 1 US

launcher.db changes but not always.. not sure what triggers the change.
  Reply With Quote
07-24-14, 09:45 AM   #24
Bringer
A Fallenroot Satyr
 
Bringer's Avatar
Join Date: Jul 2012
Posts: 26
Originally Posted by Ketho View Post
Are we talking about the CVars on Live servers or the WoD beta servers? I'm a bit confused now
Both.
With CVar(realmslist) no longer being correctly set by the Battlenet Desktop app launcher which is now the de facto launcher those of us who need to know which region a character is in are hurting.

The addon I maintain (CensusPlus) and the website it supports are in real trouble since we can't insure data integrity.

At this point all we can do is ask people to not play in both US & EU regions on the same WoW client directory while using our addon.
  Reply With Quote
07-24-14, 02:59 PM   #25
TOM_RUS
A Warpwood Thunder Caller
Join Date: Sep 2008
Posts: 95
As far I know Battle.net App passes region and login data to client directly using shared memory (file mapping). Value for "portal" from config.wtf are only used when starting wow client without battle.net app.

Last edited by TOM_RUS : 07-24-14 at 03:01 PM.
  Reply With Quote
07-25-14, 12:34 PM   #26
Bringer
A Fallenroot Satyr
 
Bringer's Avatar
Join Date: Jul 2012
Posts: 26
battlenet app to wow testing.

Conclusion from testing.
Battlenet desktop app appears to trigger launch with: Program to launch (full path), AccountID, Account password (hash presumed)
Wow client launches with configuration based upon Config.wtf locale setting
(this is seen where if locale is an EU variant the client has a prominent LANGUAGE button whereas the US client has that option buried in settings.)
client is directed to authentication server based upon accounts last region usage.

Tests and results.

Battlenet account with 2 WoW starter editions attached 1-US, 1- EU
Edited Config.wtf to SET locale "enUS" --Note: previous testing had "enGB"
Launch Battlenet .. and then Wow-US

/logs/connection.log
7/24 21:25:34.402 Login program=WoW platform=Wn64 locale=enUS
7/24 21:25:34.435 Component WoW.Wn64.18414
7/24 21:25:34.457 Component WoW.base.18273 --Note: version id of base language packs
7/24 21:25:34.480 Component WoW.deDE.18414 --Note: EU packs installed when WoW-EU first activated.
7/24 21:25:34.502 Component WoW.enGB.18414
7/24 21:25:34.524 Component WoW.enUS.18273
7/24 21:25:34.547 Component WoW.esES.18414
7/24 21:25:34.568 Component WoW.frFR.18414
7/24 21:25:34.591 Component WoW.itIT.18414
7/24 21:25:34.633 Battle.net is Component Bnet.Wn64.37165
7/24 21:25:34.658 LOGIN: state: LOGIN_STATE_CONNECTING result: LOGIN_OK --Note: initial client log in
7/24 21:25:34.770 Connecting to 213.248.127.130:1119 --Note: Paris data center
7/24 21:25:36.400 LOGIN: state: LOGIN_STATE_AUTHENTICATED result: LOGIN_OK
7/24 21:25:36.864 ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
7/24 21:25:36.893 LOGIN: state: RESPONSE_CONNECTED result: LOGIN_OK
7/24 21:25:37.863 ClientConnection Completed: COP_CONNECT code=RESPONSE_CONNECTED result=TRUE
7/24 21:25:37.944 ClientConnection Initiating: COP_AUTHENTICATE code=CSTATUS_AUTHENTICATING
7/24 21:25:38.951 ClientConnection Completed: COP_AUTHENTICATE code=AUTH_OK result=TRUE
7/24 21:25:41.948 ClientConnection Initiating: COP_GET_CHARACTERS code=43
7/24 21:25:43.026 ClientConnection Completed: COP_GET_CHARACTERS code=44 result=TRUE
7/24 21:25:53.124 ClientConnection Initiating: COP_GET_CHARACTERS code=43
7/24 21:25:53.545 ClientConnection Completed: COP_GET_CHARACTERS code=44 result=TRUE
7/24 21:25:55.784 ClientConnection Initiating: COP_GET_REALMS code=REALM_LIST_IN_PROGRESS
7/24 21:25:55.881 ClientConnection Completed: COP_GET_REALMS code=REALM_LIST_SUCCESS result=TRUE
7/24 21:26:02.984 ClientConnection Completed: COP_GET_REALMS code=RESPONSE_CANCELLED result=FALSE
7/24 21:26:03.014 Client Disconnect due to reason:12

exit out to edit Config.wtf to SET locale "enGB"
rename connection.log to save
Launch Battlenet .. and then Wow-US

/logs/connection.log
7/24 22:12:09.953 Login program=WoW platform=Wn64 locale=enGB
--note: identical Component list removed to cut wall of text
7/24 22:12:10.326 LOGIN: state: LOGIN_STATE_CONNECTING result: LOGIN_OK
7/24 22:12:10.373 Connecting to 12.129.206.130:1119 --Note:Los Angeles data center
7/24 22:12:10.871 LOGIN: state: LOGIN_STATE_AUTHENTICATED result: LOGIN_OK
7/24 22:12:11.427 ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
7/24 22:12:11.485 LOGIN: state: RESPONSE_CONNECTED result: LOGIN_OK
7/24 22:12:11.714 ClientConnection Completed: COP_CONNECT code=RESPONSE_CONNECTED result=TRUE
7/24 22:12:11.780 ClientConnection Initiating: COP_AUTHENTICATE code=CSTATUS_AUTHENTICATING
7/24 22:12:12.454 ClientConnection Completed: COP_AUTHENTICATE code=AUTH_OK result=TRUE
7/24 22:12:15.527 ClientConnection Initiating: COP_GET_CHARACTERS code=43
7/24 22:12:15.940 ClientConnection Completed: COP_GET_CHARACTERS code=44 result=TRUE
7/24 22:15:28.304 ClientConnection Initiating: COP_LOGIN_CHARACTER code=78
7/24 22:15:31.099 ClientConnection Completed: COP_LOGIN_CHARACTER code=79 result=TRUE
7/24 22:16:18.103 ClientConnection Completed: COP_LOGIN_CHARACTER code=79 result=TRUE
7/24 22:16:22.502 ClientConnection Initiating: COP_GET_CHARACTERS code=43
7/24 22:16:22.904 ClientConnection Completed: COP_GET_CHARACTERS code=44 result=TRUE

exit out to edit Config.wtf to SET locale "enGB" --note: edit not needed as already set
rename connection.log to save
Launch Battlenet .. and then Wow-EU --NOTE:different WoW account

/logs/connection.log
7/25 08:38:13.755 Login program=WoW platform=Wn64 locale=enGB
--note: identical Component list removed to cut wall of text
7/25 08:38:14.207 LOGIN: state: LOGIN_STATE_CONNECTING result: LOGIN_OK
7/25 08:38:14.347 Connecting to 213.248.127.130:1119 --Note: Paris data center
7/25 08:38:15.939 LOGIN: state: LOGIN_STATE_AUTHENTICATED result: LOGIN_OK
7/25 08:38:16.703 ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
7/25 08:38:16.734 LOGIN: state: RESPONSE_CONNECTED result: LOGIN_OK

exit out to edit Config.wtf to SET locale "enUS"
rename connection.log to save
Launch Battlenet .. and then Wow-EU

/logs/connection.log
7/25 10:25:23.966 Login program=WoW platform=Wn64 locale=enGB
--note: identical Component list removed to cut wall of text
7/25 10:25:24.200 LOGIN: state: LOGIN_STATE_CONNECTING result: LOGIN_OK
7/25 10:25:24.216 Connecting to 12.129.206.130:1119 --Note:Los Angeles data center
7/25 10:25:24.543 LOGIN: state: LOGIN_STATE_AUTHENTICATED result: LOGIN_OK
7/25 10:25:25.058 ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
7/25 10:25:25.089 LOGIN: state: RESPONSE_CONNECTED result: LOGIN_OK
7/25 10:25:25.199 ClientConnection Completed: COP_CONNECT code=REALM_LIST_REALM_NOT_FOUND result=FALSE
7/25 10:26:50.588 ClientConnection Completed: COP_CONNECT code=RESPONSE_CANCELLED result=FALSE
7/25 10:26:50.636 ClientConnection Initiating: COP_CONNECT code=CSTATUS_CONNECTING
7/25 10:26:50.803 ClientConnection Completed: COP_CONNECT code=RESPONSE_CONNECTED result=TRUE
7/25 10:26:50.842 ClientConnection Initiating: COP_AUTHENTICATE code=CSTATUS_AUTHENTICATING
7/25 10:26:51.532 ClientConnection Completed: COP_AUTHENTICATE code=AUTH_OK result=TRUE
--Note: fingers went auto-pilot and pressed cancel had to reconnect..log continues
--Note: part of above was client getting confused with data.. and defaulting to no known realm/character status.
7/25 10:27:19.116 ClientConnection Initiating: COP_GET_CHARACTERS code=43
7/25 10:27:19.630 ClientConnection Completed: COP_GET_CHARACTERS code=44 result=TRUE
7/25 10:27:58.773 ClientConnection Initiating: COP_CREATE_CHARACTER code=46
7/25 10:27:59.179 ClientConnection Completed: COP_CREATE_CHARACTER code=47 result=TRUE
7/25 10:27:59.210 ClientConnection Initiating: COP_GET_CHARACTERS code=43
7/25 10:27:59.756 ClientConnection Completed: COP_GET_CHARACTERS code=44 result=TRUE
7/25 10:29:00.180 ClientConnection Initiating: COP_LOGIN_CHARACTER code=78
7/25 10:29:03.003 ClientConnection Completed: COP_LOGIN_CHARACTER code=79 result=TRUE
  Reply With Quote
07-25-14, 12:44 PM   #27
Bringer
A Fallenroot Satyr
 
Bringer's Avatar
Join Date: Jul 2012
Posts: 26
region detection fallback

Unless something comes available to ID realm-region.
I am looking at providing a user option for users who plan to play in multiple regions.
The option will pop up a reminder notice and allowing users to override select their current region.

On the web side of the CensusPlus data, I expect we will have to do generate a unique identifier each time the addon is loaded and associate that identifier with the data collected during the character login session.
After data is sent to the web site, we will need to do sample cross checks with Blizzards Community Platform API to confirm validity of data.
  Reply With Quote
07-26-14, 01:52 AM   #28
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
BNGetToonInfo and BNGetFriendToonInfo both provide a realmID, though as I only have access to a trial account at the moment, I can't actually check whether it's different for the US and EU realms of the same name. If it is, then you could set up a hardcoded table mapping each realmID to its region, and then check the player's Battle.net friends (assuming they have any) to find out which region they were playing on.

If the realmID proves useful, it might also be worth asking Blizzard to add it to non-Battle.net functions that currently return a realm name, eg. UnitName, UnitFullName, GetRealmName, though I'm not sure how much they really listen to that kind of suggestion...
__________________
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
07-26-14, 03:42 PM   #29
TOM_RUS
A Warpwood Thunder Caller
Join Date: Sep 2008
Posts: 95
Originally Posted by Phanx View Post
BNGetToonInfo and BNGetFriendToonInfo both provide a realmID, though as I only have access to a trial account at the moment, I can't actually check whether it's different for the US and EU realms of the same name. If it is, then you could set up a hardcoded table mapping each realmID to its region, and then check the player's Battle.net friends (assuming they have any) to find out which region they were playing on.

If the realmID proves useful, it might also be worth asking Blizzard to add it to non-Battle.net functions that currently return a realm name, eg. UnitName, UnitFullName, GetRealmName, though I'm not sure how much they really listen to that kind of suggestion...
Looks like realm id's are unique:
EU realms
US realms
TW realms
CN realms

You can even get your own realm id like this:
Code:
local presenceID, battleTag, toonID, broadcastText, bnetAFK, bnetDND, isRIDEnabled = BNGetInfo();
local hasFocus, toonName, client, realmName, realmID, faction, race, class, guild, zoneName, level, gameText, broadcastText, broadcastTime, canSoR, toonID = BNGetToonInfo(presenceID or toonID);

Last edited by TOM_RUS : 07-29-14 at 05:35 AM.
  Reply With Quote
07-26-14, 03:46 PM   #30
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,048
You can actually query yourself using BNGetToonInfo(BNGetInfo()) (although I'm not sure if your own "presence ID" is ever something other than 1).

I'm also not sure what this would do if you got disconnected from battle net.
  Reply With Quote
07-26-14, 06:37 PM   #31
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 789
Your own ID is probably 1 always yes. But there is an issue if BNet is not available, or disabled.

Good method but not perfect.
__________________
Profile: Curse | Wowhead
  Reply With Quote
07-27-14, 05:02 AM   #32
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,706
How would you be able to log in without battle.net? Well it might struggle if the battle.net goes down after login.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
07-27-14, 07:50 AM   #33
TOM_RUS
A Warpwood Thunder Caller
Join Date: Sep 2008
Posts: 95
Just cache realm id right after login. Chances that battle.net goes down between login and entering world pretty low.
  Reply With Quote
07-27-14, 09:24 AM   #34
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Isn't the Battle.net chat a separate system? I've witnessed several times that the chat was down on login. There's also the fact that one may completely opt out of Battle.net chat on the account level. (I think?) All in all it doesn't seem like a very reliable solution, but if it's the only way.. meh. All these cvars always seemed a bit clunky to me, as well. I hope they'll implement a proper API for it, a la GetServerRegion().
__________________
Grab your sword and fight the Horde!
  Reply With Quote
07-27-14, 09:47 AM   #35
Rainrider
A Scalebane Royal Guard
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 449
You can use the new Unit GUID format in WoD to get the server id.
Code:
local unitType, serverID, guid = strsplit(":", UnitGUID("player"))
This may also be a great way to deliver localized messages to others in the language of the server they play on.

@TOM_RUS
How did you get the server id lists? Can one break them down into deDE, frFR and so on?
  Reply With Quote
07-27-14, 10:12 AM   #36
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 789
I believe it is a internal ID assignment to the various realms. I guess datamining is one way to retrieve this list. Haven't found an easier method just yet.

*Edit* You can find, at least the public available realms, over at character transfer. The page HTML contains javascript data on realm names and internal ID's. So far this is the easiest way to extract the list of realms and their IDs:
  1. https://eu.battle.net/account/manage...ct-select.html
  2. Select account with at least one character.
  3. Select character.
  4. Run the following script on the page to get the realm list in return.
    Code:
    var r=RealmSelector;if(r){var d=[];for(var i=0;i<RealmSelector.realmID.length;i++){d[i]=[parseInt(r.realmID[i]),r.realmName[i].trim(),r.realmType[i].trim(),r.realmLocale[i].trim()]}console.log(JSON.stringify(d))}else{console.log("Can't find RealmSelector object.")}
    The script will simply read from the RealmSelector object on the page and extract realmID, realmName, realmType and realmLocale, store it in an array and return that array in the console as JSON for easy copy-paste.

The downside is this requires you to login, do some actions then finally get the list. It's also limited to your region, so you need another account from other regions if you want to copy their realm information. Mine is EU and this is what the script above dumped:

http://pastebin.com/rqTWCPWj
__________________
Profile: Curse | Wowhead

Last edited by Vlad : 07-27-14 at 10:37 AM.
  Reply With Quote
07-27-14, 11:39 AM   #37
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,048
Here are the US realms: http://pastebin.com/XBqWFQzn

And like Rainrider said, your GUID is probably the best way to get the realm ID in WoD.

Last edited by semlar : 07-27-14 at 11:50 AM.
  Reply With Quote
07-27-14, 03:31 PM   #38
Simca
An Aku'mai Servant
 
Simca's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2012
Posts: 33
Do UnitGUID("player") and/or BNGetToonInfo(BNGetInfo()) always report the correct serverID, even when you're not on your server or you're in an instance?

Also - a bunch of important hardcoded data that many addons will want to use? Sounds like library time! Any volunteers?
__________________
Assistant admin for MMO-Champion
WoW database file expert - ask me anything
  Reply With Quote
07-27-14, 04:25 PM   #39
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,048
Originally Posted by Simca View Post
Do UnitGUID("player") and/or BNGetToonInfo(BNGetInfo()) always report the correct serverID, even when you're not on your server or you're in an instance?
The player's GUID is static and should only ever change if a character has a paid transfer to another server.

It doesn't represent where a unit currently is, only where it was created.
  Reply With Quote
07-27-14, 05:23 PM   #40
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Ah, forgot about the GUID changes coming up. That's probably a better solution than querying Battle.net.

Originally Posted by semlar View Post
You can actually query yourself using BNGetToonInfo(BNGetInfo()) (although I'm not sure if your own "presence ID" is ever something other than 1).
I thought there was a way to do that, but couldn't remember what it was offhand, and was too lazy to go look it up. >_>
__________________
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 : 07-27-14 at 05:25 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Detect Current Region

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