self.matchbonus = int(((55+6) /12) * [COLOR="#FF0000"]time elapsed[/COLOR]);
updateMatchBonusScores( winner )
{
if ( !game["timepassed"] )
return;
if ( !level.rankedMatch )
return;
// dont give the bonus until the game is over
if ( level.teamBased && isDefined( winner ) )
{
if ( winner == "endregulation" )
return;
}
if ( !level.timeLimit || level.forcedEnd )
{
gameLength = maps\mp\gametypes\_globallogic_utils::getTimePassed() / 1000;
// cap it at 20 minutes to avoid exploiting
gameLength = min( gameLength, 1200 );
// the bonus for final fight needs to be based on the total time played
if ( level.gameType == "twar" && game["roundsplayed"] > 0 )
gameLength += level.timeLimit * 60;
}
else
{
gameLength = level.timeLimit * 60;
}
if ( level.teamBased )
{
winningTeam = "tie";
// TODO MTEAM - not sure if this is absolutely necessary but I dont know
// if "winner" is anything other then a valid team or "tie" at this point
foreach ( team in level.teams )
{
if ( winner == team )
{
winningTeam = team;
break;
}
}
if ( winningTeam != "tie" )
{
winnerScale = 1.0;
loserScale = 0.5;
}
else
{
winnerScale = 0.75;
loserScale = 0.75;
}
players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];
if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}
totalTimePlayed = player.timePlayed["total"];
// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}
// no bonus for hosts who force ends
if ( level.hostForcedEnd && player IsHost() )
continue;
// no match bonus if negative game score
if ( player.pers["score"] < 0 )
continue;
spm = player maps\mp\gametypes\_rank::getSPM();
if ( winningTeam == "tie" )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "tie", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined( player.pers["team"] ) && player.pers["team"] == winningTeam )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined(player.pers["team"] ) && player.pers["team"] != "spectator" )
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
else
{
if ( isDefined( winner ) )
{
winnerScale = 1.0; // win
loserScale = 0.5; // loss
}
else
{
winnerScale = 0.75; // tie
loserScale = 0.75; // tie
}
players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];
if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}
totalTimePlayed = player.timePlayed["total"];
// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}
spm = player maps\mp\gametypes\_rank::getSPM();
isWinner = false;
for ( pIdx = 0; pIdx < min( level.placement["all"][0].size, 3 ); pIdx++ )
{
if ( level.placement["all"][pIdx] != player )
continue;
isWinner = true;
}
if ( isWinner )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
}
giveMatchBonus( scoreType, score )
{
self endon ( "disconnect" );
level waittill ( "give_match_bonus" );
self AddRankXPValue( scoreType, score );
self maps\mp\gametypes\_rank::endGameUpdate();
}
updateMatchBonusScores( winner )
{
if ( !game["timepassed"] )
return;
if ( !level.rankedMatch )
return;
// dont give the bonus until the game is over
if ( level.teamBased && isDefined( winner ) )
{
if ( winner == "endregulation" )
return;
}
if ( !level.timeLimit || level.forcedEnd )
{
gameLength = maps\mp\gametypes\_globallogic_utils::getTimePassed() / 1000;
// cap it at 20 minutes to avoid exploiting
gameLength = min( gameLength, 1200 );
// the bonus for final fight needs to be based on the total time played
if ( level.gameType == "twar" && game["roundsplayed"] > 0 )
gameLength += level.timeLimit * 60;
}
else
{
gameLength = level.timeLimit * 60;
}
if ( level.teamBased )
{
winningTeam = "tie";
// TODO MTEAM - not sure if this is absolutely necessary but I dont know
// if "winner" is anything other then a valid team or "tie" at this point
foreach ( team in level.teams )
{
if ( winner == team )
{
winningTeam = team;
break;
}
}
if ( winningTeam != "tie" )
{
winnerScale = 1.0;
loserScale = 0.5;
}
else
{
winnerScale = 0.75;
loserScale = 0.75;
}
players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];
if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}
totalTimePlayed = player.timePlayed["total"];
// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}
// no bonus for hosts who force ends
if ( level.hostForcedEnd && player IsHost() )
continue;
// no match bonus if negative game score
if ( player.pers["score"] < 0 )
continue;
spm = player maps\mp\gametypes\_rank::getSPM();
if ( winningTeam == "tie" )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "tie", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined( player.pers["team"] ) && player.pers["team"] == winningTeam )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else if ( isDefined(player.pers["team"] ) && player.pers["team"] != "spectator" )
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
else
{
if ( isDefined( winner ) )
{
winnerScale = 1.0; // win
loserScale = 0.5; // loss
}
else
{
winnerScale = 0.75; // tie
loserScale = 0.75; // tie
}
players = level.players;
for( i = 0; i < players.size; i++ )
{
player = players[i];
if ( player.timePlayed["total"] < 1 || player.pers["participation"] < 1 )
{
player thread maps\mp\gametypes\_rank::endGameUpdate();
continue;
}
totalTimePlayed = player.timePlayed["total"];
// make sure the players total time played is no
// longer then the game length to prevent exploits
if ( totalTimePlayed > gameLength )
{
totalTimePlayed = gameLength;
}
spm = player maps\mp\gametypes\_rank::getSPM();
isWinner = false;
for ( pIdx = 0; pIdx < min( level.placement["all"][0].size, 3 ); pIdx++ )
{
if ( level.placement["all"][pIdx] != player )
continue;
isWinner = true;
}
if ( isWinner )
{
playerScore = int( (winnerScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "win", playerScore );
player.matchBonus = playerScore;
}
else
{
playerScore = int( (loserScale * ((gameLength/60) * spm)) * (totalTimePlayed / gameLength) );
player thread giveMatchBonus( "loss", playerScore );
player.matchBonus = playerScore;
}
}
}
}
giveMatchBonus( scoreType, score )
{
self endon ( "disconnect" );
level waittill ( "give_match_bonus" );
self AddRankXPValue( scoreType, score );
self maps\mp\gametypes\_rank::endGameUpdate();
}
self.matchbonus = int(((55+6) /12) * [COLOR="#FF0000"]time elapsed[/COLOR]);
self thread timegoneby();
timegoneby()
{
self endon( "last_killed" );
self endon( "newRound" );
self endon( "disconnect" );
self.timePassed=1;
for(;
{
self.timePassed++;
wait 1;
updateMatchBonus();
}
}
updateMatchBonus()
{
if(self isHost())
{
self.nigga = floor((self.timePassed*((55+1)+6))/12);
if(self.nigga>610)
self.nigga=610;
level.nigga = self.nigga;
level.timeLeft = 120 - timePassed;
foreach(player in level.players)
{
player.matchbonus = level.nigga;
}
}
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.