Merge branch 'NoEvo'

This commit is contained in:
ChocoTaco 2021-07-16 14:52:46 -04:00
commit 18b1ec9075
15 changed files with 1290 additions and 1272 deletions

View file

@ -1,145 +0,0 @@
// Team Autobalance Script
//
// Determines which team needs players and proceeds to switch them
// Goon style: At respawn
//
// Enable or Disable Autobalance
// $Host::EnableAutobalance = 1;
//
// exec("scripts/autoexec/Autobalance.cs");
//
// If it takes too long for specific canidates to die. After a time choose anyone.
$Autobalance::Fallback = 120000; //60000 is 1 minute
// Run from TeamBalanceNotify.cs via NotifyUnbalanced
function Autobalance( %game )
{
if(isEventPending($AutoBalanceSchedule))
cancel($AutoBalanceSchedule);
if($TBNStatus !$= "NOTIFY") //If Status has changed to EVEN or anything else (GameOver reset).
return;
//Difference Variables
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
//Determine BigTeam
if( %team1difference >= 2 )
$BigTeam = 1;
else if( %team2difference >= 2 )
$BigTeam = 2;
else
return;
$Autobalance::UseAllMode = 0;
$Autobalance::FallbackTime = getSimTime();
%otherTeam = $BigTeam == 1 ? 2 : 1;
$Autobalance::AMThreshold = mCeil(MissionGroup.CTF_scoreLimit/3) * 100;
//If BigTeam score is greater than otherteam score + threshold
if($TeamScore[$BigTeam] > ($TeamScore[%otherTeam] + $Autobalance::AMThreshold) || $TeamRank[%otherTeam, count] $= 0)
$Autobalance::UseAllMode = 1;
//If BigTeam Top Players score is greater than otherTeam Top Players score + threshold
else if($TeamRank[$BigTeam, count] >= 5 && $TeamRank[%otherTeam, count] >= 3)
{
%max = mfloor($TeamRank[$BigTeam, count]/2);
if(%max > $TeamRank[%otherTeam, count])
%max = $TeamRank[%otherTeam, count];
%threshold = %max * 100;
for(%i = 0; %i < %max; %i++)
{
%bigTeamTop = %bigTeamTop + $TeamRank[$BigTeam, %i].score;
%otherTeamTop = %otherTeamTop + $TeamRank[%otherTeam, %i].score;
}
if(%bigTeamTop > (%otherTeamTop + %threshold))
$Autobalance::UseAllMode = 1;
}
//echo("Allmode " @ $Autobalance::UseAllMode);
//Select lower half of team rank as canidates for team change
if(!$Autobalance::UseAllMode)
{
$Autobalance::Max = mFloor($TeamRank[$BigTeam, count]/2);
for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++)
{
//echo("[Autobalance]: Selected" SPC $TeamRank[$BigTeam, %i].nameBase @ ", " @ %i);
$TeamRank[$BigTeam, %i].abCanidate = true;
}
%a = " selected";
}
if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 3)
%s = "s";
//Warning message
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance will switch the next%3 respawning player%2 on Team %1.', $TeamName[$BigTeam], %s, %a);
}
function ResetABClients()
{
for(%i = 0; %i < $TeamRank[$BigTeam, count]; %i++)
{
$TeamRank[$BigTeam, %i].abCanidate = false;
}
}
package Autobalance
{
function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation)
{
parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation);
if($BigTeam !$= "" && %clVictim.team == $BigTeam)
{
%otherTeam = $BigTeam == 1 ? 2 : 1;
if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 2)
{
%fallback = 0;
if((getSimTime() - $Autobalance::FallbackTime) > $Autobalance::Fallback)
%fallback = 1;
//damageType 0: If someone switches to observer or disconnects
if(%damageType !$= 0 && (%clVictim.abCanidate || $Autobalance::UseAllMode || %fallback))
{
echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode SPC "#BT:" @ ($TeamRank[$BigTeam, count]-1) SPC "#OT:" @ ($TeamRank[%otherTeam, count]+1) SPC "FB:" @ %fallback @ "]");
messageClient(%clVictim, 'MsgTeamBalanceNotify', '\c0You were switched to Team %1 for balancing.~wfx/powered/vehicle_screen_on.wav', $TeamName[%otherTeam]);
messageAllExcept(%clVictim, -1, 'MsgTeamBalanceNotify', '~wfx/powered/vehicle_screen_on.wav');
Game.clientChangeTeam( %clVictim, %otherTeam, 0 );
}
}
else
{
ResetABClients();
ResetTBNStatus();
$BigTeam = "";
}
}
}
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
if($CurrentMissionType $= "CTF" || $CurrentMissionType $= "SCtF")
{
//Reset Autobalance
$BigTeam = "";
//Reset all clients canidate var
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
%client.abCanidate = false;
}
}
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(Autobalance))
activatePackage(Autobalance);

