00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 class LadderProfiles extends Info config;
00011
00012 var const float VER;
00013 const LOGNAME = 'LadderProfiles';
00014
00015 var localized string LPPropsDisplayText;
00016 var localized string DisabledText;
00017
00018 var string LogLine[6];
00019 var int LogWidth;
00020
00021 var bool bEnableProfileControl;
00022 var config string DefaultProfileName;
00023 var config string LadderProfileClass;
00024
00025 function PreBeginPlay()
00026 {
00027 local GameRules GR;
00028 local MutLadderMenu LadderMenu;
00029 local string StatusText;
00030 local class<AutoLoader> LoaderClass;
00031 local int i;
00032
00033 LoaderClass = class<AutoLoader>(DynamicLoadObject("LadderLoader.LadderLoader",class'Class',True));
00034 if (LoaderClass != None && !LoaderClass.static.MatchesVersion(VER,True,"http://www.organized-evolution.com/Ladder/"))
00035 {
00036 Destroy();
00037 return;
00038 }
00039
00040 bEnableProfileControl = default.bEnableProfileControl;
00041
00042 class'LadderGameRules'.default.DefaultProfileName = DefaultProfileName;
00043 if (!bEnableProfileControl)
00044 {
00045 for (i = 0; i < class'LadderGameRules'.default.Profiles.Length; i++)
00046 if (class'LadderGameRules'.default.Profiles[i].bActive)
00047 class'LadderGameRules'.default.Profiles[i].bActive = False;
00048
00049 class'LadderGameRules'.static.StaticSaveConfig();
00050 StatusText = DisabledText;
00051 }
00052
00053 else
00054 {
00055 for (GR=Level.Game.GameRulesModifiers;GR!=None;GR=GR.NextGameRules)
00056 {
00057 if (LadderGameRules(GR) != None)
00058 {
00059 LadderGameRules(GR).SetOwner(Self);
00060 LadderGameRules(GR).LadderProfileClass = LadderProfileClass;
00061 LadderGameRules(GR).DefaultProfileName = DefaultProfileName;
00062 break;
00063 }
00064 }
00065
00066 if (GR == None)
00067 {
00068 GR = Spawn(class'LadderGameRules',Self);
00069 if (Level.Game.GameRulesModifiers != None)
00070 Level.Game.GameRulesModifiers.AddGameRules(GR);
00071 else Level.Game.GameRulesModifiers = GR;
00072 }
00073
00074 LadderMenu = Spawn(class'Ladder.MutLadderMenu', Self);
00075 if (LadderMenu != None)
00076 Level.Game.BaseMutator.AddMutator(LadderMenu);
00077 else log("Error spawning MutLadderMenu!",LOGNAME);
00078 }
00079
00080 LogLine[1] = "Ladder v"$VER@StatusText;
00081 LogLine[2] = "Server Profile Management System";
00082 LogLine[3] = "by Organized Evolution";
00083 LogLine[4] = "http://www.organized-evolution.com/Ladder/";
00084
00085 BannerLog();
00086 }
00087
00088 function BannerLog()
00089 {
00090 local int i;
00091 local string TestString, BorderString;
00092 local string Prefix, Suffix;
00093
00094 for (i = 0; i < ArrayCount(LogLine); i++)
00095 if ( Len(LogLine[i]) > LogWidth )
00096 LogWidth = Len(LogLine[i]);
00097
00098 LogWidth = LogWidth + 6;
00099 for (BorderString = ""; Len(BorderString) < LogWidth; BorderString = BorderString $ "~");
00100 log("",LOGNAME);
00101 log(BorderString,LOGNAME);
00102
00103 for (i = 0; i < ArrayCount(LogLine); i++)
00104 {
00105 Prefix = "[] "; Suffix = " []";
00106 TestString = Prefix $ LogLine[i] $ Suffix;
00107
00108 while ( Len(TestString) < LogWidth)
00109 {
00110 Prefix = Prefix $ " ";
00111 if (LogWidth - Len(TestString) > 1)
00112 Suffix = " " $ Suffix;
00113
00114 TestString = Prefix $ LogLine[i] $ Suffix;
00115 }
00116
00117 log(TestString,LOGNAME);
00118 }
00119
00120 log(BorderString,LOGNAME);
00121 log("",LOGNAME);
00122 }
00123
00124 static function FillPlayInfo(PlayInfo PI)
00125 {
00126 Super.FillPlayInfo(PI);
00127
00128 PI.AddSetting("Server", "DefaultProfileName", default.LPPropsDisplayText, 1, 10, "Text", "32");
00129 }
00130
00131
00132 defaultproperties
00133 {
00134 VER=1.5
00135 LadderProfileClass="Ladder.ProfileConfigSet"
00136 DisabledText="( Disabled )"
00137 LPPropsDisplayText="Default Profile Name"
00138 }