Getting player list and score from a server - Better Battlelog Forums #117103

Sitemap
Post edited 1 x times, last by
Topicstarter
Hi there,

I'm currently working on a plugin that extends the information you see in the server browser. Often I find a server that perfectly matches my filter criterias (e.g. slots for 4 friends and me, favorite game mode, nice map, good server size) - just to realise upon map change that we joined a mixed mode server that makes us play TDM on Locker, bah.

What I got so far: when selecting a server, my plugin shows the next map (I know that this gets incorrect when the server has votemap enabled), using the following request to get the server data:

$.ajax({
headers: {
'X-AjaxNavigation': 1
},
url: 'http://battlelog.battlefield.com/bf4/servers/show/pc/6a47de60-0874-4d98-83e3-de8d1d2fe2f1/BiG-HC-RANKED-24-7-RUSH/',
success:function( r ) {
// map information in r.context.server.maps
var mapObj = r.context.server.maps,
nextMap = mapObj.maps[ mapObj.nextMapIndex ].map;

alert( 'Next map is ' + nextMap );
}
});


btw: is there any object I can access to transform the internal map names to recognizable ones, like "MP_Journey" -> "Golmud Railway"?

Now, I want to get the player list, like the live scoreboard does. However, even if I enable logging of requests in Chrome, I don't see any queries that indicate an update to the live scoreboard. The player list in the response object is outdated and lists players that don't even play on the server.

Any suggestions?
Post edited 3 x times, last by
Some hints

