strfree(PS_GR_OUT_EVL);
if (PS_GR_OUT_DB >= 0)
+ {
db_close(PS_GR_OUT_DB);
- PlayerStats_GameReport_Init();
+ PlayerStats_GameReport_Init();
+ }
if(PS_GR_OUT_DB < 0)
return;
- for (int i = 0; i < 16; i++)
+ for (int i = 0; i < 16; ++i)
if (teamscorekeepers[i])
PlayerStats_GameReport_AddTeam(i + 1);
FOREACH_CLIENT(true, {
{
float latency = max(0, CS(p).latency_sum / CS(p).latency_cnt);
if(latency)
- PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, latency);
+ {
+ // if previous average latency exists (player disconnected and reconnected)
+ // make the average of previous and current average latency
+ float prev_latency = PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, 0);
+ float new_latency = !prev_latency ? latency : (prev_latency + latency) / 2;
+ PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, -prev_latency + new_latency);
+ }
}
db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS_CVAR(p).cvar_cl_allow_uidranking));
PlayerStats_GameReport_FinalizePlayer(it);
});
- if(autocvar_g_playerstats_gamereport_uri != "")
- {
- PlayerStats_GameReport_DelayMapVote = true;
- url_multi_fopen(
- autocvar_g_playerstats_gamereport_uri,
- FILE_APPEND,
- PlayerStats_GameReport_Handler,
- NULL
- );
- }
- else
+ if(autocvar_g_playerstats_gamereport_uri == "" || warmup_stage)
{
PlayerStats_GameReport_DelayMapVote = false;
db_close(PS_GR_OUT_DB);
PS_GR_OUT_DB = -1;
+ return;
}
+
+ PlayerStats_GameReport_DelayMapVote = true;
+ url_multi_fopen(
+ autocvar_g_playerstats_gamereport_uri,
+ FILE_APPEND,
+ PlayerStats_GameReport_Handler,
+ NULL
+ );
}
void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that scores are added properly
{
+ serverflags &= ~SERVERFLAG_PLAYERSTATS;
+ serverflags &= ~SERVERFLAG_PLAYERSTATS_CUSTOM;
+
if(autocvar_g_playerstats_gamereport_uri == "") { return; }
PS_GR_OUT_DB = db_create();
{
PlayerStats_GameReport_DelayMapVote = true;
- serverflags |= SERVERFLAG_PLAYERSTATS;
if(autocvar_g_playerstats_gamereport_uri != cvar_defstring("g_playerstats_gamereport_uri"))
- {
- serverflags |= SERVERFLAG_PLAYERSTATS_CUSTOM;
- }
+ serverflags |= SERVERFLAG_PLAYERSTATS | SERVERFLAG_PLAYERSTATS_CUSTOM;
+ else if(checkextension("DP_CRYPTO") && checkextension("DP_QC_URI_POST"))
+ // XonStat submission requires player and server IDs, and HTTPS POST
+ serverflags |= SERVERFLAG_PLAYERSTATS;
PlayerStats_GameReport_AddEvent(PLAYERSTATS_ALIVETIME);
PlayerStats_GameReport_AddEvent(PLAYERSTATS_AVGLATENCY);
* C: number of "unpure" cvar changes
* U: UDP port number of the server
* D: duration of the match
+ * RP: number of rounds played
* L: "ladder" in which the server is participating in
* P: player ID of an existing player; this also sets the owner for all following "n", "e" and "t" lines (lower case!)
* Q: team number of an existing team (format: team#NN); this also sets the owner for all following "e" lines (lower case!)
* i: player index
* n: nickname of the player (optional)
* t: team ID
+ * r: player ranking enabled / disabled
* e: followed by an event name, a space, and the event count/score
* event names can be:
* alivetime: total playing time of the player
url_fputs(fh, sprintf("C %d\n", cvar_purechanges_count));
url_fputs(fh, sprintf("U %d\n", cvar("port")));
url_fputs(fh, sprintf("D %f\n", max(0, time - game_starttime)));
- url_fputs(fh, sprintf("L %s\n", autocvar_g_playerstats_gamereport_ladder));
+ if (rounds_played > 0)
+ url_fputs(fh, sprintf("RP %d\n", rounds_played));
+ if (autocvar_g_playerstats_gamereport_ladder != "")
+ url_fputs(fh, sprintf("L %s\n", autocvar_g_playerstats_gamereport_ladder));
// TEAMS
if(teamplay)