]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
playerstats: also count killing sprees, botlike, first blood
authorRudolf Polzer <divverent@alientrap.org>
Sat, 15 Jan 2011 11:28:50 +0000 (12:28 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 15 Jan 2011 11:28:50 +0000 (12:28 +0100)
qcsrc/server/g_damage.qc
qcsrc/server/playerstats.qc
qcsrc/server/playerstats.qh

index 8583d8ca986cdd583c68947c58bc429fc943f484..d809f3534ed89076843975f0c64874a7a4603403 100644 (file)
@@ -367,6 +367,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                        // TODO: make these print a newline if they dont
                                        Send_CSQC_Centerprint(attacker, "", "", KILL_FIRST_BLOOD, MSG_KILL);
                                        Send_CSQC_Centerprint(targ, "", "", KILL_FIRST_VICTIM, MSG_KILL);
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD, 1);
+                                       PlayerStats_Event(targ, PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM, 1);
                                }
 
                                if((autocvar_sv_fragmessage_information_typefrag) && (targ.BUTTON_CHAT)) {
@@ -412,36 +414,43 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_3, MSG_SPREE);
                                        AnnounceTo(attacker, "03kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3, 1);
                                }
                                else if (attacker.killcount == 5)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_5, MSG_SPREE);
                                        AnnounceTo(attacker, "05kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5, 1);
                                }
                                else if (attacker.killcount == 10)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_10, MSG_SPREE);
                                        AnnounceTo(attacker, "10kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_10, 1);
                                }
                                else if (attacker.killcount == 15)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_15, MSG_SPREE);
                                        AnnounceTo(attacker, "15kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_15, 1);
                                }
                                else if (attacker.killcount == 20)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_20, MSG_SPREE);
                                        AnnounceTo(attacker, "20kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_20, 1);
                                }
                                else if (attacker.killcount == 25)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_25, MSG_SPREE);
                                        AnnounceTo(attacker, "25kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_25, 1);
                                }
                                else if (attacker.killcount == 30)
                                {
                                        Send_KillNotification(a, "", "", KILL_SPREE_30, MSG_SPREE);
                                        AnnounceTo(attacker, "30kills");
+                                       PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_30, 1);
                                }
                                LogDeath("frag", deathtype, attacker, targ);
                        }
@@ -459,6 +468,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                        GiveFrags(targ, targ, -1, deathtype);
                        if(PlayerScore_Add(targ, SP_SCORE, 0) == -5) {
                                AnnounceTo(targ, "botlike");
+                               PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1);
                        }
                        Send_KillNotification(s, msg, "", deathtype, MSG_KILL_ACTION);
 
index 94d1a8cfc0594edea15d3e607d9f08197ae939e8..0466a559b513079603898b14d98066fcf0dc4ca7 100644 (file)
@@ -20,7 +20,19 @@ void PlayerStats_Init()
        PlayerStats_AddEvent(PLAYERSTATS_ALIVETIME);
        PlayerStats_AddEvent(PLAYERSTATS_WINS);
        PlayerStats_AddEvent(PLAYERSTATS_MATCHES);
+       PlayerStats_AddEvent(PLAYERSTATS_JOINS);
        PlayerStats_AddEvent(PLAYERSTATS_SCOREBOARD_VALID);
+
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_10);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_15);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_20);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_25);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_30);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_BOTLIKE);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD);
+       PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM);
 }
 
 void PlayerStats_AddPlayer(entity e)
@@ -176,6 +188,8 @@ void PlayerStats_AddGlobalInfo(entity p)
        if(p.cvar_cl_allow_uid2name == 1 || clienttype(p) == CLIENTTYPE_BOT)
                db_put(playerstats_db, sprintf("%s:_netname", p.playerstats_id), p.netname);
 
+       PlayerStats_Event(p, PLAYERSTATS_JOINS, 1);
+
        strunzone(p.playerstats_id);
        p.playerstats_id = string_null;
 }
index 85ba6bcbfdc291049ef6818facc40668b1e4b721..2d004c1207b4580929de5325c5543341d42741b1 100644 (file)
@@ -2,9 +2,22 @@
 string PLAYERSTATS_ALIVETIME  = "alivetime";
 string PLAYERSTATS_WINS = "wins";
 string PLAYERSTATS_MATCHES = "matches";
+string PLAYERSTATS_JOINS = "joins";
+string PLAYERSTATS_SCOREBOARD_VALID = "scoreboardvalid";
+
 string PLAYERSTATS_TOTAL = "total-";
 string PLAYERSTATS_SCOREBOARD = "scoreboard-";
-string PLAYERSTATS_SCOREBOARD_VALID = "scoreboardvalid";
+
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3 = "achievement-kill-spree-3";
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5 = "achievement-kill-spree-5";
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_10 = "achievement-kill-spree-10";
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_15 = "achievement-kill-spree-15";
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_20 = "achievement-kill-spree-20";
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_25 = "achievement-kill-spree-25";
+string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_30 = "achievement-kill-spree-30";
+string PLAYERSTATS_ACHIEVEMENT_BOTLIKE = "achievement-botlike";
+string PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD = "achievement-firstblood";
+string PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM = "achievement-firstvictim";
 
 // delay map switch until this is set
 float playerstats_waitforme;