* Use BBLog handler to get JSON from battlelog
BBLog.handle("json.from.battlelog", {url : '/bf4/servers/show/pc/6a47de60-0874-4d98-83e3-de8d1d2fe2f1/BiG-HC-RANKED-24-7-RUSH/', callback : function(data){// code here});

* Search in console.log(S.translations) if you find some translations that fit your need, eg: WARSAW_ID_RP_LEVELNAME_MULTIPLAYER.

* Player list - Is requested by the installed webplugin in a special way - As far as i know there some plugins here that already fetch the server playerlists, check out the plugins
Post edited 2 x times, last by
Topicstarter
BrainFooLong wrote:
* Use BBLog handler to get JSON from battlelog
BBLog.handle("json.from.battlelog", {url : '/bf4/servers/show/pc/6a47de60-0874-4d98-83e3-de8d1d2fe2f1/BiG-HC-RANKED-24-7-RUSH/', callback : function(data){// code here});

What's the difference?

BrainFooLong wrote:
* Search in console.log(S.translations) if you find some translations that fit your need, eg: WARSAW_ID_RP_LEVELNAME_MULTIPLAYER.


Gives me the following data:
WARSAW_ID_M_SP_LEVELNAME_AIRFIELD => SINGAPORE
WARSAW_ID_M_SP_LEVELNAME_DAM => TASHGAR
WARSAW_ID_M_SP_LEVELNAME_NAVAL => SOUTH CHINA SEA
WARSAW_ID_M_SP_LEVELNAME_PRISON => KUNLUN MOUNTAINS
WARSAW_ID_M_SP_LEVELNAME_PROLOGUE => BAKU
WARSAW_ID_M_SP_LEVELNAME_SHANGHAI => SHANGHAI
WARSAW_ID_M_SP_LEVELNAME_SUEZ => SUEZ
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_ABANDONED => Zavod 311
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_DAMAGE => Lancang Dam
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_DISH => Rogue Transmission
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_FLOODED => Flood Zone
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_JOURNEY => Golmud Railway
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_NAVAL => Paracel Storm
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_PRISON => Operation Locker
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_RESORT => Hainan Resort
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_SIEGE => Siege of Shanghai
WARSAW_ID_RP_LEVELNAME_MULTIPLAYER_TREMORS => Dawnbreaker
WARSAW_ID_RP_XP0_LEVELNAME_MULTIPLAYER_CASPIAN => Caspian Border 2014
WARSAW_ID_RP_XP0_LEVELNAME_MULTIPLAYER_FIRESTORM => Firestorm 2014
WARSAW_ID_RP_XP0_LEVELNAME_MULTIPLAYER_METRO => Operation Metro 2014
WARSAW_ID_RP_XP0_LEVELNAME_MULTIPLAYER_OMAN => Gulf of Oman 2014
WARSAW_ID_RP_XP2_LEVEL_LEVELNAME_XP2_001 => Lost Islands
WARSAW_ID_RP_XP2_LEVEL_LEVELNAME_XP2_002 => Nansha Strike
WARSAW_ID_RP_XP2_LEVEL_LEVELNAME_XP2_003 => Wave Breaker
WARSAW_ID_RP_XP2_LEVEL_LEVELNAME_XP2_004 => Operation Mortar
WARSAW_ID_XP1_LEVEL_LEVELNAME_XP1_001 => SILK ROAD
WARSAW_ID_XP1_LEVEL_LEVELNAME_XP1_002 => ALTAI RANGE
WARSAW_ID_XP1_LEVEL_LEVELNAME_XP1_003 => GUILIN PEAKS
WARSAW_ID_XP1_LEVEL_LEVELNAME_XP1_004 => DRAGON PASS
BF3_ID_RP_LEVELNAME_MULTIPLAYER_CANALS => Noshahr Canals
BF3_ID_RP_LEVELNAME_MULTIPLAYER_EARTHQUAKE => Epicenter
BF3_ID_RP_LEVELNAME_MULTIPLAYER_FINANCIAL => Markaz Monolith
BF3_ID_RP_LEVELNAME_MULTIPLAYER_PARLIAMENT => Azadi Palace
BF3_ID_RP_LEVELNAME_MULTIPLAYER_RUBBLE => Talah Market
BF3_ID_RP_LEVELNAME_MULTIPLAYER_XP5_001 => Operation Riverside
BF3_ID_RP_LEVELNAME_MULTIPLAYER_XP5_002 => Nebandan Flats
BF3_ID_RP_LEVELNAME_MULTIPLAYER_XP5_003 => Kiasar Railroad
BF3_ID_RP_LEVELNAME_MULTIPLAYER_XP5_004 => Sabalan Pipeline

I don't like that the China Rising maps are uppercased and that the keys differ to much (some have XP1 or 2 in their key, some use numbers, some underscores), it just seems inconsistent.

I just found another way, what about this one? Is it reliable?
console.log( gamedatawarsaw.function_warsawgameserver().maps[ 2 ] );
->
Object
{
gameExpansion: 0
gameModes: Array[8]
id: "MP_Prison"
label: "Operation Locker"
platforms: Array[5]
}


BrainFooLong wrote:
* Player list - Is requested by the installed webplugin in a special way - As far as i know there some plugins here that already fetch the server playerlists, check out the plugins

Thanks, will take a look.

//edit
I couldn't find any plugin that accesses the player list :( any further suggestion? The player list I can obtain via bf4stats.com includes 1000 players from the past, I can't seem to find which players are currently active (beside some non-reliable date comparisons).
What's the difference?

It's cross browser tested.
It's future battlelog update stable (if they change something that break it, i will fix it fastly with an update)
It's internally cached when you call the same url multiple times, you can disable the cache with the optional flag "cache : false" in the params.

Gives me the following data:

Well, was just a tip. If you don't can use it, you must search another way or map it for yourself.
The way you mentioned looks ok, you need to find the best solution for your needs.

PlayerList

Well, don't have an idea currently. In the past it was able with an simple request in battlelog, seems like this way doesn't exist anymore. Maybe there something hidden in the "gamedatawarsaw" that you've already found.
Sry guys for the bump, but who knows. Maybe someone later reading this want it to know ;)
You can get the playerlist, the score and also the currently joining player from this url:
http://keeper.battlelog.com/snapshot/17f9d784-62bd-461e-92b0-0e1528f83e91


Just change the guid at the end for your server and you will have your data there :)

Some more info:
- If there is no "deathmatch" element in the snapshot element, then the round is not started (due to not enough players or just because the round is restarting).
- If you look into snapshot > teamInfo you see five elements.
First one is for the currently joining people. And all others are the playing teams. So mostly only the second and third element is filled. (4th and 5th) is only filled if there are 4 teams on the server (like in squad deathmatch).
The faction element give you the ID of the team. 0 => US, 1=> RU, 2 => CN

This should be everything you may need to know :)