]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Adding xonstat event for teamscore
authorJan Behrens <zykure@web.de>
Sat, 20 Apr 2013 16:46:48 +0000 (18:46 +0200)
committerJan Behrens <zykure@web.de>
Sat, 20 Apr 2013 16:46:48 +0000 (18:46 +0200)
qcsrc/server/playerstats.qc
qcsrc/server/scores.qc

index c01a25bbdc8228807ab8602cbd83b8aeaa2dfbb8..45b00c07684d14cb2912ed2c7fdd8a89543efc53 100644 (file)
@@ -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
index e8d5590238b877b79fdb53a74d1dc44f2f1c03a0..aa9afa7bf03a0e4368680af43e5ac422ffb79994 100644 (file)
@@ -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]));
        }
 }