Skip to content

UserStats

Levi edited this page May 6, 2024 · 7 revisions

The following structure is used until today:

Size Datatype Description
4 sInt UserId
StatusUpdate Status
8 sLongLong Ranked Score
4 float Accuracy
4 sInt Play Count
8 sLongLong Total Score
4 sInt Rank
2 sShort PP

In versions b20120725 and lower, the pp is not present anymore:

Size Datatype Description
4 sInt UserId
StatusUpdate Status
8 sLongLong Ranked Score
4 float Accuracy
4 sInt Play Count
8 sLongLong Total Score
4 sInt Rank

As explained in this document, the user stats changed a lot on how they work in versions b1717 and below. Here we need to introduce a new enum, called "Completeness", which determines how much data to read:

Name Value
StatusOnly 0
Statistics 1
Full 2

If the "Completenes" is set to StatusOnly, the following information is sent:

Size Datatype Description
4 sInt UserId
1 Completeness
StatusUpdate Status

If it's set to Statistics, it will contain this:

Size Datatype Description
4 sInt UserId
1 Completeness
StatusUpdate Status
8 sLong Ranked Score
4 float Accuracy
4 sInt Playcount
8 sLong Total Score
4 sInt Rank

And lastly, if it's set to Full:

Size Datatype Description
4 sInt UserId
1 Completeness
StatusUpdate Status
8 sLong Ranked Score
4 float Accuracy
4 sInt Playcount
8 sLong Total Score
4 sInt Rank
String Username
String Avatar Filename
1 uChar Timezone + 24
String City
1 uChar Permissions
4 float Longitude
4 float Latitude

Note

The city should be left empty, if the Display City Location is set to false in the Client Info.


In b338, the "Rank" datatype was changed:

Size Datatype Description
4 sInt UserId
1 Completeness
StatusUpdate Status
8 sLong Ranked Score
4 float Accuracy
4 sInt Playcount
8 sLong Total Score
2 uShort Rank

In b337, the "Completeness" is not present anymore. Instead there is a boolean, called "newstats", that determines if there are... well... new stats.

Here is an example when the boolean is false:

Size Datatype Description
4 sInt UserId
1 bool Newstats (false)
StatusUpdate Status

And here is the structure, when it's set to true:

Size Datatype Description
4 sInt UserId
1 bool Newstats (true)
String Username
8 sLong Ranked Score
4 float Accuracy
4 sInt Playcount
8 sLong Total Score
4 sInt Rank
String Avatar Filename
1 uChar Timezone + 24
String City
StatusUpdate Status

Warning

On versions b501 and below, the maximum value for the total score was 17705429347. On versions b658 and below, the maximum value was 26931190826. This is because the toNextLevel array had a limit, which caused the bancho connection to crash when going over a certain total score value.

Clone this wiki locally