}
}
-// referred to by PS_GR_P_ADDVAL and PS_GR_T_ADDVAL
float PlayerStats_GameReport_Event(string prefix, string event_id, float value)
{
if((prefix == "") || PS_GR_OUT_DB < 0) { return 0; }
void PlayerStats_GameReport_Accuracy(entity p)
{
#define ACCMAC(suffix, field) \
- PS_GR_P_ADDVAL(p, sprintf("acc-%s-%s", it.netname, suffix), CS(p).accuracy.(field[i-1]));
+ PlayerStats_GameReport_Event_Player(p, \
+ sprintf("acc-%s-%s", it.netname, suffix), CS(p).accuracy.(field[i-1]));
FOREACH(Weapons, it != WEP_Null, {
ACCMAC("hit", accuracy_hit)
ACCMAC("fired", accuracy_fired)
// add global info!
if(p.alivetime)
{
- PS_GR_P_ADDVAL(p, PLAYERSTATS_ALIVETIME, time - p.alivetime);
+ PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_ALIVETIME, time - p.alivetime);
p.alivetime = 0;
}
db_put(PS_GR_OUT_DB, sprintf("%s:_team", p.playerstats_id), ftos(p.team));
if(stof(db_get(PS_GR_OUT_DB, sprintf("%s:%s", p.playerstats_id, PLAYERSTATS_ALIVETIME))) > 0)
- PS_GR_P_ADDVAL(p, PLAYERSTATS_JOINS, 1);
+ PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_JOINS, 1);
PlayerStats_GameReport_Accuracy(p);
anticheat_report_to_playerstats(p);
if(CS(p).latency_cnt)
{
float latency = (CS(p).latency_sum / CS(p).latency_cnt);
- if(latency) { PS_GR_P_ADDVAL(p, PLAYERSTATS_AVGLATENCY, latency); }
+ if(latency)
+ PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, latency);
}
}
FOREACH_CLIENT(true, {
// add personal score rank
- PS_GR_P_ADDVAL(it, PLAYERSTATS_RANK, it.score_dummyfield);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_RANK, it.score_dummyfield);
// scoreboard data
if(it.scoreboard_pos)
{
// scoreboard is valid!
- PS_GR_P_ADDVAL(it, PLAYERSTATS_SCOREBOARD_VALID, 1);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_SCOREBOARD_VALID, 1);
// add scoreboard position
- PS_GR_P_ADDVAL(it, PLAYERSTATS_SCOREBOARD_POS, it.scoreboard_pos);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_SCOREBOARD_POS, it.scoreboard_pos);
// add scoreboard data
PlayerScore_PlayerStats(it);
// if the match ended normally, add winning info
if(finished)
{
- PS_GR_P_ADDVAL(it, PLAYERSTATS_WINS, it.winning);
- PS_GR_P_ADDVAL(it, PLAYERSTATS_MATCHES, 1);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_WINS, it.winning);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_MATCHES, 1);
}
}
void PlayerStats_GameReport_AddEvent(string event_id);
// call on each event to track, or at player disconnect OR match end for "global stuff"
-#define PS_GR_P_ADDVAL(ent,eventid,val) PlayerStats_GameReport_Event(ent.playerstats_id, eventid, val)
-#define PS_GR_T_ADDVAL(team,eventid,val) PlayerStats_GameReport_Event(sprintf("team#%d", team), eventid, val)
+#define PlayerStats_GameReport_Event_Player(ent, eventid, val) PlayerStats_GameReport_Event(ent.playerstats_id, eventid, val)
+#define PlayerStats_GameReport_Event_Team(team, eventid, val) PlayerStats_GameReport_Event(sprintf("team#%d", team), eventid, val)
float PlayerStats_GameReport_Event(string prefix, string event_id, float value);
void PlayerStats_GameReport_Accuracy(entity p);
}
void anticheat_report_to_playerstats(entity this) {
- PS_GR_P_ADDVAL(this, strcat(PLAYERSTATS_ANTICHEAT, "_time"), servertime - CS(this).anticheat_jointime);
+ PlayerStats_GameReport_Event_Player(this,
+ strcat(PLAYERSTATS_ANTICHEAT, "_time"), servertime - CS(this).anticheat_jointime);
#define ANTICHEAT_REPORT_ONE(name, f, tmin, mi, ma) \
- PS_GR_P_ADDVAL(this, strcat(PLAYERSTATS_ANTICHEAT, name), f)
+ PlayerStats_GameReport_Event_Player(this, strcat(PLAYERSTATS_ANTICHEAT, name), f)
ANTICHEATS(ANTICHEAT_REPORT_ONE);
#undef ANTICHEAT_REPORT_ONE
}
if (this.alivetime)
{
if (!warmup_stage)
- PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+ PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
this.alivetime = 0;
}
FOREACH_CLIENT(IS_PLAYER(it), {
it.alivetime = 0;
CS(it).killcount = 0;
- PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, -PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, 0));
+ float val = PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_ALIVETIME, 0);
+ PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_ALIVETIME, -val);
});
restart_mapalreadyrestarted = false; // reset this var, needed when cvar sv_ready_restart_repeatable is in use
// regular frag
GameRules_scoring_add(attacker, KILLS, 1);
if(targ.playerid)
- PS_GR_P_ADDVAL(attacker, sprintf("kills-%d", targ.playerid), 1);
+ PlayerStats_GameReport_Event_Player(attacker, sprintf("kills-%d", targ.playerid), 1);
}
GameRules_scoring_add(targ, DEATHS, 1);
case counta: \
{ \
Send_Notification(NOTIF_ONE, attacker, MSG_ANNCE, ANNCE_KILLSTREAK_##countb); \
- PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_##counta, 1); \
+ PlayerStats_GameReport_Event_Player(attacker, PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_##counta, 1); \
break; \
}
switch(CS(attacker).killcount)
{
checkrules_firstblood = true;
notif_firstblood = true; // modify the current messages so that they too show firstblood information
- PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD, 1);
- PS_GR_P_ADDVAL(targ, PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM, 1);
+ PlayerStats_GameReport_Event_Player(attacker, PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD, 1);
+ PlayerStats_GameReport_Event_Player(targ, PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM, 1);
// tell spree_inf and spree_cen that this is a first-blood and first-victim event
kill_count_to_attacker = -1;
if(GameRules_scoring_add(targ, SCORE, 0) == -5)
{
Send_Notification(NOTIF_ONE, targ, MSG_ANNCE, ANNCE_ACHIEVEMENT_BOTLIKE);
- PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1);
+ PlayerStats_GameReport_Event_Player(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1);
}
}
if(this.alivetime)
{
- PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+ PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
this.alivetime = 0;
}
if(scores_label(scorefield) != "")
s.SendFlags |= (2 ** (scorefield.m_id % 16));
if(!warmup_stage)
- PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label(scorefield)), score);
+ PlayerStats_GameReport_Event_Player(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label(scorefield)), score);
s.(scores(scorefield)) += score;
MUTATOR_CALLHOOK(AddedPlayerScore, scorefield, score, player);
return s.(scores(scorefield));
{
entity s = CS(p).scorekeeper;
FOREACH(Scores, true, {
- if(s.(scores(it)) != 0)
- if(scores_label(it) != "")
- PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label(it)), s.(scores(it)));
- });
+ if(s.(scores(it)) != 0 && scores_label(it) != "")
+ PlayerStats_GameReport_Event_Player(s.owner,
+ strcat(PLAYERSTATS_SCOREBOARD, scores_label(it)), s.(scores(it)));
+ });
}
void PlayerScore_TeamStats()
if(!sk)
continue;
for(i = 0; i < MAX_TEAMSCORE; ++i)
- if(sk.(teamscores(i)) != 0)
- if(teamscores_label(i) != "")
- // the +1 is important here!
- PS_GR_T_ADDVAL(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label(i)), sk.(teamscores(i)));
+ if(sk.(teamscores(i)) != 0 && teamscores_label(i) != "")
+ // the +1 is important here!
+ PlayerStats_GameReport_Event_Team(t+1,
+ strcat(PLAYERSTATS_SCOREBOARD, teamscores_label(i)), sk.(teamscores(i)));
}
}