From 116e6f906188e3331417d4868f804fd18047fb07 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Tue, 29 Sep 2020 01:22:53 -0400 Subject: [PATCH 01/15] Added Gamepoint --- Classic/scripts/SCtFGame.cs | 49 ++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index d486513..e2ec982 100644 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -926,21 +926,42 @@ function SCtFGame::flagCap(%game, %player) //call the AI function %game.AIflagCap(%player, %flag); - //if this cap didn't end the game, play the announcer... - if ($missionRunning) + //Determine score status + %caplimit = MissionGroup.CTF_scoreLimit; + %otherteam = ( %client.team == 1 ) ? 2 : 1; + //Find out caps from score + %clientteamcaps = mFloor($TeamScore[%client.team] / %game.SCORE_PER_TEAM_FLAG_CAP); + %otherteamcaps = mFloor($TeamScore[%otherteam] / %game.SCORE_PER_TEAM_FLAG_CAP); + + //Determine Gamepoint + if(%clientteamcaps >= (%caplimit - 1)) { - if (%game.getTeamName(%client.team) $= 'Inferno') - messageAll("", '~wvoice/announcer/ann.infscores.wav'); - else if (%game.getTeamName(%client.team) $= 'Storm') - messageAll("", '~wvoice/announcer/ann.stoscores.wav'); - else if (%game.getTeamName(%client.team) $= 'Phoenix') - messageAll("", '~wvoice/announcer/ann.pxscore.wav'); - else if (%game.getTeamName(%client.team) $= 'Blood Eagle') - messageAll("", '~wvoice/announcer/ann.bescore.wav'); - else if (%game.getTeamName(%client.team) $= 'Diamond Sword') - messageAll("", '~wvoice/announcer/ann.dsscore.wav'); - else if (%game.getTeamName(%client.team) $= 'Starwolf') - messageAll("", '~wvoice/announcer/ann.swscore.wav'); + if(%clientteamcaps == %otherteamcaps) + %scorestatus = "tied"; + else + %scorestatus = "gamepoint"; + } + else + %scorestatus = "normal"; + + //if this cap didn't end the game, play the announcer... + if($missionRunning) + { + switch$(%scorestatus) + { + case normal: + //classic uses only storm/inferno + if(%game.getTeamName(%client.team) $= 'Inferno') + messageAll("", '~wvoice/announcer/ann.infscores.wav'); + else if(%game.getTeamName(%client.team) $= 'Storm') + messageAll("", '~wvoice/announcer/ann.stoscores.wav'); + case tied: + //Announce tied message + messageAll("", '~wvoice/announcer/ann.closegame_03.wav'); + case gamepoint: + //Announce gamepoint + messageAll("", '~wvoice/announcer/ann.gamepoint_imminent.wav'); + } } } From 7e894284c50666e98ed4b47491832032832880d7 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Tue, 29 Sep 2020 13:15:14 -0400 Subject: [PATCH 02/15] Update zDarkTigerStats.cs --- Classic/scripts/autoexec/zDarkTigerStats.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs index 9449877..55b1896 100644 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -167,10 +167,15 @@ // Removed lockout schedule on chain kills, left the multi kill one in as its kind of nessaary in how it functions // Renamed mid air distance vars to know at a glance how its tracking, Ex: instead of cgMaDist renamed to cgMAHitDist // Fixed land spike turret stats +// +// 7.7 +// Added teamScore to player game files for correct team scores +// KDR adjustment +// Adjusted cleanup function //-----------Settings------------ //Notes score ui width is 592 -$dtStats::version = 7.6; +$dtStats::version = 7.7; //disable stats system $dtStats::Enable = 1; //enable disable map stats @@ -423,6 +428,7 @@ $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "PulseSensorDep"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "InventoryDep"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "TurretOutdoorDep"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "TurretIndoorDep"; +$dtStats::FV[$dtStats::FC["CTFGame","Game"]++,"CTFGame","Game"] = "teamScore"; ///////////////////////////////////////////////////////////////////////////// //Unused vars needed for stats back up @@ -505,6 +511,7 @@ $dtStats::FV[$dtStats::FC["SCtFGame","Avg"]++,"SCtFGame","Avg"] = "winLostPct"; $dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "dtTeam"; $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "destruction"; $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "repairs"; +$dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "teamScore"; ////////////////////////////Unused LCTF Vars///////////////////////////////////// $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "tkDestroys"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "genDestroys"; @@ -561,6 +568,7 @@ $dtStats::FVG[$dtStats::FCG["ArenaGame","TG"]++,"ArenaGame","TG"] = "assists"; $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"; /////////////////////////////////////////////////////////////////////////////// // SiegeGame /////////////////////////////////////////////////////////////////////////////// @@ -3801,7 +3809,7 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en if(!isObject(%dtStats)) return; %dtStats.null = getRandom(1,100); - %dtStats.kdr = (%dtStats.kills / (%dtStats.deaths ? %dtStats.deaths : 1)); + %dtStats.kdr = %dtStats.deaths ? (%dtStats.kills/%dtStats.deaths) : %dtStats.kills; if(statsGroup.lastKill == %dtStats) %dtStats.lastKill = 1; @@ -3935,6 +3943,8 @@ 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.destruction = %dtStats.genDestroys + %dtStats.solarDestroys + %dtStats.sensorDestroys + @@ -3984,6 +3994,8 @@ 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]; } function isGameRun(){// @@ -11296,7 +11308,7 @@ function dtCleanUp(%force){ %gcCM = getField(%gameCountLine,6); %gcPM = getField(%gameCountLine,5); %gc = (%gcCM > %gcPM) ? %gcCM : %gcPM; - %extraDays = mCeil((%gc * $dtStats::expireFactor[%game]) + $dtStats::expireMin); + %extraDays = mCeil((%gc * $dtStats::expireFactor[%game])); //error(%extraDays SPC %dayCount); if(%dayCount > %extraDays || %dayCount > $dtStats::expireMax){ if($dtStats::sm || %force){ @@ -11305,12 +11317,12 @@ function dtCleanUp(%force){ schedule(%v++ * 500,0,"deleteFile",%filepath); %oldFileCount++; } - %gPath = strreplace(%filepath,"t.cs","g.cs"); %mPath = strreplace(%filepath,"t.cs","m.cs"); if(isFile(%mPath)){ schedule(%v++ * 500,0,"deleteFile",%mPath); %oldFileCount++; } + %gPath = strreplace(%filepath,"t.cs","g.cs"); if(isFile(%gPath)){ schedule(%v++ * 500,0,"deleteFile",%gPath); %oldFileCount++; From 99d44f0328be628b45f95c8fc83275f9a7504165 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Tue, 29 Sep 2020 14:30:47 -0400 Subject: [PATCH 03/15] Dynamic TeamRank --- Classic/scripts/autoexec/Autobalance.cs | 28 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs index 9f872c8..a5e8b41 100644 --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -12,10 +12,8 @@ // Meaning picking from a pool of all players on the $BigTeam instead of just the lowest scoring players. // 400 equals 400 points. 4 caps behind. $Autobalance::AMThreshold = 300; -// Based on BigTeams Top3 scorers. If BigTeams Top3 scorers is greater than the otherTeams Top3 + Top3Threshold. Use AllMode. -$Autobalance::Top3Threshold = 400; // If it takes too long for specific canidates to die. After a time choose anyone. -$Autobalance::Fallback = 90000; +$Autobalance::Fallback = 60000; //60000 is 1 minute // Run from TeamBalanceNotify.cs via NotifyUnbalanced function Autobalance( %game ) @@ -40,12 +38,26 @@ function Autobalance( %game ) $Autobalace::UseAllMode = 0; %otherTeam = $BigTeam == 1 ? 2 : 1; - %bigTeamTop3 = $TeamRank[$BigTeam, 0].score + $TeamRank[$BigTeam, 1].score + $TeamRank[$BigTeam, 2].score; - %otherTeamTop3 = $TeamRank[%otherTeam, 0].score + $TeamRank[%otherTeam, 1].score + $TeamRank[%otherTeam, 2].score; - //Anyone who dies is eligable to switch - //If BigTeam score is greater than otherteam score + threshold or BigTeam Top3 is greater than otherTeam Top3 + Top3Threshold - if($TeamScore[$BigTeam] > ($TeamScore[%otherTeam] + $Autobalance::AMThreshold) || $TeamRank[%otherTeam, count] $= 0 || %bigTeamTop3 > (%otherTeamTop3 + $Autobalance::Top3Threshold)) + + //If BigTeam score is greater than otherteam score + threshold + if($TeamScore[$BigTeam] > ($TeamScore[%otherTeam] + $Autobalance::AMThreshold) || $TeamRank[%otherTeam, count] $= 0) $Autobalace::UseAllMode = 1; + //BigTeam Top is greater than otherTeam Top + 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)) + $Autobalace::UseAllMode = 1; + } //echo("Allmode " @ $Autobalace::UseAllMode); //Select lower half of team rank as canidates for team change From 80e6f56123081b825667d0b9d9f0ad439dab9a50 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Tue, 29 Sep 2020 15:20:15 -0400 Subject: [PATCH 04/15] Update zDarkTigerStats.cs --- Classic/scripts/autoexec/zDarkTigerStats.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs index 55b1896..cbf8ebe 100644 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -172,6 +172,7 @@ // Added teamScore to player game files for correct team scores // KDR adjustment // Adjusted cleanup function +// Mine disc kill fix //-----------Settings------------ //Notes score ui width is 592 @@ -5259,8 +5260,8 @@ function clientKillStats(%game,%clVictim, %clKiller, %damageType, %implement, %d if(%killerDT.discKillDist < %dis){%killerDT.discKillDist = %dis;} if(%killerDT.discKillVV < %victimVel){%killerDT.discKillVV = %victimVel;} if(%killerDT.discKillSV < %clKiller.dtShotSpeed){%killerDT.discKillSV = %clKiller.dtShotSpeed;} - if(%isCombo){%killerDT.discCom++;} - if((getSimTime() - %clKiller.mdHitTime) < 256){%killerDT.minePlusDiscKill++;} + if(%isCombo){%killerDT.discCom++;} + if(%clKiller.mdHit){%killerDT.minePlusDiscKill++;} if(%kcAir == 1 && %vcAir == 1){%killerDT.discKillAir++;%victimDT.discDeathAir++;%killerDT.discKillAirAir++;%victimDT.discDeathAirAir++;} else if(%kcAir == 2 && %vcAir == 1){%killerDT.discKillAir++;%victimDT.discDeathAir++;%killerDT.discKillGroundAir++;%victimDT.discDeathGroundAir++;} @@ -5366,8 +5367,7 @@ function clientKillStats(%game,%clVictim, %clKiller, %damageType, %implement, %d if(%killerDT.mineKillDist < %dis){%killerDT.mineKillDist = %dis;} if(%killerDT.mineKillVV < %victimVel){%killerDT.mineKillVV = %victimVel;} if(%isCombo){%killerDT.mineCom++;} - if((getSimTime() - %clKiller.mdHitTime) < 256){%killerDT.minePlusDiscKill++;} - + if(%clKiller.mdHit){%killerDT.minePlusDiscKill++;} if(%kcAir == 1 && %vcAir == 1){%killerDT.mineKillAir++;%victimDT.mineDeathAir++;%killerDT.mineKillAirAir++;%victimDT.mineDeathAirAir++;} else if(%kcAir == 2 && %vcAir == 1){%killerDT.mineKillAir++;%victimDT.mineDeathAir++;%killerDT.mineKillGroundAir++;%victimDT.mineDeathGroundAir++;} else if(%kcAir == 1 && %vcAir == 2){%killerDT.mineKillGround++;%victimDT.mineDeathGround++;%killerDT.mineKillAirGround++;%victimDT.mineDeathAirGround++;} @@ -5765,8 +5765,8 @@ function clientDmgStats(%data,%position,%sourceObject, %targetObject, %damageTyp %sourceDT.discDmgACC = (%sourceDT.discDmgHits / (%sourceDT.discShotsFired ? %sourceDT.discShotsFired : 1)) * 100; if(%sourceDT.discHitDist < %dis){%sourceDT.discHitDist = %dis;} if(%sourceDT.weaponHitDist < %dis){%sourceDT.weaponHitDist = %dis;} - %targetClient.mdHit = 0; - if((getSimTime() - %targetClient.mdTime1) < 256){%sourceDT.minePlusDisc++; %targetClient.mdHit = 1;} + %sourceClient.mdHit = 0; + if((getSimTime() - %targetClient.mdTime1) < 256){%sourceDT.minePlusDisc++; %sourceClient.mdHit = 1;} %targetClient.mdTime2 = getSimTime(); if(%rayTest >= $dtStats::midAirHeight){ if(%sourceDT.discMAHitDist < %dis){%sourceDT.discMAHitDist = %dis;} @@ -5876,13 +5876,13 @@ function clientDmgStats(%data,%position,%sourceObject, %targetObject, %damageTyp } if(%sourceDT.shockHitSV < %sourceObject.client.dtShotSpeed){%sourceDT.shockHitSV = %sourceObject.client.dtShotSpeed;} if(%sourceDT.shockHitVV < %vv){%sourceDT.shockHitVV = %vv;} - case $DamageType::Mine: + case $DamageType::Mine: %sourceDT.mineDmg += %amount; %sourceDT.mineHits++; %sourceDT.mineACC = (%sourceDT.mineHits / (%sourceDT.mineShotsFired ? %sourceDT.mineShotsFired : 1)) * 100; if(%sourceDT.mineHitDist < %dis){%sourceDT.mineHitDist = %dis;} - %targetClient.mdHit = 0; - if((getSimTime() - %targetClient.mdTime2) < 256){%sourceDT.minePlusDisc++; %targetClient.mdHit = 1;} + %sourceClient.mdHit = 0; + if((getSimTime() - %targetClient.mdTime2) < 256){%sourceDT.minePlusDisc++; %sourceClient.mdHit = 1;} %targetClient.mdTime1 = getSimTime(); if(%rayTest >= $dtStats::midAirHeight){ if(%sourceDT.mineMAHitDist < %dis){%sourceDT.mineMAHitDist = %dis;} From 7abc79fa96d36e82fba1308e4dda8a155e3f4934 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Wed, 30 Sep 2020 13:36:22 -0400 Subject: [PATCH 05/15] Update Autobalance.cs --- Classic/scripts/autoexec/Autobalance.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs index a5e8b41..df8a503 100644 --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -8,10 +8,6 @@ // // exec("scripts/autoexec/Autobalance.cs"); // -// How far behind otherteam must be to use All Mode. -// Meaning picking from a pool of all players on the $BigTeam instead of just the lowest scoring players. -// 400 equals 400 points. 4 caps behind. -$Autobalance::AMThreshold = 300; // If it takes too long for specific canidates to die. After a time choose anyone. $Autobalance::Fallback = 60000; //60000 is 1 minute @@ -38,15 +34,16 @@ function Autobalance( %game ) $Autobalace::UseAllMode = 0; %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) $Autobalace::UseAllMode = 1; - //BigTeam Top is greater than otherTeam Top + threshold + //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]) + if(%max > $TeamRank[%otherTeam, count]) %max = $TeamRank[%otherTeam, count]; %threshold = %max * 100; for(%i = 0; %i < %max; %i++) From 96e137fb1d3afff8eb760a0c9a42fe42db5120b9 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Thu, 1 Oct 2020 12:10:39 -0400 Subject: [PATCH 06/15] Autobalance echo info --- Classic/scripts/autoexec/Autobalance.cs | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) mode change 100644 => 100755 Classic/scripts/autoexec/Autobalance.cs diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs old mode 100644 new mode 100755 index df8a503..03496be --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -13,17 +13,17 @@ $Autobalance::Fallback = 60000; //60000 is 1 minute // Run from TeamBalanceNotify.cs via NotifyUnbalanced function Autobalance( %game ) -{ - if(isEventPending($AutoBalanceSchedule)) +{ + 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; @@ -35,7 +35,7 @@ function Autobalance( %game ) $Autobalace::UseAllMode = 0; %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) $Autobalace::UseAllMode = 1; @@ -51,12 +51,12 @@ function Autobalance( %game ) %bigTeamTop = %bigTeamTop + $TeamRank[$BigTeam, %i].score; %otherTeamTop = %otherTeamTop + $TeamRank[%otherTeam, %i].score; } - + if(%bigTeamTop > (%otherTeamTop + %threshold)) $Autobalace::UseAllMode = 1; } //echo("Allmode " @ $Autobalace::UseAllMode); - + //Select lower half of team rank as canidates for team change if(!$Autobalace::UseAllMode) { @@ -68,10 +68,10 @@ function Autobalance( %game ) } %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); } @@ -98,17 +98,17 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, % { %otherTeam = $BigTeam == 1 ? 2 : 1; if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 2) - { + { if($Autobalance::CanidateFallbackTime $= "") $Autobalance::CanidateFallbackTime = getSimTime(); - + //damageType 0: If someone switches to observer or disconnects - if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalace::UseAllMode || (getSimTime() - $Autobalance::CanidateFallbackTime > $Autobalance::Fallback))) + if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalace::UseAllMode || (getSimTime() - $Autobalance::CanidateFallbackTime > $Autobalance::Fallback))) { - echo(%clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing."); + echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalace::UseAllMode @ "]"); 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 ); } } @@ -124,7 +124,7 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, % function DefaultGame::gameOver(%game) { Parent::gameOver(%game); - + //Reset Autobalance $BigTeam = ""; deleteVariables("$Autobalace::Canidate*"); @@ -134,4 +134,4 @@ function DefaultGame::gameOver(%game) // Prevent package from being activated if it is already if (!isActivePackage(Autobalance)) - activatePackage(Autobalance); \ No newline at end of file + activatePackage(Autobalance); From f56767693ce37880f684048beda454624dc2be48 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Fri, 2 Oct 2020 15:01:54 -0400 Subject: [PATCH 07/15] Update 7.8 --- Classic/scripts/autoexec/zDarkTigerStats.cs | 53 +++++++++++++++++++-- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs index cbf8ebe..6c11709 100644 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -173,10 +173,14 @@ // KDR adjustment // Adjusted cleanup function // Mine disc kill fix +// +// 7.8 +// Added Armor Timers + //-----------Settings------------ //Notes score ui width is 592 -$dtStats::version = 7.7; +$dtStats::version = 7.8; //disable stats system $dtStats::Enable = 1; //enable disable map stats @@ -802,6 +806,10 @@ $dtStats::FV[$dtStats::FC["TTL"]++,"TTL"] = "lagSpikes"; $dtStats::FV[$dtStats::FC["TTL"]++,"TTL"] = "clientCrash"; +$dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "lArmorTime"; +$dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "mArmorTime"; +$dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "hArmorTime"; + $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "armorL"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "armorM"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "armorH"; @@ -1959,6 +1967,16 @@ package dtStats{ } parent::onLeaveTrigger(%data, %obj, %colObj); } + function DefaultGame::playerSpawned(%game, %player){ + parent::playerSpawned(%game, %player); + if($dtStats::Enable) + armorTimer(%player.client.dtStats, %player.getArmorSize(), 0); + } + function Player::setArmor(%this,%size){//for game types that use spawn favs + parent::setArmor(%this,%size); + if($dtStats::Enable) + armorTimer(%this.client.dtStats, %size, 0); + } function Weapon::onPickup(%this, %obj, %shape, %amount){ parent::onPickup(%this, %obj, %shape, %amount); if($dtStats::Enable) @@ -3809,6 +3827,7 @@ function dtSaveDone(){ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the end of the match 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) @@ -4022,7 +4041,7 @@ function ArenaGame::getGamePct(%game){ else if( $TeamScore[1] <= $TeamScore[2]){ return ($TeamScore[2] / %game.roundLimit) * 100; } - } + } } return 0; } @@ -4039,7 +4058,6 @@ function CTFGame::getGamePct(%game){ %scorePct = ($TeamScore[1] / %scoreLimit) * 100; else %scorePct = ($TeamScore[2] / %scoreLimit) * 100; - if(%scorePct > %timePct) return %scorePct; @@ -4204,9 +4222,10 @@ function getCNameToCID(%name){ return %name; // not a name its a client so return it } else{ + %name = stripChars(%name, "\cp\co\c6\c7\c8\c9" ); for (%i = 0; %i < ClientGroup.getCount(); %i++){ %client = ClientGroup.getObject(%i); - if(stripChars(getTaggedString( %client.name ), "\cp\co\c6\c7\c8\c9" ) $= %name){ + if(stripChars( getTaggedString( %client.name ), "\cp\co\c6\c7\c8\c9" ) $= %name){ return %client; } } @@ -5108,6 +5127,29 @@ function buildVarList(){ //////////////////////////////////////////////////////////////////////////////// //Stats Collecting //////////////////////////////////////////////////////////////////////////////// +function armorTimer(%dtStats, %size, %death){ + if(%dtStats.lastArmor $= "Light" && %dtStats.ArmorTime[%dtStats.lastArmor] > 0){ + %dtStats.lArmorTime += ((getSimTime() - %dtStats.ArmorTime[%dtStats.lastArmor])/1000)/60; + %dtStats.ArmorTime[%dtStats.lastArmor] = 0; + %dtStats.lastArmor = 0; + } + else if(%dtStats.lastArmor $= "Medium" && %dtStats.ArmorTime[%dtStats.lastArmor] > 0){ + %dtStats.mArmorTime += ((getSimTime() - %dtStats.ArmorTime[%dtStats.lastArmor])/1000)/60; + %dtStats.ArmorTime[%dtStats.lastArmor] = 0; + %dtStats.lastArmor = 0; + } + else if(%dtStats.lastArmor $= "Heavy" && %dtStats.ArmorTime[%dtStats.lastArmor] > 0){ + %dtStats.hArmorTime += ((getSimTime() - %dtStats.ArmorTime[%dtStats.lastArmor])/1000)/60; + %dtStats.ArmorTime[%dtStats.lastArmor] = 0; + %dtStats.lastArmor = 0; + } + if(!%death){ + %dtStats.ArmorTime[%size] = getSimTime(); + %dtStats.lastArmor = %size; + } + //error(%dtStats.lArmorTime SPC %dtStats.mArmorTime SPC %dtStats.hArmorTime); +} + function clientKillStats(%game,%clVictim, %clKiller, %damageType, %implement, %damageLocation){ if(%damageType == $DamageType::Explosion || %damageType == $DamageType::Ground || %damageType == $DamageType::OutOfBounds || %damageType == $DamageType::Lava || @@ -5131,6 +5173,7 @@ function clientKillStats(%game,%clVictim, %clKiller, %damageType, %implement, %d %victimPlayer = isObject(%clVictim.player) ? %clVictim.player : %clVictim.lastPlayer; %killerPlayer = isObject(%clKiller.player) ? %clKiller.player : %clKiller.lastPlayer; %clVictim.lp = "";//last position for distMove + armorTimer(%victimDT, 0, 1); //------------------------------------------------------------------------------ %victimDT.timeToLive += getSimTime() - %clVictim.spawnTime; %victimDT.timeTL = mFloor((%victimDT.timeToLive/(%clVictim.deaths+%clVictim.suicides ? %clVictim.deaths+%clVictim.suicides : 1))/1000); @@ -11307,7 +11350,7 @@ function dtCleanUp(%force){ if(%dayCount > $dtStats::expireMin){ %gcCM = getField(%gameCountLine,6); %gcPM = getField(%gameCountLine,5); - %gc = (%gcCM > %gcPM) ? %gcCM : %gcPM; + %gc = (%gcCM > %gcPM) ? %gcCM : %gcPM; %extraDays = mCeil((%gc * $dtStats::expireFactor[%game])); //error(%extraDays SPC %dayCount); if(%dayCount > %extraDays || %dayCount > $dtStats::expireMax){ From 47065a85d6187596e656a3b477fac6015ccdc09b Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Fri, 2 Oct 2020 19:52:42 -0400 Subject: [PATCH 08/15] Added Check --- Classic/scripts/autoexec/Autobalance.cs | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs index 03496be..bb6ffea 100755 --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -32,14 +32,14 @@ function Autobalance( %game ) else return; - $Autobalace::UseAllMode = 0; + $Autobalance::UseAllMode = 0; %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) - $Autobalace::UseAllMode = 1; - //BigTeam Top Players score is greater than otherTeam Top Players score + threshold + $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); @@ -53,12 +53,12 @@ function Autobalance( %game ) } if(%bigTeamTop > (%otherTeamTop + %threshold)) - $Autobalace::UseAllMode = 1; + $Autobalance::UseAllMode = 1; } - //echo("Allmode " @ $Autobalace::UseAllMode); + //echo("Allmode " @ $Autobalance::UseAllMode); //Select lower half of team rank as canidates for team change - if(!$Autobalace::UseAllMode) + if(!$Autobalance::UseAllMode) { $Autobalance::Max = mFloor($TeamRank[$BigTeam, count]/2); for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++) @@ -79,11 +79,14 @@ function Autobalance( %game ) // Return true if client is a canidate function CheckCanidate(%client) { - for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++) - { - if(%client $= $Autobalance::Canidate[%i]) - return true; - } + if(!$Autobalance::UseAllMode) + { + for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++) + { + if(%client $= $Autobalance::Canidate[%i]) + return true; + } + } return false; } @@ -103,9 +106,9 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, % $Autobalance::CanidateFallbackTime = getSimTime(); //damageType 0: If someone switches to observer or disconnects - if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalace::UseAllMode || (getSimTime() - $Autobalance::CanidateFallbackTime > $Autobalance::Fallback))) + if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalance::UseAllMode || (getSimTime() - $Autobalance::CanidateFallbackTime > $Autobalance::Fallback))) { - echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalace::UseAllMode @ "]"); + echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode @ "]"); 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'); From 023476ea9faf91f09b7535a7068495e379a4ccc9 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Mon, 5 Oct 2020 16:35:31 -0400 Subject: [PATCH 09/15] Added Concussion and Invy use stat --- Classic/scripts/autoexec/zDarkTigerStats.cs | 106 ++++++++++++++++---- 1 file changed, 87 insertions(+), 19 deletions(-) diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs index 6c11709..f416e16 100644 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -177,10 +177,13 @@ // 7.8 // Added Armor Timers +// 7.9 +// Added Concussion Stats +// Invy use stat //-----------Settings------------ //Notes score ui width is 592 -$dtStats::version = 7.8; +$dtStats::version = 7.9; //disable stats system $dtStats::Enable = 1; //enable disable map stats @@ -268,7 +271,7 @@ $dtStats::debugEchos = 1;// echos function calls //--------------------------------- // Torque Markup Language - TML -// Reference Tags +// Reference Tags //--------------------------------- //Sets the current font to the indicated name and size. Example: @@ -434,7 +437,8 @@ $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "InventoryDep"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "TurretOutdoorDep"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "TurretIndoorDep"; $dtStats::FV[$dtStats::FC["CTFGame","Game"]++,"CTFGame","Game"] = "teamScore"; - +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "concussFlag"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "depInvyUse"; ///////////////////////////////////////////////////////////////////////////// //Unused vars needed for stats back up $dtStats::uGFV[$dtStats::uGFC["CTFGame"]++,"CTFGame"] = "returnPts"; @@ -517,6 +521,7 @@ $dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "dtTeam"; $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "destruction"; $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "repairs"; $dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "teamScore"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "concussFlag"; ////////////////////////////Unused LCTF Vars///////////////////////////////////// $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "tkDestroys"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "genDestroys"; @@ -783,6 +788,8 @@ $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "deathKills"; //$dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "mineDiscShots"; $dtStats::FV[$dtStats::FC["Avg"]++,"Avg"] = "kdr"; $dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "ctrlKKills"; +$dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "concussHit"; +$dtStats::FV[$dtStats::FC["TG"]++,"TG"] = "concussTaken"; // nongame $dtStats::FV[$dtStats::FC["TTL"]++,"TTL"] = "leavemissionareaCount"; @@ -1963,6 +1970,11 @@ package dtStats{ } %player.dtRepairPickup = 0; } + if(%name $= "DeployedStationInventory"){ + %ow = %obj.station.owner; + if(isObject(%ow) && %ow != %colObj.client) + %ow.dtStats.depInvyUse++; + } } } parent::onLeaveTrigger(%data, %obj, %colObj); @@ -2054,6 +2066,32 @@ package dtStats{ } return %obj; } + function Armor::applyConcussion( %this, %dist, %radius, %sourceObject, %targetObject ){ + if($dtStats::Enable){ + %sourceObject.client.dtStats.concussHit++; + %targetObject.client.dtStats.concussTaken++; + %targetObject.concussBy = %sourceObject.client.dtStats; + } + parent::applyConcussion( %this, %dist, %radius, %sourceObject, %targetObject ); + } + function SCtFGame::applyConcussion(%game, %player){ + parent::applyConcussion(%game, %player); + if($dtStats::Enable){ + %dtStats = %player.concussBy; + if(isObject(%dtStats)) + %dtStats.concussFlag++; + %player.concussBy = -1; + } + } + function CTFGame::applyConcussion(%game, %player){ + parent::applyConcussion(%game, %player); + if($dtStats::Enable){ + %dtStats = %player.concussBy; + if(isObject(%dtStats)) + %dtStats.concussFlag++; + %player.concussBy = -1; + } + } //function TurretData::replaceCallback(%this, %turret, %engineer){ //parent::replaceCallback(%this, %turret, %engineer); //if (%engineer.getMountedImage($BackPackSlot) != 0 && $dtStats::Enable){ @@ -2137,6 +2175,7 @@ package dtStatsGame{ } return %p; } + function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC){ if($dtStats::Enable) clientDmgStats(%data,%position,%sourceObject,%targetObject, %damageType,%amount); @@ -4638,7 +4677,7 @@ function incGameStats(%dtStats,%game) {// record that games stats and inc by one setValueField(%dtStats,"monthStamp","g",%game,%c,$dtStats::curMonth); setValueField(%dtStats,"quarterStamp","g",%game,%c,$dtStats::curQuarter); setValueField(%dtStats,"yearStamp","g",%game,%c,$dtStats::curYear); - setValueField(%dtStats,"dateStamp","g",%game,%c,formattimestring("yy-mm-dd hh:nn:ss")); + setValueField(%dtStats,"dateStamp","g",%game,%c,formattimestring("yy-mm-dd HH:nn:ss")); setValueField(%dtStats,"timeDayMonth","g",%game,%c,formattimestring("hh:nn a, mm-dd")); setValueField(%dtStats,"map","g",%game,%c,$dtStats::LastMissionDN); setValueField(%dtStats,"mapID","g",%game,%c,getMapID($dtStats::LastMissionCM,%game,0,1)); @@ -8183,6 +8222,21 @@ function statsMenu(%client,%game){ %nameTitle2 = "" @ %var2Title SPC "" @ %i2; %nameTitle3 = "" @ %var3Title SPC "" @ %i3; messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%vClient,0,%nameTitle1,%nameTitle2,%nameTitle3,%vsc1,%vsc2,%vsc3); + //16 + %var1 = "lArmorTimeTG"; %var1Title = "Lt Armor Time:"; %var1Name = "Scout Armor Time"; %var1TypeName = "Minutes"; + %var2 = "mArmorTimeTG"; %var2Title = "Med Armor Time:"; %var2Name = "Assault Armor Time"; %var2TypeName = "Minutes"; + %var3 = "hArmorTimeTG"; %var3Title = "Hvy Armor Time:"; %var3Name = "Juggernaut Armor Time"; %var3TypeName = "Minutes"; + %i1 = getField($lData::data[%var1,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var1,%client.lgame,%lType,%mon,%year],0) : %NA; + %i2 = getField($lData::data[%var2,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var2,%client.lgame,%lType,%mon,%year],0) : %NA; + %i3 = getField($lData::data[%var3,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var3,%client.lgame,%lType,%mon,%year],0) : %NA; + %client.statsFieldSet[%vsc1 = %f++] = %var1 TAB %var1Name TAB %var1TypeName; + %client.statsFieldSet[%vsc2 = %f++] = %var2 TAB %var2Name TAB %var2TypeName; + %client.statsFieldSet[%vsc3 = %f++] = %var3 TAB %var3Name TAB %var3TypeName; + %line = '\t%3\t%4\t%5'; + %nameTitle1 = "" @ %var1Title SPC "" @ %i1; + %nameTitle2 = "" @ %var2Title SPC "" @ %i2; + %nameTitle3 = "" @ %var3Title SPC "" @ %i3; + messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%vClient,0,%nameTitle1,%nameTitle2,%nameTitle3,%vsc1,%vsc2,%vsc3); case "SCtfGame": //1 %var1 = "scoreTG"; %var1Title = "Score Total:"; %var1Name = "Score Total"; %var1TypeName = "Total"; @@ -9217,22 +9271,36 @@ function statsMenu(%client,%game){ %nameTitle2 = "" @ %var2Title SPC "" @ %i2; %nameTitle3 = "" @ %var3Title SPC "" @ %i3; messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%vClient,0,%nameTitle1,%nameTitle2,%nameTitle3,%vsc1,%vsc2,%vsc3); - //13 - //%var1 = "lightningMAEVKillsTG"; %var1Title = "MA + Lightning Kills:"; %var1Name = "MA Lightning Kills, Wep + Lightning"; %var1TypeName = "Total"; - //%var2 = "lightningMAHitsTG"; %var2Title = "Lightning + Ma Hits:"; %var2Name = "Lightning Kills"; %var2TypeName = "Total"; - //%var3 = "lightningMAEVHitsTG"; %var3Title = "Ma Hits + Lightning"; %var3Name = "Lightning MA Kills"; %var3TypeName = "Total"; - //%i1 = getField($lData::data[%var1,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var1,%client.lgame,%lType,%mon,%year],0) : %NA; - //%i2 = getField($lData::data[%var2,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var2,%client.lgame,%lType,%mon,%year],0) : %NA; - //%i3 = getField($lData::data[%var3,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var3,%client.lgame,%lType,%mon,%year],0) : %NA; - //%client.statsFieldSet[%vsc1 = %f++] = %var1 TAB %var1Name TAB %var1TypeName; - //%client.statsFieldSet[%vsc2 = %f++] = %var2 TAB %var2Name TAB %var2TypeName; - //%client.statsFieldSet[%vsc3 = %f++] = %var3 TAB %var3Name TAB %var3TypeName; - //%line = '\t%3\t%4\t%5'; - //%nameTitle1 = "" @ %var1Title SPC "" @ %i1; - //%nameTitle2 = "" @ %var2Title SPC "" @ %i2; - //%nameTitle3 = "" @ %var3Title SPC "" @ %i3; - //messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%vClient,0,%nameTitle1,%nameTitle2,%nameTitle3,%vsc1,%vsc2,%vsc3); + %var1 = "lightningMAEVKillsTG"; %var1Title = "MA + Lightning Kills:"; %var1Name = "MA Lightning Kills, Wep + Lightning"; %var1TypeName = "Total"; + %var2 = "lightningMAHitsTG"; %var2Title = "Lightning + Ma Hits:"; %var2Name = "Lightning MidAir Hits"; %var2TypeName = "Total"; + %var3 = "lightningMAEVHitsTG"; %var3Title = "Ma Hits + Lightning"; %var3Name = "MidAir Lightning Hits"; %var3TypeName = "Total"; + %i1 = getField($lData::data[%var1,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var1,%client.lgame,%lType,%mon,%year],0) : %NA; + %i2 = getField($lData::data[%var2,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var2,%client.lgame,%lType,%mon,%year],0) : %NA; + %i3 = getField($lData::data[%var3,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var3,%client.lgame,%lType,%mon,%year],0) : %NA; + %client.statsFieldSet[%vsc1 = %f++] = %var1 TAB %var1Name TAB %var1TypeName; + %client.statsFieldSet[%vsc2 = %f++] = %var2 TAB %var2Name TAB %var2TypeName; + %client.statsFieldSet[%vsc3 = %f++] = %var3 TAB %var3Name TAB %var3TypeName; + %line = '\t%3\t%4\t%5'; + %nameTitle1 = "" @ %var1Title SPC "" @ %i1; + %nameTitle2 = "" @ %var2Title SPC "" @ %i2; + %nameTitle3 = "" @ %var3Title SPC "" @ %i3; + messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%vClient,0,%nameTitle1,%nameTitle2,%nameTitle3,%vsc1,%vsc2,%vsc3); + //14 + %var1 = "concussHitTG"; %var1Title = "Concussion Hits:"; %var1Name = "Concussion Nade Hits"; %var1TypeName = "Total"; + %var2 = "concussFlagTG"; %var2Title = "Concussion Flags:"; %var2Name = "Concussion Flags"; %var2TypeName = "Total"; + %var3 = "depInvyUseTG"; %var3Title = "Deploy Invy Use"; %var3Name = "Deploy Invy Use"; %var3TypeName = "Total"; + %i1 = getField($lData::data[%var1,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var1,%client.lgame,%lType,%mon,%year],0) : %NA; + %i2 = getField($lData::data[%var2,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var2,%client.lgame,%lType,%mon,%year],0) : %NA; + %i3 = getField($lData::data[%var3,%client.lgame,%lType,%mon,%year],0) ? getField($lData::name[%var3,%client.lgame,%lType,%mon,%year],0) : %NA; + %client.statsFieldSet[%vsc1 = %f++] = %var1 TAB %var1Name TAB %var1TypeName; + %client.statsFieldSet[%vsc2 = %f++] = %var2 TAB %var2Name TAB %var2TypeName; + %client.statsFieldSet[%vsc3 = %f++] = %var3 TAB %var3Name TAB %var3TypeName; + %line = '\t%3\t%4\t%5'; + %nameTitle1 = "" @ %var1Title SPC "" @ %i1; + %nameTitle2 = "" @ %var2Title SPC "" @ %i2; + %nameTitle3 = "" @ %var3Title SPC "" @ %i3; + messageClient( %client, 'SetLineHud', "", %tag, %index++, %line,%vClient,0,%nameTitle1,%nameTitle2,%nameTitle3,%vsc1,%vsc2,%vsc3); for(%i = %index; %i < 15; %i++) messageClient( %client, 'SetLineHud', "", %tag, %index++, ''); From 34dea78fd562ada469fccc1883bfa1fb878ccaec Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Mon, 12 Oct 2020 02:20:38 -0400 Subject: [PATCH 10/15] Bad > / Better echos --- Classic/scripts/autoexec/Autobalance.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) mode change 100755 => 100644 Classic/scripts/autoexec/Autobalance.cs diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs old mode 100755 new mode 100644 index bb6ffea..0c212bb --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -9,7 +9,7 @@ // exec("scripts/autoexec/Autobalance.cs"); // // If it takes too long for specific canidates to die. After a time choose anyone. -$Autobalance::Fallback = 60000; //60000 is 1 minute +$Autobalance::Fallback = 120000; //60000 is 1 minute // Run from TeamBalanceNotify.cs via NotifyUnbalanced function Autobalance( %game ) @@ -63,7 +63,7 @@ function Autobalance( %game ) $Autobalance::Max = mFloor($TeamRank[$BigTeam, count]/2); for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++) { - //echo(%i); echo($TeamRank[$BigTeam, %i].nameBase); + //echo("[Autobalance]: Selected" SPC $TeamRank[$BigTeam, %i].nameBase @ ", " @ %i); $Autobalance::Canidate[%i] = $TeamRank[$BigTeam, %i]; } %a = " selected"; @@ -87,7 +87,7 @@ function CheckCanidate(%client) return true; } } - return false; + return false; } package Autobalance @@ -95,20 +95,23 @@ package Autobalance function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation) { - parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); + parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLocation); - if($BigTeam !$= "" && %clVictim.team == $BigTeam) - { + if($BigTeam !$= "" && %clVictim.team == $BigTeam) + { %otherTeam = $BigTeam == 1 ? 2 : 1; if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 2) { + %fallback = 0; if($Autobalance::CanidateFallbackTime $= "") $Autobalance::CanidateFallbackTime = getSimTime(); + else if((getSimTime() - $Autobalance::CanidateFallbackTime) < $Autobalance::Fallback) + %fallback = 1; //damageType 0: If someone switches to observer or disconnects - if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalance::UseAllMode || (getSimTime() - $Autobalance::CanidateFallbackTime > $Autobalance::Fallback))) + if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalance::UseAllMode || %fallback)) { - echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode @ "]"); + echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode SPC "#BT:" @ $TeamRank[$BigTeam, count] 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'); @@ -121,7 +124,7 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, % ResetTBNStatus(); deleteVariables("$Autobalace::Canidate*"); } - } + } } function DefaultGame::gameOver(%game) From aebe71ebf809f5e98c6d662755b2d51a60356725 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Mon, 12 Oct 2020 11:35:11 -0400 Subject: [PATCH 11/15] Update 8.0 --- Classic/scripts/autoexec/zDarkTigerStats.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs index f416e16..84a1560 100644 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -180,10 +180,13 @@ // 7.9 // Added Concussion Stats // Invy use stat - +// +// 8.0 +// Added check for teams for concuss +// Adjust crash log player count to > 1 //-----------Settings------------ //Notes score ui width is 592 -$dtStats::version = 7.9; +$dtStats::version = 8.0; //disable stats system $dtStats::Enable = 1; //enable disable map stats @@ -2067,8 +2070,8 @@ package dtStats{ return %obj; } function Armor::applyConcussion( %this, %dist, %radius, %sourceObject, %targetObject ){ - if($dtStats::Enable){ - %sourceObject.client.dtStats.concussHit++; + if($dtStats::Enable && %sourceObject.client.team != %targetObject.client.team){ + %sourceObject.client.dtStats.concussHit++; %targetObject.client.dtStats.concussTaken++; %targetObject.concussBy = %sourceObject.client.dtStats; } @@ -5979,7 +5982,7 @@ function clientDmgStats(%data,%position,%sourceObject, %targetObject, %damageTyp if(%rayTest >= $dtStats::midAirHeight){%sourceDT.satchelMA++;} if(%sourceDT.satchelHitVV < %vv){%sourceDT.satchelHitVV = %vv;} } - } + } } else if(%targetClass $= "Turret" || %targetClass $= "FlyingVehicle" || %targetClass $= "HoverVehicle" || %targetClass $= "WheeledVehicle"){ %targetClient = %targetObject.getControllingClient(); @@ -6143,12 +6146,6 @@ function getGameData(%game,%client,%var,%type,%value){ } return 0; } -function getGameRunWinLossAvg(%client,%game){ - %winCount = getField(%vClient.dtStats.gameStats["winCount","t",%game],9); - %lossCount =getField(%vClient.dtStats.gameStats["lossCount","t",%game],9); - %total = %winCount + %lossCount; - return (%winCount / %total) * 100 SPC (%lossCount / %total) * 100; -} function numReduce(%num,%des){ if(%num !$= ""){ @@ -11894,7 +11891,7 @@ 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 > 0){ + if($dtServerVars::lastPlayerCount > 1){ $dtServerVars::serverCrash[%mis, $dtServerVars::lastGameType]++; $dtServerVars::crashLog[$dtServerVars::crashLogCount++] =%date @ "-" @ %upTime @ "-" @ %mis @ "-" @ $dtServerVars::lastGameType @ "-" @ $dtServerVars::lastPlayerCount; $dtServerVars::lastPlayerCount = 0; From 210d4da69af18a19d1dc8eb538a75babb632831c Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Wed, 14 Oct 2020 15:59:24 -0400 Subject: [PATCH 12/15] Better echo --- Classic/scripts/autoexec/Autobalance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classic/scripts/autoexec/Autobalance.cs b/Classic/scripts/autoexec/Autobalance.cs index 0c212bb..e1f365f 100644 --- a/Classic/scripts/autoexec/Autobalance.cs +++ b/Classic/scripts/autoexec/Autobalance.cs @@ -111,7 +111,7 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, % //damageType 0: If someone switches to observer or disconnects if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalance::UseAllMode || %fallback)) { - echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode SPC "#BT:" @ $TeamRank[$BigTeam, count] SPC "FB:" @ %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'); From ac86f1ed7ff152f013decb4b9194c5a0c38bafa9 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Tue, 20 Oct 2020 18:09:49 -0400 Subject: [PATCH 13/15] Update 8.1 --- Classic/scripts/autoexec/zDarkTigerStats.cs | 212 ++++++++++++++++---- 1 file changed, 177 insertions(+), 35 deletions(-) diff --git a/Classic/scripts/autoexec/zDarkTigerStats.cs b/Classic/scripts/autoexec/zDarkTigerStats.cs index 84a1560..9e3b306 100644 --- a/Classic/scripts/autoexec/zDarkTigerStats.cs +++ b/Classic/scripts/autoexec/zDarkTigerStats.cs @@ -183,10 +183,16 @@ // // 8.0 // Added check for teams for concuss -// Adjust crash log player count to > 1 +// Adjust crash log player count to > 1 +// +// 8.1 +// Misc stat fixes +// Added mpb glitch stat +// Added flag tossing and catching stats + //-----------Settings------------ //Notes score ui width is 592 -$dtStats::version = 8.0; +$dtStats::version = 8.1; //disable stats system $dtStats::Enable = 1; //enable disable map stats @@ -442,6 +448,16 @@ $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "TurretIndoorDep"; $dtStats::FV[$dtStats::FC["CTFGame","Game"]++,"CTFGame","Game"] = "teamScore"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "concussFlag"; $dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "depInvyUse"; + +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "mpbGlitch"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "flagCatch"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "maFlagCatch"; +$dtStats::FV[$dtStats::FC["CTFGame","Max"]++,"CTFGame","Max"] = "flagCatchSpeed"; +$dtStats::FV[$dtStats::FC["CTFGame","Max"]++,"CTFGame","Max"] = "maFlagCatchSpeed"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "flagToss"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "flagTossCatch"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "interceptedFlag"; +$dtStats::FV[$dtStats::FC["CTFGame","TG"]++,"CTFGame","TG"] = "maInterceptedFlag"; ///////////////////////////////////////////////////////////////////////////// //Unused vars needed for stats back up $dtStats::uGFV[$dtStats::uGFC["CTFGame"]++,"CTFGame"] = "returnPts"; @@ -525,6 +541,14 @@ $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "destruction"; $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "repairs"; $dtStats::FV[$dtStats::FC["SCtFGame","Game"]++,"SCtFGame","Game"] = "teamScore"; $dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "concussFlag"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "flagCatch"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "maFlagCatch"; +$dtStats::FV[$dtStats::FC["SCtFGame","Max"]++,"SCtFGame","Max"] = "flagCatchSpeed"; +$dtStats::FV[$dtStats::FC["SCtFGame","Max"]++,"SCtFGame","Max"] = "maFlagCatchSpeed"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "flagToss"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "flagTossCatch"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "interceptedFlag"; +$dtStats::FV[$dtStats::FC["SCtFGame","TG"]++,"SCtFGame","TG"] = "maInterceptedFlag"; ////////////////////////////Unused LCTF Vars///////////////////////////////////// $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "tkDestroys"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "genDestroys"; @@ -556,6 +580,7 @@ $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "depSensorRepairs"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "depInvRepairs"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "depTurretRepairs"; $dtStats::uGFV[$dtStats::uGFC["SCtFGame"]++,"SCtFGame"] = "returnPts"; + /////////////////////////////////////////////////////////////////////////////// // DuelGame /////////////////////////////////////////////////////////////////////////////// @@ -2018,7 +2043,7 @@ package dtStats{ function CTFGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc){ parent::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement, %damageLoc); if ((%clVictim.player.holdingFlag !$= "") && (%clVictim.team != %clAttacker.team)) - %clAttacker.dmgdFlagTime = getSimTime(); + %clAttacker.dmgdFlagTime = getSimTime(); } function CTFGame::testEscortAssist(%game, %victimID, %killerID){ if((getSimTime() - %victimID.dmgdFlagTime) < 5000 && %killerID.player.holdingFlag $= "") @@ -2035,18 +2060,25 @@ package dtStats{ return true; return false; } + function ProjectileData::onExplode(%data, %proj, %pos, %mod){ - if($dtStats::Enable) - dtOnExplode(%data, %proj, %pos, %mod); + if($dtStats::Enable){ + %cl = %proj.sourceObject.client; + if(isObject(%cl)){ + if(%proj.dtShotSpeed > 0) + %cl.dtShotSpeed = %proj.dtShotSpeed; + else + %cl.dtShotSpeed = mFloor(vectorLen(%proj.sourceObject.getVelocity()) * 3.6); + %cl.lastExp = %data TAB %proj.initialPosition TAB %pos; + } + } parent::onExplode(%data, %proj, %pos, %mod); } //function MineDeployed::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType){ //parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType); - //if($DamageType::Disc && $dtStats::Enable){ - //%sourceObject.client.dtStats.mineDiscPct = (%sourceObject.client.dtStats.mineDiscHit++ / (%thrower.client.dtStats.mineShotsFired ? %thrower.client.dtStats.mineShotsFired : 1)) * 100; - //%sourceObject.client.dtStats.mineDiscAcc = (%sourceObject.client.dtStats.mineDiscShots / (%thrower.client.dtStats.mineShotsFired ? %thrower.client.dtStats.mineShotsFired : 1)) * 100; - //%sourceObject.client.dtStats.mineDiscAccMP = (%sourceObject.client.dtStats.minePlusDisc / (%thrower.client.dtStats.mineShotsFired ? %thrower.client.dtStats.mineShotsFired : 1)) * 100; -// + //if(%damageType == $DamageType::Disc && $dtStats::Enable){ + //%targetObject.mineDiscHit = 1; + //error("boom" SPC %sourceObject.getClassName()); //} //} function ShapeBaseImageData::onDeploy(%item, %plyr, %slot){ @@ -2095,6 +2127,21 @@ package dtStats{ %player.concussBy = -1; } } + function MobileBaseVehicle::playerMounted(%data, %obj, %player, %node){ + if($dtStats::Enable){ + %obj.dtStats = %player.client.dtStats; + } + parent::playerMounted(%data, %obj, %player, %node); + } + function MobileBaseVehicle::onDamage(%this, %obj){ + if($dtStats::Enable){ + if(VectorLen(%obj.getVelocity()) > 200){ + if(isObject(%obj.dtStats)) + %obj.dtStats.mpbGlitch++; + } + } + parent::onDamage(%this, %obj); + } //function TurretData::replaceCallback(%this, %turret, %engineer){ //parent::replaceCallback(%this, %turret, %engineer); //if (%engineer.getMountedImage($BackPackSlot) != 0 && $dtStats::Enable){ @@ -2310,6 +2357,15 @@ package dtStatsGame{ if($dtStats::Enable){ %flag = %player.holdingFlag; %game.dtTotalFlagTime[%flag] = 0; + if(%player.getState() !$= "Dead"){ + error("flag drop"); + %player.client.dtStats.flagToss++; + %flag.pass = 1; + %flag.lastDTStat = %player.client.dtStats; + } + else{ + %flag.pass = 0; + } } parent::playerDroppedFlag(%game, %player); } @@ -2320,12 +2376,37 @@ package dtStatsGame{ } parent::boundaryLoseFlag(%game, %player); } + function CTFGame::updateFlagTransform(%game, %flag){ + parent::updateFlagTransform(%game, %flag); + if($dtStats::Enable){ + %vel = %flag.getVelocity(); + %flag.speed = vectorLen(%vel) ; + //error(%flag.speed); + } + } function CTFGame::playerTouchEnemyFlag(%game, %player, %flag){ if($dtStats::Enable){ if(%flag.isHome){ %game.dtTotalFlagTime[%flag] = getSimTime(); } - if(!%player.flagStatsWait){ + if(!%player.flagTossWait){ + if(%flag.speed > 10 && %flag.pass && %player.client.dtStats != %flag.lastDTStat){ + //error("pass" SPC %player.flagStatsWait); + %player.client.dtStats.flagCatch++; + %speed = vectorLen(%player.getVelocity()); + %player.client.dtStats.flagCatchSpeed = (%player.client.dtStats.flagCatchSpeed > %speed) ? %player.client.dtStats.flagCatchSpeed : %speed; + if(rayTest(%player, $dtStats::midAirHeight)){ + %player.client.dtStats.maFlagCatch++; + %player.client.dtStats.maFlagCatchSpeed = (%player.client.dtStats.maFlagCatchSpeed > %speed) ? %player.client.dtStats.maFlagCatchSpeed : %speed; + } + if(isObject(%flag.lastDTStat)){ + %flag.lastDTStat.flagTossCatch++; + %flag.lastDTStat = -1; + } + %flag.speed = 0; + %flag.pass = 0; + + } %grabspeed = mFloor(VectorLen(setWord(%player.getVelocity(), 2, 0)) * 3.6); if(%grabSpeed > %player.client.dtStats.grabSpeed){ if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ @@ -2339,28 +2420,50 @@ package dtStatsGame{ } parent::playerTouchEnemyFlag(%game, %player, %flag); } + function CTFGame::flagCap(%game, %player){ if($dtStats::Enable){ %flag = %player.holdingFlag; if(%game.dtTotalFlagTime[%flag]){ %heldTime = (getSimTime() - %game.dtTotalFlagTime[%flag])/1000; if(%heldTime < %player.client.dtStats.heldTimeSec || !%player.client.dtStats.heldTimeSec){ - if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ - %player.client.dtStats.heldTimeSec = %heldTime; - %player.client.dtStats.heldTimeLow = %heldTime; - } - else - %player.client.dtStats.heldTimeLow = %heldTime; + if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ + %player.client.dtStats.heldTimeSec = %heldTime; + %player.client.dtStats.heldTimeSecLow = %heldTime; + } + else + %player.client.dtStats.heldTimeSecLow = %heldTime; } } } parent::flagCap(%game, %player); } + function CTFGame::playerTouchOwnFlag(%game, %player, %flag){ + if($dtStats::Enable){ + if(!%flag.isHome){ + if(%flag.speed > 10 && %flag.pass){ + %player.client.dtStats.interceptedFlag++; + if(rayTest(%player, $dtStats::midAirHeight)) + %player.client.dtStats.maInterceptedFlag++; + } + } + } + parent::playerTouchOwnFlag(%game, %player, %flag); + } ///////////////////////////////////////////////////////////////////////////// function SCtFGame::playerDroppedFlag(%game, %player){ if($dtStats::Enable){ %flag = %player.holdingFlag; %game.dtTotalFlagTime[%flag] = 0; + if(%player.getState() !$= "Dead"){ + error("flag drop"); + %player.client.dtStats.flagToss++; + %flag.pass = 1; + %flag.lastDTStat = %player.client.dtStats; + } + else{ + %flag.pass = 0; + } } parent::playerDroppedFlag(%game, %player); } @@ -2371,34 +2474,80 @@ package dtStatsGame{ } parent::boundaryLoseFlag(%game, %player); } + function SCtFGame::updateFlagTransform(%game, %flag){ + parent::updateFlagTransform(%game, %flag); + if($dtStats::Enable){ + %vel = %flag.getVelocity(); + %flag.speed = vectorLen(%vel) ; + //error(%flag.speed); + } + } function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag){ if($dtStats::Enable){ if(%flag.isHome){ %game.dtTotalFlagTime[%flag] = getSimTime(); } - if(!%player.flagStatsWait){ + if(!%player.flagTossWait){ + if(%flag.speed > 10 && %flag.pass && %player.client.dtStats != %flag.lastDTStat){ + //error("pass" SPC %player.flagStatsWait); + %player.client.dtStats.flagCatch++; + %speed = vectorLen(%player.getVelocity()); + %player.client.dtStats.flagCatchSpeed = (%player.client.dtStats.flagCatchSpeed > %speed) ? %player.client.dtStats.flagCatchSpeed : %speed; + if(rayTest(%player, $dtStats::midAirHeight)){ + %player.client.dtStats.maFlagCatch++; + %player.client.dtStats.maFlagCatchSpeed = (%player.client.dtStats.maFlagCatchSpeed > %speed) ? %player.client.dtStats.maFlagCatchSpeed : %speed; + } + if(isObject(%flag.lastDTStat)){ + %flag.lastDTStat.flagTossCatch++; + %flag.lastDTStat = -1; + } + %flag.speed = 0; + %flag.pass = 0; + + } %grabspeed = mFloor(VectorLen(setWord(%player.getVelocity(), 2, 0)) * 3.6); if(%grabSpeed > %player.client.dtStats.grabSpeed){ - if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5) + if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ %player.client.dtStats.grabSpeed = %grabSpeed; + %player.client.dtStats.grabSpeedLow = %grabSpeed; + } + else + %player.client.dtStats.grabSpeedLow = %grabSpeed; } } } parent::playerTouchEnemyFlag(%game, %player, %flag); } + function SCtFGame::flagCap(%game, %player){ if($dtStats::Enable){ %flag = %player.holdingFlag; if(%game.dtTotalFlagTime[%flag]){ %heldTime = (getSimTime() - %game.dtTotalFlagTime[%flag])/1000; if(%heldTime < %player.client.dtStats.heldTimeSec || !%player.client.dtStats.heldTimeSec){ - if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5) + if($TeamRank[2,"count"] > 5 && $TeamRank[1,"count"] > 5){ %player.client.dtStats.heldTimeSec = %heldTime; + %player.client.dtStats.heldTimeSecLow = %heldTime; + } + else + %player.client.dtStats.heldTimeSecLow = %heldTime; } } } parent::flagCap(%game, %player); } + function SCtFGame::playerTouchOwnFlag(%game, %player, %flag){ + if($dtStats::Enable){ + if(!%flag.isHome){ + if(%flag.speed > 10 && %flag.pass){ + %player.client.dtStats.interceptedFlag++; + if(rayTest(%player, $dtStats::midAirHeight)) + %player.client.dtStats.maInterceptedFlag++; + } + } + } + parent::playerTouchOwnFlag(%game, %player, %flag); + } }; function chkGrounded(%player){ @@ -3808,7 +3957,7 @@ function dtStatsGameOver( %game ){ $dtStats::statsSave = 1; if(%game.getGamePct() > 50){ $dtServer::playCount[cleanMapName($CurrentMission),%game.class]++; - $dtServer::lastPlay[cleanMapName($CurrentMission),%game.class] = getDayNum() TAB getYear TAB formattimestring("mm/dd/yy hh:nn:a"); + $dtServer::lastPlay[cleanMapName($CurrentMission),%game.class] = getDayNum() TAB getYear() TAB formattimestring("mm/dd/yy hh:nn:a"); } else $dtServer::skipCount[cleanMapName($CurrentMission),%game.class]++; @@ -5660,17 +5809,6 @@ function vectorRayCast(%startPos,%vec,%dis){ %result = containerRayCast(%startPos, %endPos, %mask, %proj); return %result; } - -function dtOnExplode(%data, %proj, %pos, %mod){ - %cl = %proj.sourceObject.client; - if(isObject(%cl)){ - if(%proj.dtShotSpeed > 0) - %cl.dtShotSpeed = %proj.dtShotSpeed; - else - %cl.dtShotSpeed = mFloor(vectorLen(%proj.sourceObject.getVelocity()) * 3.6); - %cl.lastExp = %data TAB %proj.initialPosition TAB %pos; - } -} function testHit(%client){ if(isObject(%client)){ %field = %client.lastExp; @@ -6054,7 +6192,7 @@ function clientShotsFired(%data, %sourceObject, %projectile){ // could do a fov return; %dtStats = %sourceClient.dtStats; - if(%data.hasDamageRadius) + if(%data.hasDamageRadius || %data $= "BasicShocker") %damageType = %data.radiusDamageType; else %damageType = %data.directDamageType; @@ -11815,7 +11953,7 @@ function dtPingAvg(){ if(%pc > 0){ $dtStats::pingAvg = %pingT / %pc; } - if(%pc > 4){ + if(%pc > 3){ if($dtStats::pingAvg > 1000){//network issues %msg = "Host Hang Event" SPC formattimestring("hh:nn:a mm-dd-yy") SPC $dtStats::pingAvg SPC "ms" SPC "ms" SPC %pc; if($dtStats::debugEchos){error(%msg);} @@ -11828,7 +11966,11 @@ function dtPingAvg(){ else if($dtStats::pingAvg > 500){ %msg = "Small Host Event" SPC formattimestring("hh:nn:a mm-dd-yy") SPC $dtStats::pingAvg SPC "ms" SPC %pc; if($dtStats::debugEchos){error(%msg);} - + LogPrefIssue(%msg SPC "Map:" SPC $CurrentMission SPC Game.class SPC "UpTime:" SPC dtFormatTime(getSimTime())); + } + else if($dtStats::pingAvg > 200){ + %msg = "High Ping Avg" SPC formattimestring("hh:nn:a mm-dd-yy") SPC $dtStats::pingAvg SPC "ms" SPC %pc; + if($dtStats::debugEchos){error(%msg);} LogPrefIssue(%msg SPC "Map:" SPC $CurrentMission SPC Game.class SPC "UpTime:" SPC dtFormatTime(getSimTime())); } } From 743143f1da182f803429ae01854d7baf0d7da6f8 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Wed, 21 Oct 2020 02:09:48 -0400 Subject: [PATCH 14/15] KickObserver changes --- Classic/scripts/defaultGame.cs | 49 +++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/Classic/scripts/defaultGame.cs b/Classic/scripts/defaultGame.cs index 6321a9f..789285b 100644 --- a/Classic/scripts/defaultGame.cs +++ b/Classic/scripts/defaultGame.cs @@ -1123,7 +1123,8 @@ function DefaultGame::forceObserver( %game, %client, %reason ) messageClient(%client, 'MsgClientJoinTeam', '\c2You have become an observer.', %client.name, %game.getTeamName(0), %client, 0 ); logEcho(%client.nameBase@" (cl "@%client@") entered observer mode"); %client.lastTeam = %client.team; - %scheduleAutoKick = true; + + %scheduleAutoKick = true; case "AdminForce": %client.camera.getDataBlock().setMode( %client.camera, "observerFly" ); @@ -1155,18 +1156,22 @@ function DefaultGame::forceObserver( %game, %client, %reason ) logEcho(%client.nameBase@" (cl "@%client@") was placed in observer mode due to spawn delay"); // save the team the player was on - only if this was a delay in respawning %client.lastTeam = %client.team; - %scheduleAutoKick = true; + + %scheduleAutoKick = true; } - if (%scheduleAutoKick && !%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout ) + if(%scheduleAutoKick && !%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout) { - %minutes = $Host::KickObserverTimeout / 60; - messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes); + if(isEventPending(%client.okschedule)) + cancel(%client.okschedule); + + %minutes = $Host::KickObserverTimeout / 60; + messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes); - %key = mFloor(getRandom() * 1000); - %client.okkey = %key; + %key = mFloor(getRandom() * 1000); + %client.okkey = %key; - schedule(($Host::KickObserverTimeout * 1000), 0, "cmdAutoKickObserver", %client, %key); + %client.okschedule = schedule(($Host::KickObserverTimeout * 1000), 0, "cmdAutoKickObserver", %client, %key); } // switch client to team 0 (observer) @@ -1204,6 +1209,9 @@ function cmdAutoKickObserver(%client, %key) // Edit GG if (($Host::TournamentMode) || (!$MissionRunning) || (%client.isAdmin) || (%client.team != 0) || (!%client.okkey) || (%client.okkey != %key)) return; + if(isEventPending(%client.okschedule)) + cancel(%client.okschedule); + %client.okkey = ""; if( isObject( %client.player ) ) %client.player.scriptKill(0); @@ -1378,7 +1386,7 @@ function DefaultGame::displayDeathMessages(%game, %clVictim, %clKiller, %damageT function DefaultGame::assignClientTeam(%game, %client, %respawn ) { -//error("DefaultGame::assignClientTeam"); + //error("DefaultGame::assignClientTeam"); // this function is overwritten in non-team mission types (e.g. DM) // so these lines won't do anything //if(!%game.numTeams) @@ -1449,6 +1457,9 @@ function DefaultGame::assignClientTeam(%game, %client, %respawn ) logEcho(%client.nameBase@" (cl "@%client@") joined team "@%client.team); + //Cancel clients observer kick schedule if he/she has one + if(isEventPending(%client.okschedule)) + cancel(%client.okschedule); } function DefaultGame::getTeamSkin(%game, %team) @@ -1469,7 +1480,7 @@ function DefaultGame::getTeamName(%game, %team) function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn ) { -//error("DefaultGame::clientJoinTeam"); + //error("DefaultGame::clientJoinTeam"); if ( %team < 1 || %team > %game.numTeams ) return; @@ -1491,6 +1502,10 @@ function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn ) updateCanListenState( %client ); logEcho(%client.nameBase@" (cl "@%client@") joined team "@%client.team); + + //Cancel clients observer kick schedule if he/she has one + if(isEventPending(%client.okschedule)) + cancel(%client.okschedule); } function DefaultGame::AIHasJoined(%game, %client) @@ -1808,6 +1823,20 @@ function DefaultGame::clientMissionDropReady(%game, %client) %client.hs = ""; for(%i = 1; %i <= 13; %i++) $stats::weapon_damage[%client, %i] = ""; + + if(!%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout) + { + if(isEventPending(%client.okschedule)) + cancel(%client.okschedule); + + %minutes = $Host::KickObserverTimeout / 60; + messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes); + + %key = mFloor(getRandom() * 1000); + %client.okkey = %key; + + %client.okschedule = schedule(($Host::KickObserverTimeout * 1000), 0, "cmdAutoKickObserver", %client, %key); + } } function DefaultGame::sendClientTeamList(%game, %client) From f51829f5d543efb47a7dc5b66ad697ee35e3ad93 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Wed, 21 Oct 2020 02:20:36 -0400 Subject: [PATCH 15/15] No Message --- Classic/scripts/defaultGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classic/scripts/defaultGame.cs b/Classic/scripts/defaultGame.cs index 789285b..bef4749 100644 --- a/Classic/scripts/defaultGame.cs +++ b/Classic/scripts/defaultGame.cs @@ -1830,7 +1830,7 @@ function DefaultGame::clientMissionDropReady(%game, %client) cancel(%client.okschedule); %minutes = $Host::KickObserverTimeout / 60; - messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes); + //messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes); %key = mFloor(getRandom() * 1000); %client.okkey = %key;