diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs deleted file mode 100755 index 1d05c35..0000000 --- a/Classic/scripts/autoexec/Autobalance.cs +++ /dev/null @@ -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); diff --git a/Classic/scripts/autoexec/GetTeamCounts.cs b/Classic/scripts/autoexec/GetTeamCounts.cs deleted file mode 100755 index 6ad384b..0000000 --- a/Classic/scripts/autoexec/GetTeamCounts.cs +++ /dev/null @@ -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(); -} - -}; \ No newline at end of file diff --git a/Classic/scripts/autoexec/LockedTeams.cs b/Classic/scripts/autoexec/LockedTeams.cs deleted file mode 100755 index d8c28d8..0000000 --- a/Classic/scripts/autoexec/LockedTeams.cs +++ /dev/null @@ -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); -} - -}; \ No newline at end of file diff --git a/Classic/scripts/autoexec/MissionTypeOptions.cs b/Classic/scripts/autoexec/MissionTypeOptions.cs index 5db87b4..daa7f86 100644 --- a/Classic/scripts/autoexec/MissionTypeOptions.cs +++ b/Classic/scripts/autoexec/MissionTypeOptions.cs @@ -20,22 +20,29 @@ function loadMissionStage2() switch$($Host::PUGpasswordAlwaysOn) { case 0: - if( $CurrentMissionType !$= "LakRabbit" ) + if( $CurrentMissionType !$= "LakRabbit" ) { if( $Host::TournamentMode && $Host::PUGautoPassword ) $Host::Password = $Host::PUGPassword; else if( !$Host::TournamentMode ) - $Host::Password = ""; - $LockedTeams = 0; + { + if($Host::Password) + $Host::Password = ""; + if($LockedTeams) + $LockedTeams = 0; + } //Set server mode to SPEED $Host::HiVisibility = "0"; } - else if( $CurrentMissionType $= "LakRabbit" ) + else if( $CurrentMissionType $= "LakRabbit" ) { - $Host::Password = ""; - $Host::TournamentMode = 0; - $LockedTeams = 0; + if($Host::Password) + $Host::Password = ""; + if($LockedTeams) + $LockedTeams = 0; + if($Host::TournamentMode) + $Host::TournamentMode = 0; //Set server mode to DISTANCE $Host::HiVisibility = "1"; @@ -44,16 +51,16 @@ function loadMissionStage2() $Host::Password = $Host::PUGPassword; $Host::HiVisibility = "0"; //always SPEED } - + //Siege NoBaseRape Fix - if( $CurrentMissionType $= "Siege" ) + if( $CurrentMissionType $= "Siege" ) $Host::NoBaseRapeEnabled = 0; else $Host::NoBaseRapeEnabled = 1; - + if(isActivePackage(LockedTeams) && !$LockedTeams) deactivatePackage(LockedTeams); - + parent::loadMissionStage2(); } @@ -61,4 +68,4 @@ function loadMissionStage2() // Prevent package from being activated if it is already if (!isActivePackage(MissionTypeOptions)) - activatePackage(MissionTypeOptions); \ No newline at end of file + activatePackage(MissionTypeOptions); diff --git a/Classic/scripts/autoexec/NoBaseRapeNotify.cs b/Classic/scripts/autoexec/NoBaseRapeNotify.cs deleted file mode 100644 index 82dfaf5..0000000 --- a/Classic/scripts/autoexec/NoBaseRapeNotify.cs +++ /dev/null @@ -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); - - diff --git a/Classic/scripts/autoexec/TacoOverrides.cs b/Classic/scripts/autoexec/TacoOverrides.cs index d503bbd..a2d85c8 100755 --- a/Classic/scripts/autoexec/TacoOverrides.cs +++ b/Classic/scripts/autoexec/TacoOverrides.cs @@ -303,6 +303,3 @@ function ConcussionGrenadeThrown::onThrow(%this, %gren) // Prevent package from being activated if it is already if (!isActivePackage(TacoOverrides)) activatePackage(TacoOverrides); - -//Ban WhiteOut Grenade -$InvBanList[CTF, "FlashGrenade"] = 1; diff --git a/Classic/scripts/autoexec/TeamBalanceNotify.cs b/Classic/scripts/autoexec/TeamBalanceNotify.cs deleted file mode 100644 index f84005f..0000000 --- a/Classic/scripts/autoexec/TeamBalanceNotify.cs +++ /dev/null @@ -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); \ No newline at end of file diff --git a/Classic/scripts/autoexec/TeamManagement.cs b/Classic/scripts/autoexec/TeamManagement.cs new file mode 100644 index 0000000..36532cb --- /dev/null +++ b/Classic/scripts/autoexec/TeamManagement.cs @@ -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); diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 3df956a..783c46f 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -171,7 +171,7 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key) messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password'); else messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password'); - + if($LockedTeams) messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleLockedTeams', 'Disable Locked Teams', 'Disable Locked Teams'); else @@ -568,7 +568,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % adminLog(%client, " has enabled Net Tourney Client checking."); } } - return; + return; case "ForceVote": if (%client.isAdmin && $Host::AllowAdminVotes) { @@ -746,7 +746,7 @@ function DefaultGame::voteKickPlayer(%game, %admin, %client) { kick(%client, %admin, %game.kickGuid); %cause = "(vote)"; - + %key = "Passed"; } else @@ -783,7 +783,7 @@ function DefaultGame::voteKickPlayer(%game, %admin, %client) function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId) { %typeName = "VoteChangeMission"; - + %mission = $HostMissionFile[%missionId]; if ( %mission $= "" ) { @@ -839,7 +839,7 @@ function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId ) { %typeName = "VoteTournamentMode"; - + %mission = $HostMissionFile[%missionId]; if ( %mission $= "" ) { @@ -864,16 +864,16 @@ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %t { %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD - if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) { messageAll('MsgVotePassed', '\c2Server switched to Tournament mode by vote (%1): %2 percent.', %missionDisplayName, mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); - + //Log Vote % - Must be before Game Over %key = "Passed"; votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); //Show Vote % messageAll('', '\c1Vote %6: \c0Yea: %1 Nay: %2 Abstain: %7 Total: %3 [%4%5]', %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, mfloor((%game.totalVotesFor/(ClientGroup.getCount() - %game.totalVotesNone)) * 100), "%", %key, %game.totalVotesNone); - + setModeTournament( %mission, %missionType ); } else @@ -883,7 +883,7 @@ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %t votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); //Show Vote % messageAll('', '\c1Vote %6: \c0Yea: %1 Nay: %2 Abstain: %7 Total: %3 [%4%5]', %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, mfloor((%game.totalVotesFor/(ClientGroup.getCount() - %game.totalVotesNone)) * 100), "%", %key, %game.totalVotesNone); - + messageAll('MsgVoteFailed', '\c2Tournament mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); } } @@ -896,7 +896,7 @@ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %t function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit ) { %typeName = "VoteChangeTimeLimit"; - + if( %newLimit == 999 ) %display = "unlimited"; else @@ -936,7 +936,7 @@ function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit ) votePercentLog(%newLimit, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); //Show Vote % messageAll('', '\c1Vote %6: \c0Yea: %1 Nay: %2 Abstain: %7 Total: %3 [%4%5]', %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, mfloor((%game.totalVotesFor/(ClientGroup.getCount() - %game.totalVotesNone)) * 100), "%", %key, %game.totalVotesNone); - + // VoteOvertime ResetVOall(%game); } @@ -984,7 +984,7 @@ function DefaultGame::voteFFAMode( %game, %admin, %client ) function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4) { %typeName = "VoteSkipMission"; - + if(isObject(%admin)) { messageAll('MsgAdminForce', '\c2The Admin %1 has skipped to the next mission.',%admin.name ); @@ -999,13 +999,13 @@ function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4) if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) { messageAll('MsgVotePassed', '\c2The mission was skipped to next by vote.'); - + //Log Vote % - Must be before Game Over %key = "Passed"; votePercentLog("N/A", %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); //Show Vote % messageAll('', '\c1Vote %6: \c0Yea: %1 Nay: %2 Abstain: %7 Total: %3 [%4%5]', %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, mfloor((%game.totalVotesFor/(ClientGroup.getCount() - %game.totalVotesNone)) * 100), "%", %key, %game.totalVotesNone); - + echo("mission skipped (vote)"); %game.gameOver(); //loadMission( findNextCycleMission(), $CurrentMissionType, false ); @@ -1014,7 +1014,7 @@ function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4) else { messageAll('MsgVoteFailed', '\c2Skip mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); - + //Log Vote % %key = "Failed"; votePercentLog("N/A", %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); @@ -1442,6 +1442,53 @@ function resetViewSchedule(%client) %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 if (!isActivePackage(ExtraVoteMenu)) activatePackage(ExtraVoteMenu); diff --git a/Classic/scripts/autoexec/dtBanSystem.cs b/Classic/scripts/autoexec/dtBanSystem.cs old mode 100644 new mode 100755 index 23d1d50..f899e39 --- a/Classic/scripts/autoexec/dtBanSystem.cs +++ b/Classic/scripts/autoexec/dtBanSystem.cs @@ -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 = "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 { @@ -147,6 +151,7 @@ function unban(%guid,%ip){ $dtBanList::GUID[%guid] = ""; error("GUID" SPC %guid SPC "UNBANNED"); } + %ip = strReplace(%ip, ".", "_"); if($dtBanList::IP[%ip] !$= ""){ $dtBanList::IP[%ip] = ""; error("IP" SPC %ip SPC "UNBANNED"); diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs old mode 100755 new mode 100644 index 8d850ce..0b2bcc0 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -14,7 +14,7 @@ //-----------Settings------------ //Notes score ui width is 592 -$dtStats::version = 8.8; +$dtStats::version = 9.3; //disable stats system $dtStats::Enable = 1; //enable disable map stats @@ -28,6 +28,7 @@ $dtStats::MaxNumOfGames = 100; $dtStats::avgCount = 10; // number of players to start tracking totals +//number of games for leaderboard averages $dtStats::minTotal = 6; //how high the player has to be off the ground before it will count $dtStats::midAirHeight = 10; @@ -40,7 +41,6 @@ $dtStats::sortSpeed = 128; //Load/saving rates to prevent any server hitching $dtStats::slowSaveTime = 100; -$dtStats::loadSlowTime = 0;// dont use yet //This will load player stats after their first game, to reduce any impact on the server. $dtStats::loadAfter = 0;//keep 0 not finished @@ -288,6 +288,12 @@ $dtStats::FV[$dtStats::FC["CTFGame","Max"]++,"CTFGame","Max"] = "interceptSpeed" $dtStats::FV[$dtStats::FC["CTFGame","Max"]++,"CTFGame","Max"] = "interceptFlagSpeed"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "friendlyFire"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "timeOnTeamZero"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "timeOnTeamOne"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "timeOnTeamTwo"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "matchRunTime"; +$dtStats::FV[$dtStats::FC["CTFGame","Game"]++,"CTFGame","Game"] = "teamOneCapTimes"; +$dtStats::FV[$dtStats::FC["CTFGame","Game"]++,"CTFGame","Game"] = "teamTwoCapTimes"; ///////////////////////////////////////////////////////////////////////////// //Unused vars needed for stats back up $dtStats::uGFV[$dtStats::uGFC["CTFGame"]++,"CTFGame"] = "returnPts"; @@ -414,6 +420,12 @@ $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "depInvRepairs"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "depTurretRepairs"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "returnPts"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "timeOnTeamZero"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "timeOnTeamOne"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "timeOnTeamTwo"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "matchRunTime"; +$dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "teamOneCapTimes"; +$dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "teamTwoCapTimes"; /////////////////////////////////////////////////////////////////////////////// // DuelGame /////////////////////////////////////////////////////////////////////////////// @@ -440,6 +452,10 @@ $dtStats::FVG[$dtStats::FCG["ArenaGame","TG"]++,"ArenaGame","TG"] = "roundKills" $dtStats::FVG[$dtStats::FCG["ArenaGame","TG"]++,"ArenaGame","TG"] = "hatTricks"; $dtStats::FV[$dtStats::FC["ArenaGame","Game"]++,"ArenaGame","Game"] = "dtTeam"; $dtStats::FV[$dtStats::FC["ArenaGame","Game"]++,"ArenaGame","Game"] = "teamScore"; +$dtStats::FV[$dtStats::FC["ArenaGame","TG"]++,"ArenaGame","TG"] = "timeOnTeamZero"; +$dtStats::FV[$dtStats::FC["ArenaGame","TG"]++,"ArenaGame","TG"] = "timeOnTeamOne"; +$dtStats::FV[$dtStats::FC["ArenaGame","TG"]++,"ArenaGame","TG"] = "timeOnTeamTwo"; +$dtStats::FV[$dtStats::FC["ArenaGame","TG"]++,"ArenaGame","TG"] = "matchRunTime"; /////////////////////////////////////////////////////////////////////////////// // SiegeGame /////////////////////////////////////////////////////////////////////////////// @@ -625,7 +641,10 @@ $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "lightningMAEVKills"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "EVHitWep"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "EVMAHit"; - +$dtStats::FV[$dtStats::FC["Game"]++,"Game"] = "startPCT"; +$dtStats::FV[$dtStats::FC["Game"]++,"Game"] = "endPCT"; +$dtStats::FV[$dtStats::FC["Game"]++,"Game"] = "mapSkip"; +$dtStats::FV[$dtStats::FC["Game"]++,"Game"] = "clientQuit"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "totalWepDmg"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "timeTL"; $dtStats::FV[$dtStats::FC["Avg"]++,"Avg"] = "timeTL"; @@ -1710,6 +1729,7 @@ package dtStats{ /////////////////////////////////////////////////////////////////////////////// function DefaultGame::missionLoadDone(%game){ parent::missionLoadDone(%game); + //$dtStats::loadPlayerCount = $HostGamePlayerCount; if($dtStats::Enable){ dtSaveServerVars(); dtScanForRepair(); @@ -1724,6 +1744,8 @@ package dtStats{ if(%reason $= "spawnTimeout"){ %client.dtStats.spawnobstimeoutCount++; } + updateTeamTime(%client.dtStats,%client.dtStats.team); + %client.dtStats.team = 0; %client.gt = %client.at = 0;//air time ground time reset } } @@ -1782,11 +1804,40 @@ package dtStats{ if($dtStats::Enable) %player.client.dtStats.leavemissionareaCount++; } - function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned){ // z0dd - ZOD, 6/06/02. Don't send a message if player used respawn feature. Added %respawned - parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned); - if($dtStats::Enable && isGameRun()) - %client.dtStats.switchteamCount++; + function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn ){ + parent::clientJoinTeam( %game, %client, %team, %respawn ); + if($dtStats::Enable){ + updateTeamTime(%client.dtStats, 0); + %client.dtStats.team = %team; + //error("jointeam" SPC %team); + } } + function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned){ // z0dd - ZOD, 6/06/02. Don't send a message if player used respawn feature. Added %respawned + if($dtStats::Enable && isGameRun()){ + %client.dtStats.team = %team; + %client.dtStats.switchteamCount++; + //error("clientChagneTeam" SPC %fromObs SPC %team); + if(%fromObs) + updateTeamTime(%client.dtStats, 0); + else + updateTeamTime(%client.dtStats,%client.team); + } + parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned); + } + function DefaultGame::assignClientTeam(%game, %client, %respawn ){ + parent::assignClientTeam(%game, %client, %respawn ); + if($dtStats::Enable){ + updateTeamTime(%client.dtStats, 0); + %client.dtStats.team = %client.team; + } + //error("assignClientTeam" SPC %client.team SPC %respawn); + } + //function DefaultGame::startMatch(%game){ + //parent::startMatch(%game); + //if($dtStats::Enable){ + // + //} + //} function RepairPack::onThrow(%data,%obj,%shape){ parent::onThrow(%data,%obj,%shape); if($dtStats::Enable){ @@ -2416,15 +2467,33 @@ package dtStatsGame{ function CTFGame::flagCap(%game, %player){ if($dtStats::Enable){ %flag = %player.holdingFlag; + %clTeam = %player.client.team; + %dtStats = %player.client.dtStats; + %time = ((getSimTime() - $missionStartTime)/1000)/60; + if(%clTeam == 1){ + $dtStats::teamOneCapCount++; + if($dtStats::teamOneCapCount == 1) + $dtStats::teamOneCapTimes = 0 @ "," @ cropFloat(%time,1); + else + $dtStats::teamOneCapTimes = $dtStats::teamOneCapTimes @ "," @ cropFloat(%time,1); + } + else{ + $dtStats::teamTwoCapCount++; + if($dtStats::teamTwoCapCount == 1) + $dtStats::teamTwoCapTimes = 0 @ "," @ cropFloat(%time,1); + else + $dtStats::teamTwoCapTimes = $dtStats::teamTwoCapTimes @ "," @ cropFloat(%time,1); + } + //error($dtStats::teamOneCapTimes SPC $dtStats::teamTwoCapTimes); if(%game.dtTotalFlagTime[%flag]){ %heldTime = (getSimTime() - %game.dtTotalFlagTime[%flag])/1000; - if(%heldTime < %player.client.dtStats.heldTimeSec || !%player.client.dtStats.heldTimeSec){ + if(%heldTime < %dtStats.heldTimeSec || !%dtStats.heldTimeSec){ if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ - %player.client.dtStats.heldTimeSec = %heldTime; - %player.client.dtStats.heldTimeSecLow = %heldTime; + %dtStats.heldTimeSec = %heldTime; + %dtStats.heldTimeSecLow = %heldTime; } else - %player.client.dtStats.heldTimeSecLow = %heldTime; + %dtStats.heldTimeSecLow = %heldTime; } } } @@ -2516,15 +2585,31 @@ package dtStatsGame{ function SCtFGame::flagCap(%game, %player){ if($dtStats::Enable){ %flag = %player.holdingFlag; + %dtStats = %player.client.dtStats; + %time = ((getSimTime() - $missionStartTime)/1000)/60; + if(%clTeam == 1){ + $dtStats::teamOneCapCount++; + if($dtStats::teamOneCapCount == 1) + $dtStats::teamOneCapTimes = 0 @ "," @ cropFloat(%time,1); + else + $dtStats::teamOneCapTimes = $dtStats::teamOneCapTimes @ "," @ cropFloat(%time,1); + } + else{ + $dtStats::teamTwoCapCount++; + if($dtStats::teamTwoCapCount == 1) + $dtStats::teamTwoCapTimes = 0 @ "," @ cropFloat(%time,1); + else + $dtStats::teamTwoCapTimes = $dtStats::teamTwoCapTimes @ "," @ cropFloat(%time,1); + } if(%game.dtTotalFlagTime[%flag]){ %heldTime = (getSimTime() - %game.dtTotalFlagTime[%flag])/1000; - if(%heldTime < %player.client.dtStats.heldTimeSec || !%player.client.dtStats.heldTimeSec){ + if(%heldTime < %dtStats.heldTimeSec || !%dtStats.heldTimeSec){ if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ - %player.client.dtStats.heldTimeSec = %heldTime; - %player.client.dtStats.heldTimeSecLow = %heldTime; + %dtStats.heldTimeSec = %heldTime; + %dtStats.heldTimeSecLow = %heldTime; } else - %player.client.dtStats.heldTimeSecLow = %heldTime; + %dtStats.heldTimeSecLow = %heldTime; } } } @@ -2593,7 +2678,7 @@ if($dtStats::Enable){ // Game Type Commons // //////////////////////////////////////////////////////////////////////////////// function dtGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5){ - if($dtStats::debugEchos){error(%game SPC %client SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4 SPC %arg5);} + if($dtStats::debugEchos){error("dtGameLink" SPC %game SPC %client SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4 SPC %arg5);} if(%arg1 $= "S"){ %client.viewClient = getCNameToCID(%arg3); if( %client.viewClient != 0){ @@ -3866,7 +3951,6 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini %client.lgame = %game.class; %foundOld = 0; %mrx = setGUIDName(%client);// make sure we have a guid if not make one - %authInfo = %client.getAuthInfo(); %realName = getField( %authInfo, 0 ); if(%realName !$= "") @@ -3909,7 +3993,9 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini else %dtStats = %client.dtStats; - %dtStats.joinPCT = %game.getGamePct(); + %dtStats.joinPCT = (isGameRun() == 1) ? %game.getGamePct() : 0; + updateTeamTime(%dtStats, -1); + %dtStats.team = %client.team;// should be 0 if(isObject(%dtStats) && %dtStats.gameData[%game.class] != 1){ // game type change %dtStats.gameStats["totalGames","g",%game.class] = 0; %dtStats.gameStats["statsOverWrite","g",%game.class] = -1; @@ -3922,102 +4008,117 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini } } function dtStatsClientLeaveGame(%client){ + $dtServerVars::lastPlayerCount = $HostGamePlayerCount - $HostGameBotCount; + if(isGameRun()){// if they dc during game over dont count it $dtServer::mapDisconnects[cleanMapName($CurrentMission),Game.class]++; if(%client.score != 0) $dtServer::mapDisconnectsScore[cleanMapName($CurrentMission),Game.class]++; } - //if($HostGamePlayerCount - $HostGameBotCount == 0) + if(isObject(%client.dtStats)){ %client.dtStats.clientLeft = 1; %client.dtStats.leftTime = getSimTime(); %client.dtStats.leftID = $dtStats::leftID; + %client.dtStats.leftPCT = Game.getGamePct(); if(isObject(Game) && isGameRun() && %client.score != 0) bakGameStats(%client,Game.class);//back up there current game in case they lost connection } } function dtStatsGameOver( %game ){ + if($dtStats::debugEchos){error("dtStatsGameOver");} $dtStats::serverHang = $dtStats::hostHang = 0; $dtStats::LastMissionDN = $MissionDisplayName; $dtStats::LastMissionCM = $CurrentMission; $dtStats::LastGameType = %game.class; - $dtStats::statsSave = 1; - if(%game.getGamePct() > 50){ + if(%game.getGamePct() > 90){ $dtServer::playCount[cleanMapName($CurrentMission),%game.class]++; $dtServer::lastPlay[cleanMapName($CurrentMission),%game.class] = getDayNum() TAB getYear() TAB formattimestring("mm/dd/yy hh:nn:a"); } else $dtServer::skipCount[cleanMapName($CurrentMission),%game.class]++; - - statsGroup.firstKill = 0; - if($dtStats::debugEchos){error("dtStatsGameOver");} - if(%game.class $= "CTFGame" || %game.class $= "SCtFGame" || %game.class $= "ArenaGame"){ - statsGroup.team[1] = $teamScore[1]; - statsGroup.team[2] = $teamScore[2]; - } - %timeNext =0; - %time = 2000; - for (%i = 0; %i < statsGroup.getCount(); %i++){// see if we have any old clients data - %dtStats = statsGroup.getObject(%i); - if(%dtStats.clientLeft || !isObject(%dtStats.client)){ // find any that left during the match and - %dtStats.markForDelete = 1; - %game.postGameStats(%dtStats); - %time += $dtStats::slowSaveTime; // this will chain them - schedule(%time ,0,"incGameStats",%dtStats,%game.class); - if($dtStats::mapStats){ - %time += $dtStats::slowSaveTime; // this will chain them - schedule(%time ,0,"saveMapStats",%dtStats,%game.class); + if(!$dtStats::statsSave){//in case of admin skip map and it has not finished saving the old map + $dtStats::statsSave = 1; + statsGroup.firstKill = 0; + if($dtStats::debugEchos){error("dtStatsGameOver2");} + if(%game.class $= "CTFGame" || %game.class $= "SCtFGame" || %game.class $= "ArenaGame"){ + statsGroup.team[1] = $teamScore[1]; + statsGroup.team[2] = $teamScore[2]; + } + %timeNext =0; + %time = 2000; + for (%i = 0; %i < statsGroup.getCount(); %i++){// see if we have any old clients data + %dtStats = statsGroup.getObject(%i); + if(%dtStats.clientLeft || !isObject(%dtStats.client)){ // find any that left during the match and + %dtStats.markForDelete = 1; + %game.postGameStats(%dtStats);// note bakGame was called when they left + %time += $dtStats::slowSaveTime; + schedule(%time ,0,"incGameStats",%dtStats,%game.class); + if($dtStats::mapStats){ + %time += $dtStats::slowSaveTime; + schedule(%time ,0,"saveMapStats",%dtStats,%game.class); + } + %time += $dtStats::slowSaveTime; + schedule(%time ,0,"saveGameTotalStats",%dtStats,%game.class); } - %time += $dtStats::slowSaveTime; // this will chain them - schedule(%time ,0,"saveGameTotalStats",%dtStats,%game.class); - } - else if(isObject(%dtStats.client)){// make sure client is still a thing - %client = %dtStats.client; - %client.viewMenu = %client.viewClient = %client.viewStats = 0;//reset hud - %client.lastPage = 1; %client.lgame = %game; - bakGameStats(%client,%game.class);// copy over game type values before they reset - %game.postGameStats(%dtStats); - %time += $dtStats::slowSaveTime; // this will chain them - schedule(%time ,0,"incGameStats",%dtStats,%game.class); //resetDtStats after incGame - if($dtStats::mapStats){ + else if(isObject(%dtStats.client)){// make sure client is still a thing + %client = %dtStats.client; + %client.viewMenu = %client.viewClient = %client.viewStats = 0;//reset hud + %client.lastPage = 1; %client.lgame = %game; + bakGameStats(%client,%game.class);// copy over game type values before they reset + %game.postGameStats(%dtStats); %time += $dtStats::slowSaveTime; // this will chain them - schedule(%time ,0,"saveMapStats",%dtStats,%game.class); + schedule(%time ,0,"incGameStats",%dtStats,%game.class); //resetDtStats after incGame + if($dtStats::mapStats){ + %time += $dtStats::slowSaveTime; // this will chain them + schedule(%time ,0,"saveMapStats",%dtStats,%game.class); + } + %time += $dtStats::slowSaveTime; + schedule(%time,0,"saveGameTotalStats",%dtStats,%game.class); // + } + else{ + error("Logic issue in dtStatsGameOver" SPC %dtStats SPC %client SPC %game.class); + %dtStats.delete(); } - %time += $dtStats::slowSaveTime; - schedule(%time,0,"saveGameTotalStats",%dtStats,%game.class); // - } - else{ - error("Logic issue in dtStatsGameOver" SPC %dtStats SPC %client SPC %game.class); - %dtStats.delete(); } + %time += $dtStats::slowSaveTime; + schedule(%time,0,"dtSaveDone"); } - %time += $dtStats::slowSaveTime; - schedule(%time,0,"dtSaveDone"); } function dtSaveDone(){ - $dtStats::statsSave = 0; - $dtStats::leftID++; + $dtStats::statsSave = 0; + $dtStats::leftID++; + $dtStats::teamOneCapTimes = 0; + $dtStats::teamTwoCapTimes = 0; + $dtStats::teamOneCapCount = 0; + $dtStats::teamTwoCapCount = 0; } //////////////////////////////////////////////////////////////////////////////// // Supporting Functions // //////////////////////////////////////////////////////////////////////////////// function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the end of the match + if($dtStats::debugEchos){error("postGameStats GUID = " SPC %dtStats.guid);} if(!isObject(%dtStats)) return; - armorTimer(%dtStats, 0, 1); + %dtStats.null = getRandom(1,100); + %dtStats.kdr = %dtStats.deaths ? (%dtStats.kills/%dtStats.deaths) : %dtStats.kills; - if(statsGroup.lastKill == %dtStats) - %dtStats.lastKill = 1; - %dtStats.dtTeam = %dtStats.team;// this may need to be lastteam - if(%dtStats.clientLeft) - %dtStats.totalTime = ((%dtStats.leftTime - %dtStats.joinTime)/1000)/60; - else - %dtStats.totalTime = ((getSimTime() - %dtStats.joinTime)/1000)/60;//convert it to min + %dtStats.lastKill = (statsGroup.lastKill == %dtStats); - %dtStats.gamePCT = mFloor(%game.getGamePct() - %dtStats.joinPCT); + %dtStats.totalTime = (%dtStats.clientLeft == 1) ? ((%dtStats.leftTime - %dtStats.joinTime)/1000)/60 : ((getSimTime() - %dtStats.joinTime)/1000)/60; + + %dtStats.clientQuit = %dtStats.clientLeft == 1; + + %dtStats.matchRunTime =((getSimTime() - $missionStartTime)/1000)/60; + + %dtStats.startPCT = %dtStats.joinPCT; + %dtStats.endPCT = (%dtStats.clientLeft == 1) ? %dtStats.leftPCT : %game.getGamePct(); + %dtStats.gamePCT = mFloor(%dtStats.endPCT - %dtStats.startPCT); + %dtStats.mapSkip = (%game.getGamePct() < 99); + //error(%dtStats.endPCT SPC %dtStats.startPCT SPC %dtStats.gamePCT SPC %dtStats.mapSkip); %dtStats.totalMA = %dtStats.discMA + %dtStats.grenadeMA + @@ -4030,7 +4131,7 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en %dtStats.mineMA; - %dtStats.EVKills = %dtStats.explosionKills + + %dtStats.EVKills = %dtStats.explosionKills + %dtStats.groundKills + %dtStats.outOfBoundKills + %dtStats.lavaKills + @@ -4039,7 +4140,7 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en %dtStats.forceFieldPowerUpKills + %dtStats.nexusCampingKills; - %dtStats.EVDeaths = %dtStats.explosionDeaths + + %dtStats.EVDeaths = %dtStats.explosionDeaths + %dtStats.groundDeaths + %dtStats.outOfBoundDeaths + %dtStats.lavaDeaths + @@ -4049,18 +4150,18 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en %dtStats.nexusCampingDeaths; %dtStats.totalWepDmg = %dtStats.cgDmg + - %dtStats.laserDmg + - %dtStats.blasterDmg + - %dtStats.elfDmg + - %dtStats.discDmg + - %dtStats.grenadeDmg + - %dtStats.hGrenadeDmg + - %dtStats.mortarDmg + - %dtStats.missileDmg + - %dtStats.plasmaDmg + - %dtStats.shockDmg + - %dtStats.mineDmg + - %dtStats.SatchelDmg; + %dtStats.laserDmg + + %dtStats.blasterDmg + + %dtStats.elfDmg + + %dtStats.discDmg + + %dtStats.grenadeDmg + + %dtStats.hGrenadeDmg + + %dtStats.mortarDmg + + %dtStats.missileDmg + + %dtStats.plasmaDmg + + %dtStats.shockDmg + + %dtStats.mineDmg + + %dtStats.SatchelDmg; if(%dtStats.cgShotsFired < 100) @@ -4106,9 +4207,11 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en if(%game.class $= "CTFGame" || %game.class $= "SCtFGame"){ - %dtStats.teamScore = $TeamScore[%dtStats.team]; + %dtStats.teamOneCapTimes = $dtStats::teamOneCapTimes; + %dtStats.teamTwoCapTimes = $dtStats::teamTwoCapTimes; + %dtStats.teamScore = $TeamScore[%dtStats.dtTeam]; - %dtStats.destruction = %dtStats.genDestroys + + %dtStats.destruction = %dtStats.genDestroys + %dtStats.solarDestroys + %dtStats.sensorDestroys + %dtStats.turretDestroys + @@ -4121,7 +4224,7 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en %dtStats.depStationDestroys + %dtStats.mpbtstationDestroys; - %dtStats.repairs = %dtStats.genRepairs + + %dtStats.repairs = %dtStats.genRepairs + %dtStats.SensorRepairs + %dtStats.TurretRepairs + %dtStats.StationRepairs + @@ -4133,20 +4236,17 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en %dtStats.depInvRepairs + %dtStats.depTurretRepairs; - if(%dtStats.flagGrabs > 0) - %dtStats.capEfficiency = %dtStats.flagCaps / %dtStats.flagGrabs; - else - %dtStats.capEfficiency = 0; + %dtStats.capEfficiency = (%dtStats.flagGrabs > 0) ? (%dtStats.flagCaps / %dtStats.flagGrabs) : 0; if(statsGroup.team[1] == statsGroup.team[2]){ %dtStats.winCount = 0; %dtStats.lossCount = 0; } - else if(statsGroup.team[1] > statsGroup.team[2] && %dtStats.team == 1) + else if(statsGroup.team[1] > statsGroup.team[2] && %dtStats.dtTeam == 1) %dtStats.winCount = 1; - else if(statsGroup.team[2] > statsGroup.team[1] && %dtStats.team == 2) + else if(statsGroup.team[2] > statsGroup.team[1] && %dtStats.dtTeam == 2) %dtStats.winCount = 1; - else if(%dtStats.team > 0) + else if(%dtStats.dtTeam > 0) %dtStats.lossCount = 1; %winCount = getField(%dtStats.gameStats["winCountTG","t",%game.class],5) + %dtStats.winCount; @@ -4158,7 +4258,7 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en else if(%game.class $= "LakRabbitGame") %dtStats.flagTimeMin = (%dtStats.flagTimeMS / 1000)/60; else if(%game.class $= "ArenaGame") - %dtStats.teamScore = $TeamScore[%dtStats.team]; + %dtStats.teamScore = $TeamScore[%dtStats.dtTeam]; } function isGameRun(){// @@ -4166,120 +4266,109 @@ function isGameRun(){// } function DefaultGame::getGamePct(%game){ - if(isGameRun()){ - %curTimeLeftMS = mAbs((($missionStartTime - getSimTime())/60)/1000); - %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; - return %timePct; - } - return 0; + %curTimeLeftMS = ((getSimTime() - $missionStartTime)/1000)/60; + %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %timePct = (%timePct > 100) ? 100 : %timePct; + return %timePct; } function ArenaGame::getGamePct(%game){ - if(isGameRun()){ - // Verify that there is a roundlimit and that the team has met it - if(%game.roundLimit != 0){ - if( $TeamScore[1] >= $TeamScore[2]){ - return ($TeamScore[1] / %game.roundLimit) * 100; - } - else if( $TeamScore[1] <= $TeamScore[2]){ - return ($TeamScore[2] / %game.roundLimit) * 100; - } + if(%game.roundLimit != 0){ + if( $TeamScore[1] >= $TeamScore[2]){ + %pct = ($TeamScore[1] / %game.roundLimit) * 100; + %pct = (%pct > 100) ? 100 : %pct; + return %pct; } + else if( $TeamScore[1] <= $TeamScore[2]){ + %pct = ($TeamScore[2] / %game.roundLimit) * 100; + %pct = (%pct > 100) ? 100 : %pct; + return %pct; + } } return 0; } function CTFGame::getGamePct(%game){ - if(isGameRun()){ - %curTimeLeftMS = mAbs((($missionStartTime - getSimTime())/60)/1000); + %curTimeLeftMS = ((getSimTime() - $missionStartTime)/1000)/60; %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %timePct = (%timePct > 100) ? 100 : %timePct; %scoreLimit = MissionGroup.CTF_scoreLimit * %game.SCORE_PER_TEAM_FLAG_CAP; if(%scoreLimit $= "") %scoreLimit = 5 * %game.SCORE_PER_TEAM_FLAG_CAP; if($TeamScore[1] > $TeamScore[2]) - %scorePct = ($TeamScore[1] / %scoreLimit) * 100; + %pct = ($TeamScore[1] / %scoreLimit) * 100; else - %scorePct = ($TeamScore[2] / %scoreLimit) * 100; + %pct = ($TeamScore[2] / %scoreLimit) * 100; + %scorePct = (%pct > 100) ? 100 : %pct; if(%scorePct > %timePct) return %scorePct; else return %timePct; - } - return 0; } function LakRabbitGame::getGamePct(%game){ - if(isGameRun()){ - %curTimeLeftMS = mAbs((($missionStartTime - getSimTime())/60)/1000); - %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; - - %scoreLimit = MissionGroup.Rabbit_scoreLimit; - if(%scoreLimit $= "") - %scoreLimit = 2000; - - for (%i = 0; %i < ClientGroup.getCount(); %i++){ - %client = ClientGroup.getObject(%i); - if(%lScore < %client.score){ - %lScore = %client.score; - } + %curTimeLeftMS = ((getSimTime() - $missionStartTime)/1000)/60; + %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %timePct = (%timePct > 100) ? 100 : %timePct; + %scoreLimit = MissionGroup.Rabbit_scoreLimit; + if(%scoreLimit $= "") + %scoreLimit = 2000; + %lScore = 0; + for (%i = 0; %i < ClientGroup.getCount(); %i++){ + %client = ClientGroup.getObject(%i); + if(%lScore < %client.score){ + %lScore = %client.score; } - %scorePct = (%lScore / %scoreLimit) * 100; - - if(%scorePct > %timePct) - return %scorePct; - else - return %timePct; } - return 0; - + %pct = (%lScore / %scoreLimit) * 100; + %scorePct = (%pct > 100) ? 100 : %pct; + if(%scorePct > %timePct) + return %scorePct; + else + return %timePct; } function DMGame::getGamePct(%game){ - if(isGameRun()){ - %curTimeLeftMS = mAbs((($missionStartTime - getSimTime())/60)/1000); - %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %curTimeLeftMS = ((getSimTime() - $missionStartTime)/1000)/60; + %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %timePct = (%timePct > 100) ? 100 : %timePct; + %scoreLimit = MissionGroup.DM_scoreLimit; + if(%scoreLimit $= "") + %scoreLimit = 25; - %scoreLimit = MissionGroup.DM_scoreLimit; - if(%scoreLimit $= "") - %scoreLimit = 25; - - for (%i = 0; %i < ClientGroup.getCount(); %i++){ - %client = ClientGroup.getObject(%i); - if(%lScore < %client.score){ - %lScore = %client.score; - } + for (%i = 0; %i < ClientGroup.getCount(); %i++){ + %client = ClientGroup.getObject(%i); + if(%lScore < %client.score){ + %lScore = %client.score; } - %scorePct = (%lScore / %scoreLimit) * 100; - - - if(%scorePct > %timePct) - return %scorePct; - else - return %timePct; } - return 0; + %pct = (%lScore / %scoreLimit) * 100; + %scorePct = (%pct > 100) ? 100 : %pct; + + if(%scorePct > %timePct) + return %scorePct; + else + return %timePct; } function SCtFGame::getGamePct(%game){ - if(isGameRun()){ - %curTimeLeftMS = mAbs((($missionStartTime - getSimTime())/60)/1000); - %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %curTimeLeftMS = ((getSimTime() - $missionStartTime)/1000)/60; + %timePct = (%curTimeLeftMS / $Host::TimeLimit) * 100; + %timePct = (%timePct > 100) ? 100 : %timePct; + %scoreLimit = MissionGroup.CTF_scoreLimit * %game.SCORE_PER_TEAM_FLAG_CAP; + if(%scoreLimit $= "") + %scoreLimit = 5 * %game.SCORE_PER_TEAM_FLAG_CAP; - %scoreLimit = MissionGroup.CTF_scoreLimit * %game.SCORE_PER_TEAM_FLAG_CAP; - if(%scoreLimit $= "") - %scoreLimit = 5 * %game.SCORE_PER_TEAM_FLAG_CAP; + if($TeamScore[1] > $TeamScore[2]) + %pct = ($TeamScore[1] / %scoreLimit) * 100; + else + %pct = ($TeamScore[2] / %scoreLimit) * 100; - if($TeamScore[1] > $TeamScore[2]) - %scorePct = ($TeamScore[1] / %scoreLimit) * 100; - else - %scorePct = ($TeamScore[2] / %scoreLimit) * 100; - - - if(%scorePct > %timePct) - return %scorePct; - else - return %timePct; - } + %scorePct = (%pct > 100) ? 100 : %pct; + if(%scorePct > %timePct) + return %scorePct; + else + return %timePct; } function msToMinSec(%time) { @@ -4499,46 +4588,6 @@ function monthString(%num){ // Load Save Management // //////////////////////////////////////////////////////////////////////////////// -function loadSlowStats(%file,%dtStats,%game,%total){ - if(!%file.isEOF()){ - %line = strreplace(%file.readline(),"%t","\t"); - %var = getField(%line,0); - %dtStats.gameStats[%var,"g",%game] = getFields(%line,1,getFieldCount(%line)-1); - schedule($dtStats::loadSlowTime,0,"loadSlowStats",%file,%dtStats,%game,%total); - } - else{ - %dtStats.gameData[%game]= 1; - %file.close(); - %file.delete(); - } -} -function loadTotalSlowStats(%file,%dtStats,%game){ - if(!%file.isEOF()){ - %line = strreplace(%file.readline(),"%t","\t"); - %var = getField(%line,0); - if(%var !$= "playerName"){ - %d0 = getField(%line,1);%d1 = getField(%line,2); - %w0 = getField(%line,3);%w1 = getField(%line,4); - %m0 = getField(%line,5);%m1 = getField(%line,6); - %q0 = getField(%line,7);%q1 = getField(%line,8); - %y0 = getField(%line,9);%y1 = getField(%line,10); - - if(%day){ %d0 = %d1; %d1 = 0;} //if there was a change flip new with old and reset new - if(%week){%w0 = %w1;%w1 = 0;} - if(%month){%m0 = %m1;%m1 = 0;} - if(%quarter){%q0 = %q1;%q1 = 0;} - if(%year){ %y0 = %y1;%y1 = 0;} - - %dtStats.gameStats[%var,"t",%game] = %d0 TAB %d1 TAB %w0 TAB %w1 TAB %m0 TAB %m1 TAB %q0 TAB %q1 TAB %y0 TAB %y1; - } - schedule($dtStats::loadSlowTime,0,"loadTotalSlowStats",%file,%dtStats,%game,%total); - } - else{ - %file.close(); - %file.delete(); - } -} - function loadGameStats(%dtStats,%game){// called when client joins server.cs onConnect if($dtStats::debugEchos){error("loadGameStats GUID = " SPC %dtStats.guid);} if(%dtStats.guid !$= ""){ @@ -4548,18 +4597,14 @@ function loadGameStats(%dtStats,%game){// called when client joins server.cs onC %file = new FileObject(); RootGroup.add(%file); %file.OpenForRead(%filename); - if($dtStats::loadSlowTime > 0 && !$dtStats::loadAfter)// if load after is enabled dont load slow - loadSlowStats(%file,%dtStats,%game); - else{ - while( !%file.isEOF() ){ - %line = strreplace(%file.readline(),"%t","\t"); - %var = getField(%line,0); - %dtStats.gameStats[%var,"g",%game] = getFields(%line,1,getFieldCount(%line)-1); - } - %dtStats.gameData[%game]= 1; - %file.close(); - %file.delete(); + while( !%file.isEOF() ){ + %line = strreplace(%file.readline(),"%t","\t"); + %var = getField(%line,0); + %dtStats.gameStats[%var,"g",%game] = getFields(%line,1,getFieldCount(%line)-1); } + %dtStats.gameData[%game]= 1; + %file.close(); + %file.delete(); } else %dtStats.gameData[%game]= 1; @@ -4597,32 +4642,27 @@ function loadGameTotalStats(%dtStats,%game){ if(%year){ %y0 = %y1; %y1 = %y;} %dtStats.gameStats["dwmqy","t",%game] = %d0 TAB %d1 TAB %w0 TAB %w1 TAB %m0 TAB %m1 TAB %q0 TAB %q1 TAB %y0 TAB %y1; // update line } - if($dtStats::loadSlowTime > 0 && !$dtStats::loadAfter)// if load after is enabled dont load slow - loadTotalSlowStats(%file,%dtStats,%game); - else{ - while( !%file.isEOF() ){ - %line = strreplace(%file.readline(),"%t","\t"); - %var = getField(%line,0); - if(%var !$= "playerName" && %var !$= "versionNum"){ - %d0 = getField(%line,1);%d1 = getField(%line,2); - %w0 = getField(%line,3);%w1 = getField(%line,4); - %m0 = getField(%line,5);%m1 = getField(%line,6); - %q0 = getField(%line,7);%q1 = getField(%line,8); - %y0 = getField(%line,9);%y1 = getField(%line,10); + while( !%file.isEOF() ){ + %line = strreplace(%file.readline(),"%t","\t"); + %var = getField(%line,0); + if(%var !$= "playerName" && %var !$= "versionNum"){ + %d0 = getField(%line,1);%d1 = getField(%line,2); + %w0 = getField(%line,3);%w1 = getField(%line,4); + %m0 = getField(%line,5);%m1 = getField(%line,6); + %q0 = getField(%line,7);%q1 = getField(%line,8); + %y0 = getField(%line,9);%y1 = getField(%line,10); - if(%day){ %d0 = %d1; %d1 = 0;} //if there was a change flip new with old and reset new - if(%week){%w0 = %w1;%w1 = 0;} - if(%month){%m0 = %m1;%m1 = 0;} - if(%quarter){%q0 = %q1;%q1 = 0;} - if(%year){ %y0 = %y1;%y1 = 0;} + if(%day){ %d0 = %d1; %d1 = 0;} //if there was a change flip new with old and reset new + if(%week){%w0 = %w1;%w1 = 0;} + if(%month){%m0 = %m1;%m1 = 0;} + if(%quarter){%q0 = %q1;%q1 = 0;} + if(%year){ %y0 = %y1;%y1 = 0;} - %dtStats.gameStats[%var,"t",%game] = %d0 TAB %d1 TAB %w0 TAB %w1 TAB %m0 TAB %m1 TAB %q0 TAB %q1 TAB %y0 TAB %y1; - - } + %dtStats.gameStats[%var,"t",%game] = %d0 TAB %d1 TAB %w0 TAB %w1 TAB %m0 TAB %m1 TAB %q0 TAB %q1 TAB %y0 TAB %y1; } - %file.close(); - %file.delete(); } + %file.close(); + %file.delete(); } else// must be new person so be sure to set the dates %dtStats.gameStats["dwmqy","t",%game] = %d TAB %d TAB %w TAB %w TAB %m TAB %m TAB %q TAB %q TAB %y TAB %y; @@ -4859,12 +4899,8 @@ function incGameStats(%dtStats,%game) {// record that games stats and inc by one %mapVal = getField(%dtStats.mapStats[getMapIDName(%game),%game],%varID); else %mapVal = 0; - if(%val < %mapVal && %val != 0 || !%mapVal){ - setValueField(%dtStats,getMapIDName(%game),"m",%game,%varID,%val); - } - else{ - setValueField(%dtStats,getMapIDName(%game),"m",%game,%varID,%mapVal); - } + if(%val < %mapVal && %val != 0 || !%mapVal){ setValueField(%dtStats,getMapIDName(%game),"m",%game,%varID,%val);} + else{ setValueField(%dtStats,getMapIDName(%game),"m",%game,%varID,%mapVal);} setValueField(%dtStats,"varName","m",%game,%varID,%varNameType); } for(%x = 1; %x <= 9; %x+=2){ @@ -5136,8 +5172,9 @@ function hasValue(%val){//make sure we have at least something in the field spot function bakGameStats(%client,%game) {//back up clients current stats in case they come back if($dtStats::debugEchos){error("bakGameStats GUID = " SPC %client.guid);} %dtStats = %client.dtStats; - %dtStats.team = (%client.team > 0) ? %client.team : %client.lastTeam; - + %dtStats.dtTeam = %client.team; + updateTeamTime(%client.dtStats, %dtStats.team); + armorTimer(%dtStats, 0, 1); for(%v = 0; %v < $dtStats::varTypeCount; %v++){ %varType = $dtStats::varType[%v]; for(%i = 1; %i <= $dtStats::FCG[%game,%varType]; %i++){ @@ -5286,6 +5323,27 @@ function armorTimer(%dtStats, %size, %death){ } //error(%dtStats.lArmorTime SPC %dtStats.mArmorTime SPC %dtStats.hArmorTime); } +function updateTeamTime(%dtStats,%team){ + if(Game.numTeams > 1){ + %time = getSimTime() - %dtStats.teamTime; + if(%team == 1){ + %dtStats.timeOnTeamOne += (%time/1000)/60; + %dtStats.teamTime = getSimTime(); + } + else if(%team == 2){ + %dtStats.timeOnTeamTwo += (%time/1000)/60; + %dtStats.teamTime = getSimTime(); + } + else if(%team == 0){ + %dtStats.timeOnTeamZero += (%time/1000)/60; + %dtStats.teamTime = getSimTime(); + } + else{ + %dtStats.teamTime = getSimTime(); + } + } + //error(%team SPC %dtStats.timeOnTeamZero SPC %dtStats.timeOnTeamOne SPC %dtStats.timeOnTeamTwo); +} function deadDist(%pos,%pl){ if(isObject(%pl)){ %dist = vectorDist(getWords(%pos,0,1) SPC 0, getWords(%pl.getPosition(),0,1) SPC 0); // 2d distance @@ -5781,12 +5839,7 @@ function rayTestDis(%targetObject){ else return 0; } -function vectorRayCast(%startPos,%vec,%dis){ - %mask = $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::PlayerObjectType; - %endPos = VectorAdd(%startPos, VectorScale(VectorNormalize(%vec), %dis)); - %result = containerRayCast(%startPos, %endPos, %mask, %proj); - return %result; -} + function testHit(%client){ if(isObject(%client)){ %field = %client.lastExp; @@ -5794,9 +5847,9 @@ function testHit(%client){ if(%data.hasDamageRadius){ %mask = $TypeMasks::PlayerObjectType; %vec = vectorNormalize(vectorSub(%ePos,%sPos));// some how this vector works - %ray = containerRayCast(%ePos, VectorAdd(%ePos, VectorScale(VectorNormalize(%vec), 5)), %mask, -1); + %ray = containerRayCast(%ePos, VectorAdd(%ePos, VectorScale(VectorNormalize(%vec), 5)), %mask, %client.player); if(%ray){ - %dmgType = %data.radiusDamageType; + //%dmgType = %data.radiusDamageType; //error(%dmgType); return 1; } @@ -5818,7 +5871,7 @@ function clientDmgStats(%data, %position, %sourceObject, %targetObject, %damageT if(rayTest(%targetObject, $dtStats::midAirHeight) && %damageType == $DamageType::Lightning) %sourceClient.dtStats.lightningMAEVHits++; else - %sourceDT.EVMAHit++; + %sourceClient.dtStats.EVMAHit++; } return; } @@ -11683,7 +11736,9 @@ function sortLStats(%c,%game,%lType){ %maxCount = %i; for (%j = %i+1; %j < %statsCount; %j++){ if(%cat $= "AvgI"){ - if (getField(strreplace(serverStats.getObject(%j).LStats[%var,%game],"%a","\t"),0) < getField(strreplace(serverStats.getObject(%maxCount).LStats[%var,%game],"%a","\t"),0)) + %aVal = getField(strreplace(serverStats.getObject(%j).LStats[%var,%game],"%a","\t"),2) >= $dtStats::minTotal ? getField(strreplace(serverStats.getObject(%j).LStats[%var,%game],"%a","\t"),0) : 0; + %bVal = getField(strreplace(serverStats.getObject(%maxCount).LStats[%var,%game],"%a","\t"),2) >= $dtStats::minTotal ? getField(strreplace(serverStats.getObject(%maxCount).LStats[%var,%game],"%a","\t"),0) : 0; + if (%aVal < %bVal) %maxCount = %j; } else{ @@ -11694,7 +11749,7 @@ function sortLStats(%c,%game,%lType){ %obj = serverStats.getObject(%maxCount); serverStats.bringToFront(%obj);// push the ones we have sorted to the front so we dont pass over them again if(%cat $= "AvgI") - %num = getField(strreplace(%obj.LStats[%var,%game],"%a","\t"),0); + %num = getField(strreplace(%obj.LStats[%var,%game],"%a","\t"),2) >= $dtStats::minTotal ? getField(strreplace(%obj.LStats[%var,%game],"%a","\t"),0) : 0; else %num = %obj.LStats[%var,%game]; if(%num != 0){ @@ -11719,7 +11774,9 @@ function sortLStats(%c,%game,%lType){ %maxCount = %i; for (%j = %i+1; %j < %statsCount; %j++){ if(%cat $= "Avg"){ - if (getField(strreplace(serverStats.getObject(%j).LStats[%var,%game],"%a","\t"),0) > getField(strreplace(serverStats.getObject(%maxCount).LStats[%var,%game],"%a","\t"),0)) + %aVal = getField(strreplace(serverStats.getObject(%j).LStats[%var,%game],"%a","\t"),2) >= $dtStats::minTotal ? getField(strreplace(serverStats.getObject(%j).LStats[%var,%game],"%a","\t"),0) : 0; + %bVal = getField(strreplace(serverStats.getObject(%maxCount).LStats[%var,%game],"%a","\t"),2) >= $dtStats::minTotal ? getField(strreplace(serverStats.getObject(%maxCount).LStats[%var,%game],"%a","\t"),0) : 0; + if (%aVal > %bVal) %maxCount = %j; } else{ @@ -11730,7 +11787,7 @@ function sortLStats(%c,%game,%lType){ %obj = serverStats.getObject(%maxCount); serverStats.bringToFront(%obj);// push the ones we have sorted to the front so we dont pass over them again if(%cat $= "Avg") - %num = getField(strreplace(%obj.LStats[%var,%game],"%a","\t"),0); + %num = getField(strreplace(%obj.LStats[%var,%game],"%a","\t"),2) >= $dtStats::minTotal ? getField(strreplace(%obj.LStats[%var,%game],"%a","\t"),0) : 0; else %num = %obj.LStats[%var,%game]; @@ -11817,7 +11874,7 @@ function loadMapLeaderBoards(%reset){ else{ if($dtStats::lsmMap){ if($dtStats::debugEchos){error("Deleting old file" SPC %filepath);} - schedule((%i+1) * 500,0,"deleteFile",%filepath); + schedule((%i+1) * 256,0,"deleteFile",%filepath); } } } @@ -11880,7 +11937,7 @@ function loadLeaderboards(%reset){ // loads up leaderboards else{// not valid any more delete; if($dtStats::lsm){ if($dtStats::debugEchos){error("Deleting old file" SPC %filepath);} - schedule((%i+1) * 1000,0,"deleteFile",%filepath); + schedule((%i+1) * 256,0,"deleteFile",%filepath); } else{ %oldFileCount++; @@ -11954,17 +12011,17 @@ function dtCleanUp(%force){ if($dtStats::sm || %force){ if($dtStats::debugEchos){error("Deleting old file" SPC %dayCount SPC %extraDays SPC %filepath);} if(isFile(%filepath)){ - schedule(%v++ * 500,0,"deleteFile",%filepath); + schedule(%v++ * 256,0,"deleteFile",%filepath); %oldFileCount++; } %mPath = strreplace(%filepath,"t.cs","m.cs"); if(isFile(%mPath)){ - schedule(%v++ * 500,0,"deleteFile",%mPath); + schedule(%v++ * 256,0,"deleteFile",%mPath); %oldFileCount++; } %gPath = strreplace(%filepath,"t.cs","g.cs"); if(isFile(%gPath)){ - schedule(%v++ * 500,0,"deleteFile",%gPath); + schedule(%v++ * 256,0,"deleteFile",%gPath); %oldFileCount++; } } @@ -12331,6 +12388,8 @@ function sortMapStats(%varIndex,%game,%lType,%mapIndex){ %obj1 = serverMapStats.getObject(%j); %obj2 = serverMapStats.getObject(%maxCount); if(getField(%obj1.varList,%varIndex) $= getField(%obj2.varList,%varIndex)){//make sure the var matches up in case of change if(%cat $= "AvgI"){ + //%avgCount = getField(strreplace(getField(%obj1.mapStats[%mapNameID],%varIndex),"%a","\t"),2); + //%avgCountM = getField(strreplace(getField(%obj2.mapStats[%mapNameID],%varIndex),"%a","\t"),2); if (getField(strreplace(getField(%obj1.mapStats[%mapNameID],%varIndex),"%a","\t"),0) < getField(strreplace(getField(%obj2.mapStats[%mapNameID],%varIndex),"%a","\t"),0)) %maxCount = %j; } @@ -12370,7 +12429,9 @@ function sortMapStats(%varIndex,%game,%lType,%mapIndex){ %obj1 = serverMapStats.getObject(%j); %obj2 = serverMapStats.getObject(%maxCount); if(getField(%obj1.varList,%varIndex) $= getField(%obj2.varList,%varIndex)){ if(%cat $= "Avg"){ - if (getField(strreplace(getField(%obj1.mapStats[%mapNameID],%varIndex),"%a","\t"),0) > getField(strreplace(getField(%obj2.mapStats[%mapNameID],%varIndex),"%a","\t"),0)) + //%avgCount = getField(strreplace(getField(%obj1.mapStats[%mapNameID],%varIndex),"%a","\t"),2); + //%avgCountM = getField(strreplace(getField(%obj2.mapStats[%mapNameID],%varIndex),"%a","\t"),2); + if(getField(strreplace(getField(%obj1.mapStats[%mapNameID],%varIndex),"%a","\t"),0) > getField(strreplace(getField(%obj2.mapStats[%mapNameID],%varIndex),"%a","\t"),0)) %maxCount = %j; } else{ @@ -12585,7 +12646,7 @@ function startMonitor(){ } } -function dtSaveServerVars(){ +function dtSaveServerVars(){ $dtServerVars::lastSimTime = getSimTime(); $dtServerVars::lastDate = formattimestring("mm/dd/yy hh:nn:a"); $dtServerVars::lastMission = cleanMapName($CurrentMission); @@ -12608,8 +12669,12 @@ function dtLoadServerVars(){// keep function at the bottom if($dtStats::Enable){ if(!statsGroup.serverStart){ statsGroup.serverStart = 1; + $dtStats::teamOneCapTimes = 0; + $dtStats::teamTwoCapTimes = 0; + $dtStats::teamOneCapCount = 0; + $dtStats::teamTwoCapCount = 0; $dtServerVars::upTimeCount = -1; - %crash = 0; + if(isFile("serverStats/serverVars.cs")){ exec("serverStats/serverVars.cs"); %date = $dtServerVars::lastDate; @@ -12617,11 +12682,10 @@ function dtLoadServerVars(){// keep function at the bottom %mis = $dtServerVars::lastMission; if($dtStats::debugEchos){schedule(6000,0,"error","last server uptime = " SPC %date @ "-" @ %upTime @ "-" @ %mis);} $dtServerVars::upTime[$dtServerVars::upTimeCount++] = %date @ "-" @ %upTime @ "-" @ %mis; - if($dtServerVars::lastPlayerCount > 1){ + if($dtServerVars::lastPlayerCount > 3){ $dtServerVars::serverCrash[%mis, $dtServerVars::lastGameType]++; - $dtServerVars::crashLog[$dtServerVars::crashLogCount++] =%date @ "-" @ %upTime @ "-" @ %mis @ "-" @ $dtServerVars::lastGameType @ "-" @ $dtServerVars::lastPlayerCount; - $dtServerVars::lastPlayerCount = 0; - %crash = 1; + $dtServerVars::crashLog[$dtServerVars::crashLogCount++] = %date @ "-" @ %upTime @ "-" @ %mis @ "-" @ $dtServerVars::lastGameType @ "-" @ $dtServerVars::lastPlayerCount; + schedule(15000,0,"dtEventLog","Server Crash" SPC %date SPC "Pl Count =" SPC $dtServerVars::lastPlayerCount SPC "Map =" SPC %mis SPC "Up Time =" SPC %upTime, 0); } } if($dtServerVars::upTimeCount >= 30) @@ -12629,6 +12693,7 @@ function dtLoadServerVars(){// keep function at the bottom if($dtServerVars::crashLogCount >= 15) $dtServerVars::crashLogCount = 0; + $dtServerVars::lastPlayerCount = 0; $dtServerVars::lastSimTime = getSimTime(); $dtServerVars::lastDate = formattimestring("mm/dd/yy hh:nn:a"); export( "$dtServerVars::*", "serverStats/serverVars.cs", false ); @@ -12653,8 +12718,6 @@ function dtLoadServerVars(){// keep function at the bottom $dtServer::eventLogCount = -1; //if(isFile("serverStats/eventLog.cs")) //exec("serverStats/eventLog.cs"); - if(%crash) - dtEventLog("Server Crash" SPC %date SPC "Plr Count =" SPC $dtServerVars::lastPlayerCount SPC "Map =" SPC $dtServerVars::lastMission, 0); dtEventLog("Server Start" SPC formattimestring("hh:nn:a mm-dd-yy"), 0); @@ -12903,3 +12966,32 @@ function testVarsRandomAll(%max){ // Removed arbitrary weapon scores replaced with total kills // Added map name to server hang in case its a map issue we need to keep an eye on // 200+ server warning now only echos to console +// +// 8.9 +// New stats to track time spent on teams and game length +// Sorter now looks at avg count and rejects low counts for better leaderboard avgs +// Misc Stat fixes +// Speed up file delete time +// Removed loadslow in favor for loadafter, less edge cases +// +// 9.0 +// Misc Stat Fixes +// Reverted team changes and removed some of the inconsistencies with team tracking +// Added flag capture times +// Capped gamepct do to timeing/score it can go over 100 +// Added startPCt and endPct for game progress info +// Added clientQuit to make filtering easier +// Some code cleanup +// +// 9.1 +// Stat fixes +// - made cap timers global instead of client... oops +// - fixed endPCt/leftPCT +// +// 9.2 +// Added a delay for server crash to be able to report it to the bot on server start +// Fix Cap timers a 3rd time +// Server crash messsage fix +// +// 9.3 +// Stat format change for flag cap times, they now start at 0 \ No newline at end of file diff --git a/Classic/scripts/autoexec/zDebriefLoadingScreen.cs b/Classic/scripts/autoexec/zDebriefLoadingScreen.cs old mode 100644 new mode 100755 index ea903fd..6b4e758 --- a/Classic/scripts/autoexec/zDebriefLoadingScreen.cs +++ b/Classic/scripts/autoexec/zDebriefLoadingScreen.cs @@ -33,11 +33,11 @@ // $Host::LoadScreenLine1 = "Join Discord:"; // $Host::LoadScreenLine1_Msg = "https://discord.me/tribes2"; // $Host::LoadScreenLine2 = "Game Modes:"; -// $Host::LoadScreenLine2_Msg = "LakRabbit, Capture the Flag, DeathMatch, (Light Only) Capture the Flag"; +// $Host::LoadScreenLine2_Msg = "LakRabbit, Capture the Flag, DeathMatch, (Light Only) Capture the Flag"; // $Host::LoadScreenLine3 = "Required Mappacks:"; // $Host::LoadScreenLine3_Msg = "S5, S8, TWL, TWL2"; // $Host::LoadScreenLine4 = "Server Provided by:"; -// $Host::LoadScreenLine4_Msg = "Ravin"; +// $Host::LoadScreenLine4_Msg = "Ravin"; // $Host::LoadScreenLine5 = "Server Hosted by:"; // $Host::LoadScreenLine5_Msg = "Branzone"; // $Host::LoadScreenLine6 = "Server Github:"; @@ -51,7 +51,7 @@ // First Screen loading time (Map Screen) // If this is set too low the second screen wont show at all -$dtLoadingScreen::FirstScreen = 6000; +$dtLoadingScreen::FirstScreen = 5500; // Second Screen Delay $dtLoadingScreen::Delay = 0; @@ -75,7 +75,7 @@ if( $Host::LoadScreenColor3 $= " " ) $Host::LoadScreenColor3 = "33CCCC"; // So ServerDefaults wont replace a "" value when meant to be blank function DLSBlank() { - for(%x = 1; %x <= 4; %x++) + for(%x = 1; %x <= 4; %x++) { if( $Host::LoadScreenMOTD[%x] $= "") { @@ -88,7 +88,7 @@ DLSBlank(); // Keep it in a package to be neat and organized! package LoadScreenPackage { - function sendLoadInfoToClient( %client ) + function sendLoadInfoToClient( %client ) { //error( "** SENDING LOAD INFO TO CLIENT " @ %client @ "! **" ); %singlePlayer = $CurrentMissionType $= "SinglePlayer"; @@ -149,7 +149,7 @@ if (!isActivePackage(LoadScreenPackage) && $Host::LoadingScreenUseDebrief) // Dont even try to override sendModInfoToClient since evo has it // Just make our own function ALTsendModInfoToClient(%client) -{ +{ // Wont allow Debrief on consecutive map loads if(%client.loaded) { @@ -160,7 +160,7 @@ function ALTsendModInfoToClient(%client) // Sound // As the background hum will stop on the debrief page // Breaks the abrupt stop - // LoadingScreen sounds are limited to 5 secs or you'll receive an error + // LoadingScreen sounds are limited to 5 secs or you'll receive an error %snd = '~wgui/inventory_hum.wav'; messageClient(%client, 'MsgLoadQuoteLine', %snd, ""); @@ -169,10 +169,10 @@ function ALTsendModInfoToClient(%client) %line3 = "" @ $Host::LoadScreenLine3 @ " " @ $Host::LoadScreenLine3_Msg; %line4 = "" @ $Host::LoadScreenLine4 @ " " @ $Host::LoadScreenLine4_Msg; %line5 = "" @ $Host::LoadScreenLine5 @ " " @ $Host::LoadScreenLine5_Msg; - %line6 = "" @ $Host::LoadScreenLine6 @ " " @ $Host::LoadScreenLine6_Msg; + %line6 = "" @ $Host::LoadScreenLine6 @ " " @ $Host::LoadScreenLine6_Msg; if($Host::TimeLimit $= "999" || $Host::TimeLimit $= "unlimited") %timeloadingvar = "Unlimited"; else %timeloadingvar = $Host::TimeLimit; - + if($Host::KickObserverTimeout $= 0) %obskickvar = "Off"; else %obskickvar = ($Host::KickObserverTimeout / 60) @ " Minutes"; %time = "Time limit: " @ %timeloadingvar; @@ -201,13 +201,13 @@ function ALTsendModInfoToClient(%client) $dmlP = 0; - + $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; // Images // Desired pics much exist in the texticons folder on the client in some capacity //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - + if($dtLoadingScreen::ShowImages) { $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; @@ -218,13 +218,13 @@ function ALTsendModInfoToClient(%client) $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; case 2: $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; - case 3: + case 3: $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; - case 4: + case 4: $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; } //$dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; - + $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; @@ -240,7 +240,7 @@ function ALTsendModInfoToClient(%client) if(%client.dmpVersion $=$DMP::Version) { $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; - + $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; @@ -322,7 +322,7 @@ function ALTsendModInfoToClient(%client) //$dtLoadingScreen::LoadScreenMessage[$dmlP++] = "*" @ $Host::GameName; //$dtLoadingScreen::LoadScreenMessage[$dmlP++] = "" @ $Host::Info; - //$dtLoadingScreen::LoadScreenMessage[$dmlP++] = "Map Info:"; + //$dtLoadingScreen::LoadScreenMessage[$dmlP++] = "Map Info:"; //$dtLoadingScreen::LoadScreenMessage[$dmlP++] = %currentmis; schedule($dtLoadingScreen::Delay, 0, "sendLoadscreen", %client); @@ -351,17 +351,17 @@ function sendLoadscreen(%client) { %msgTag = $dtLoadingScreen::LoadScreenMessage[%a]; messageClient(%client, 'MsgDebriefAddLine', "", %msgTag); - } + } %MOTDHeader = "Events:"; %MOTDMsg1 = "" @ $Host::LoadScreenMOTD1; %MOTDMsg2 = "" @ $Host::LoadScreenMOTD2; %MOTDMsg3 = "" @ $Host::LoadScreenMOTD3; %MOTDMsg4 = "" @ $Host::LoadScreenMOTD4; - + //MOTD Loop //Leave line " " in ServerPrefs to not show a line - for(%x = 1; %x <= 4; %x++) + for(%x = 1; %x <= 4; %x++) { if($Host::LoadScreenMOTD[%x] !$= " " && $Host::LoadScreenMOTD[%x] !$= "") { @@ -375,7 +375,7 @@ function sendLoadscreen(%client) messageClient(%client, 'MsgDebriefAddLine', "", %MOTDMsg[%x]); } } - + // Normal Screen Always in the Background // If client hits continue during debrief screen sendLoadInfoToClient(%client); @@ -383,7 +383,7 @@ function sendLoadscreen(%client) // Show normal second screen during following map loads function NORMALsendModInfoToClient(%client) -{ +{ %line1 = "" @ $Host::LoadScreenLine1 @ " " @ $Host::LoadScreenLine1_Msg; %line2 = "" @ $Host::LoadScreenLine2 @ " " @ $Host::LoadScreenLine2_Msg; %line3 = "" @ $Host::LoadScreenLine3 @ " " @ $Host::LoadScreenLine3_Msg; @@ -397,7 +397,7 @@ function NORMALsendModInfoToClient(%client) %max = "Max players: " @ $Host::MaxPlayers; %net = "Packets Rate / Size: " @ $pref::Net::PacketRateToClient @ " / " @ $pref::Net::PacketSize; %smurf = "Refuse smurfs: " @ ($Host::NoSmurfs ? "On" : "Off"); - + //%random = "Random teams: " @ ($RandomTeams ? "On" : "Off"); //%fair = "Fair teams: " @ ($Host::ClassicFairTeams ? "On" : "Off"); //%rape = "No Base Rape: " @ ($Host::EvoNoBaseRapeEnabled ? "On" : "Off"); @@ -492,4 +492,4 @@ function NORMALsendModInfoToClient(%client) messageClient(%client, 'MsgLoadRulesLine', "", %ServerTextLine[%line], !%singlePlayer); messageClient(%client, 'MsgLoadInfoDone'); -} \ No newline at end of file +} diff --git a/Classic/scripts/autoexec/zzDiscordBot.cs b/Classic/scripts/autoexec/zzDiscordBot.cs old mode 100755 new mode 100644 index 6bcb4c6..dd1a356 --- a/Classic/scripts/autoexec/zzDiscordBot.cs +++ b/Classic/scripts/autoexec/zzDiscordBot.cs @@ -4,7 +4,7 @@ //exec("scripts/autoexec/zzDiscordBot.cs"); -//note first channel is for monitoring +//note first channel is for monitoring $discordBot::discordCHID = ""; $discordBot::IP = ""; $discordBot::reconnectTimeout = 3 * 60000; @@ -32,21 +32,21 @@ function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8 %type = getTaggedString(%msgType); switch$(%type) { - case "msgExplosionKill" or "msgSuicide" or "msgVehicleSpawnKill" or "msgVehicleCrash" or "msgVehicleKill" or "msgTurretSelfKill" or "msgTurretSelfKill" or "msgCTurretKill" or "msgTurretKill" or + case "msgExplosionKill" or "msgSuicide" or "msgVehicleSpawnKill" or "msgVehicleCrash" or "msgVehicleKill" or "msgTurretSelfKill" or "msgTurretSelfKill" or "msgCTurretKill" or "msgTurretKill" or "msgSelfKill" or "msgOOBKill" or "msgCampKill" or "msgTeamKill" or "msgLavaKill" or "msgLightningKill" or "MsgRogueMineKill" or "MsgHeadshotKill" or "MsgRearshotKill" or "MsgLegitKill" or - "MsgClientJoin" or "MsgClientDrop": + "MsgClientJoin" or "MsgClientDrop": %message = getTaggedString(%msgString); - %message = strreplace(%message,"%1",getTaggedString(%a1)); - %message = strreplace(%message,"%2",getTaggedString(%a2)); - %message = strreplace(%message,"%3",getTaggedString(%a3)); - %message = strreplace(%message,"%4",getTaggedString(%a4)); - %message = strreplace(%message,"%5",getTaggedString(%a5)); - %message = strreplace(%message,"%6",getTaggedString(%a6)); - %message = strreplace(%message,"%7",getTaggedString(%a7)); - %message = strreplace(%message,"%8",getTaggedString(%a8)); + %message = strreplace(%message,"%1",getTaggedString(%a1)); + %message = strreplace(%message,"%2",getTaggedString(%a2)); + %message = strreplace(%message,"%3",getTaggedString(%a3)); + %message = strreplace(%message,"%4",getTaggedString(%a4)); + %message = strreplace(%message,"%5",getTaggedString(%a5)); + %message = strreplace(%message,"%6",getTaggedString(%a6)); + %message = strreplace(%message,"%7",getTaggedString(%a7)); + %message = strreplace(%message,"%8",getTaggedString(%a8)); %message = stripChars(%message, "\cp\co\c0\c6\c7\c8\c9"); sendToDiscordEmote(%message, $discordBot::serverFeed); - } + } if($missionName !$= $discordBot::cm && ClientGroup.getCount() > 2){ sendToDiscordEmote("The mission changed to" SPC $missionName, $discordBot::serverFeed); $discordBot::cm = $missionName; @@ -139,11 +139,11 @@ function LogMessage(%client, %msg, %cat){ if(!isActivePackage(discordPackage)) activatePackage(discordPackage); - + function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6) { //echo(%type SPC %var1 SPC %var2 SPC %var3 SPC %var4 SPC %var5 SPC %var6); - + switch$ (%type) { case "flagCap": @@ -162,7 +162,7 @@ function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6) if(%flag.isHome) %msg = getTaggedString(%player.client.name) SPC "took the" SPC getTaggedString(%game.getTeamName(%flag.team)) SPC "flag. (Speed:" SPC %grabspeed @ "Kph)"; else if(!%flag.isHome) - %msg = getTaggedString(%player.client.name) SPC "took the" SPC getTaggedString(%game.getTeamName(%flag.team)) SPC "flag in the field. (Speed:" SPC %grabspeed @ "Kph)"; + %msg = getTaggedString(%player.client.name) SPC "took the" SPC getTaggedString(%game.getTeamName(%flag.team)) SPC "flag in the field. (Speed:" SPC %grabspeed @ "Kph)"; } case "droppedFlag": %game = %var1; @@ -187,16 +187,16 @@ function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6) case "lakMApoints": %sourceObject = %var1; %points = %var2; - if(%points == 1) + if(%points !$=1) %s = "s"; %hitType = %var3; %weapon = %var4; %distance = %var5; %vel = %var6; 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 !$= "") { %msg = stripChars(%msg, "\cp\co\c0\c6\c7\c8\c9"); @@ -223,20 +223,20 @@ function sendToDiscordEmote(%msg,%channel)//emote filter will be applyed used in } } } -function discordCon(){ +function discordCon(){ if(discord.lastState !$= "Connected"){ if(isEventPending($discordBot::reconnectEvent)) cancel($discordBot::reconnectEvent); if(isObject(discord)) discord.delete(); - new TCPObject(discord); + new TCPObject(discord); discord.lastState = "Connecting"; - discord.connect($discordBot::IP); + discord.connect($discordBot::IP); } } function discordKill(){ if(isEventPending($discordBot::reconnectEvent)) - cancel($discordBot::reconnectEvent); + cancel($discordBot::reconnectEvent); discord.delete(); } @@ -279,7 +279,7 @@ function discord::onLine(%this, %line){ %cmd = getWord(%lineStrip,0); switch$(%cmd){ //case "Discord": - //messageAll( 'MsgDiscord', '\c3Discord: \c4%1 %2',getWord(%lineStrip,1),getWords(%lineStrip,2,getWordCount(%lineStrip) -1)); + //messageAll( 'MsgDiscord', '\c3Discord: \c4%1 %2',getWord(%lineStrip,1),getWords(%lineStrip,2,getWordCount(%lineStrip) -1)); case "PING": discord.send("PONG" @ $discordBot::cmdSplit @ "\r\n"); case "PINGAVG": @@ -287,20 +287,20 @@ function discord::onLine(%this, %line){ %max = -10000; %lowCount = %lowPing = 0; for(%i = 0; %i < ClientGroup.getCount(); %i++){ - %cl = ClientGroup.getObject(%i); - %ping = %cl.isAIControlled() ? 0 : %cl.getPing(); + %cl = ClientGroup.getObject(%i); + %ping = %cl.isAIControlled() ? 0 : %cl.getPing(); %min = (%ping < %min) ? %ping : %min; %max = (%ping > %max) ? %ping : %max; if(%ping < 250){ %lowCount++; - %lowPing += %ping; + %lowPing += %ping; } %pc++; - %pingT += %ping; + %pingT += %ping; } %lowCount = (%lowCount == 0) ? 1 : %lowCount; if(!%pc){ - sendToDiscord("Ping AVG:" @ 0 SPC "Low Avg:" @ 0 SPC "Min:" @ 0 SPC "Max:" @ 0, $discordBot::monitorChannel); + sendToDiscord("Ping AVG:" @ 0 SPC "Low Avg:" @ 0 SPC "Min:" @ 0 SPC "Max:" @ 0, $discordBot::monitorChannel); } else{ %avg = mFloor(%pingT/%pc); @@ -312,8 +312,8 @@ function discord::onLine(%this, %line){ %channel = 1; if(ClientGroup.getCount() > 0){ for(%i = 0; %i < ClientGroup.getCount(); %i++){ - %cl = ClientGroup.getObject(%i); - %ping = %cl.isAIControlled() ? 0 : %cl.getPing(); + %cl = ClientGroup.getObject(%i); + %ping = %cl.isAIControlled() ? 0 : %cl.getPing(); %msg = %cl.namebase @ $discordBot::cmdSubSplit @ %ping @ $discordBot::cmdSubSplit @ %i; discord.schedule(%i*32,"send","MSGSTACK" @ $discordBot::cmdSplit @ (%channel-1) @ $discordBot::cmdSplit @ %msg @ "\r\n"); } @@ -325,4 +325,4 @@ function discord::onLine(%this, %line){ } } if(!isObject(discord) && $discordBot::autoStart) - discordCon(); \ No newline at end of file + discordCon(); diff --git a/Classic/scripts/dtChatCmdGame.cs b/Classic/scripts/dtChatCmdGame.cs old mode 100644 new mode 100755 index 3f3e5eb..f910076 --- a/Classic/scripts/dtChatCmdGame.cs +++ b/Classic/scripts/dtChatCmdGame.cs @@ -13,7 +13,7 @@ function chatMessageAll(%sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, chatCmd(%sender,%a2,0); return; } - + parent::chatMessageAll(%sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); } @@ -28,8 +28,8 @@ if (!isActivePackage(dtChatCmd)) function chatCmd(%client, %message) //%client is sender { %command = strlwr(trim(getWord(%message, 0)));// strip command trim and make it lower case - - switch$(%command) + + switch$(%command) { case "/help": if(%client.isSuperAdmin) @@ -39,8 +39,8 @@ function chatCmd(%client, %message) //%client is sender messageClient(%client, 'msgChatCmd', '\c2/snowsky - changes the sky to a snow sky.'); messageClient(%client, 'msgChatCmd', '\c2/firesky - changes the sky to a fire sky.'); messageClient(%client, 'msgChatCmd', '\c2/rainsky - changes the sky to a rain sky.'); - messageClient(%client, 'msgChatCmd', '\c2/sandsky - changes the sky to a sand sky.'); - messageClient(%client, 'msgChatCmd', '\c2/nicesky - changes the sky to a variation of four nice skies.'); + messageClient(%client, 'msgChatCmd', '\c2/sandsky - changes the sky to a sand sky.'); + messageClient(%client, 'msgChatCmd', '\c2/nicesky - changes the sky to a variation of four nice skies.'); messageClient(%client, 'msgChatCmd', '\c2/normalsky - changes the sky to a fallback sky.'); messageClient(%client, 'msgChatCmd', '\c2/spookysky - changes the sky to a halloween sky.'); messageClient(%client, 'msgChatCmd', '\c2/fireworks - look at some fireworks.'); @@ -49,20 +49,20 @@ function chatCmd(%client, %message) //%client is sender } else if(%client.isAdmin) { - messageClient(%client, 'msgChatCmd', '\c2/snowsky - changes the sky to a snow sky.'); + messageClient(%client, 'msgChatCmd', '\c2/snowsky - changes the sky to a snow sky.'); messageClient(%client, 'msgChatCmd', '\c2/firesky - changes the sky to a fire sky.'); messageClient(%client, 'msgChatCmd', '\c2/rainsky - changes the sky to a rain sky.'); messageClient(%client, 'msgChatCmd', '\c2/sandsky - changes the sky to a sand sky.'); - messageClient(%client, 'msgChatCmd', '\c2/nicesky - changes the sky to a variation of four nice skies.'); + messageClient(%client, 'msgChatCmd', '\c2/nicesky - changes the sky to a variation of four nice skies.'); messageClient(%client, 'msgChatCmd', '\c2/normalsky - changes the sky to a fallback sky.'); messageClient(%client, 'msgChatCmd', '\c2/spookysky - changes the sky to a halloween sky.'); messageClient(%client, 'msgChatCmd', '\c2/fireworks - look at some fireworks.'); messageClient(%client, 'msgChatCmd', '\c2/AIQ 1 or 0 - to enable tor disable ai chat.'); - messageClient(%client, 'msgChatCmd', '\c2/idInfo - get id resources.'); + messageClient(%client, 'msgChatCmd', '\c2/idInfo - get id resources.'); } messageClient(%client, 'msgChatCmd', '\c2/report "message" - report a problem for server owner.'); messageClient(%client, 'msgChatCmd', '\c2/msg "message" - leave the server owner a message.'); - + case "/summon": if(%client.isSuperAdmin) { @@ -72,7 +72,7 @@ function chatCmd(%client, %message) //%client is sender %obj.setTransform(%pos SPC getWords(%obj.getTransform(), 3, 6)); %obj.setVelocity("0 0 1");// stop them incase they are going over 9000 } - + case "/warpto": if(%client.isSuperAdmin) { @@ -81,42 +81,42 @@ function chatCmd(%client, %message) //%client is sender %obj = %client.player; %obj.setTransform(%pos SPC getWords(%obj.getTransform(), 3, 6)); } - + case "/fireworks": if(%client.isAdmin || %client.isSuperAdmin ) { fireworksSky(1);// only one sky for right now $CurrentSky = "fireworks"; } - + case "/normalsky": if(%client.isAdmin || %client.isSuperAdmin ) { normalSky(1);// only one sky for right now $CurrentSky = "normal"; } - + case "/firesky": if(%client.isAdmin || %client.isSuperAdmin ) { fireSky(1);// only one sky for right now $CurrentSky = "fire"; } - + case "/rainsky": if(%client.isAdmin || %client.isSuperAdmin ) { rainSky(1);// only one sky for right now $CurrentSky = "rain"; } - + case "/snowsky": if(%client.isAdmin || %client.isSuperAdmin ) { snowSky(1);// only one sky for right now $CurrentSky = "snow"; - } - + } + case "/sandsky": if(%client.isAdmin || %client.isSuperAdmin ) { @@ -129,15 +129,15 @@ function chatCmd(%client, %message) //%client is sender niceSky(1);// only one sky for right now $CurrentSky = "nice"; } - + case "/report": LogMessage(%client, %message, "report"); messageClient(%client, 'msgChatCmd', 'Your report has been received.'); - + case "/msg": LogMessage(%client, %message, "message"); messageClient(%client, 'msgChatCmd', 'Your message has been received.'); - + case "/idInfo": if(%client.isSuperAdmin || %client.isAdmin) { @@ -145,21 +145,21 @@ function chatCmd(%client, %message) //%client is sender messageClient(%client, 'msgChatCmd', '\c2 Num of id left %1 / 2147483647 = %2%',%num, (%num / 2147483647) * 100); %num.delete(); } - + case "/enableAI": if(%client.isSuperAdmin) { AISystemEnabled(true); messageAll('message', 'AI is now enabled.'); } - + case "/disableAI": if(%client.isSuperAdmin) { AISystemEnabled(false); messageAll('message', 'AI is now disabled.'); } - + case "/AIQ": if(%client.isSuperAdmin || %client.isAdmin) { @@ -171,7 +171,7 @@ function chatCmd(%client, %message) //%client is sender } else { - $AIDisableChat = 0; + $AIDisableChat = 0; messageClient(%client, 'msgChatCmd', '\c2AI Chat Enabled.'); } } @@ -182,7 +182,7 @@ function chatCmd(%client, %message) //%client is sender spookySky(1);// only one sky for right now $CurrentSky = "spookySky"; } - + default: messageClient(%client, 'msgChatCmd', '\c2Oops, that command is not recognized. '); } @@ -191,7 +191,7 @@ function chatCmd(%client, %message) //%client is sender function clientNameAuto(%name) //client name auto complate { - for (%i = 0; %i < ClientGroup.getCount(); %i++) + for (%i = 0; %i < ClientGroup.getCount(); %i++) { // the client list %client = ClientGroup.getObject(%i); %fullName = %client.nameBase; @@ -199,10 +199,10 @@ function clientNameAuto(%name) //client name auto complate %partname = strlwr(%name); for(%a=1; %a <= strlen(%partname); %a++){ if(getSubStr(%fullName,0,%a) $= getSubStr(%partname,0,%a)){ - //echo(getSubStr(%fullName,0,%a) SPC getSubStr(%partname,0,%a)); + //echo(getSubStr(%fullName,0,%a) SPC getSubStr(%partname,0,%a)); if(%c[%i] > %x){ %x =%c[%i]; - %f = %i; + %f = %i; } %c[%i]++; } @@ -215,8 +215,8 @@ function clientNameAuto(%name) //client name auto complate function LogMessage(%client, %msg, %cat) //phantoms chatlogging { %filename = "logs/" @ %cat @ "/" @ formattimestring("mm-dd-yy") @ ".txt"; - - if (!IsFile(%filename)) + + if (!IsFile(%filename)) { new fileobject(Clog); Clog.openforwrite(%filename); @@ -224,7 +224,7 @@ function LogMessage(%client, %msg, %cat) //phantoms chatlogging Clog.close(); Clog.delete(); } - else + else { new fileobject(Clog); Clog.openforappend(%filename); @@ -240,7 +240,7 @@ function removeSky(%sky) Sky.delete(); if(isObject(Precipitation)) { - alxStopAll(); + alxStopAll(); Precipitation.delete(); } if(isObject(Lightning)) @@ -257,12 +257,12 @@ function normalSky(%sky) { if($CurrentSky $= "normal") return; - + MessageAll('Msg', "\c2Looks like the weather is clearing up."); - + removeSky(%sky); - new Sky(Sky) + new Sky(Sky) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -300,10 +300,10 @@ function fireSky(%sky) return; MessageAll('Msg', "\c2Is it getting hot outside?"); - - removeSky(%sky); - - new Sky(Sky) + + removeSky(%sky); + + new Sky(Sky) { position = "-1216 -1336 0"; rotation = "1 0 0 0"; @@ -334,12 +334,12 @@ function fireSky(%sky) high_fogVolume1 = "-1 3.22439e-42 1.04486e-40"; high_fogVolume2 = "-1 1.04845e-40 3.26643e-42"; high_fogVolume3 = "-1 3.28324e-42 1.05581e-40"; - + cloudSpeed0 = "0.000000 0.000000"; }; - + MissionCleanup.add(Sky); - + %fireball = new FireballAtmosphere(FireballAtmosphere) { position = "0 0 0"; @@ -356,7 +356,7 @@ function fireSky(%sky) dropHeight = "2000"; dropDir = "0.212 0.212 -0.953998"; }; - %embers = new Precipitation(Precipitation) + %embers = new Precipitation(Precipitation) { position = "116.059 -26.7731 156.557"; rotation = "1 0 0 0"; @@ -374,7 +374,7 @@ function fireSky(%sky) maxNumDrops = "500"; maxRadius = "125"; }; - %firewind = new AudioEmitter(PlanetSoundEmitter) + %firewind = new AudioEmitter(PlanetSoundEmitter) { position = "289.762 209.214 173.677"; rotation = "1 0 0 0"; @@ -395,7 +395,7 @@ function fireSky(%sky) minLoopGap = "0"; maxLoopGap = "0"; type = "EffectAudioType"; - }; + }; MissionCleanup.add(%fireball); MissionCleanup.add(%embers2); @@ -404,17 +404,17 @@ function fireSky(%sky) } - + function rainSky(%sky) { if($CurrentSky $= "rain") return; - - MessageAll('Msg', "\c2Looks like a storm is brewing."); - - removeSky(%sky); - new Sky(Sky) + MessageAll('Msg', "\c2Looks like a storm is brewing."); + + removeSky(%sky); + + new Sky(Sky) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -445,14 +445,14 @@ function rainSky(%sky) high_fogVolume1 = "-1 107 1.07457e-38"; high_fogVolume2 = "-1 9.69184e-34 8.26766e-44"; high_fogVolume3 = "-1 0 3.2509e-38"; - + cloudSpeed0 = "0.000000 0.000400"; }; - + MissionCleanup.add(Sky); - + //Requires RainNoSound Datablock in weather.cs - %rain = new Precipitation(Precipitation) + %rain = new Precipitation(Precipitation) { position = "-336.859 -631.623 191.648"; rotation = "1 0 0 0"; @@ -470,7 +470,7 @@ function rainSky(%sky) maxNumDrops = "1000"; maxRadius = "80"; }; - %lightning = new Lightning(Lightning) + %lightning = new Lightning(Lightning) { position = "-274.935 -143.111 353.049"; rotation = "1 0 0 0"; @@ -487,7 +487,7 @@ function rainSky(%sky) fadeColor = "0.100000 0.100000 1.000000 1.000000"; useFog = "0"; }; - %rainthunder = new AudioEmitter(PlanetSoundEmitter) + %rainthunder = new AudioEmitter(PlanetSoundEmitter) { position = "289.762 209.214 173.677"; rotation = "1 0 0 0"; @@ -509,7 +509,7 @@ function rainSky(%sky) maxLoopGap = "0"; type = "EffectAudioType"; }; - %rainsound = new AudioEmitter(PlanetSoundEmitter) + %rainsound = new AudioEmitter(PlanetSoundEmitter) { position = "-361.683 451 83.9062"; rotation = "1 0 0 0"; @@ -545,13 +545,13 @@ function snowSky(%sky) { if($CurrentSky $= "snow") return; - - MessageAll('Msg', "\c2The temperature seems to be dropping."); - - removeSky(%sky); - removeSky(%sky); - new Sky(Sky) + MessageAll('Msg', "\c2The temperature seems to be dropping."); + + removeSky(%sky); + removeSky(%sky); + + new Sky(Sky) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -576,13 +576,13 @@ function snowSky(%sky) fogVolumeColor1 = "128.000000 128.000000 128.000000 -0.000000"; fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000"; fogVolumeColor3 = "128.000000 128.000000 128.000000 0.000000"; - + cloudSpeed0 = "0.000000 0.000400"; }; - + MissionCleanup.add(Sky); - - %snow = new Precipitation(Precipitation) + + %snow = new Precipitation(Precipitation) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -598,7 +598,7 @@ function snowSky(%sky) maxNumDrops = "2000"; maxRadius = "125"; }; - %snowwind = new AudioEmitter(PlanetSoundEmitter) + %snowwind = new AudioEmitter(PlanetSoundEmitter) { position = "289.762 209.214 173.677"; rotation = "1 0 0 0"; @@ -620,7 +620,7 @@ function snowSky(%sky) maxLoopGap = "0"; type = "EffectAudioType"; }; - + MissionCleanup.add(%snow); MissionCleanup.add(%snowwind); } @@ -630,13 +630,13 @@ function sandSky(%sky) { if($CurrentSky $= "sand") return; - - MessageAll('Msg', "\c2Visibility looks like its getting low."); - - removeSky(%sky); - removeSky(%sky); - new Sky(Sky) + MessageAll('Msg', "\c2Visibility looks like its getting low."); + + removeSky(%sky); + removeSky(%sky); + + new Sky(Sky) { position = "-1216 -848 0"; rotation = "1 0 0 0"; @@ -670,10 +670,10 @@ function sandSky(%sky) cloudSpeed0 = "0.000000 0.000000"; }; - + MissionCleanup.add(Sky); - - %sandwind = new AudioEmitter(PlanetSoundEmitter) + + %sandwind = new AudioEmitter(PlanetSoundEmitter) { position = "289.762 209.214 173.677"; rotation = "1 0 0 0"; @@ -695,7 +695,7 @@ function sandSky(%sky) maxLoopGap = "0"; type = "EffectAudioType"; }; - + MissionCleanup.add(%sandwind); } @@ -703,11 +703,11 @@ function sandSky(%sky) function niceSky(%sky) { removeSky(%sky); - removeSky(%sky); - + removeSky(%sky); + if($niceSkyNumber $= "" || $niceSkyNumber $= 4) { - new Sky(Sky) + new Sky(Sky) { position = "-1216 -848 0"; rotation = "1 0 0 0"; @@ -741,13 +741,13 @@ function niceSky(%sky) cloudSpeed0 = "0.000000 0.000000"; }; - + MissionCleanup.add(Sky); $niceSkyNumber = 1; } else if($niceSkyNumber $= 1) - { - new Sky(Sky) + { + new Sky(Sky) { position = "-1024 -1024 0"; rotation = "1 0 0 0"; @@ -781,13 +781,13 @@ function niceSky(%sky) cloudSpeed0 = "0.900000 0.900000"; }; - + MissionCleanup.add(Sky); $niceSkyNumber = 2; } else if($niceSkyNumber $= 2) - { - new Sky(Sky) + { + new Sky(Sky) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -821,13 +821,13 @@ function niceSky(%sky) cloudSpeed0 = "0.0000003 0.0000003"; }; - + MissionCleanup.add(Sky); $niceSkyNumber = 3; } else if($niceSkyNumber $= 3) - { - new Sky(Sky) + { + new Sky(Sky) { position = "-1216 -848 0"; rotation = "1 0 0 0"; @@ -861,23 +861,23 @@ function niceSky(%sky) cloudSpeed0 = "0.000000 0.000000"; }; - + MissionCleanup.add(Sky); $niceSkyNumber = 4; } } function fireworksSky(%sky) -{ +{ if($CurrentSky $= "fireworks") { schedule(1500, 0, "dtCommandsReset"); return; } - + removeSky(%sky); - - new Sky(Sky) + + new Sky(Sky) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -908,20 +908,20 @@ function fireworksSky(%sky) high_fogVolume1 = "-1 -2.58511e+36 2.28656e-38"; high_fogVolume2 = "-1 -1991.03 nan"; high_fogVolume3 = "-1 7945.87 7.22445e-09"; - + cloudSpeed0 = "0.0000003 0.0000003"; }; - + MissionCleanup.add(Sky); - + schedule(1500, 0, "fireworkLoop"); } function fireworkLoop() { - if($CurrentSky !$= "fireworks") + if($CurrentSky !$= "fireworks" || !ClientGroup.getCount()) return; - + // find a random client. %client = ClientGroup.getObject(getRandom(ClientGroup.getCount() - 1)); @@ -972,15 +972,15 @@ datablock AudioProfile(dtFireworksSound) }; function spookySky(%sky) -{ +{ if($CurrentSky $= "spookySky") { schedule(1500, 0, "dtCommandsReset"); return; } - + removeSky(%sky); - + new Sky(Sky) { position = "0 0 0"; rotation = "1 0 0 0"; @@ -1015,17 +1015,17 @@ function spookySky(%sky) locked = "true"; cloudSpeed0 = "0.000000 0.000000"; }; - + MissionCleanup.add(Sky); - + schedule(1500, 0, "spookyFireworkLoop"); } function spookyFireworkLoop() { - if($CurrentSky !$= "spookySky") + if($CurrentSky !$= "spookySky" || !ClientGroup.getCount()) return; - + // find a random client. %client = ClientGroup.getObject(getRandom(ClientGroup.getCount() - 1)); @@ -1505,7 +1505,7 @@ package dtCommandsReset function DefaultGame::gameOver(%game) { Parent::gameOver(%game); - + //Reset CurrentSky dtCommandsReset(); } @@ -1514,7 +1514,7 @@ function DefaultGame::gameOver(%game) function DestroyServer() { Parent::DestroyServer(); - + //Reset CurrentSky dtCommandsReset(); } @@ -1523,4 +1523,4 @@ function DestroyServer() // Prevent package from being activated if it is already if (!isActivePackage(dtCommandsReset)) - activatePackage(dtCommandsReset); \ No newline at end of file + activatePackage(dtCommandsReset); diff --git a/Classic/scripts/server.cs b/Classic/scripts/server.cs index 0518d91..4221725 100755 --- a/Classic/scripts/server.cs +++ b/Classic/scripts/server.cs @@ -3,7 +3,7 @@ $classicVersion = "1.5.2"; // z0dd - ZOD, 5/12/04. Set the version. if($Host::TimeLimit $= "") $Host::TimeLimit = 20; -$SB::WODec = 0.004; // whiteout +$SB::WODec = 0.004; // whiteout $SB::DFDec = 0.02; // damageFlash $Classic::gravSetting = -26.9; // z0dd - ZOD, 9/13/02. Classic Gravity setting @@ -18,7 +18,7 @@ $BackupPassword = $Host::Password; // z0dd - ZOD, 8/09/03. Backup the server pas // ----------------------------------------------------- // z0dd - ZOD, 6/22/02. Addition. -// Alert players on server that a remote connection has +// Alert players on server that a remote connection has // been established to the server. $TelnetSpam = 0; function onTelnetConnect(%ip, %access) @@ -44,7 +44,7 @@ function clearTelnetSpam() function VerifyCDCheck(%func) { if (!cdFileCheck()) - messageBoxOkCancel("TRIBES 2 CD CHECK", "You must have the Tribes 2 CD in the CD-ROM drive while playing Tribes 2. Please insert the CD.", "schedule(0, 0, VerifyCDCheck, " @ %func @ ");", "quit();"); + messageBoxOkCancel("TRIBES 2 CD CHECK", "You must have the Tribes 2 CD in the CD-ROM drive while playing Tribes 2. Please insert the CD.", "schedule(0, 0, VerifyCDCheck, " @ %func @ ");", "quit();"); else call(%func); } @@ -93,7 +93,7 @@ function CreateServer(%mission, %missionType) // Load server data blocks exec("scripts/commanderMapIcons.cs"); - exec("scripts/markers.cs"); + exec("scripts/markers.cs"); exec("scripts/serverAudio.cs"); exec("scripts/damageTypes.cs"); exec("scripts/deathMessages.cs"); @@ -158,9 +158,9 @@ function CreateServer(%mission, %missionType) if($Host::ClassicLoadTR2Gametype) { exec("scripts/TR2Game.cs"); - } + } - %search = "scripts/*Game.cs"; + %search = "scripts/*Game.cs"; for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search)) { %type = fileBase(%file); // get the name of the script @@ -184,9 +184,9 @@ function CreateServer(%mission, %missionType) } } // ------------------------------------------------------------------- - + // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - + $missionSequence = 0; $CurrentMissionType = %missionType; $HostGameBotCount = 0; @@ -206,7 +206,7 @@ function CreateServer(%mission, %missionType) // setup the bots for this server if( $Host::BotsEnabled ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - initGameBots( %mission, %missionType ); + initGameBots( %mission, %missionType ); // z0dd - ZOD, 9/13/02. For TR2 compatability // This is a failsafe way of ensuring that default gravity is always restored @@ -224,13 +224,13 @@ function CreateServer(%mission, %missionType) setPerfCounterEnable(3); else setPerfCounterEnable(0); - + // Load Banlist ClassicLoadBanlist(); // load the mission... loadMission(%mission, %missionType, true); - + // TraversalRoot Console spam fix if($Host::ClassicSuppressTraversalRootError) suppressTraversalRootPatch(); @@ -239,7 +239,7 @@ function CreateServer(%mission, %missionType) function initGameBots( %mission, %mType ) { echo( "adding bots..." ); - + AISystemEnabled( false ); if ( $Host::BotCount > 0 && %mType !$= "SinglePlayer" ) { @@ -265,7 +265,7 @@ function initGameBots( %mission, %mType ) aiConnectMultiple( $HostGameBotCount, $Host::MinBotDifficulty, $Host::MaxBotDifficulty, -1 ); } else - { + { $HostGameBotCount = 0; } } @@ -306,7 +306,7 @@ function getValidMap(%misType) else %file = $HostMissionFile[$HostMission[%type, mFloor(getRandom(0, %count-1))]]; - return %file; + return %file; } function findNextCycleMission(%type) @@ -340,7 +340,7 @@ function findNextCycleMission(%type) { %nextMissionIndex = getNextMission($CurrentMission, %type); //return $HostMissionName[%nextMissionIndex]; // z0dd - ZOD - Founder, 10/06/02. Was trying to load a mission name instead of file. - return $HostMissionFile[%nextMissionIndex]; + return $HostMissionFile[%nextMissionIndex]; } %numPlayers = ClientGroup.getCount(); @@ -364,7 +364,7 @@ function CycleMissions() { if(Game.scheduleVote !$= "") // a vote is still running, stop it stopCurrentVote(); - + echo( "cycling mission. " @ ClientGroup.getCount() @ " clients in game." ); if($Host::ClassicCycleMisTypes && !$Host::ClassicRandomMisTypes) { @@ -407,7 +407,7 @@ function DestroyServer() stopHeartbeat(); if ( isObject( MissionGroup ) ) MissionGroup.delete(); - if ( isObject( MissionCleanup ) ) + if ( isObject( MissionCleanup ) ) MissionCleanup.delete(); if(isObject(game)) { @@ -427,10 +427,10 @@ function DestroyServer() %client.delete(); } - // delete all the data blocks... + // delete all the data blocks... // this will cause problems if there are any connections deleteDataBlocks(); - + // reset the target manager resetTargetManager(); @@ -458,7 +458,7 @@ function DisconnectedCleanup() { $CurrentMissionType = ""; $CurrentMission = ""; - + // Make sure we're not still waiting for the loading info: cancelLoadInfoCheck(); @@ -466,14 +466,14 @@ function DisconnectedCleanup() HudMessageVector.clear(); if ( isObject( PlayerListGroup ) ) PlayerListGroup.delete(); - + // terminate all playing sounds alxStopAll(); - + // clean up voting voteHud.voting = false; mainVoteHud.setvisible(0); - + // clear all print messages clientCmdclearBottomPrint(); clientCmdClearCenterPrint(); @@ -481,7 +481,7 @@ function DisconnectedCleanup() // clear the inventory and weapons hud weaponsHud.clearAll(); inventoryHud.clearAll(); - + // back to the launch screen Canvas.setContent(LaunchGui); if ( isObject( MusicPlayer ) ) @@ -506,7 +506,7 @@ function kick( %client, %admin, %guid ) messageAll( 'MsgAdminForce', '\c2%1 has kicked %2.', %admin.name, %client.name ); // z0dd - ZOD, 7/13/03. Tell who kicked else messageAll( 'MsgVotePassed', '\c2%1 was kicked by vote.', Game.kickClientName ); - + messageClient(%client, 'onClientKicked', ""); messageAllExcept( %client, -1, 'MsgClientDrop', "", Game.kickClientName, %client ); @@ -532,12 +532,12 @@ function kick( %client, %admin, %guid ) %cl = ClientGroup.getObject( %i ); if( %cl.guid == %guid ) { - %found = true; + %found = true; // kill and delete this client, their done in this server. if( isObject( %cl.player ) ) %cl.player.scriptKill(0); - + if ( isObject( %cl ) ) { %client.setDisconnectReason( "You have been kicked out of the game." ); // z0dd - ZOD, 7/13/03. Tell who kicked @@ -545,17 +545,17 @@ function kick( %client, %admin, %guid ) } // ban by IP as well BanList::add( %guid, %client.getAddress(), $Host::KickBanTime ); - } + } } if( !%found ) - BanList::add( %guid, "0", $Host::KickBanTime ); // keep this guy out for a while since he left. + BanList::add( %guid, "0", $Host::KickBanTime ); // keep this guy out for a while since he left. } else // lan games { // kill and delete this client if( isObject( %client.player ) ) %client.player.scriptKill(0); - + if ( isObject( %client ) ) { %client.setDisconnectReason( "You have been kicked out of the game." ); @@ -572,14 +572,14 @@ function ban( %client, %admin ) messageAll('MsgAdminForce', '\c2%1 has banned %2.', %admin.name, %client.name); // z0dd - ZOD, 10/03/2. Tell who banned else messageAll( 'MsgVotePassed', '\c2%1 was banned by vote.', %client.name ); - + messageClient(%client, 'onClientBanned', ""); messageAllExcept( %client, -1, 'MsgClientDrop', "", %client.name, %client ); - + // kill and delete this client if( isObject(%client.player) ) %client.player.scriptKill(0); - + if ( isObject( %client ) ) { %client.setDisconnectReason( %admin.nameBase @ " has banned you from this server." ); // z0dd - ZOD, 10/03/2. Tell who banned @@ -625,7 +625,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, // if hosting this server, set this client to superAdmin if(%client.getAddress() $= "Local") - { + { %client.isAdmin = true; %client.isSuperAdmin = true; } @@ -637,9 +637,9 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, if ( !%client.isSuperAdmin ) { if ( isOnSuperAdminList( %client ) ) - { + { %client.isAdmin = true; - %client.isSuperAdmin = true; + %client.isSuperAdmin = true; } else if( isOnAdminList( %client ) ) { @@ -670,7 +670,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, %realName = getField( %authInfo, 0 ); if ( $PlayingOnline && $Host::NoSmurfs ) %name = %realName; - + //Remove <> to not mess up tribesnext json %name = stripChars( detag( %name ), "<>" ); @@ -751,7 +751,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, %name = stripTrailingSpaces( strToPlayerName( %name ) ); if ( strlen( %name ) < 3 ) %name = "Poser"; - + // Make sure the alias is unique: %isUnique = true; %count = ClientGroup.getCount(); @@ -805,17 +805,23 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, else %client.nameBase = %realName; - //Allow - ChocoTaco // Make sure that the connecting client is not trying to use a bot skin: //%temp = detag( %skin ); //if ( %temp $= "basebot" || %temp $= "basebbot" ) // %client.skin = addTaggedString( "base" ); //else + // %client.skin = addTaggedString( %skin ); + + //Changed to allow botskins + %temp = detag( %skin ); + if(%temp $= "") + %client.skin = addTaggedString( "base" ); + else %client.skin = addTaggedString( %skin ); %client.voice = %voice; %client.voiceTag = addtaggedString(%voice); - + //set the voice pitch based on a lookup table from their chosen voice %client.voicePitch = getValidVoicePitch(%voice, %voicePitch); // z0dd - ZOD, 9/29/02. Removed T2 demo code from here @@ -830,7 +836,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, %client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch); %client.score = 0; %client.team = 0; - + $instantGroup = ServerGroup; $instantGroup = MissionCleanup; @@ -843,17 +849,17 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, if((%recipient != %client)) { // These should be "silent" versions of these messages... - messageClient(%client, 'MsgClientJoin', "", - %recipient.name, - %recipient, - %recipient.target, - %recipient.isAIControlled(), - %recipient.isAdmin, - %recipient.isSuperAdmin, - %recipient.isSmurf, + messageClient(%client, 'MsgClientJoin', "", + %recipient.name, + %recipient, + %recipient.target, + %recipient.isAIControlled(), + %recipient.isAdmin, + %recipient.isSuperAdmin, + %recipient.isSmurf, %recipient.sendGuid); - messageClient(%client, 'MsgClientJoinTeam', "", %recipient.name, $teamName[%recipient.team], %recipient, %recipient.team ); + messageClient(%client, 'MsgClientJoinTeam', "", %recipient.name, $teamName[%recipient.team], %recipient, %recipient.team ); } } @@ -861,7 +867,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, commandToClient(%client, 'setBeaconNames', "Target Beacon", "Marker Beacon", "Bomb Target"); - if ( $CurrentMissionType !$= "SinglePlayer" ) + if ( $CurrentMissionType !$= "SinglePlayer" ) { // z0dd - ZOD, 5/08/04. Send message of any gameplay changes // messageClient( %client, 'MsgClassic', 'Classic \c2Sniper Mod: \c3%1.', ($Host::ClassicLoadSniperChanges ? 'Enabled' : 'Disabled') ); @@ -875,35 +881,35 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, // messageClient( %client, 'MsgClassic', 'Classic \c2V-Ramming Mod: \c3%1.', ($Host::ClassicLoadVRamChanges ? 'Enabled' : 'Disabled') ); // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - messageClient(%client, 'MsgClientJoin', 'Welcome to Tribes2 %1.', - %client.name, - %client, - %client.target, - false, // isBot - %client.isAdmin, - %client.isSuperAdmin, - %client.isSmurf, + messageClient(%client, 'MsgClientJoin', 'Welcome to Tribes2 %1.', + %client.name, + %client, + %client.target, + false, // isBot + %client.isAdmin, + %client.isSuperAdmin, + %client.isSmurf, %client.sendGuid ); // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.', - %client.name, - %client, - %client.target, - false, // isBot - %client.isAdmin, - %client.isSuperAdmin, + messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.', + %client.name, + %client, + %client.target, + false, // isBot + %client.isAdmin, + %client.isSuperAdmin, %client.isSmurf, %client.sendGuid ); } else - messageClient(%client, 'MsgClientJoin', "\c0Mission Insertion complete...", - %client.name, - %client, - %client.target, - false, // isBot - false, // isAdmin - false, // isSuperAdmin + messageClient(%client, 'MsgClientJoin', "\c0Mission Insertion complete...", + %client.name, + %client, + %client.target, + false, // isBot + false, // isAdmin + false, // isSuperAdmin false, // isSmurf %client.sendGuid ); @@ -956,22 +962,22 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, } } } - - if($Host::EmptyServerReset && isEventPending($EmptyServerResetSchedule)) + + if($Host::EmptyServerReset && isEventPending($EmptyServerResetSchedule)) { error(formatTimeString("HH:nn:ss") SPC "Previous Timed Server Reset schedule cancelled..." ); cancel($EmptyServerResetSchedule); } - + if($Host::GuidCheck) { // If we don't have a GUID try to find one somewhere. - if(!%client.guid || %client.guid $= "") + if(!%client.guid || %client.guid $= "") { %client.guid = getField(%client.getAuthInfo(),3); } // If we don't have a name, try to get one. - if(%name $= "") + if(%name $= "") { %name = getField(%client.getAuthInfo(),0); %client.nameBase = %name; @@ -984,7 +990,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, return; } } - + // %stuff = getIPAddress(%client); // if(strstr(%stuff, "70.240.") == 0) // { @@ -1052,7 +1058,7 @@ function GameConnection::onDrop(%client, %reason) connectLog(%client, 1); // make sure that tagged string of player name is not used - if ( $CurrentMissionType $= "SinglePlayer" ) + if ( $CurrentMissionType $= "SinglePlayer" ) messageAllExcept(%client, -1, 'MsgClientDrop', "", getTaggedString(%client.name), %client); else messageAllExcept(%client, -1, 'MsgClientDrop', '\c1%1 has left the game.', getTaggedString(%client.name), %client); @@ -1100,14 +1106,14 @@ function GameConnection::onDrop(%client, %reason) } // reset the server if everyone has left the game if( $HostGamePlayerCount - $HostGameBotCount == 0 && $Host::EmptyServerReset && !$resettingServer && !$LoadingMission && $CurrentMissionType !$= $Host::MissionType ) - { + { // Timed Server Reset: $Host::EmptyServerReset = 1; --- Time in Minutes $Host::EmptyServerResetTime = 120; - if(isEventPending($EmptyServerResetSchedule)) + if(isEventPending($EmptyServerResetSchedule)) { error(formatTimeString("HH:nn:ss") SPC "Previous Timed Server Reset schedule cancelled..." ); cancel($EmptyServerResetSchedule); } - + %resettime = $Host::EmptyServerResetTime * 60000; if(%resettime <= 0) %resettime = 1; $EmptyServerResetSchedule = schedule(%resettime, 0, "ResetServerTimed"); @@ -1132,11 +1138,11 @@ function resetServerDefaults() { $resettingServer = true; echo( "Resetting server defaults..." ); - + if( isObject( Game ) ) Game.gameOver(); - - // Override server defaults with prefs: + + // Override server defaults with prefs: exec( "scripts/ServerDefaults.cs" ); exec( $serverprefs ); @@ -1162,7 +1168,7 @@ function resetServerDefaults() $TeamName[%index] = addTaggedString($Host::TeamName[%index]); %index++; } - + // Get the hologram names from the prefs... %index = 1; while ( $Host::holoName[%index] !$= "" ) @@ -1174,7 +1180,7 @@ function resetServerDefaults() // kick all bots... removeAllBots(); - + // add bots back if they were there before.. if( $Host::botsEnabled ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here initGameBots( $Host::Map, $Host::MissionType ); @@ -1229,17 +1235,17 @@ function loadMission( %missionName, %missionType, %firstMission ) disableCyclingConnections(true); if (!$pref::NoClearConsole) cls(); - if ( isObject( LoadingGui ) ) + if ( isObject( LoadingGui ) ) LoadingGui.gotLoadInfo = ""; buildLoadInfo( %missionName, %missionType ); - + // reset all of these ClearCenterPrintAll(); ClearBottomPrintAll(); - + if( $Host::TournamentMode ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here resetTournamentPlayers(); - + // Send load info to all the connected clients: %count = ClientGroup.getCount(); for ( %cl = 0; %cl < %count; %cl++ ) @@ -1255,7 +1261,7 @@ function loadMission( %missionName, %missionType, %firstMission ) if(%missionType $= "CTF" || %missionType $= "SCtF") { %fileIn = "stats/maps/classic/" @ %missionType @ "/" @ %missionName @ ".txt"; - + // Initialize the file if not exist if(!isFile(%fileIn)) { @@ -1276,7 +1282,7 @@ function loadMission( %missionName, %missionType, %firstMission ) // Eolk - Testing new stuff to make map rotation less stale. if($CurrentMissionType !$= %missionType && !%firstMission) deleteVariables("$MapPlayed*"); - + // reset the default time limit if changed if($TimeLimitChanged) { @@ -1293,7 +1299,7 @@ function loadMission( %missionName, %missionType, %firstMission ) // allow load condition to exit out schedule(0,ServerGroup,loadMissionStage1,%missionName,%missionType,%firstMission); } - + function loadMissionStage1(%missionName, %missionType, %firstMission) { // if a mission group was there, delete prior mission stuff @@ -1311,7 +1317,7 @@ function loadMissionStage1(%missionName, %missionType, %firstMission) } Game.endMission(); $lastMissionTeamCount = Game.numTeams; - + MissionGroup.delete(); MissionCleanup.delete(); Game.deactivatePackages(); @@ -1319,19 +1325,19 @@ function loadMissionStage1(%missionName, %missionType, %firstMission) $ServerGroup.delete(); $ServerGroup = new SimGroup(ServerGroup); } - + $CurrentMission = %missionName; $CurrentMissionType = %missionType; 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) $missionSequence++; - + // if this isn't the first mission, allow some time for the server // to transmit information to the clients: - + // jff: $currentMission already being used for this purpose, used in 'finishLoadMission' $MissionName = %missionName; $missionRunning = false; @@ -1349,7 +1355,7 @@ function loadMissionStage2() $instantGroup = ServerGroup; new SimGroup (MissionCleanup); - + if($CurrentMissionType $= "") { new ScriptObject(Game) { @@ -1386,7 +1392,7 @@ function loadMissionStage2() $countDownStarted = false; exec(%file); $instantGroup = MissionCleanup; - + // pre-game mission stuff if(!isObject(MissionGroup)) { @@ -1438,7 +1444,7 @@ function loadMissionStage2() $missionRunning = true; for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++) ClientGroup.getObject(%clientIndex).startMission(); - + if(!$MatchStarted && $LaunchMode !$= "NavBuild" && $LaunchMode !$= "SpnBuild" ) { if( $Host::TournamentMode ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here @@ -1447,10 +1453,10 @@ function loadMissionStage2() checkMissionStart(); } - // offline graph builder... + // offline graph builder... if( $LaunchMode $= "NavBuild" ) buildNavigationGraph( "Nav" ); - + if( $LaunchMode $= "SpnBuild" ) buildNavigationGraph( "Spn" ); @@ -1463,11 +1469,11 @@ function ShapeBase::cleanNonType(%this, %type) { if(%this.missionTypesList $= "") return; - + for(%i = 0; (%typei = getWord(%this.missionTypesList, %i)) !$= ""; %i++) if(%typei $= %type) return; - + // first 32 targets are team targets (never allocated/freed) // - must reallocate the target if unhiding if(%this.getTarget() >= 32) @@ -1520,7 +1526,7 @@ function serverCmdMissionStartPhase1Done(%client, %seq) return; %client.currentPhase = 1; - // when the datablocks are transmitted, we'll send the ghost always objects + // when the datablocks are transmitted, we'll send the ghost always objects %client.transmitDataBlocks($missionSequence); } @@ -1535,7 +1541,7 @@ function GameConnection::dataBlocksDone( %client, %missionSequence ) return; %client.currentPhase = 2; - // only want to set this once... (targets will not be updated/sent until a + // only want to set this once... (targets will not be updated/sent until a // client has this flag set) if(!%client.getReceivedDataBlocks()) { @@ -1557,15 +1563,15 @@ function serverCmdMissionStartPhase2Done(%client, %seq) // when all this good love is over, we'll know that the mission lighting is done %client.transmitPaths(); - + // setup the client team state - if ( $CurrentMissionType !$= "SinglePlayer" ) + if ( $CurrentMissionType !$= "SinglePlayer" ) serverSetClientTeamState( %client ); - + // start ghosting %client.activateGhosting(); %client.camera.scopeToClient(%client); - + // to the next phase... commandToClient(%client, 'MissionStartPhase3', $missionSequence, $CurrentMission); } @@ -1581,7 +1587,7 @@ function serverCmdMissionStartPhase3Done(%client, %seq) %client.isReady = true; Game.clientMissionDropReady(%client); - + if(!%client.seenMOTD && $Host::ClassicMOTD !$= "") { centerPrint(%client, $Host::ClassicMOTD, $Host::ClassicMOTDTime, $Host::ClassicMOTDLines); @@ -1592,9 +1598,9 @@ function serverCmdMissionStartPhase3Done(%client, %seq) function serverSetClientTeamState( %client ) { // set all player states prior to mission drop ready - + // create a new camera for this client - %client.camera = new Camera() + %client.camera = new Camera() { dataBlock = Observer; }; @@ -1603,9 +1609,9 @@ function serverSetClientTeamState( %client ) Cancel( %client.rescheduleVote ); %client.canVote = true; %client.rescheduleVote = ""; - + MissionCleanup.add( %client.camera ); // we get automatic cleanup this way. - + %observer = false; if( !$Host::TournamentMode ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here { @@ -1618,49 +1624,49 @@ function serverSetClientTeamState( %client ) { // server just changed maps - this guy was here before if( %client.lastTeam !$= "" ) - { + { // see if this guy was an observer from last game if(%client.lastTeam == 0) { %observer = true; - + %client.camera.getDataBlock().setMode( %client.camera, "ObserverFly" ); } else // let this player join the team he was on last game { if(Game.numTeams > 1 && %client.lastTeam <= Game.numTeams ) - { + { Game.clientJoinTeam( %client, %client.lastTeam, false ); } else - { + { Game.assignClientTeam( %client ); - + // spawn the player Game.spawnPlayer( %client, false ); } } } else - { + { Game.assignClientTeam( %client ); - + // spawn the player Game.spawnPlayer( %client, false ); } - + if( !%observer ) { - if(!$MatchStarted && !$CountdownStarted) + if(!$MatchStarted && !$CountdownStarted) %client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player ); - else if(!$MatchStarted && $CountdownStarted) + else if(!$MatchStarted && $CountdownStarted) %client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player ); - } + } } } else { - // don't need to do anything. MissionDrop will handle things from here. + // don't need to do anything. MissionDrop will handle things from here. } } @@ -1672,7 +1678,7 @@ function serverSetClientTeamState( %client ) // %client.camera.mode = "PreviewMode"; // %client.camera.setTransform( %markerObj ); // %client.camera.setFlyMode(); -// +// // %client.setControlObject( %client.camera ); //} @@ -1733,7 +1739,7 @@ function clientCmdVehicleMount() $firstPerson = false; } } - + function clientCmdVehicleDismount() { if ( $pref::toggleVehicleView ) @@ -1750,7 +1756,7 @@ function serverCmdSAD(%client, %password) return; } %name = %client.name; - + switch$ (%password) { case $Host::ClassicSuperAdminPassword: @@ -1816,10 +1822,10 @@ function ResetSadAttp(%client) //--------------------------------------------------------------- // z0dd - ZOD, 8/13/02. Added this function. Writen by Writer // -// Returns true if %text consists of nothing but digits and/or +// Returns true if %text consists of nothing but digits and/or // decimals. -// Note: rejects strings with more than one decimal, or with a + -// or - as anything but the first character (+ or - are only +// Note: rejects strings with more than one decimal, or with a + +// or - as anything but the first character (+ or - are only // allowed as the first character in the string) function isNumber(%text) { @@ -1862,7 +1868,7 @@ function isNumber(%text) case "+": if(%i) // only valid as first character return false; - + continue; default: return false; @@ -1946,7 +1952,7 @@ function serverCmdSet(%client, %type, %val) export( "$Host::*", $serverprefs, false ); messageClient(%client, 'MsgSuperPassword', '\c2\"Super Admin\" PW changed to: \c3%1\c2.', addTaggedString(%val)); logEcho(%client.nameBase @ " changed the Super Admin password.", 1); - + case "adminpw": $Host::AdminPassword = %val; export( "$Host::*", $serverprefs, false ); @@ -2077,7 +2083,7 @@ function AutoPWServer(%val) $Host::Password = $BackupPassword; } -// z0dd - ZOD, 9/27/02, Chat was being spammed every time someone joined if limit was hit or above +// z0dd - ZOD, 9/27/02, Chat was being spammed every time someone joined if limit was hit or above // %detail = (($Host::Password $= "") ? "removed" : "set"); // messageAll( 'MsgAdmin', '\c2Join password %1 by Auto-password feature.', %detail ); } @@ -2148,7 +2154,7 @@ function serverCmdAutoPWSetup(%client, %type, %val) } //--------------------------------------------------------------------------------------------------- -// z0dd - ZOD, 4-15-02. Pick spawn spot by killing self during tourney wait. Also addresses +// z0dd - ZOD, 4-15-02. Pick spawn spot by killing self during tourney wait. Also addresses // team switching to crash server exploit. New function //$WAIT_PERIOD = 15000; //$WAIT_MESSAGE = '\c3WAIT MESSAGE:\cr You must wait another %1 seconds'; @@ -2170,16 +2176,16 @@ function SpawnPosChange( %client ) clearBottomPrint(%client); Game.clientChangeTeam( %client, %client.team, 0, true ); - + if(!$MatchStarted) { %client.observerMode = "pregame"; %client.notReady = true; %client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player ); %client.setControlObject( %client.camera ); - + if(!$CountdownStarted) - { + { %client.notReady = true; centerprint( %client, "\nPress FIRE when ready.", 0, 3 ); } @@ -2333,13 +2339,13 @@ function PlayAnim(%client, %anim) if(%weapon $= "MissileLauncher" || %weapon $= "GrenadeLauncher" || %weapon $= "SniperRifle" || %weapon $= "Mortar") { %player.animResetWeapon = true; - %player.lastWeapon = %weapon; + %player.lastWeapon = %weapon; %player.unmountImage($WeaponSlot); // ---------------------------------------------- // z0dd - ZOD, 5/8/02. %obj is the wrong varible. //%obj.setArmThread(look); %player.setArmThread(look); - } + } %player.setActionThread(%anim); } @@ -2356,9 +2362,9 @@ function serverCmdPlayDeath(%client,%anim) } // NOTENOTENOTE: Review these! -//------------------------------------------------------------ +//------------------------------------------------------------ // TODO - make this function specify a team to switch to... -// z0dd - ZOD - Kaiten 8/10/03. This is retarded, it passes NULL +// z0dd - ZOD - Kaiten 8/10/03. This is retarded, it passes NULL // as a team which screws up like mad. also it is not used by anything. // Kill it! function serverCmdClientTeamChange( %client ) @@ -2386,7 +2392,7 @@ function serverCanAddBot() %botCount++; } - //add only if we have less bots than the bot count, and if there would still be room for a + //add only if we have less bots than the bot count, and if there would still be room for a if ($HostGameBotCount > 0 && %botCount < $Host::botCount && %numClients < $Host::maxPlayers - 1) return true; else @@ -2423,7 +2429,7 @@ function serverCmdClientJoinTeam( %client, %team, %admin ) } if ( isObject( Game ) && Game.kickClient != %client) { - if(%client.team != %team) + if(%client.team != %team) { // z0dd - ZOD, 9/17/02. Fair teams, check for Team Rabbit 2 as well. if(($FairTeams && !%client.isAdmin) && ($CurrentMissionType !$= TR2)) @@ -2435,7 +2441,7 @@ function serverCmdClientJoinTeam( %client, %team, %admin ) return; } } - + if(!%client.isWaiting || %admin.isAdmin) { %client.isWaiting = true; @@ -2443,10 +2449,10 @@ function serverCmdClientJoinTeam( %client, %team, %admin ) %client.schedule(15000, waitTimeout); %fromObs = %client.team == 0; - + if(%fromObs) clearBottomPrint(%client); - + if( %client.isAIControlled() ) Game.AIChangeTeam( %client, %team ); else @@ -2458,7 +2464,7 @@ function serverCmdClientJoinTeam( %client, %team, %admin ) messageClient(%client, "", '\c3WAIT MESSAGE:\cr You must wait another %1 seconds', %wait); } } - } + } } // --------------------------------------------------------------------------------- @@ -2467,9 +2473,9 @@ function serverCmdClientAddToGame( %client, %targetClient ) { if ( isObject( Game ) ) Game.clientJoinTeam( %targetClient, 0, $matchstarted ); - + clearBottomPrint(%targetClient); - + if($matchstarted) { %targetClient.setControlObject( %targetClient.player ); @@ -2481,9 +2487,9 @@ function serverCmdClientAddToGame( %client, %targetClient ) %targetClient.camera.getDataBlock().setMode( %targetClient.camera, "pre-game", %targetClient.player ); %targetClient.setControlObject( %targetClient.camera ); } - + if( $Host::TournamentMode && !$CountdownStarted) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - { + { %targetClient.notReady = true; centerprint( %targetClient, "\nPress FIRE when ready.", 0, 3 ); } @@ -2497,7 +2503,7 @@ function serverCmdClientJoinGame( %client ) if ( isObject( Game ) ) Game.clientJoinTeam( %client, 0, 1 ); - + %client.setControlObject( %client.player ); clearBottomPrint(%client); commandToClient(%client, 'setHudMode', 'Standard'); @@ -2524,16 +2530,16 @@ function serverCmdChangePlayersTeam( %clientRequesting, %client, %team) %client.notReady = true; %client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player ); %client.setControlObject( %client.camera ); - + if( $Host::TournamentMode && !$CountdownStarted) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - { + { %client.notReady = true; centerprint( %client, "\nPress FIRE when ready.", 0, 3 ); } } else commandToClient(%client, 'setHudMode', 'Standard', "", 0); - + %multiTeam = (Game.numTeams > 1); %aname = %clientRequesting.name; // z0dd - ZOD, 4-15-02. who did what @@ -2567,7 +2573,7 @@ function serverCmdStripAdmin(%client, %admin) logEcho(%client.nameBase @ " stripped admin from " @ %admin.nameBase, 1); return; } - else if(%client.isSuperAdmin) + else if(%client.isSuperAdmin) { messageAll( 'MsgStripAdminPlayer', '\c2%1 removed %2\'s admin privledges.', %client.name, %admin.name, %admin ); messageClient(%admin, 'MsgStripAdminPlayer', 'You are being stripped of your admin privledges by %1.', %client.name); @@ -2659,10 +2665,10 @@ function serverCmdGetMissionList( %client, %key, %type ) continue; } - messageClient( %client, 'MsgVoteItem', "", %key, - %idx, // mission index, will be stored in $clVoteCmd - "", - $HostMissionName[%idx], + messageClient( %client, 'MsgVoteItem', "", %key, + %idx, // mission index, will be stored in $clVoteCmd + "", + $HostMissionName[%idx], true ); } } @@ -2681,10 +2687,10 @@ function serverCmdClientPickedTeam( %client, %option ) // ------------------------------------------------------------------------------------- // z0dd - ZOD 4/18/02. Tourney mode bug fix. Fix provided by FSB-AO - // Bug description: In tournament mode, If a player is teamchanged by an admin before - // they select a team, the server just changes their team and re-skins the player. They + // Bug description: In tournament mode, If a player is teamchanged by an admin before + // they select a team, the server just changes their team and re-skins the player. They // are not moved from their initial spawn point, meaning they could spawn very close to - // the other teams flag. This script kills the player if they are already teamed when + // the other teams flag. This script kills the player if they are already teamed when // they select an option and spawns them on the correct side of the map. switch(%option) { @@ -2708,9 +2714,9 @@ function serverCmdClientPickedTeam( %client, %option ) if( !isObject(%client.player) ) { Game.assignClientTeam( %client, $MatchStarted ); - Game.spawnPlayer( %client, false ); + Game.spawnPlayer( %client, false ); } - default: + default: if( isObject(%client.player) ) { %client.player.scriptKill(0); @@ -2720,7 +2726,7 @@ function serverCmdClientPickedTeam( %client, %option ) %client.observerMode = "observer"; %client.notReady = false; return; - } + } // ------------------------------------------------------------------------------------- ClearBottomPrint(%client); @@ -2735,7 +2741,7 @@ function serverCmdClientPickedTeam( %client, %option ) function playerPickTeam( %client ) { %numTeams = Game.numTeams; - + if(%numTeams > 1) { %client.camera.mode = "PickingTeam"; @@ -2774,34 +2780,34 @@ function dumpGameString() function isOnAdminList(%client) { if( !%totalRecords = getFieldCount( $Host::AdminList ) ) - { + { return false; } - + for(%i = 0; %i < %totalRecords; %i++) { %record = getField( getRecord( $Host::AdminList, 0 ), %i); if(%record == %client.guid) return true; } - + return false; -} +} function isOnSuperAdminList(%client) { if( !%totalRecords = getFieldCount( $Host::superAdminList ) ) - { + { return false; } - + for(%i = 0; %i < %totalRecords; %i++) { %record = getField( getRecord( $Host::superAdminList, 0 ), %i); if(%record == %client.guid) return true; } - + return false; } @@ -2809,14 +2815,14 @@ function ServerCmdAddToAdminList( %admin, %client ) { if( !%admin.isSuperAdmin ) return; - + %count = getFieldCount( $Host::AdminList ); for ( %i = 0; %i < %count; %i++ ) { %id = getField( $Host::AdminList, %i ); if ( %id == %client.guid ) - { + { return; // They're already there! } } @@ -2878,13 +2884,13 @@ function forceTourneyMatchStart() if(%cl.camera.Mode $= "pre-game") %playerCount++; } - + // don't start the mission until we have players if(%playerCount == 0) - { - return false; + { + return false; } - + %count = ClientGroup.getCount(); for( %i = 0; %i < %count; %i++ ) { @@ -2896,7 +2902,7 @@ function forceTourneyMatchStart() commandToClient( %cl, 'processPickTeam'); // clear the pickteam menu Game.forceObserver( %cl, "adminForce" ); } - } + } return true; } @@ -2909,7 +2915,7 @@ function startTourneyCountdown() ClearCenterPrint(%cl); ClearBottomPrint(%cl); } - + // lets get it on! Countdown( 30 * 1000 ); } @@ -2918,11 +2924,11 @@ function checkTourneyMatchStart() { if( $CountdownStarted || $matchStarted ) return; - + // loop through all the clients and see if any are still notready %playerCount = 0; %notReadyCount = 0; - + %count = ClientGroup.getCount(); for( %i = 0; %i < %count; %i++ ) { @@ -2931,7 +2937,7 @@ function checkTourneyMatchStart() { %notReady[%notReadyCount] = %cl; %notReadyCount++; - } + } else if(%cl.camera.Mode $= "pre-game") { if(%cl.notready) @@ -2940,7 +2946,7 @@ function checkTourneyMatchStart() %notReadyCount++; } else - { + { %playerCount++; } } @@ -2949,7 +2955,7 @@ function checkTourneyMatchStart() // this guy is watching } } - + if(%notReadyCount) { if(%notReadyCount == 1) @@ -2959,7 +2965,7 @@ function checkTourneyMatchStart() for(%i = 0; %i < %notReadyCount - 2; %i++) %str = getTaggedString(%notReady[%i].name) @ ", " @ %str; - %str = "\c2" @ %str @ getTaggedString(%notReady[%i].name) @ " and " @ getTaggedString(%notReady[%i+1].name) + %str = "\c2" @ %str @ getTaggedString(%notReady[%i].name) @ " and " @ getTaggedString(%notReady[%i+1].name) @ " are holding things up!"; MessageAll( 'msgHoldingUp', %str ); } @@ -2977,8 +2983,8 @@ function checkTourneyMatchStart() ClearCenterPrint(%cl); ClearBottomPrint(%cl); } - - if ( Game.scheduleVote !$= "" && Game.voteType $= "VoteMatchStart") + + if ( Game.scheduleVote !$= "" && Game.voteType $= "VoteMatchStart") { messageAll('closeVoteHud', ""); cancel(Game.scheduleVote); @@ -2993,22 +2999,22 @@ function checkMissionStart() { %readyToStart = false; for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++) - { + { %client = ClientGroup.getObject(%clientIndex); if(%client.isReady) - { + { %readyToStart = true; break; } } - + if(%readyToStart || ClientGroup.getCount() < 1) - { + { if($Host::warmupTime > 0 && $CurrentMissionType !$= "SinglePlayer") countDown($Host::warmupTime * 1000); else - Game.startMatch(); - + Game.startMatch(); + // z0dd - ZOD, 5/12/04. First off, there is no time specified. Secondly, this isn't // in checkTourneyMatchStart, which it should have been. We do way with this and // handle it in vehicle::onAdd. @@ -3017,8 +3023,8 @@ function checkMissionStart() //$NumVehiclesDeploy = 0; } else - { - schedule(2000, ServerGroup, "checkMissionStart"); + { + schedule(2000, ServerGroup, "checkMissionStart"); } } @@ -3026,20 +3032,20 @@ function Countdown(%timeMS) { if($countdownStarted) return; - + echo("starting mission countdown..."); - + if(isObject(Game)) %game = Game.getId(); else return; - + $countdownStarted = true; Game.matchStart = Game.schedule( %timeMS, "StartMatch" ); if (%timeMS > 30000) notifyMatchStart(%timeMS); - + if(%timeMS >= 30000) Game.thirtyCount = schedule(%timeMS - 30000, Game, "notifyMatchStart", 30000); if(%timeMS >= 15000) @@ -3061,12 +3067,12 @@ function Countdown(%timeMS) function EndCountdown(%timeMS) { echo("mission end countdown..."); - + if(isObject(Game)) %game = Game.getId(); else return; - + if(%timeMS >= 180000) Game.endthreeminuteCount = schedule(%timeMS - 180000, Game, "notifyMatchEndMinutes", 180000); if(%timeMS >= 120000) @@ -3111,7 +3117,7 @@ function CancelCountdown() cancel(Game.oneCount); if(isObject(Game)) cancel(Game.matchStart); - + Game.matchStart = ""; Game.thirtyCount = ""; Game.fifteenCount = ""; @@ -3148,7 +3154,7 @@ function CancelEndCountdown() cancel(Game.endtwoCount); if(Game.endoneCount !$= "") cancel(Game.endoneCount); - + Game.endmatchStart = ""; Game.endthirtyCount = ""; Game.endtenCount = ""; @@ -3163,11 +3169,11 @@ function resetServerDefaults() { $resettingServer = true; echo( "Resetting server defaults..." ); - + if( isObject( Game ) ) Game.gameOver(); - - // Override server defaults with prefs: + + // Override server defaults with prefs: exec( "scripts/ServerDefaults.cs" ); exec( $serverprefs ); @@ -3187,7 +3193,7 @@ function resetServerDefaults() $TeamName[%index] = addTaggedString($Host::TeamName[%index]); %index++; } - + // Get the hologram names from the prefs... %index = 1; while ( $Host::holoName[%index] !$= "" ) @@ -3199,11 +3205,11 @@ function resetServerDefaults() // kick all bots... removeAllBots(); - + // add bots back if they were there before.. if( $Host::botsEnabled ) // z0dd - ZOD, 9/29/02. Removed T2 demo code from here initGameBots( $Host::Map, $Host::MissionType ); - + // load the missions loadMission( $Host::Map, $Host::MissionType ); $resettingServer = false; @@ -3237,7 +3243,7 @@ function getServerGUIDList() if ( %list $= "" ) %list = %guid; else - %list = %list TAB %guid; + %list = %list TAB %guid; } } } @@ -3246,11 +3252,11 @@ function getServerGUIDList() } //------------------------------------------------------------------------------ -// will return the first admin found on the server +// will return the first admin found on the server function getAdmin() { %admin = 0; - for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) + for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) { %cl = ClientGroup.getObject( %clientIndex ); if(%cl.isAdmin || %cl.isSuperAdmin) @@ -3259,7 +3265,7 @@ function getAdmin() break; } } - return %admin; + return %admin; } function serverCmdSetPDAPose(%client, %val) @@ -3405,4 +3411,4 @@ function GameConnection::ResetTagSwitchWait(%this) function serverCmdGetTargetGameName(%client) { // No more spam -} \ No newline at end of file +}