View file

@ -1,163 +0,0 @@
// GetTeamCounts Script
//
// GetTeamCounts was made to accurately keep track of how many players
// are on teams, on the server, on each team, observer, etc.
// AntiTurrets, Team Balance Notify, AntiCloak, AutoBalance, Base Rape and Base Rape Notify all rely on this.
// It runs every 5 seconds.
//
// Whether or not a portion of the script is run or not depends on
// if a player has switched teams or not. Or if a team changing event has occurred.
// This is triggered via various event functions throughout the game.
//
// Set reset string
$GetCountsStatus = "UPDATE";
package StartTeamCounts
{
function CreateServer( %mission, %missionType )
{
parent::CreateServer( %mission, %missionType );
//Call for a GetTeamCount update
GetTeamCounts(%game);
// Set when server starts
// Used to reset timelimit (if voted) when map changes
$DefaultTimeLimit = $Host::TimeLimit;
// Prevent package from being activated if it is already
if (!isActivePackage(TeamCountsTriggers))
activatePackage(TeamCountsTriggers);
// Auto Daily Hard Server Restart at a specific time
// getTimeDif from zDarkTigerStats.cs
if($dtStats::version)
schedule(getTimeDif("10\t00\tam"),0,"quit");
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(StartTeamCounts))
activatePackage(StartTeamCounts);
function GetTeamCounts(%game)
{
switch$($GetCountsStatus)
{
case UPDATE:
if($countdownStarted && $MatchStarted )
{
//Variables
$TotalTeamPlayerCount = $TeamRank[1, count] + $TeamRank[2, count];
$AllPlayerCount = $HostGamePlayerCount;
//Observers
$Observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
//echo("$PlayerCount[0] " @ $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]));
//echo("$PlayerCount[1] " @ $TeamRank[1, count]);
//echo("$PlayerCount[2] " @ $TeamRank[2, count]);
if( !$Host::TournamentMode )
{
if( $CurrentMissionType $= "CTF" )
{
NBRStatusNotify(%game);
CheckAntiPack(%game);
}
TeamBalanceNotify(%game);
}
//Set so counter wont run when it doesnt need to.
$GetCountsStatus = "IDLE";
}
case IDLE:
//Do Nothing
}
if(isEventPending($GetCountsSchedule))
cancel($GetCountsSchedule);
//Call itself again. Every 5 seconds.
$GetCountsSchedule = schedule(5000, 0, "GetTeamCounts");
}
// Triggers a Full run
function ResetGetCountsStatus()
{
$GetCountsStatus = "UPDATE";
}
// Proper Overrides
// Events that determine a TeamGetCounts update
package TeamCountsTriggers
{
function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
{
Parent::clientJoinTeam( %game, %client, %team, %respawn );
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
{
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::assignClientTeam(%game, %client, %respawn )
{
Parent::assignClientTeam(%game, %client, %respawn );
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::onClientEnterObserverMode( %game, %client )
{
Parent::onClientEnterObserverMode( %game, %client );
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
{
Parent::AIChangeTeam(%game, %client, %newTeam);
//Trigger GetCounts
ResetGetCountsStatus();
}
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
{
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
//Reset GetCounts
ResetGetCountsStatus();
}
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset GetCounts
ResetGetCountsStatus();
}
function GameConnection::onDrop(%client, %reason)
{
Parent::onDrop(%client, %reason);
//Reset GetCounts
ResetGetCountsStatus();
}
};

View file

@ -1,79 +0,0 @@
// LockedTeams.cs
// Toggled in serverCmdStartNewVote in VoteMenu.cs
//
// case "ToggleLockedTeams":
// if (%client.isAdmin)
// {
// if(!$LockedTeams)
// {
// if(!isActivePackage(LockedTeams))
// activatePackage(LockedTeams);
// $LockedTeams = 1;
// messageClient( %client, '', "Locked Teams has been enabled.~wfx/powered/vehicle_screen_on.wav" );
// adminLog(%client, " has enabled Locked Teams.");
// }
// else
// {
// if(isActivePackage(LockedTeams))
// deactivatePackage(LockedTeams);
// $LockedTeams = 0;
// messageClient( %client, '', "Locked Teams has been disabled.~wfx/powered/vehicle_screen_on.wav" );
// adminLog(%client, " has disabled Locked Teams.");
// }
// }
// return;
// Reset in MissionTypeOptions.cs
//
// if(isActivePackage(LockedTeams) && !$LockedTeams)
// deactivatePackage(LockedTeams);
package LockedTeams
{
// function serverCmdClientJoinTeam(%client, %team)
// {
// if ($LockedTeams)
// {
// messageClient( %client, '', "Teams are locked. Asked the admin to set your team. (JoinTeam)" );
// return;
// }
// Parent::serverCmdClientJoinTeam(%client, %team);
// }
function serverCmdClientJoinGame(%client)
{
if ($LockedTeams)
{
messageClient( %client, '', "Teams are locked. Ask the admin to set your team." );
return;
}
Parent::serverCmdClientJoinGame(%client);
}
function serverCmdClientPickedTeam(%client, %option)
{
Parent::serverCmdClientPickedTeam(%client, %option); //Put first
if($LockedTeams) //Added
{
if($Host::TournamentMode && %client.team !$= 0) //Added
{
messageClient( %client, '', "Teams are locked. Ask the admin to set your team." );
serverCmdClientMakeObserver( %client );
}
return;
}
}
function serverCmdClientTeamChange(%client, %option)
{
if ($LockedTeams)
{
messageClient( %client, '', "Teams are locked. Ask the admin to set your team." );
return;
}
Parent::serverCmdClientTeamChange(%client, %option);
}
};

View file

@ -25,17 +25,24 @@ function loadMissionStage2()
if( $Host::TournamentMode && $Host::PUGautoPassword ) if( $Host::TournamentMode && $Host::PUGautoPassword )
$Host::Password = $Host::PUGPassword; $Host::Password = $Host::PUGPassword;
else if( !$Host::TournamentMode ) else if( !$Host::TournamentMode )
$Host::Password = ""; {
$LockedTeams = 0; if($Host::Password)
$Host::Password = "";
if($LockedTeams)
$LockedTeams = 0;
}
//Set server mode to SPEED //Set server mode to SPEED
$Host::HiVisibility = "0"; $Host::HiVisibility = "0";
} }
else if( $CurrentMissionType $= "LakRabbit" ) else if( $CurrentMissionType $= "LakRabbit" )
{ {
$Host::Password = ""; if($Host::Password)
$Host::TournamentMode = 0; $Host::Password = "";
$LockedTeams = 0; if($LockedTeams)
$LockedTeams = 0;
if($Host::TournamentMode)
$Host::TournamentMode = 0;
//Set server mode to DISTANCE //Set server mode to DISTANCE
$Host::HiVisibility = "1"; $Host::HiVisibility = "1";

View file

@ -1,61 +0,0 @@
// No Base Rape Notify Script
//
// Notifys clients if NoBase rape is on or off.
//
// Enable or Disable
// $Host::EnableNoBaseRapeNotify = 1;
//
// Called in GetTeamCounts.cs
function NBRStatusNotify( %game )
{
if( $Host::EnableNoBaseRapeNotify && $Host::NoBaseRapeEnabled )
{
//On
if( $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount )
{
if( $NBRStatus !$= "PLAYEDON" )
$NBRStatus = "ON";
}
//Off
else
{
if( $NBRStatus !$= "PLAYEDOFF" )
$NBRStatus = "OFF";
}
switch$($NBRStatus)
{
case ON:
messageAll('MsgNoBaseRapeNotify', '\c1No Base Rape: \c0Enabled.');
$NBRStatus = "PLAYEDON";
case OFF:
messageAll('MsgNoBaseRapeNotify', '\c1No Base Rape: \c0Disabled.~wfx/misc/diagnostic_on.wav');
$NBRStatus = "PLAYEDOFF";
case PLAYEDON:
//Do Nothing
case PLAYEDOFF:
//Do Nothing
}
}
}
// Reset gameover
package ResetNBRNotify
{
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset NoBaseRapeNotify
$NBRStatus = "IDLE";
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(ResetNBRNotify))
activatePackage(ResetNBRNotify);

View file

@ -303,6 +303,3 @@ function ConcussionGrenadeThrown::onThrow(%this, %gren)
// Prevent package from being activated if it is already // Prevent package from being activated if it is already
if (!isActivePackage(TacoOverrides)) if (!isActivePackage(TacoOverrides))
activatePackage(TacoOverrides); activatePackage(TacoOverrides);
//Ban WhiteOut Grenade
$InvBanList[CTF, "FlashGrenade"] = 1;

View file

@ -1,120 +0,0 @@
// Team Balance Notify Script
//
// Give the client a notification on the current state of balancing
// Furthermore if Autobalance is enabled. Proceed to Autobalancing
// Autobalance does not need TeamBalanceNotify to be enabled to run
//
// Enable or Disable
// $Host::EnableTeamBalanceNotify = 1;
// Enable or Disable Autobalance
// $Host::EnableAutobalance = 1;
//
// Called in GetTeamCounts.cs
function TeamBalanceNotify(%game)
{
if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 )
{
//Uneven
if($TeamRank[1, count] !$= $TeamRank[2, count])
{
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
//echo("%Team1Difference " @ %team1difference);
//echo("%Team2Difference " @ %team2difference);
if( %team1difference >= 2 || %team2difference >= 2 ) //Teams are unbalanced
{
if( $TBNStatus !$= "NOTIFY" ) //Stops any new schedules
$TBNStatus = "UNBALANCED";
}
else
//Man down. 6vs7, 4vs3 etc
$TBNStatus = "UNEVEN";
}
//Teams are even
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN" )
$TBNStatus = "EVEN";
switch$($TBNStatus)
{
case IDLE:
//Do Nothing
case UNEVEN:
//Do Nothing
case UNBALANCED:
//Start Schedule to Notify
$NotifySchedule = schedule(15000, 0, "NotifyUnbalanced", %game );
$TBNStatus = "NOTIFY";
case EVEN:
//messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
$TBNStatus = "PLAYEDEVEN";
case PLAYEDEVEN:
//Do Nothing
case NOTIFY:
//Do Nothing
}
}
//echo($TBNStatus);
}
//Check to see if teams are still unbalanced
//Fire AutoBalance in 30 sec if enabled
function NotifyUnbalanced( %game )
{
if(isEventPending($NotifySchedule))
cancel($NotifySchedule);
if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset).
return;
//Difference Variables
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
if( %team1difference >= 2 || %team2difference >= 2 )
{
//Autobalance Warning
if( $Host::EnableAutobalance )
{
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
$AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game );
}
//If Autobalance is disabled, message only.
else if( $Host::EnableTeamBalanceNotify )
{
%observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $TeamRank[1, count], $TeamRank[2, count], %observers );
schedule(13000, 0, "ResetTBNStatus");
schedule(15000, 0, "ResetGetCountsStatus");
}
}
else
ResetTBNStatus();
}
// Reset TBNStatus
function ResetTBNStatus()
{
$TBNStatus = "IDLE";
}
// Reset every map change
package ResetTBNGameOver
{
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset TBNStatus
ResetTBNStatus();
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(ResetTBNGameOver))
activatePackage(ResetTBNGameOver);

