summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-04-15 22:59:31 +0200
committerPaweł Redman <pawel.redman@gmail.com>2020-04-15 23:13:43 +0200
commit679261bf99df9365f55e75457c94b6b5d7189068 (patch)
tree3848771eab0c1370c2ee9c5c7ad91e546923deb6 /src
parent10936b413f37810d8498522510af8f97e601fb81 (diff)
Track funds fed; rework /allstats
Diffstat (limited to 'src')
-rw-r--r--src/game/g_cmds.c200
-rw-r--r--src/game/g_combat.c3
-rw-r--r--src/game/g_local.h1
3 files changed, 102 insertions, 102 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index e39c465..10bb2aa 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -4102,7 +4102,7 @@ char *G_statsString( statsCounters_t *sc, pTeam_t *pt )
if( sc->hitslocational )
percentHeadshots = (int)(100 * (float) sc->headshots / ((float) (sc->hitslocational) ) );
- s = va( "^3Kills:^7 %3i ^3StructKills:^7 %3i ^3Assists:^7 %3i^7 ^3Poisons:^7 %3i ^3Headshots:^7 %3i (%3i)\n^3Deaths:^7 %3i ^3Feeds:^7 %3i ^3Suicides:^7 %3i ^3TKs:^7 %3i ^3Avg Lifespan:^7 %4d:%02d\n^3Damage to:^7 ^3Enemies:^7 %5i ^3Structs:^7 %5i ^3Friendlies:^7 %3i \n^3Structs Built:^7 %3i ^3Time Near Base:^7 %3i ^3Time wallwalking:^7 %3i\n^3Earned:^7 %6.3f ^3Shared:^7 %6.3f ^3Overflowed:^7 %6.3f ^3Recvd:^7 %6.3f\n",
+ s = va( "^3Kills:^7 %3i ^3StructKills:^7 %3i ^3Assists:^7 %3i^7 ^3Poisons:^7 %3i ^3Headshots:^7 %3i (%3i)\n^3Deaths:^7 %3i ^3Feeds:^7 %3i ^3Suicides:^7 %3i ^3TKs:^7 %3i ^3Avg Lifespan:^7 %4d:%02d\n^3Damage to:^7 ^3Enemies:^7 %5i ^3Structs:^7 %5i ^3Friendlies:^7 %3i \n^3Structs Built:^7 %3i ^3Time Near Base:^7 %3i ^3Time wallwalking:^7 %3i\n^3Earned:^7 %6.3f ^3Fed:^7 %6.3f ^3Shared:^7 %6.3f ^3Overflowed:^7 %6.3f ^3Recvd:^7 %6.3f\n",
sc->kills,
sc->structskilled,
sc->assists,
@@ -4122,6 +4122,7 @@ char *G_statsString( statsCounters_t *sc, pTeam_t *pt )
percentNearBase,
percentJetpackWallwalk,
sc->earned / EVO_TO_CREDS_RATE,
+ sc->fed / EVO_TO_CREDS_RATE,
sc->shared / EVO_TO_CREDS_RATE,
sc->overflowed / EVO_TO_CREDS_RATE,
sc->received / EVO_TO_CREDS_RATE
@@ -4131,7 +4132,7 @@ char *G_statsString( statsCounters_t *sc, pTeam_t *pt )
{
if( sc->timealive )
percentJetpackWallwalk = (int)(100 * (float) sc->jetpackusewallwalkusetime / ((float) ( sc->timealive ) ) );
- s = va( "^3Kills:^7 %3i ^3StructKills:^7 %3i ^3Assists:^7 %3i \n^3Deaths:^7 %3i ^3Feeds:^7 %3i ^3Suicides:^7 %3i ^3TKs:^7 %3i ^3Avg Lifespan:^7 %4d:%02d\n^3Damage to:^7 ^3Enemies:^7 %5i ^3Structs:^7 %5i ^3Friendlies:^7 %3i \n^3Structs Built:^7 %3i ^3Repairs:^7 %4i ^3Time Near Base:^7 %3i ^3Time Jetpacking:^7 %3i\n^3Earned:^7 %6d ^3Shared:^7 %6d ^3Overflowed:^7 %6d ^3Recvd:^7 %6d\n",
+ s = va( "^3Kills:^7 %3i ^3StructKills:^7 %3i ^3Assists:^7 %3i \n^3Deaths:^7 %3i ^3Feeds:^7 %3i ^3Suicides:^7 %3i ^3TKs:^7 %3i ^3Avg Lifespan:^7 %4d:%02d\n^3Damage to:^7 ^3Enemies:^7 %5i ^3Structs:^7 %5i ^3Friendlies:^7 %3i \n^3Structs Built:^7 %3i ^3Repairs:^7 %4i ^3Time Near Base:^7 %3i ^3Time Jetpacking:^7 %3i\n^3Earned:^7 %6d ^3Fed:^7 %6d ^3Shared:^7 %6d ^3Overflowed:^7 %6d ^3Recvd:^7 %6d\n",
sc->kills,
sc->structskilled,
sc->assists,
@@ -4149,6 +4150,7 @@ char *G_statsString( statsCounters_t *sc, pTeam_t *pt )
percentNearBase,
percentJetpackWallwalk,
sc->earned,
+ sc->fed,
sc->shared,
sc->overflowed,
sc->received
@@ -4159,112 +4161,106 @@ char *G_statsString( statsCounters_t *sc, pTeam_t *pt )
return s;
}
- /*
- =================
- Cmd_AllStats_f
- =================
- */
- void Cmd_AllStats_f( gentity_t *ent )
- {
- int i;
- int NextViewTime;
- int NumResults = 0;
- int Teamcolor = 3;
- gentity_t *tmpent;
-
- //check if ent exists
- if(!ent) return;
-
- NextViewTime = ent->client->pers.statscounters.AllstatstimeLastViewed + g_AllStatsTime.integer * 1000;
- //check if you can use the cmd at this time
- if( !level.intermissiontime && level.time < NextViewTime)
+/*
+=================
+Cmd_AllStats_f
+=================
+*/
+void Cmd_AllStats_f( gentity_t *ent )
+{
+ int i;
+ int NextViewTime;
+ int NumResults = 0;
+ float divisor = 0.0f;
+ char Teamcolor = 'c';
+ gentity_t *other;
+
+ //check if ent exists
+ if(!ent) return;
+
+ NextViewTime = ent->client->pers.statscounters.AllstatstimeLastViewed + g_AllStatsTime.integer * 1000;
+ //check if you can use the cmd at this time
+ if( !level.intermissiontime && level.time < NextViewTime)
+ {
+ ADMP( va("You may only check your stats every %i Seconds and during intermission. Next valid time is %d:%02d\n",
+ ( g_AllStatsTime.integer ) ? ( g_AllStatsTime.integer ) : 60,
+ ( NextViewTime / 60000 ), ( NextViewTime / 1000 ) % 60 ) );
+ return;
+ }
+
+ //see if allstats is enabled
+ if( !g_AllStats.integer )
+ {
+ ADMP( "AllStats has been disabled\n");
+ return;
+ }
+
+ ADMP("^cK^B=^7Kills ^cA^B=^7Assists ^cSK^B=^7StructKills\n^cD^B=^7Deaths ^cF^B=^7Feeds ^cS^B=^7Suicides ^cTK^B=^7Teamkills\n^cDD^B=^7Damage done ^cTDD^B=^7Team Damage done\n^cSB^B=^7Structs Built\n^cEA^B=^7Funds Earned (Humans x100) ^cFE^B=^7Funds Earned by Enemies\n\n" );
+ //display a header describing the data
+ ADMP( "^c #| K A SK| D F S TK| DD TDD| SB| EA FE| Name\n" );
+
+ //loop through the clients that are connected
+ for( i = 0; i < level.numConnectedClients; i++ )
+ {
+ other = g_entities + level.sortedClients[ i ];
+
+ if( !other->client || other->client->pers.connected != CON_CONNECTED )
+ continue;
+
+ if( other->client->pers.teamSelection == PTE_NONE )
+ continue;
+
+ // g_AllStats 1 shows only teammates
+ if( g_AllStats.integer == 1 && ent->client->pers.teamSelection != PTE_NONE
+ && other->client->pers.teamSelection != ent->client->pers.teamSelection )
+ continue;
+
+ NumResults++;
+ if( other->client->pers.teamSelection == PTE_ALIENS )
{
- ADMP( va("You may only check your stats every %i Seconds and during intermission. Next valid time is %d:%02d\n",( g_AllStatsTime.integer ) ? ( g_AllStatsTime.integer ) : 60, ( NextViewTime / 60000 ), ( NextViewTime / 1000 ) % 60 ) );
- return;
+ Teamcolor = 'F';
+ divisor = EVO_TO_CREDS_RATE;
}
- //see if allstats is enabled
- if( !g_AllStats.integer )
+ else if( other->client->pers.teamSelection == PTE_HUMANS )
{
- ADMP( "AllStats has been disabled\n");
- return;
+ Teamcolor = 't';
+ divisor = 100.0f;
}
- ADMP("^3K^2=^7Kills ^3A^2=^7Assists ^3SK^2=^7StructKills\n^3D^2=^7Deaths ^3F^2=^7Feeds ^3S^2=^7Suicides ^3TK^2=^7Teamkills\n^3DD^2=^7Damage done ^3TDD^2=^7Team Damage done\n^3SB^2=^7Structs Built\n\n" );
- //display a header describing the data
- ADMP( "^3 #| K A SK| D F S TK| DD TDD| SB| Name\n" );
- //loop through the clients that are connected
- for( i = 0; i < level.numConnectedClients; i++ )
- {
- //assign a tempent 4 the hell of it
- tmpent = &g_entities[ level.sortedClients[ i ] ];
-
- //check for what mode we are working in and display relevent data
- if( g_AllStats.integer == 1 )
- {
- //check if client is connected and on same team
- if( tmpent->client && tmpent->client->pers.connected == CON_CONNECTED && tmpent->client->pers.teamSelection == ent->client->pers.teamSelection && tmpent->client->pers.teamSelection != PTE_NONE )
- {
- NumResults++;
- if( tmpent->client->pers.teamSelection == PTE_ALIENS ) Teamcolor = 1;
- if( tmpent->client->pers.teamSelection == PTE_HUMANS ) Teamcolor = 5;
- ADMP( va( "^%i%2i^3|^%i%3i %3i %3i^3|^%i%3i %3i %3i %3i^3|^%i%5i %5i^3|^%i%3i^3|^7 %s\n",
- Teamcolor,
- NumResults,
- Teamcolor,
- ( tmpent->client->pers.statscounters.kills ) ? tmpent->client->pers.statscounters.kills : 0,
- ( tmpent->client->pers.statscounters.assists ) ? tmpent->client->pers.statscounters.assists : 0,
- ( tmpent->client->pers.statscounters.structskilled ) ? tmpent->client->pers.statscounters.structskilled : 0,
- Teamcolor,
- ( tmpent->client->pers.statscounters.deaths ) ? tmpent->client->pers.statscounters.deaths : 0,
- ( tmpent->client->pers.statscounters.feeds ) ? tmpent->client->pers.statscounters.feeds : 0,
- ( tmpent->client->pers.statscounters.suicides ) ? tmpent->client->pers.statscounters.suicides : 0,
- ( tmpent->client->pers.statscounters.teamkills ) ? tmpent->client->pers.statscounters.teamkills : 0,
- Teamcolor,
- ( tmpent->client->pers.statscounters.dmgdone ) ? tmpent->client->pers.statscounters.dmgdone : 0,
- ( tmpent->client->pers.statscounters.ffdmgdone ) ? tmpent->client->pers.statscounters.ffdmgdone : 0,
- Teamcolor,
- ( tmpent->client->pers.statscounters.structsbuilt ) ? tmpent->client->pers.statscounters.structsbuilt : 0,
- ( tmpent->client->pers.netname ) ? tmpent->client->pers.netname : "Unknown" ) );
- }
- }
- else if( g_AllStats.integer == 2 )
- {
- //check if client is connected and has some stats or atleast is on a team
- if( tmpent->client && tmpent->client->pers.connected == CON_CONNECTED && ( tmpent->client->pers.teamSelection != PTE_NONE ) )
- {
- NumResults++;
- if( tmpent->client->pers.teamSelection == PTE_ALIENS ) Teamcolor = 1;
- if( tmpent->client->pers.teamSelection == PTE_HUMANS ) Teamcolor = 5;
- ADMP( va( "^%i%2i^3|^%i%3i %3i %3i^3|^%i%3i %3i %3i %3i^3|^%i%5i %5i^3|^%i%3i^3|^7 %s\n",
- Teamcolor,
- NumResults,
- Teamcolor,
- ( tmpent->client->pers.statscounters.kills ) ? tmpent->client->pers.statscounters.kills : 0,
- ( tmpent->client->pers.statscounters.assists ) ? tmpent->client->pers.statscounters.assists : 0,
- ( tmpent->client->pers.statscounters.structskilled ) ? tmpent->client->pers.statscounters.structskilled : 0,
- Teamcolor,
- ( tmpent->client->pers.statscounters.deaths ) ? tmpent->client->pers.statscounters.deaths : 0,
- ( tmpent->client->pers.statscounters.feeds ) ? tmpent->client->pers.statscounters.feeds : 0,
- ( tmpent->client->pers.statscounters.suicides ) ? tmpent->client->pers.statscounters.suicides : 0,
- ( tmpent->client->pers.statscounters.teamkills ) ? tmpent->client->pers.statscounters.teamkills : 0,
- Teamcolor,
- ( tmpent->client->pers.statscounters.dmgdone ) ? tmpent->client->pers.statscounters.dmgdone : 0,
- ( tmpent->client->pers.statscounters.ffdmgdone ) ? tmpent->client->pers.statscounters.ffdmgdone : 0,
- Teamcolor,
- ( tmpent->client->pers.statscounters.structsbuilt ) ? tmpent->client->pers.statscounters.structsbuilt : 0,
- ( tmpent->client->pers.netname ) ? tmpent->client->pers.netname : "Unknown" ) );
- }
- }
- }
- if( NumResults == 0 ) {
- ADMP( " ^3EMPTY!\n" );
- } else {
- ADMP( va( "^7 %i Players found!\n", NumResults ) );
- }
- //update time last viewed
+ ADMP( va( "^%c%2i^c|^%c%3i %3i %3i^c|^%c%3i %3i %3i %3i^c|^%c%5i %5i^c|^%c%3i^c|^%c%4i %4i^c|^7 %s\n",
+ Teamcolor, NumResults, Teamcolor,
+ other->client->pers.statscounters.kills,
+ other->client->pers.statscounters.assists,
+ other->client->pers.statscounters.structskilled,
+ Teamcolor,
+ other->client->pers.statscounters.deaths,
+ other->client->pers.statscounters.feeds,
+ other->client->pers.statscounters.suicides,
+ other->client->pers.statscounters.teamkills,
+ Teamcolor,
+ other->client->pers.statscounters.dmgdone,
+ other->client->pers.statscounters.ffdmgdone,
+ Teamcolor,
+ other->client->pers.statscounters.structsbuilt,
+ Teamcolor,
+ (int)floor( other->client->pers.statscounters.earned / divisor ),
+ (int)floor( other->client->pers.statscounters.fed / divisor ),
+ other->client->pers.netname ) );
+ }
- ent->client->pers.statscounters.AllstatstimeLastViewed = level.time;
- return;
+ if( NumResults == 0 )
+ {
+ ADMP( " ^cEMPTY!\n" );
+ }
+ else
+ {
+ ADMP( va( "^7 %i player%s found!\n", NumResults, NumResults == 1 ? "" : "s" ) );
+ }
+
+ //update time last viewed
+ ent->client->pers.statscounters.AllstatstimeLastViewed = level.time;
+
+ return;
}
/*
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 60d4f28..2bfa6f6 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -530,6 +530,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
amount = classValue * percentDamage;
G_AddCreditToClient( player->client, amount, qtrue );
player->client->pers.statscounters.earned += amount;
+ self->client->pers.statscounters.fed += amount;
if( g_debugRewards.integer )
Com_Printf( ", %d credit(s) to #%d for %.1f%% of damage", amount,
@@ -587,6 +588,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//add kills
G_AddCreditToClient( player->client, frags, qtrue );
player->client->pers.statscounters.earned += frags;
+ self->client->pers.statscounters.fed += frags;
if( g_debugRewards.integer )
Com_Printf( ", %d/%d evo(s) to #%d for %.1f%% of damage", frags,
@@ -634,6 +636,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//add kills
G_AddCreditToClient( player->client, 1, qtrue );
player->client->pers.statscounters.earned += 1;
+ self->client->pers.statscounters.fed += 1;
if( g_debugRewards.integer )
Com_Printf( ", 1/%d to #%d (unclaimed)", (int)EVO_TO_CREDS_RATE,
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 635ceb1..af29793 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -365,6 +365,7 @@ typedef struct
int AllstatstimeLastViewed;
int spreebleeds;
int earned;
+ int fed;
int shared;
int overflowed;
int received;