From: Jan Behrens Date: Sat, 20 Apr 2013 16:46:48 +0000 (+0200) Subject: Adding xonstat event for teamscore X-Git-Tag: xonotic-v0.7.0~23^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5448301a8aca77ba6a7435e6467a97672902e679;p=xonotic%2Fxonotic-data.pk3dir.git Adding xonstat event for teamscore --- diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index c01a25bbd..45b00c076 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -159,7 +159,7 @@ float PlayerStats_Event(entity e, string event_id, float value) return val; } -void PlayerStats_TeamScore(float t, string event_id, float value) // TODO: doesn't this remain unused? +void PlayerStats_TeamScore(float t, string event_id, float value) { string key; float val; @@ -219,7 +219,7 @@ void PlayerStats_ready(entity fh, entity pass, float status) { string p, pn; string e, en; - string nn, tt; + string nn, tt, ts; string s; switch(status) @@ -251,6 +251,9 @@ void PlayerStats_ready(entity fh, entity pass, float status) { tt = db_get(playerstats_db, sprintf("%s:_team", p)); url_fputs(fh, sprintf("t %s\n", tt)); + ts = db_get(playerstats_db, sprintf("team#%d:%s-score", PLAYERSTATS_SCOREBOARD, stof(tt))); + if(ts != "") + url_fputs(fh, sprintf("e %s %s\n", strcat(PLAYERSTATS_SCOREBOARD, "teamscore"), ts)); } for(e = events_last; (en = db_get(playerstats_db, sprintf("*:%s", e))) != ""; e = en) { @@ -383,6 +386,8 @@ void PlayerStats_EndMatch(float finished) entity p; PlayerScore_Sort(score_dummyfield, 0, 0, 0); PlayerScore_Sort(scoreboard_pos, 1, 1, 1); + if(teamplay) + PlayerScore_TeamStats(); FOR_EACH_CLIENT(p) { // add personal score rank diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index e8d559023..aa9afa7bf 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -927,6 +927,7 @@ void PlayerScore_TeamStats(void) for(i = 0; i < MAX_TEAMSCORE; ++i) if(sk.(teamscores[i]) != 0) if(teamscores_label[i] != "") - PlayerStats_TeamScore(t, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i])); + // the +1 is important here! + PlayerStats_TeamScore(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i])); } }