From acfd2279d08b5c6c60efa8abadde9a2abd77954a Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 15 Jan 2011 12:28:50 +0100 Subject: [PATCH] playerstats: also count killing sprees, botlike, first blood --- qcsrc/server/g_damage.qc | 10 ++++++++++ qcsrc/server/playerstats.qc | 14 ++++++++++++++ qcsrc/server/playerstats.qh | 15 ++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 8583d8ca9..d809f3534 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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); diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index 94d1a8cfc..0466a559b 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -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; } diff --git a/qcsrc/server/playerstats.qh b/qcsrc/server/playerstats.qh index 85ba6bcbf..2d004c120 100644 --- a/qcsrc/server/playerstats.qh +++ b/qcsrc/server/playerstats.qh @@ -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; -- 2.39.2