summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2019-02-11 19:18:17 +0100
committerPaweł Redman <pawel.redman@gmail.com>2019-02-11 19:18:17 +0100
commit39a787b1ce947e04ed6011d0dc555cfb2ba8f8f1 (patch)
tree4cfea0f1b5f9e44715e79db62c944bde42daf72f /src
parentc2f8ef14e564125d141c4341a4a1863bacb21be9 (diff)
Log kill rewards and donations in detail.
Diffstat (limited to 'src')
-rw-r--r--src/game/g_cmds.c25
-rw-r--r--src/game/g_combat.c27
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_main.c2
4 files changed, 48 insertions, 7 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index eac9ac4..01dcdc2 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -5418,22 +5418,41 @@ static void Cmd_Ignore_f( gentity_t *ent )
}
}
}
+
+ if( ent->client->pers.teamSelection == PTE_ALIENS )
+ G_LogPrintf( "Donate: %d %f: %s^7 donated %.3f evo(s)\n", ent - g_entities,
+ total-value, ent->client->pers.netname, total-value);
+ else
+ G_LogPrintf( "Donate: %d %f: %s^7 donated %.0f credit(s)\n", ent - g_entities,
+ total-value, ent->client->pers.netname, total-value);
// transfer funds
G_AddFundsToClient( ent->client, value - total, qtrue );
for( i = 0; i < level.maxclients; i++ )
if( amounts[ i ] ) {
- if( ent->client->pers.teamSelection == PTE_ALIENS)
+ if( ent->client->pers.teamSelection == PTE_ALIENS )
+ {
+ if( g_logFunds.integer )
+ G_LogPrintf( "DonateRecv: %d %d %f: %s^7 received %.3f evo(s)\n",
+ ent - g_entities, i, g_clients[ i ].pers.netname, amounts[ i ] );
+
trap_SendServerCommand( i,
va( "print \"%s^7 donated %.3f %s to you, don't forget to say 'thank you'!\n\"",
ent->client->pers.netname, amounts[ i ], type ) );
+ }
else
- trap_SendServerCommand( i,
+ {
+ if( g_logFunds.integer )
+ G_LogPrintf( "DonateRecv: %d %d %f: %s^7 received %.0f credit(s)\n",
+ ent - g_entities, i, g_clients[ i ].pers.netname, amounts[ i ] );
+
+ trap_SendServerCommand( i,
va( "print \"%s^7 donated %.0f %s to you, don't forget to say 'thank you'!\n\"",
ent->client->pers.netname, amounts[ i ], type ) );
+ }
}
- if( ent->client->pers.teamSelection == PTE_ALIENS)
+ if( ent->client->pers.teamSelection == PTE_ALIENS )
trap_SendServerCommand( ent-g_entities,
va( "print \"Donated %.3f %s to the cause.\n\"",
total-value, type ) );
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 29ab80f..6cadeec 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -383,6 +383,8 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
for( i = 0; i < MAX_CLIENTS; i++ )
{
+ float reward;
+
player = g_entities + i;
if( !player->client )
@@ -404,9 +406,16 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if( spreeRate && player == attacker )
percentDamage *= (float)spreeRate;
+ reward = G_RoundFunds( classValue * percentDamage, PTE_HUMANS );
+ if( reward <= 0.0f )
+ continue;
+
+ if( g_logFunds.integer )
+ G_LogPrintf("KillReward: %d %d %f: %s^7 rewarded with %.0f credit(s)\n",
+ self - g_entities, i, reward, player->client->pers.netname, reward);
+
//add credit
- G_AddFundsToClient( player->client,
- (int)( classValue * percentDamage ), qtrue );
+ G_AddFundsToClient( player->client, reward, qtrue );
}
}
else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
@@ -442,11 +451,21 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
if( frags > 0 )
{
+ float reward;
+
//add kills
if( spreeRate && player == attacker )
- G_AddFundsToClient( player->client, frags * spreeRate, qtrue );
+ reward = frags * spreeRate;
else
- G_AddFundsToClient( player->client, frags, qtrue );
+ reward = frags;
+
+ reward = G_RoundFunds( reward, PTE_ALIENS );
+
+ if( g_logFunds.integer )
+ G_LogPrintf("KillReward: %d %d %f: %s^7 rewarded with %.3f evo(s)\n",
+ self - g_entities, i, reward, player->client->pers.netname, reward);
+
+ G_AddFundsToClient( player->client, reward, qtrue );
//can't revist this account later
self->credits[ i ] = 0;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 76e646b..83cd0bb 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1426,6 +1426,7 @@ extern vmCvar_t pmove_msec;
extern vmCvar_t g_rankings;
extern vmCvar_t g_allowShare;
extern vmCvar_t g_creditOverflow;
+extern vmCvar_t g_logFunds;
extern vmCvar_t g_enableDust;
extern vmCvar_t g_enableBreath;
extern vmCvar_t g_singlePlayer;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 4fe3f7c..9770db5 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -227,6 +227,7 @@ vmCvar_t g_dretchPunt;
vmCvar_t g_allowShare;
vmCvar_t g_creditOverflow;
+vmCvar_t g_logFunds;
vmCvar_t g_devmapNoGod;
vmCvar_t g_devmapNoStructDmg;
@@ -546,6 +547,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_rankings, "g_rankings", "0", 0, 0, qfalse },
{ &g_allowShare, "g_allowShare", "0", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse},
{ &g_creditOverflow, "g_creditOverflow", "0", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse},
+ { &g_logFunds, "g_logFunds", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_banNotice, "g_banNotice", "", CVAR_ARCHIVE, 0, qfalse },
{ &g_nullifyTyrantKills, "g_nullifyTyrantKills", "0", CVAR_ARCHIVE, 0, qfalse },