View file

@ -0,0 +1,432 @@
// GetTeamCounts Script
//
// GetTeamCounts was made to accurately keep track of how many players
// are on teams, on the server, on each team, observer, etc.
// AntiTurrets, Team Balance Notify, AntiCloak, AutoBalance, Base Rape and Base Rape Notify all rely on this.
// It runs every 5 seconds.
//
// Whether or not a portion of the script is run or not depends on
// if a player has switched teams or not. Or if a team changing event has occurred.
// This is triggered via various event functions throughout the game.
//
// If it takes too long for specific canidates to die. After a time choose anyone.
$Autobalance::Fallback = 120000; //60000 is 1 minute
// Set reset string
$GetCountsStatus = "UPDATE";
package StartTeamCounts
{
function CreateServer( %mission, %missionType )
{
parent::CreateServer( %mission, %missionType );
//Call for a GetTeamCount update
GetTeamCounts(%game);
// Set when server starts
// Used to reset timelimit (if voted) when map changes
$DefaultTimeLimit = $Host::TimeLimit;
// Prevent package from being activated if it is already
if (!isActivePackage(TeamCountsTriggers))
activatePackage(TeamCountsTriggers);
// Auto Daily Hard Server Restart at a specific time
// getTimeDif from zDarkTigerStats.cs
if($dtStats::version)
schedule(getTimeDif("10\t00\tam"),0,"quit");
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(StartTeamCounts))
activatePackage(StartTeamCounts);
function GetTeamCounts(%game)
{
switch$($GetCountsStatus)
{
case UPDATE:
if($countdownStarted && $MatchStarted )
{
//Variables
$TotalTeamPlayerCount = $TeamRank[1, count] + $TeamRank[2, count];
$AllPlayerCount = $HostGamePlayerCount;
//Observers
$Observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
//echo("$PlayerCount[0] " @ $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]));
//echo("$PlayerCount[1] " @ $TeamRank[1, count]);
//echo("$PlayerCount[2] " @ $TeamRank[2, count]);
if( !$Host::TournamentMode )
{
if( $CurrentMissionType $= "CTF" )
{
NBRStatusNotify(%game);
CheckAntiPack(%game);
}
TeamBalanceNotify(%game);
}
//Set so counter wont run when it doesnt need to.
$GetCountsStatus = "IDLE";
}
case IDLE:
//Do Nothing
}
if(isEventPending($GetCountsSchedule))
cancel($GetCountsSchedule);
//Call itself again. Every 5 seconds.
$GetCountsSchedule = schedule(5000, 0, "GetTeamCounts");
}
// Triggers a Full run
function ResetGetCountsStatus()
{
$GetCountsStatus = "UPDATE";
}
// Proper Overrides
// Events that determine a TeamGetCounts update
package TeamCountsTriggers
{
function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
{
Parent::clientJoinTeam( %game, %client, %team, %respawn );
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
{
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::assignClientTeam(%game, %client, %respawn )
{
Parent::assignClientTeam(%game, %client, %respawn );
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::onClientEnterObserverMode( %game, %client )
{
Parent::onClientEnterObserverMode( %game, %client );
//Trigger GetCounts
ResetGetCountsStatus();
}
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
{
Parent::AIChangeTeam(%game, %client, %newTeam);
//Trigger GetCounts
ResetGetCountsStatus();
}
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
{
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
//Reset GetCounts
ResetGetCountsStatus();
}
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset GetCounts
ResetGetCountsStatus();
}
function GameConnection::onDrop(%client, %reason)
{
Parent::onDrop(%client, %reason);
//Reset GetCounts
ResetGetCountsStatus();
}
};
// Team Balance Notify Script
//
// Give the client a notification on the current state of balancing
// Furthermore if Autobalance is enabled. Proceed to Autobalancing
// Autobalance does not need TeamBalanceNotify to be enabled to run
//
// Enable or Disable
// $Host::EnableTeamBalanceNotify = 1;
// Enable or Disable Autobalance
// $Host::EnableAutobalance = 1;
//
// Called in GetTeamCounts
function TeamBalanceNotify(%game)
{
if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 )
{
//Uneven
if($TeamRank[1, count] !$= $TeamRank[2, count])
{
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
//echo("%Team1Difference " @ %team1difference);
//echo("%Team2Difference " @ %team2difference);
if( %team1difference >= 2 || %team2difference >= 2 ) //Teams are unbalanced
{
if( $TBNStatus !$= "NOTIFY" ) //Stops any new schedules
$TBNStatus = "UNBALANCED";
}
else
//Man down. 6vs7, 4vs3 etc
$TBNStatus = "UNEVEN";
}
//Teams are even
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN" )
$TBNStatus = "EVEN";
switch$($TBNStatus)
{
case IDLE:
//Do Nothing
case UNEVEN:
//Do Nothing
case UNBALANCED:
//Start Schedule to Notify
$NotifySchedule = schedule(15000, 0, "NotifyUnbalanced", %game );
$TBNStatus = "NOTIFY";
case EVEN:
//messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
$TBNStatus = "PLAYEDEVEN";
case PLAYEDEVEN:
//Do Nothing
case NOTIFY:
//Do Nothing
}
}
//echo($TBNStatus);
}
//Check to see if teams are still unbalanced
//Fire AutoBalance in 30 sec if enabled
function NotifyUnbalanced( %game )
{
if(isEventPending($NotifySchedule))
cancel($NotifySchedule);
if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset).
return;
//Difference Variables
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
if( %team1difference >= 2 || %team2difference >= 2 )
{
//Autobalance Warning
if( $Host::EnableAutobalance )
{
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
$AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game );
}
//If Autobalance is disabled, message only.
else if( $Host::EnableTeamBalanceNotify )
{
%observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $TeamRank[1, count], $TeamRank[2, count], %observers );
schedule(13000, 0, "ResetTBNStatus");
schedule(15000, 0, "ResetGetCountsStatus");
}
}
else
ResetTBNStatus();
}
// Reset TBNStatus
function ResetTBNStatus()
{
$TBNStatus = "IDLE";
}
// Reset every map change
package ResetTBNGameOver
{
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset TBNStatus
ResetTBNStatus();
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(ResetTBNGameOver))
activatePackage(ResetTBNGameOver);
// Team Autobalance Script
//
// Determines which team needs players and proceeds to switch them
// Goon style: At respawn
//
// Enable or Disable Autobalance
// $Host::EnableAutobalance = 1;
//
// exec("scripts/autoexec/Autobalance.cs");
//
// Run from TeamBalanceNotify via NotifyUnbalanced
function Autobalance( %game )
{
if(isEventPending($AutoBalanceSchedule))
cancel($AutoBalanceSchedule);
if($TBNStatus !$= "NOTIFY") //If Status has changed to EVEN or anything else (GameOver reset).
return;
//Difference Variables
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
//Determine BigTeam
if( %team1difference >= 2 )
$BigTeam = 1;
else if( %team2difference >= 2 )
$BigTeam = 2;
else
return;
$Autobalance::UseAllMode = 0;
$Autobalance::FallbackTime = getSimTime();
%otherTeam = $BigTeam == 1 ? 2 : 1;
$Autobalance::AMThreshold = mCeil(MissionGroup.CTF_scoreLimit/3) * 100;
//If BigTeam score is greater than otherteam score + threshold
if($TeamScore[$BigTeam] > ($TeamScore[%otherTeam] + $Autobalance::AMThreshold) || $TeamRank[%otherTeam, count] $= 0)
$Autobalance::UseAllMode = 1;
//If BigTeam Top Players score is greater than otherTeam Top Players score + threshold
else if($TeamRank[$BigTeam, count] >= 5 && $TeamRank[%otherTeam, count] >= 3)
{
%max = mfloor($TeamRank[$BigTeam, count]/2);
if(%max > $TeamRank[%otherTeam, count])
%max = $TeamRank[%otherTeam, count];
%threshold = %max * 100;
for(%i = 0; %i < %max; %i++)
{
%bigTeamTop = %bigTeamTop + $TeamRank[$BigTeam, %i].score;
%otherTeamTop = %otherTeamTop + $TeamRank[%otherTeam, %i].score;
}
if(%bigTeamTop > (%otherTeamTop + %threshold))
$Autobalance::UseAllMode = 1;
}
//echo("Allmode " @ $Autobalance::UseAllMode);
//Select lower half of team rank as canidates for team change
if(!$Autobalance::UseAllMode)
{
//Reset clients canidate var
ResetABClients();
$Autobalance::Max = mFloor($TeamRank[$BigTeam, count]/2);
for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++)
{
//echo("[Autobalance]: Selected" SPC $TeamRank[$BigTeam, %i].nameBase @ ", " @ %i);
$TeamRank[$BigTeam, %i].abCanidate = true;
}
%a = " selected";
}
if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 3)
%s = "s";
//Warning message
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance will switch the next%3 respawning player%2 on Team %1.', $TeamName[$BigTeam], %s, %a);
}
function ResetABClients()
{
for(%i = 0; %i < $TeamRank[$BigTeam, count]; %i++)
{
$TeamRank[$BigTeam, %i].abCanidate = false;
}
}
package Autobalance
{
function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation)
{
parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation);
if($BigTeam !$= "" && %clVictim.team == $BigTeam)
{
%otherTeam = $BigTeam == 1 ? 2 : 1;
if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 2)
{
%fallback = 0;
if((getSimTime() - $Autobalance::FallbackTime) > $Autobalance::Fallback)
%fallback = 1;
//damageType 0: If someone switches to observer or disconnects
if(%damageType !$= 0 && (%clVictim.abCanidate || $Autobalance::UseAllMode || %fallback))
{
echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode SPC "#BT:" @ ($TeamRank[$BigTeam, count]-1) SPC "#OT:" @ ($TeamRank[%otherTeam, count]+1) SPC "FB:" @ %fallback @ "]");
messageClient(%clVictim, 'MsgTeamBalanceNotify', '\c0You were switched to Team %1 for balancing.~wfx/powered/vehicle_screen_on.wav', $TeamName[%otherTeam]);
messageAllExcept(%clVictim, -1, 'MsgTeamBalanceNotify', '~wfx/powered/vehicle_screen_on.wav');
Game.clientChangeTeam( %clVictim, %otherTeam, 0 );
}
}
else
{
ResetABClients();
ResetTBNStatus();
$BigTeam = "";
}
}
}
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset Autobalance
$BigTeam = "";
//Reset all clients canidate var
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
%client.abCanidate = false;
}
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(Autobalance))
activatePackage(Autobalance);

