Legacy:LadderProfiles
From Unreal Wiki, The Unreal Engine Documentation Site
//-----------------------------------------------------------
// Ladder.LadderProfiles
//
// Serveractor responsible for placing LadderGameRules into the
// GameRulesModifier linked list
//
// Also serves to clearly give admins indication of what version
// of Ladder is installed on the server
//-----------------------------------------------------------
class LadderProfiles extends Info config;
var const float VER;
const LOGNAME = 'LadderProfiles';
var localized string LPPropsDisplayText;
var localized string DisabledText;
var string LogLine[6];
var int LogWidth;
var bool bEnableProfileControl;
var config string DefaultProfileName;
var config string LadderProfileClass;
function PreBeginPlay()
{
local GameRules GR;
local MutLadderMenu LadderMenu;
local string StatusText;
local class<AutoLoader> LoaderClass;
local int i;
LoaderClass = class<AutoLoader>(DynamicLoadObject("LadderLoader.LadderLoader",class'Class',True));
if (LoaderClass != None && !LoaderClass.static.MatchesVersion(VER,True,"http://www.organized-evolution.com/Ladder/"))
{
Destroy();
return;
}
bEnableProfileControl = default.bEnableProfileControl;
class'LadderGameRules'.default.DefaultProfileName = DefaultProfileName;
if (!bEnableProfileControl)
{
for (i = 0; i < class'LadderGameRules'.default.Profiles.Length; i++)
if (class'LadderGameRules'.default.Profiles[i].bActive)
class'LadderGameRules'.default.Profiles[i].bActive = False;
class'LadderGameRules'.static.StaticSaveConfig();
StatusText = DisabledText;
}
else
{
for (GR=Level.Game.GameRulesModifiers;GR!=None;GR=GR.NextGameRules)
{
if (LadderGameRules(GR) != None)
{
LadderGameRules(GR).SetOwner(Self);
LadderGameRules(GR).LadderProfileClass = LadderProfileClass;
LadderGameRules(GR).DefaultProfileName = DefaultProfileName;
break;
}
}
if (GR == None)
{
GR = Spawn(class'LadderGameRules',Self);
if (Level.Game.GameRulesModifiers != None)
Level.Game.GameRulesModifiers.AddGameRules(GR);
else Level.Game.GameRulesModifiers = GR;
}
LadderMenu = Spawn(class'Ladder.MutLadderMenu', Self);
if (LadderMenu != None)
Level.Game.BaseMutator.AddMutator(LadderMenu);
else log("Error spawning MutLadderMenu!",LOGNAME);
}
LogLine[1] = "Ladder v"$VER@StatusText;
LogLine[2] = "Server Profile Management System";
LogLine[3] = "by Organized Evolution";
LogLine[4] = "http://www.organized-evolution.com/Ladder/";
BannerLog();
}
function BannerLog()
{
local int i;
local string TestString, BorderString;
local string Prefix, Suffix;
for (i = 0; i < ArrayCount(LogLine); i++)
if ( Len(LogLine[i]) > LogWidth )
LogWidth = Len(LogLine[i]);
LogWidth = LogWidth + 6; // Account for the [] on each side
for (BorderString = ""; Len(BorderString) < LogWidth; BorderString = BorderString $ "~");
log("",LOGNAME);
log(BorderString,LOGNAME);
for (i = 0; i < ArrayCount(LogLine); i++)
{
Prefix = "[] "; Suffix = " []";
TestString = Prefix $ LogLine[i] $ Suffix;
while ( Len(TestString) < LogWidth)
{
Prefix = Prefix $ " ";
if (LogWidth - Len(TestString) > 1)
Suffix = " " $ Suffix;
TestString = Prefix $ LogLine[i] $ Suffix;
}
log(TestString,LOGNAME);
}
log(BorderString,LOGNAME);
log("",LOGNAME);
}
static function FillPlayInfo(PlayInfo PI)
{
Super.FillPlayInfo(PI);
PI.AddSetting("Server", "DefaultProfileName", default.LPPropsDisplayText, 1, 10, "Text", "32");
}
defaultproperties
{
VER=1.5
LadderProfileClass="Ladder.ProfileConfigSet"
DisabledText="( Disabled )"
LPPropsDisplayText="Default Profile Name"
}