X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fplayerstats.qc;h=3b8c97c4b81626f6d292155e1831269540559b36;hb=6ae488fa94396ad9ffa0dc3dbfbedb54c8b7983a;hp=cde6a519028093268ef95fc568e91184a40d3368;hpb=1017a955336ffea041442a10138486f16f8273f1;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/playerstats.qc b/qcsrc/common/playerstats.qc index cde6a5190..3b8c97c4b 100644 --- a/qcsrc/common/playerstats.qc +++ b/qcsrc/common/playerstats.qc @@ -5,9 +5,11 @@ #include "constants.qh" #include "util.qh" #include + #include #include "../server/anticheat.qh" - #include "../server/defs.qh" + #include #include "../server/scores.qh" + #include #include "../server/weapons/accuracy.qh" #endif @@ -55,7 +57,7 @@ void PlayerStats_GameReport_AddPlayer(entity e) } } -void PlayerStats_GameReport_AddTeam(float t) +void PlayerStats_GameReport_AddTeam(int t) { if(PS_GR_OUT_DB < 0) { return; } @@ -152,12 +154,14 @@ void PlayerStats_GameReport_FinalizePlayer(entity p) if(latency) PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, latency); } + + db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS(p).cvar_cl_allow_uidranking)); } strfree(p.playerstats_id); } -void PlayerStats_GameReport(float finished) +void PlayerStats_GameReport(bool finished) { if(PS_GR_OUT_DB < 0) { return; } @@ -258,6 +262,7 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that } // this... is a hack, a temporary one until we get a proper duel gametype +// TODO: remove duel hack after servers have migrated to the proper duel gametype! string PlayerStats_GetGametype() { if(IS_GAMETYPE(DEATHMATCH) && autocvar_g_maxplayers == 2) @@ -291,7 +296,7 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status) * G: game type * O: mod name (icon request) as in server browser * M: map name - * I: match ID (see "matchid" in g_world.qc) + * I: match ID (see "matchid" in world.qc) * S: "hostname" of the server * C: number of "unpure" cvar changes * U: UDP port number of the server @@ -375,6 +380,10 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status) url_fputs(fh, sprintf("t %s\n", tt)); } + // elo ranking enabled + nn = db_get(PS_GR_OUT_DB, sprintf("%s:_ranked", p)); + if(nn != "") { url_fputs(fh, sprintf("r %s\n", nn)); } + // output player events for(e = PS_GR_OUT_EVL; (en = db_get(PS_GR_OUT_DB, sprintf("*:%s", e))) != ""; e = en) { @@ -483,6 +492,21 @@ void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest) } } +SHUTDOWN(PlayerStats_PlayerBasic_Shutdown) +{ + if(PS_B_IN_DB >= 0) + { + db_close(PS_B_IN_DB); + PS_B_IN_DB = -1; + } + + if(PS_GR_OUT_DB >= 0) + { + db_close(PS_GR_OUT_DB); + PS_GR_OUT_DB = -1; + } +} + void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer) { // determine whether we should retrieve playerbasic information again