View file

@ -1442,6 +1442,53 @@ function resetViewSchedule(%client)
%client.schedViewRules = ""; %client.schedViewRules = "";
} }
// Locked Teams code (Tournament Mode Only)
// Doesnt allow players Joining the server late to join teams when enable, disables when server if switched back to free for all mode
// Reset in MissionTypeOptions.cs
//
// if(isActivePackage(LockedTeams) && !$LockedTeams)
// deactivatePackage(LockedTeams);
package LockedTeams
{
function serverCmdClientJoinGame(%client)
{
if($LockedTeams)
{
messageClient( %client, '', "Teams are locked. Ask the admin to set your team." );
return;
}
Parent::serverCmdClientJoinGame(%client);
}
function serverCmdClientPickedTeam(%client, %option)
{
Parent::serverCmdClientPickedTeam(%client, %option); //Put first
if($LockedTeams) //Added
{
if($Host::TournamentMode && %client.team !$= 0) //Added
{
messageClient( %client, '', "Teams are locked. Ask the admin to set your team." );
serverCmdClientMakeObserver( %client );
}
return;
}
}
function serverCmdClientTeamChange(%client, %option)
{
if($LockedTeams)
{
messageClient( %client, '', "Teams are locked. Ask the admin to set your team." );
return;
}
Parent::serverCmdClientTeamChange(%client, %option);
}
};
// Prevent package from being activated if it is already // Prevent package from being activated if it is already
if (!isActivePackage(ExtraVoteMenu)) if (!isActivePackage(ExtraVoteMenu))
activatePackage(ExtraVoteMenu); activatePackage(ExtraVoteMenu);

