//=============================================================================// // Map Vote Mutator v0.5 Copyright(C) 2005 Adam Mummery-Smith B.S.E. // //=============================================================================// class ExtendedMapList extends MapListXMP config; //=============================================================================// // Class: ExtendedMapList | Date: December 2005 // //-----------------------------------------------------------------------------// // Project: Map Vote Mutator | Author: Adam Mummery-Smith // //-----------------------------------------------------------------------------// // Description: In order for the "vote for next map" functionality to work, // // we need to intercept calls to retrieve the next map in // // rotation. This class steps in to do that. It also gives us a // // handy place to keep the pre-defined map list. // //-----------------------------------------------------------------------------// // Usage: N/A // //-----------------------------------------------------------------------------// // Note: Bug fixed: now keeps this class' maplist in line with the // // superclass'. // //=============================================================================// //----------------------------------------------------------------------------- // Declarations var config string VoteableMaps[10]; // The list of pre-defined maps //----------------------------------------------------------------------------- // We intercept calls to GetNextMap so that if a map is queued we can return that instead function string GetNextMap() { local string NextMap; // Synchronise our maplist with the superclass!!! SyncInheritedMapList(); // If a map is queued, get that instead if (Level? && Level.Game? && Level.Game.GameReplicationInfo? && MapVoteGameReplicationInfo(Level.Game.GameReplicationInfo)?) { NextMap = MapVoteGameReplicationInfo(Level.Game.GameReplicationInfo).QueuedMap; } // Otherwise, return the next map in rotation if (NextMap == "") NextMap = Super.GetNextMap(); return NextMap; } //----------------------------------------------------------------------------- // Returns an array containing the pre-defined maps (if any) set by the admin static function GetPredefinedMapList(out string Maps[10]) { local int i; for (i = 0; i < 10; i++) Maps[i] = default.VoteableMaps[i]; } //----------------------------------------------------------------------------- // Returns the pre-defined map at a specific location static function string GetPredefinedMapAtIndex(int MapNumber) { return default.VoteableMaps[MapNumber]; } //----------------------------------------------------------------------------- // Returns the next map without incrementing the counter function string PredictNextMap() { local string CurrentMap; local int i, NextMapNum; // Synchronise our maplist with the superclass!!! SyncInheritedMapList(); if (Level? && Level.Game? && Level.Game.GameReplicationInfo? && MapVoteGameReplicationInfo(Level.Game.GameReplicationInfo)? && MapVoteGameReplicationInfo(Level.Game.GameReplicationInfo).QueuedMap != "") { return MapVoteGameReplicationInfo(Level.Game.GameReplicationInfo).QueuedMap; } // Fixes an array access out of bound error if the maplist is empty if ( Maps.Length < 1) return ""; NextMapNum = MapNum; CurrentMap = GetURLMap(); if ( CurrentMap != "" ) { if ( Right(CurrentMap,4) ~= ".unr" ) CurrentMap = CurrentMap; else CurrentMap = CurrentMap$".unr"; for ( i=0; i Maps.Length - 1 ) NextMapNum = 0; if ( Maps[NextMapNum] == "" ) NextMapNum = 0; return Maps[NextMapNum]; } //----------------------------------------------------------------------------- // Had to add this function after it turned out that because lots of classes use // GameType.default.MapListType (including the WebAdmin), maplist was being updated in the // superclass but not here. This clears the 'local', inherited maplist and syncs it with // the parent classes maplist. function SyncInheritedMapList() { local class GameClass; local class MapListClass; local int i; GameClass = class(DynamicLoadObject("U2.XMPGame", class'Class')); MapListClass = class(DynamicLoadObject(GameClass.default.MapListType, class'Class')); Maps.Remove(0,Maps.Length); for (i = 0; i < MapListClass.Default.Maps.length; i++) Maps[i] = MapListClass.Default.Maps[i]; MapListClass.Default.MapNum = MapNum; SaveConfig(); } //----------------------------------------------------------------------------- // Used by the admin maplist compiler to get a list of all the maps on the server. // Doesn't have to be here but might as well be. This was adapted from a function in // the WebAdmin that compiles the "exclude" maplist. function GetAllMaps(out arrayAllMaps, String GameType) { local class GameClass; local string FirstMap, NextMap, TestMap; local string TempItem; GameClass = class(DynamicLoadObject(GameType, class'Class')); if(GameClass.Default.MapPrefix == "") return; FirstMap = Level.GetMapName(GameClass.Default.MapPrefix, "", 0); NextMap = FirstMap; while (!(FirstMap ~= TestMap) && FirstMap != "") { if(!(Left(NextMap, Len(NextMap) - 4) ~= (GameClass.Default.MapPrefix$"-tutorial"))) { TempItem = NextMap; if(Right(NextMap, 4) ~= ".unr") TempItem = Left(NextMap, Len(NextMap) - 4); else TempItem = NextMap; AllMaps[AllMaps.Length] = TempItem; } NextMap = Level.GetMapName(GameClass.Default.MapPrefix, NextMap, 1); TestMap = NextMap; } } defaultproperties { Maps(0)="XMP-Alcazar" Maps(1)="XMP-APv2-Miasma-FMI" Maps(2)="XMP-Sirocco" Maps(3)="XMP-Saiboat" Maps(4)="XMP-Rampant" Maps(5)="XMP-NaKoja" Maps(6)="XMP-Lowlands" Maps(7)="XMP-Garden" Maps(8)="XMP-CBP-Wonderwoods" Maps(9)="XMP-CBP-WinterGarden" Maps(10)="XMP-CBP-Kaminari-LE" Maps(11)="XMP-BSE-Castaway-alpha2" Maps(12)="XMP-BSE-Bullshit" MapNum=3 }