TMU Data Fetcher
Posted: 20 Jan 2008 15:24
The TMNDataFetcher class (originally by F*ckfish, and significantly updated by me since ASECO/RASP v0.92) provides an easy API to obtain lots of stats about a TMN login from Nadeo's master server. I figured it would be an interesting challenge to do the same for TMU logins.
And a challenge it was at first too, since packet sniffing TMU revealed that it uses an entirely different communication mechanism between client (or dedicated server) and the master server than TMN. While the latter employs no fewer than 7 different URLs from which to request various details via HTTP GET calls (easy to test in a browser), TMU uses one URL that exchanges XML blocks via HTTP POST calls (requires a bit of scripting to send/receive). Additionally, many types of XML requests to the master server require a valid session key to be included, and only a few return useful data without such a key (which an API cannot generate).
Fortunately those few requests include two to obtain basic player info and stats on a login, and two for traversing the player and zone ladders. So around those calls I've now developed a TMUDataFetcher class, providing an easy API for retrieving player and zone stats for a given TMU login. This includes that login's world stats, stats for all seven environments, and player ranking within each of his/her (sub)zones -- all of which can also been looked up at TM Ladder -- along with the rankings of each (sub)zone within its parent zone (just like what you see in the TMU client's server/zone browser).
Here is the return object's structure, using Mistral as a (hopefully willing
) example:
Next I am going to develop a /statsall plugin for AsecoTMU with this. That also helps me to learn how to develop AsecoTMU plugins, which will be necessary for porting ASECO/RASP features to that framework, as AsecoTMU will be the starting point for getting things going on Forever.
Cheers!
And a challenge it was at first too, since packet sniffing TMU revealed that it uses an entirely different communication mechanism between client (or dedicated server) and the master server than TMN. While the latter employs no fewer than 7 different URLs from which to request various details via HTTP GET calls (easy to test in a browser), TMU uses one URL that exchanges XML blocks via HTTP POST calls (requires a bit of scripting to send/receive). Additionally, many types of XML requests to the master server require a valid session key to be included, and only a few return useful data without such a key (which an API cannot generate).
Fortunately those few requests include two to obtain basic player info and stats on a login, and two for traversing the player and zone ladders. So around those calls I've now developed a TMUDataFetcher class, providing an easy API for retrieving player and zone stats for a given TMU login. This includes that login's world stats, stats for all seven environments, and player ranking within each of his/her (sub)zones -- all of which can also been looked up at TM Ladder -- along with the rankings of each (sub)zone within its parent zone (just like what you see in the TMU client's server/zone browser).
Here is the return object's structure, using Mistral as a (hopefully willing

Code: Select all
TMUDataFetcher Object
(
[version] => 0.2.1.0
[zones] => 1
[login] => mistral
[nickname] => $FFFMi$88Fstr$FFFal
[location] => World|Germany|Bavaria|Regensburg
[worldrank] => 657
[totalplayers] => 94308
[points] => 11418.3
[lastscore] => 0
[wins] => 71134
[losses] => 34774
[draws] => 158864
[envstats] => Array
(
[Bay] => Array
(
[rank] => 437
[points] => 1531.96
[lastscore] => 2.51
[wins] => 9935
[draws] => 22519
[losses] => 3388
)
[Coast] => Array
(
[rank] => 774
[points] => 1396.96
[lastscore] => 0
[wins] => 7587
[draws] => 15526
[losses] => 3962
)
[Desert] => Array
(
[rank] => 601
[points] => 1399.1
[lastscore] => 0.14
[wins] => 9488
[draws] => 23588
[losses] => 5829
)
[Island] => Array
(
[rank] => 496
[points] => 1927.04
[lastscore] => 3.33
[wins] => 11954
[draws] => 23331
[losses] => 4913
)
[Rally] => Array
(
[rank] => 236
[points] => 1326.43
[lastscore] => 0.29
[wins] => 11500
[draws] => 17167
[losses] => 4749
)
[Snow] => Array
(
[rank] => 396
[points] => 1573.94
[lastscore] => 2.01
[wins] => 11538
[draws] => 28763
[losses] => 6728
)
[Stadium] => Array
(
[rank] => 1521
[points] => 3978.44
[lastscore] => 0
[wins] => 9240
[draws] => 28116
[losses] => 5271
)
)
[zonestats] => Array
(
[World|Germany] => Array
(
[zonerank] => 1
[totalzones] => 45
[zonepoints] => 167418
[playerrank] => 193
[totalplayers] => 18526
[playerpoints] => 11418
)
[World|Germany|Bavaria] => Array
(
[zonerank] => 5
[totalzones] => 16
[zonepoints] => 124408
[playerrank] => 20
[totalplayers] => 2884
[playerpoints] => 11418
)
[World|Germany|Bavaria|Regensburg] => Array
(
[zonerank] => 3
[totalzones] => 6
[zonepoints] => 70911
[playerrank] => 5
[totalplayers] => 69
[playerpoints] => 11418
)
)
)
Cheers!