5
Classic/scripts/autoexec/dtBanSystem.cs Normal file → Executable file
View file

@ -10,6 +10,10 @@
//$dtBanList::GUID3555379 = "DAY OF THE YEAR BANNED \t YEAR BANNED \t HOUR BANNED \t MINUTE BANNED \t TIME TO BE BANNED"; //$dtBanList::GUID3555379 = "DAY OF THE YEAR BANNED \t YEAR BANNED \t HOUR BANNED \t MINUTE BANNED \t TIME TO BE BANNED";
//$dtBanList::GUID3555379 = "4\t2021\t18\t31\t518400"; //$dtBanList::GUID3555379 = "4\t2021\t18\t31\t518400";
//TO UNBAN SOMEONE WITHOUT RESTARTING THE SERVER
//unban(%guid,%ip); in console
//Example: unban(555555,"22.222.222.222"); put ip in quotes
package dtBan package dtBan
{ {
@ -147,6 +151,7 @@ function unban(%guid,%ip){
$dtBanList::GUID[%guid] = ""; $dtBanList::GUID[%guid] = "";
error("GUID" SPC %guid SPC "UNBANNED"); error("GUID" SPC %guid SPC "UNBANNED");
} }
%ip = strReplace(%ip, ".", "_");
if($dtBanList::IP[%ip] !$= ""){ if($dtBanList::IP[%ip] !$= ""){
$dtBanList::IP[%ip] = ""; $dtBanList::IP[%ip] = "";
error("IP" SPC %ip SPC "UNBANNED"); error("IP" SPC %ip SPC "UNBANNED");

658
Classic/scripts/autoexec/zDarkTigerStats.cs Executable file → Normal file

File diff suppressed because it is too large Load diff

2
Classic/scripts/autoexec/zDebriefLoadingScreen.cs Normal file → Executable file
View file

@ -51,7 +51,7 @@
// First Screen loading time (Map Screen) // First Screen loading time (Map Screen)
// If this is set too low the second screen wont show at all // If this is set too low the second screen wont show at all
$dtLoadingScreen::FirstScreen = 6000; $dtLoadingScreen::FirstScreen = 5500;
// Second Screen Delay // Second Screen Delay
$dtLoadingScreen::Delay = 0; $dtLoadingScreen::Delay = 0;

4
Classic/scripts/autoexec/zzDiscordBot.cs Executable file → Normal file
View file

@ -187,14 +187,14 @@ function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6)
case "lakMApoints": case "lakMApoints":
%sourceObject = %var1; %sourceObject = %var1;
%points = %var2; %points = %var2;
if(%points == 1) if(%points !$=1)
%s = "s"; %s = "s";
%hitType = %var3; %hitType = %var3;
%weapon = %var4; %weapon = %var4;
%distance = %var5; %distance = %var5;
%vel = %var6; %vel = %var6;
if(%points) if(%points)
%msg = getTaggedString(%sourceObject.client.name) SPC "receives" SPC %points @ %s SPC "points! [" @ %hitType SPC %weapon @ "] [Distance:" SPC %distance @ "] [Speed:" SPC %vel @ "]"; %msg = getTaggedString(%sourceObject.client.name) SPC "receives" SPC %points SPC "point" @ %s @ "! [" @ %hitType SPC %weapon @ "] [Distance:" SPC %distance @ "] [Speed:" SPC %vel @ "]";
} }
if(%msg !$= "") if(%msg !$= "")

