mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-19 16:14:44 +00:00
GetRandomMaps changes
RandomMaps are pulled from rotation zDarkTigerMapRotation removed for now Fallback to Evo maprotation
This commit is contained in:
parent
cf5440b41c
commit
ac9bb2fd1b
|
|
@ -10,140 +10,105 @@
|
|||
// This file is present
|
||||
$GetRandomMapsLoaded = true;
|
||||
|
||||
// Map pool
|
||||
//
|
||||
// CTF
|
||||
//
|
||||
// 1-5
|
||||
$RandomMapPick1 = "SmallCrossing"; $RandomMapPick2 = "OasisIntensity"; $RandomMapPick3 = "Blink"; $RandomMapPick4 = "SmallTimeCTF"; $RandomMapPick5 = "ArenaDome";
|
||||
// 6-10
|
||||
$RandomMapPick6 = "HighOctane"; $RandomMapPick7 = "S5_Damnation"; $RandomMapPick8 = "TWL_Feign"; $RandomMapPick9 = "TWL2_Skylight"; $RandomMapPick10 = "Prismatic";
|
||||
// 11-15
|
||||
$RandomMapPick11 = "Dire"; $RandomMapPick12 = "TWL2_JaggedClaw"; $RandomMapPick13 = "TWL2_Hildebrand"; $RandomMapPick14 = "TWL_WilderZone"; $RandomMapPick15 = "TWL_Stonehenge";
|
||||
// 16-20
|
||||
$RandomMapPick16 = "TWL2_Ocular"; $RandomMapPick17 = "S8_Opus"; $RandomMapPick18 = "Mirage"; $RandomMapPick19 = "DangerousCrossing_nef"; $RandomMapPick20 = "S5_Massive";
|
||||
// 21-25
|
||||
$RandomMapPick21 = "TheFray"; $RandomMapPick22 = "RoundTheMountain"; $RandomMapPick23 = "S5_Mordacity"; $RandomMapPick24 = "TWL2_CanyonCrusadeDeluxe"; $RandomMapPick25 = "Signal";
|
||||
// 26-30
|
||||
$RandomMapPick26 = "S8_Cardiac"; $RandomMapPick27 = "CirclesEdge"; $RandomMapPick28 = "S5_Icedance"; $RandomMapPick29 = "Bulwark"; $RandomMapPick30 = "Discord";
|
||||
// 31-35
|
||||
$RandomMapPick31 = "MoonDance"; $RandomMapPick32 = "Rollercoaster_nef"; $RandomMapPick33 = "Logans_Run"; $RandomMapPick34 = "TWL_BeachBlitz"; $RandomMapPick35 = "TWL2_FrozenGlory";
|
||||
// 36-40
|
||||
$RandomMapPick36 = "CircleofStones"; $RandomMapPick37 = "TitanV"; $RandomMapPick38 = "TWL_Katabatic"; $RandomMapPick39 = "TWL2_Magnum"; $RandomMapPick40 = "Fenix";
|
||||
//
|
||||
// LakRabbit
|
||||
//
|
||||
// 1-3
|
||||
$LakRandomMapPick1 = "VaubanLak"; $LakRandomMapPick2 = "MiniSunDried"; $LakRandomMapPick3 = "TitaniaLak";
|
||||
// 4-6
|
||||
$LakRandomMapPick4 = "DesertofDeathLak"; $LakRandomMapPick5 = "Sundance"; $LakRandomMapPick6 = "SunDriedLak";
|
||||
// 7-9
|
||||
$LakRandomMapPick7 = "SkinnyDipLak"; $LakRandomMapPick8 = "LushLak"; $LakRandomMapPick9 = "InfernusLak";
|
||||
// 10-12
|
||||
$LakRandomMapPick10 = "Arrakis"; $LakRandomMapPick11 = "BoxLak"; $LakRandomMapPick12 = "TreasureIslandLak";
|
||||
// 13-15
|
||||
$LakRandomMapPick13 = "Raindance_nefLak"; $LakRandomMapPick14 = "SaddiesHill"; $LakRandomMapPick15 = "TWL_BeachBlitzLak";
|
||||
// 16-18
|
||||
$LakRandomMapPick16 = "PhasmaDustLak"; $LakRandomMapPick17 = "TibbawLak"; $LakRandomMapPick18 = "HavenLak";
|
||||
// 19-21
|
||||
$LakRandomMapPick19 = "Crater71Lak"; $LakRandomMapPick20 = "SolsDescentLak"; $LakRandomMapPick21 = "FrozenFuryLak";
|
||||
// 22-24
|
||||
$LakRandomMapPick22 = "CankerLak"; $LakRandomMapPick23 = "S8_GeothermalLak"; $LakRandomMapPick24 = "DustRunLak";
|
||||
//
|
||||
// LCTF
|
||||
//
|
||||
// 1-5
|
||||
$LCTFRandomMapPick1 = "BastardForgeLT"; $LCTFRandomMapPick2 = "FirestormLT"; $LCTFRandomMapPick3 = "DangerousCrossingLT"; $LCTFRandomMapPick4 = "S5_DamnationLT"; $LCTFRandomMapPick5 = "TenebrousCTF";
|
||||
// 6-10
|
||||
$LCTFRandomMapPick6 = "SmallCrossingLT"; $LCTFRandomMapPick7 = "CirclesEdgeLT"; $LCTFRandomMapPick8 = "TheFray"; $LCTFRandomMapPick9 = "SignalLT"; $LCTFRandomMapPick10 = "StarFallLT";
|
||||
// 11-15
|
||||
$LCTFRandomMapPick11 = "DireLT"; $LCTFRandomMapPick12 = "S5_Icedance"; $LCTFRandomMapPick13 = "TWL2_HildebrandLT"; $LCTFRandomMapPick14 = "TWL2_CanyonCrusadeDeluxeLT"; $LCTFRandomMapPick15 = "TWL2_FrozenHopeLT";
|
||||
// 16-20
|
||||
$LCTFRandomMapPick16 = "RoundTheMountainLT"; $LCTFRandomMapPick17 = "Blink"; $LCTFRandomMapPick18 = "TWL2_SkylightLT"; $LCTFRandomMapPick19 = "TWL_BeachBlitzLT"; $LCTFRandomMapPick20 = "S5_MassiveLT";
|
||||
// 21-25
|
||||
$LCTFRandomMapPick21 = "S5_Mimicry"; $LCTFRandomMapPick22 = "S5_SilenusLT"; $LCTFRandomMapPick23 = "S5_Mordacity"; $LCTFRandomMapPick24 = "S5_Woodymyrk"; $LCTFRandomMapPick25 = "S8_Cardiac";
|
||||
// 26-30
|
||||
$LCTFRandomMapPick26 = "S8_Opus"; $LCTFRandomMapPick27 = "TWL2_Celerity"; $LCTFRandomMapPick28 = "TWL2_Crevice"; $LCTFRandomMapPick29 = "S5_HawkingHeat"; $LCTFRandomMapPick30 = "TWL2_MidnightMayhemDeluxe";
|
||||
// 31-35
|
||||
$LCTFRandomMapPick31 = "Discord"; $LCTFRandomMapPick32 = "Bulwark"; $LCTFRandomMapPick33 = "ArenaDome"; $LCTFRandomMapPick34 = "SmallTimeLT"; $LCTFRandomMapPick35 = "RaindanceLT";
|
||||
// 36-40
|
||||
$LCTFRandomMapPick36 = "TWL_OsIris"; $LCTFRandomMapPick37 = "TWL_Damnation"; $LCTFRandomMapPick38 = "Headstone"; $LCTFRandomMapPick39 = "BeggarsRunLT"; $LCTFRandomMapPick40 = "Berlard";
|
||||
// getRandomMap - returns a random map without duplicates until all have been played.
|
||||
// Script BY: DarkTiger
|
||||
// set this to 1 to save rng list to continue where the server left off in case of server reset
|
||||
|
||||
$rngListSave = 1;
|
||||
$rngDebug = 1;//show echos for testing
|
||||
|
||||
function getRandomMap(){
|
||||
// builds valid map list to pick from
|
||||
for(%i = 0; %i < $HostMissionCount; %i++){
|
||||
%map = $HostMissionFile[%i];
|
||||
%FFA = $Host::MapFFA[%map, $CurrentMissionType];
|
||||
%Cycle =$Host::MapCycle[%map, $CurrentMissionType];
|
||||
%bot = $BotEnabled[%i];
|
||||
if(%FFA && %Cycle){
|
||||
if($Host::BotsEnabled){
|
||||
if(%bot)
|
||||
%map[%c++] = %map;
|
||||
}
|
||||
else{
|
||||
%map[%c++] = %map;
|
||||
}
|
||||
}
|
||||
}
|
||||
%rng = getRSGN(1,%c,$CurrentMissionType); // use gameType as the id
|
||||
if($rngDebug){error(%map[%rng] SPC %rng);}
|
||||
return %map[%rng];
|
||||
}
|
||||
|
||||
function getRSGN(%min,%max,%id){
|
||||
// This funciton is kind of like a random sequence generator but its done on the fly
|
||||
// returns you a unique random number every time until max is reached
|
||||
// id value is so it can be used in more then one place
|
||||
// the id value can be function name that its used in or a number
|
||||
// lastly it only for numbers between -1000 to 1000 see down below;
|
||||
|
||||
if($rngListSave && isFile("rngLists/" @ %id @ ".cs") && !$rngIsLoaded[%id]){
|
||||
exec("rngLists/" @ %id @ ".cs");
|
||||
$rngIsLoaded[%id] = 1;
|
||||
if($rngDebug){error("Loading Map RNG List =" SPC "rngLists/" @ %id @ ".cs");}
|
||||
}
|
||||
|
||||
if(%id $= ""){
|
||||
error("getRSG function call does not have an id value");
|
||||
return getRandom(%min,%max);
|
||||
}
|
||||
|
||||
%c = %min - 1; // skip counter
|
||||
if(((%max - %min) - ($rng::Count[%id] - 1)) < 1) // reset if we cycled though all possable
|
||||
{
|
||||
$rng::Count[%id] = 1; // we dont reset to 0 becuae of the last number used
|
||||
// change these numbers to expand range
|
||||
for(%a = %min; %a <= %max; %a++) // this resets a wide range incase min max change for what ever reasion
|
||||
{
|
||||
$rng::List[%id,%a] = 0; // reset number list back to 0
|
||||
}
|
||||
|
||||
$rng::List[%id,$rng::Last[%id]] = 1; // mark the last number used as in used after reset
|
||||
}
|
||||
|
||||
%rng = getRandom(%min,%max - $rng::Count[%id] ); // find random number - the total number we have done
|
||||
|
||||
for(%i = %min; %i <= %max; %i++) // loop cycle though all possable numbers
|
||||
{
|
||||
if($rng::List[%id,%i]) // skip over ones that we have all ready used
|
||||
{
|
||||
continue;
|
||||
}
|
||||
%c++; // skip counter
|
||||
|
||||
if(%rng == %c) // onces the skip counter matches the rng number we have landed on a valid number that we havent used yet
|
||||
{
|
||||
break; // kill the loop
|
||||
}
|
||||
}
|
||||
|
||||
$rng::List[%id,%i] = 1;// this marks said number as used
|
||||
$rng::Count[%id]++;// up are total used numbers
|
||||
$rng::Last[%id] = %i; // for when the list resets it wont pick the same number twice
|
||||
|
||||
if(%i > %max || %i < %min)
|
||||
{ // fail safe
|
||||
return %max;
|
||||
}
|
||||
if($rngListSave){
|
||||
export( "$rng::*", "rngLists/" @ %id @ ".cs", false );
|
||||
}
|
||||
return %i; // return the one we stoped on
|
||||
}
|
||||
|
||||
// Return random maps list for SetNextMission
|
||||
// Primarily used in admin menus
|
||||
function SetNextMapGetRandoms( %client )
|
||||
{
|
||||
switch$($CurrentMissionType)
|
||||
%cyclecount = 1;
|
||||
for(%i = 0; %i < 8; %i++)
|
||||
{
|
||||
case "CTF":
|
||||
//Get random numbers
|
||||
%RandomPick1 = getRandom(1,5);
|
||||
%RandomPick2 = getRandom(6,10);
|
||||
%RandomPick3 = getRandom(11,15);
|
||||
%RandomPick4 = getRandom(16,20);
|
||||
%RandomPick5 = getRandom(21,25);
|
||||
%RandomPick6 = getRandom(26,30);
|
||||
%RandomPick7 = getRandom(31,35);
|
||||
%RandomPick8 = getRandom(36,40);
|
||||
|
||||
//Deduction code
|
||||
$SetNextMissionMapSlot1 = $RandomMapPick[%RandomPick1];
|
||||
$SetNextMissionMapSlot2 = $RandomMapPick[%RandomPick2];
|
||||
$SetNextMissionMapSlot3 = $RandomMapPick[%RandomPick3];
|
||||
$SetNextMissionMapSlot4 = $RandomMapPick[%RandomPick4];
|
||||
$SetNextMissionMapSlot5 = $RandomMapPick[%RandomPick5];
|
||||
$SetNextMissionMapSlot6 = $RandomMapPick[%RandomPick6];
|
||||
$SetNextMissionMapSlot7 = $RandomMapPick[%RandomPick7];
|
||||
$SetNextMissionMapSlot8 = $RandomMapPick[%RandomPick8];
|
||||
case "LakRabbit":
|
||||
//Get random numbers
|
||||
%LakRandomPick1 = getRandom(1,3);
|
||||
%LakRandomPick2 = getRandom(4,6);
|
||||
%LakRandomPick3 = getRandom(7,9);
|
||||
%LakRandomPick4 = getRandom(10,12);
|
||||
%LakRandomPick5 = getRandom(13,15);
|
||||
%LakRandomPick6 = getRandom(16,18);
|
||||
%LakRandomPick7 = getRandom(19,21);
|
||||
%LakRandomPick8 = getRandom(22,24);
|
||||
|
||||
//Deduction code
|
||||
$SetNextMissionMapSlot1 = $LakRandomMapPick[%LakRandomPick1];
|
||||
$SetNextMissionMapSlot2 = $LakRandomMapPick[%LakRandomPick2];
|
||||
$SetNextMissionMapSlot3 = $LakRandomMapPick[%LakRandomPick3];
|
||||
$SetNextMissionMapSlot4 = $LakRandomMapPick[%LakRandomPick4];
|
||||
$SetNextMissionMapSlot5 = $LakRandomMapPick[%LakRandomPick5];
|
||||
$SetNextMissionMapSlot6 = $LakRandomMapPick[%LakRandomPick6];
|
||||
$SetNextMissionMapSlot7 = $LakRandomMapPick[%LakRandomPick7];
|
||||
$SetNextMissionMapSlot8 = $LakRandomMapPick[%LakRandomPick8];
|
||||
case "SCtF":
|
||||
//Get random numbers
|
||||
%LCTFRandomPick1 = getRandom(1,5);
|
||||
%LCTFRandomPick2 = getRandom(6,10);
|
||||
%LCTFRandomPick3 = getRandom(11,15);
|
||||
%LCTFRandomPick4 = getRandom(16,20);
|
||||
%LCTFRandomPick5 = getRandom(21,25);
|
||||
%LCTFRandomPick6 = getRandom(26,30);
|
||||
%LCTFRandomPick7 = getRandom(31,35);
|
||||
%LCTFRandomPick8 = getRandom(36,40);
|
||||
|
||||
//Deduction code
|
||||
$SetNextMissionMapSlot1 = $LCTFRandomMapPick[%LCTFRandomPick1];
|
||||
$SetNextMissionMapSlot2 = $LCTFRandomMapPick[%LCTFRandomPick2];
|
||||
$SetNextMissionMapSlot3 = $LCTFRandomMapPick[%LCTFRandomPick3];
|
||||
$SetNextMissionMapSlot4 = $LCTFRandomMapPick[%LCTFRandomPick4];
|
||||
$SetNextMissionMapSlot5 = $LCTFRandomMapPick[%LCTFRandomPick5];
|
||||
$SetNextMissionMapSlot6 = $LCTFRandomMapPick[%LCTFRandomPick6];
|
||||
$SetNextMissionMapSlot7 = $LCTFRandomMapPick[%LCTFRandomPick7];
|
||||
$SetNextMissionMapSlot8 = $LCTFRandomMapPick[%LCTFRandomPick8];
|
||||
case "DM":
|
||||
$SetNextMissionMapSlot1 = "RaspDM";
|
||||
$SetNextMissionMapSlot2 = "EntombedDM";
|
||||
$SetNextMissionMapSlot3 = "IceDomeDM";
|
||||
$SetNextMissionMapSlot4 = "LiveBaitDM";
|
||||
$SetNextMissionMapSlot5 = "ArenaDomeDM";
|
||||
$SetNextMissionMapSlot6 = "VulcansWrathDM";
|
||||
$SetNextMissionMapSlot7 = "RampartsDM";
|
||||
$SetNextMissionMapSlot8 = "ShrineDM";
|
||||
$SetNextMissionMapSlot[%cyclecount] = getRandomMap();
|
||||
%cyclecount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,60 +21,51 @@ $PreviousMission1back = "";
|
|||
//Ran in MissionTypeOptions.cs
|
||||
function MapRepetitionChecker( %game )
|
||||
{
|
||||
if($Host::EnableMapRepetitionChecker)
|
||||
{
|
||||
//Debug
|
||||
//%MapRepetitionCheckerDebug = true;
|
||||
|
||||
if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present
|
||||
return;
|
||||
|
||||
if($EvoCachedNextMission $= "")
|
||||
return;
|
||||
//Debug
|
||||
//%MapRepetitionCheckerDebug = true;
|
||||
|
||||
if(!$Host::TournamentMode)
|
||||
{
|
||||
//Do work
|
||||
if( $PreviousMission1back $= $EvoCachedNextMission || $PreviousMission2back $= $EvoCachedNextMission ||
|
||||
$PreviousMission3back $= $EvoCachedNextMission || $PreviousMission4back $= $EvoCachedNextMission ||
|
||||
$CurrentMission $= $EvoCachedNextMission )
|
||||
MapRepetitionCheckerFindRandom();
|
||||
if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present
|
||||
return;
|
||||
|
||||
if($EvoCachedNextMission $= "")
|
||||
return;
|
||||
|
||||
if(!$Host::TournamentMode && $Host::EnableMapRepetitionChecker)
|
||||
{
|
||||
//Do work
|
||||
if( $PreviousMission1back $= $EvoCachedNextMission || $PreviousMission2back $= $EvoCachedNextMission ||
|
||||
$PreviousMission3back $= $EvoCachedNextMission || $PreviousMission4back $= $EvoCachedNextMission ||
|
||||
$CurrentMission $= $EvoCachedNextMission )
|
||||
MapRepetitionCheckerFindRandom();
|
||||
|
||||
//Set vars
|
||||
if($PreviousMission3back !$= "") $PreviousMission4back = $PreviousMission3back;
|
||||
if($PreviousMission2back !$= "") $PreviousMission3back = $PreviousMission2back;
|
||||
if($PreviousMission1back !$= "") $PreviousMission2back = $PreviousMission1back;
|
||||
$PreviousMission1back = $CurrentMission;
|
||||
|
||||
//Set vars
|
||||
if($PreviousMission3back !$= "") $PreviousMission4back = $PreviousMission3back;
|
||||
if($PreviousMission2back !$= "") $PreviousMission3back = $PreviousMission2back;
|
||||
if($PreviousMission1back !$= "") $PreviousMission2back = $PreviousMission1back;
|
||||
$PreviousMission1back = $CurrentMission;
|
||||
|
||||
//Debug
|
||||
if(%MapRepetitionCheckerDebug)
|
||||
{
|
||||
if($PreviousMission1back !$= "") echo("PM1: " @ $PreviousMission1back);
|
||||
if($PreviousMission2back !$= "") echo("PM2: " @ $PreviousMission2back);
|
||||
if($PreviousMission3back !$= "") echo("PM3: " @ $PreviousMission3back);
|
||||
if($PreviousMission4back !$= "") echo("PM4: " @ $PreviousMission4back);
|
||||
}
|
||||
//Debug
|
||||
if(%MapRepetitionCheckerDebug)
|
||||
{
|
||||
if($PreviousMission1back !$= "") echo("PM1: " @ $PreviousMission1back);
|
||||
if($PreviousMission2back !$= "") echo("PM2: " @ $PreviousMission2back);
|
||||
if($PreviousMission3back !$= "") echo("PM3: " @ $PreviousMission3back);
|
||||
if($PreviousMission4back !$= "") echo("PM4: " @ $PreviousMission4back);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MapRepetitionCheckerFindRandom()
|
||||
{
|
||||
if($GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present
|
||||
SetNextMapGetRandoms( %client ); //Get Random Set Next Mission maps
|
||||
else
|
||||
if(!$GetRandomMapsLoaded) //Make sure GetRandomMaps.cs is present
|
||||
return;
|
||||
|
||||
if( $CurrentMissionType $= "Deathmatch" )
|
||||
%MapCheckerRandom = getRandom(1,8);
|
||||
else
|
||||
%MapCheckerRandom = getRandom(1,6);
|
||||
|
||||
|
||||
//Backup
|
||||
$SetNextMissionRestore = $EvoCachedNextMission;
|
||||
|
||||
//Do work
|
||||
$EvoCachedNextMission = $SetNextMissionMapSlot[%MapCheckerRandom];
|
||||
//getRandomMap() is in GetRandomMaps.cs
|
||||
$EvoCachedNextMission = getRandomMap();
|
||||
|
||||
//Make sure new map still complies
|
||||
if( $EvoCachedNextMission $= $PreviousMission1back || $EvoCachedNextMission $= $PreviousMission2back ||
|
||||
|
|
|
|||
|
|
@ -1,342 +0,0 @@
|
|||
//----------------DarkTiger's MapRotation----------------
|
||||
//
|
||||
// - To Further Randomize Map Rotation
|
||||
// - Keep Track of maps so they arnt chosin again
|
||||
//
|
||||
// - Meant to be run with evo admin mod
|
||||
// - Set $Host::ClassicRandomMissions to 2 to activate
|
||||
// - $Host::ClassicRandomMissions = 2;
|
||||
//
|
||||
|
||||
//Deactivate EvoMapRotation
|
||||
if(isActivePackage(EvoMapRotation))
|
||||
deactivatePackage(EvoMapRotation);
|
||||
|
||||
|
||||
package DarkTigerMapRotation
|
||||
{
|
||||
|
||||
|
||||
function getNextMission( %misName, %misType )
|
||||
{
|
||||
// Find the index of the mission type:
|
||||
for( %TypeIdx = 0; %TypeIdx < $HostTypeCount; %TypeIdx++ )
|
||||
{
|
||||
if ($HostTypeName[%TypeIdx] $= %misType)
|
||||
break;
|
||||
}
|
||||
|
||||
// Mission Type was not found. Return last mission an error message
|
||||
if(%TypeIdx == $HostTypeCount)
|
||||
{
|
||||
echo("Error: Could not find matching game type in function " @ "getNextMission( " @ %misName @", " @%misType @ " ).\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
%EvoTempMissionListLength = 0;
|
||||
%EvoCurrentMissionIndex = -1;
|
||||
|
||||
// Build a list of missions that are eligible to be cycled into
|
||||
for( %MisCounter = 0; %MisCounter < $HostMissionCount[%TypeIdx]; %MisCounter ++ )
|
||||
{
|
||||
%ThisMission = $HostMission[ %TypeIdx, %MisCounter ];
|
||||
%ThisMissionName = $HostMissionFile[ %ThisMission ];
|
||||
|
||||
if ($Host::EvoCustomMapRotation && !$Host::MapCycle[%ThisMissionName, %misType])
|
||||
{
|
||||
// If mission is not set to cycle, then jump to next
|
||||
continue;
|
||||
}
|
||||
|
||||
if($HostGameBotCount && (!$BotEnabled[$HostMission[%TypeIdx, %MisCounter]]))
|
||||
{
|
||||
// If there are bots present and no bot support is on map, jump
|
||||
// to next
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( %ThisMissionName $= %misName )
|
||||
// This map is the current mission
|
||||
{
|
||||
%EvoCurrentMissionIndex = %EvoTempMissionListLength;
|
||||
}
|
||||
%EvoTempMissionList[ %EvoTempMissionListLength ] = %ThisMission;
|
||||
%EvoTempMissionListLength ++;
|
||||
}
|
||||
// If no maps are found, return last mission with error
|
||||
if(! %EvoTempMissionListLength )
|
||||
{
|
||||
echo("Error: No valid maps found in cycle." );
|
||||
return -1;
|
||||
}
|
||||
// Custom Map Rotation counts forwards
|
||||
if( $Host::EvoCustomMapRotation )
|
||||
{
|
||||
%NextMissionIndex = %EvoCurrentMissionIndex + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Standard Map Rotation counts backwards. For whatever reason
|
||||
if( %EvoCurrentMissionIndex <= 0 )
|
||||
{
|
||||
%NextMissionIndex = %EvoTempMissionListLength - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
%NextMissionIndex = %EvoCurrentMissionIndex - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(( $Host::ClassicRandomMissions == 1) && ( %EvoTempMissionListLength > 2 ) )
|
||||
{
|
||||
%NextMissionIndex = %NextMissionIndex + GetRandom(0, %EvoTempMissionListLength - 2 );
|
||||
}
|
||||
else if(( $Host::ClassicRandomMissions == 2) && ( %EvoTempMissionListLength > 2 ) ){
|
||||
%NextMissionIndex = %NextMissionIndex + getRSGN(0, %EvoTempMissionListLength - 2, "getNextMission1");
|
||||
}
|
||||
|
||||
// Bring %NextMissionIndex back into the interval
|
||||
// between 0 and %Evo...Length
|
||||
if( %NextMissionIndex < 0 )
|
||||
%NextMissionIndex += %EvoTempMissionListLength;
|
||||
|
||||
if( %NextMissionIndex >= %EvoTempMissionListLength )
|
||||
%NextMissionIndex -= %EvoTempMissionListLength;
|
||||
|
||||
return %EvoTempMissionList[ %NextMissionIndex ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// buildMissionList()
|
||||
// Info: Build the mission list
|
||||
function buildMissionList()
|
||||
{
|
||||
deleteVariables("$HostMission*");
|
||||
deleteVariables("$HostType*");
|
||||
|
||||
$HostMissionCount = 0;
|
||||
$HostTypeCount = 0;
|
||||
// standard one
|
||||
if(!$Host::EvoCustomMapRotation)
|
||||
{
|
||||
%search = "missions/*.mis";
|
||||
%fobject = new FileObject();
|
||||
|
||||
for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search))
|
||||
{
|
||||
// get the name
|
||||
%name = fileBase(%file);
|
||||
%idx = $HostMissionCount;
|
||||
|
||||
$HostMissionCount++;
|
||||
$HostMissionFile[%idx] = %name;
|
||||
$HostMissionName[%idx] = %name;
|
||||
|
||||
if(!%fobject.openForRead(%file))
|
||||
continue;
|
||||
|
||||
%typeList = "None";
|
||||
|
||||
while(!%fobject.isEOF())
|
||||
{
|
||||
%line = %fobject.readLine();
|
||||
if(getSubStr(%line, 0, 17) $= "// DisplayName = ")
|
||||
{
|
||||
// Override the mission name:
|
||||
$HostMissionName[%idx] = getSubStr(%line, 17, 1000);
|
||||
}
|
||||
else if(getSubStr(%line, 0, 18) $= "// MissionTypes = ")
|
||||
{
|
||||
%typeList = getSubStr(%line, 18, 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
%fobject.close();
|
||||
|
||||
// Don't include single player missions:
|
||||
if(strstr(%typeList, "SinglePlayer") != -1)
|
||||
continue;
|
||||
|
||||
// Test to see if the mission is bot-enabled:
|
||||
%navFile = "terrains/" @ %name @ ".nav";
|
||||
$BotEnabled[%idx] = isFile(%navFile);
|
||||
for(%word = 0; (%misType = getWord(%typeList, %word)) !$= ""; %word++)
|
||||
{
|
||||
// z0dd - ZOD - Founder(founder@mechina.com): Append Tribe Practice to CTF missions
|
||||
if(%misType $= "CTF")
|
||||
%typeList = rtrim(%typeList) @ " PracticeCTF SCtF Hybrid";
|
||||
|
||||
if(%misType $= "CnH")
|
||||
%typeList = rtrim(%typeList) @ " Conquest";
|
||||
|
||||
// load TR2 gametype?
|
||||
if((%misType $= "TR2") && (!$Host::ClassicLoadTR2Gametype))
|
||||
continue;
|
||||
|
||||
for(%i = 0; %i < $HostTypeCount; %i++)
|
||||
if($HostTypeName[%i] $= %misType)
|
||||
break;
|
||||
|
||||
if(%i == $HostTypeCount)
|
||||
{
|
||||
$HostTypeCount++;
|
||||
$HostTypeName[%i] = %misType;
|
||||
$HostMissionCount[%i] = 0;
|
||||
}
|
||||
// add the mission to the type
|
||||
$HostMission[%i, $HostMissionCount[%i]] = %idx;
|
||||
$HostMissionCount[%i]++;
|
||||
}
|
||||
}
|
||||
|
||||
getMissionTypeDisplayNames();
|
||||
%fobject.delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
exec($Host::EvoCustomMapRotationFile);
|
||||
getMissionTypeDisplayNames();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function getRSGN(%min,%max,%id)
|
||||
{
|
||||
// This funciton is kind of like a random sequence generator but its done on the fly
|
||||
// returns you a unique random number every time until max is reached
|
||||
// id value is so it can be used in more then one place
|
||||
// the id value can be function name that its used in or a number
|
||||
// lastly it only for numbers between -1000 to 1000 see down below;
|
||||
|
||||
if(%id $= "")
|
||||
{
|
||||
error("getRSG function call does not have an id value");
|
||||
return %max;
|
||||
}
|
||||
|
||||
%c = %min - 1; // skip counter
|
||||
//$rngCount[%id] - 1) is to account for 0
|
||||
if(((%max - %min) - ($rngCount[%id] - 1)) < 1) // reset if we cycled though all possable
|
||||
{
|
||||
$rngCount[%id] = 1; // we dont reset to 0 becuae of the last number used
|
||||
// change these numbers to expand range
|
||||
for(%a = -1000; %a <= 1000; %a++) // this resets a wide range incase min max change for what ever reasion
|
||||
{
|
||||
$rngList[%id,%a] = 0; // reset number list back to 0
|
||||
}
|
||||
|
||||
$rngList[%id,$rngLast[%id]] = 1; // mark teh last number used as in used after reset
|
||||
//error("reset"); //debug
|
||||
}
|
||||
|
||||
%rng = getRandom(%min,%max - $rngCount[%id] ); // find random number - the total number we have done
|
||||
|
||||
for(%i = %min; %i <= %max; %i++) // loop cycle though all possable numbers
|
||||
{
|
||||
if($RngList[%id,%i]) // skip over ones that we have all ready used
|
||||
{
|
||||
continue;
|
||||
}
|
||||
%c++; // skip counter
|
||||
|
||||
if(%rng == %c) // onces the skip counter matches the rng number we have landed on a valid number that we havent used yet
|
||||
{
|
||||
break; // kill the loop
|
||||
}
|
||||
}
|
||||
|
||||
$rngList[%id,%i] = 1;// this marks said number as used
|
||||
$rngCount[%id]++;// up are total used numbers
|
||||
$rngLast[%id] = %i; // for when the list resets it wont pick the same number twice
|
||||
|
||||
if(%i > %max || %i < %min)
|
||||
{ // fail safe
|
||||
return %max;
|
||||
}
|
||||
|
||||
return %i; // return the one we stoped on
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Info: Add a map to the mission list (source: bwadmin)
|
||||
function addRotationMap(%file, %type, %ffa, %cycle)
|
||||
{
|
||||
|
||||
if ( %cycle $= "" )
|
||||
{
|
||||
%cycle = %ffa;
|
||||
}
|
||||
|
||||
if(isFile("missions/" @ %file @ ".mis"))
|
||||
{
|
||||
if(%type $= "TR2" && !$Host::ClassicLoadTR2Gametype) // load TR2 gametype?
|
||||
return;
|
||||
|
||||
%fobject = new FileObject();
|
||||
|
||||
for(%n = 0; %n < $HostMissionCount; %n++)
|
||||
if($HostMissionFile[%n] $= %file)
|
||||
break;
|
||||
|
||||
if(%n == $HostMissionCount)
|
||||
{
|
||||
$HostMissionCount++;
|
||||
$HostMissionFile[%n] = %file;
|
||||
$HostMissionName[%n] = %file;
|
||||
|
||||
if(%fobject.openForRead("missions/" @ %file @ ".mis"))
|
||||
{
|
||||
while(!%fobject.isEOF())
|
||||
{
|
||||
%line = %fobject.readLine();
|
||||
|
||||
if(getSubStr(%line, 0, 17) $= "// DisplayName = ")
|
||||
// Override the mission name:
|
||||
$HostMissionName[%n] = getSubStr(%line, 17, 1000);
|
||||
}
|
||||
|
||||
%fobject.close();
|
||||
}
|
||||
|
||||
%navFile = "terrains/" @ %file @ ".nav";
|
||||
$BotEnabled[%n] = isFile(%navFile);
|
||||
}
|
||||
|
||||
for(%i = 0; %i < $HostTypeCount; %i++)
|
||||
|
||||
if($HostTypeName[%i] $= %type)
|
||||
break;
|
||||
|
||||
if(%i == $HostTypeCount)
|
||||
{
|
||||
$HostTypeCount++;
|
||||
$HostTypeName[%i] = %type;
|
||||
$HostMissionCount[%i] = 0;
|
||||
}
|
||||
|
||||
// add the mission to the type
|
||||
$HostMission[%i, $HostMissionCount[%i]] = %n;
|
||||
$HostMissionCount[%i]++;
|
||||
|
||||
if(%ffa !$= "")
|
||||
$Host::MapFFA[%file, %type] = %ffa;
|
||||
|
||||
if(%cycle !$= "")
|
||||
$Host::MapCycle[%file, %type] = %cycle;
|
||||
|
||||
%fobject.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(DarkTigerMapRotation))
|
||||
activatePackage(DarkTigerMapRotation);
|
||||
Loading…
Reference in a new issue