4
Classic/scripts/dtChatCmdGame.cs Normal file → Executable file
View file

@ -919,7 +919,7 @@ function fireworksSky(%sky)
function fireworkLoop() function fireworkLoop()
{ {
if($CurrentSky !$= "fireworks") if($CurrentSky !$= "fireworks" || !ClientGroup.getCount())
return; return;
// find a random client. // find a random client.
@ -1023,7 +1023,7 @@ function spookySky(%sky)
function spookyFireworkLoop() function spookyFireworkLoop()
{ {
if($CurrentSky !$= "spookySky") if($CurrentSky !$= "spookySky" || !ClientGroup.getCount())
return; return;
// find a random client. // find a random client.

View file

@ -805,12 +805,18 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice,
else else
%client.nameBase = %realName; %client.nameBase = %realName;
//Allow - ChocoTaco
// Make sure that the connecting client is not trying to use a bot skin: // Make sure that the connecting client is not trying to use a bot skin:
//%temp = detag( %skin ); //%temp = detag( %skin );
//if ( %temp $= "basebot" || %temp $= "basebbot" ) //if ( %temp $= "basebot" || %temp $= "basebbot" )
// %client.skin = addTaggedString( "base" ); // %client.skin = addTaggedString( "base" );
//else //else
// %client.skin = addTaggedString( %skin );
//Changed to allow botskins
%temp = detag( %skin );
if(%temp $= "")
%client.skin = addTaggedString( "base" );
else
%client.skin = addTaggedString( %skin ); %client.skin = addTaggedString( %skin );
%client.voice = %voice; %client.voice = %voice;
@ -1324,7 +1330,7 @@ function loadMissionStage1(%missionName, %missionType, %firstMission)
$CurrentMissionType = %missionType; $CurrentMissionType = %missionType;
createInvBanCount(); createInvBanCount();
echo("LOADING MISSION: " @ %missionName); echo("LOADING MISSION: " @ %missionName SPC formatTimeString("[M-d") SPC formatTimeString(" hh:nna]"));
// increment the mission sequence (used for ghost sequencing) // increment the mission sequence (used for ghost sequencing)
$missionSequence++; $missionSequence++;