Always snap to grid

Legacy:LadderProfiles

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2003 :: Object >> Actor >> Info >> LadderProfiles ( Ladder1.46 )
  1. //-----------------------------------------------------------
  2. // Ladder.LadderProfiles
  3. //
  4. // Serveractor responsible for placing LadderGameRules into the
  5. // GameRulesModifier linked list
  6. //
  7. // Also serves to clearly give admins indication of what version
  8. // of Ladder is installed on the server
  9. //-----------------------------------------------------------
  10. class LadderProfiles extends Info config;
  11.  
  12. var const float VER;
  13. const LOGNAME = 'LadderProfiles';
  14.  
  15. var localized string LPPropsDisplayText;
  16. var localized string DisabledText;
  17.  
  18. var string 	LogLine[6];
  19. var int 	LogWidth;
  20.  
  21. var bool				bEnableProfileControl;
  22. var config string		DefaultProfileName;
  23. var config string		LadderProfile${1}< ${3} >
  24.  
  25. function PreBeginPlay()
  26. {
  27. 	local GameRules GR;
  28. 	local MutLadderMenu LadderMenu;
  29. 	local string StatusText;
  30. 	local class<AutoLoader>	Loader${1}< ${3} >
  31. 	local int i;
  32.  
  33. 	LoaderClass = class<AutoLoader>(DynamicLoadObject("LadderLoader.LadderLoader",class'Class',True));
  34. 	if (LoaderClass != None && !LoaderClass.static.MatchesVersion(VER,True,"http://www.organized-evolution.com/Ladder/"))
  35. 	{
  36. 		Destroy();
  37. 		return;
  38. 	}
  39.  
  40. 	bEnableProfileControl = default.bEnableProfileControl;
  41.  
  42. 	class'LadderGameRules'.default.DefaultProfileName = DefaultProfileName;
  43. 	if (!bEnableProfileControl)
  44. 	{
  45. 		for (i = 0; i < class'LadderGameRules'.default.Profiles.Length; i++)
  46. 			if (class'LadderGameRules'.default.Profiles[i].bActive)
  47. 				class'LadderGameRules'.default.Profiles[i].bActive = False;
  48.  
  49. 		class'LadderGameRules'.static.StaticSaveConfig();
  50. 		StatusText = DisabledText;
  51. 	}
  52.  
  53. 	else
  54. 	{
  55. 		for (GR=Level.Game.GameRulesModifiers;GR!=None;GR=GR.NextGameRules)
  56. 		{
  57. 			if (LadderGameRules(GR) != None)
  58. 			{
  59. 				LadderGameRules(GR).SetOwner(Self);
  60. 				LadderGameRules(GR).LadderProfileClass = LadderProfile${1}< ${3} >
  61. 				LadderGameRules(GR).DefaultProfileName = DefaultProfileName;
  62. 				break;
  63. 			}
  64. 		}
  65.  
  66. 		if (GR == None)
  67. 		{
  68. 			GR = Spawn(class'LadderGameRules',Self);
  69. 			if (Level.Game.GameRulesModifiers != None)
  70. 				Level.Game.GameRulesModifiers.AddGameRules(GR);
  71. 			else Level.Game.GameRulesModifiers = GR;
  72. 		}
  73.  
  74. 		LadderMenu = Spawn(class'Ladder.MutLadderMenu', Self);
  75. 		if (LadderMenu != None)
  76. 			Level.Game.BaseMutator.AddMutator(LadderMenu);
  77. 		else log("Error spawning MutLadderMenu!",LOGNAME);
  78. 	}
  79.  
  80. 	LogLine[1] = "Ladder v"$VER@StatusText;
  81. 	LogLine[2] = "Server Profile Management System";
  82. 	LogLine[3] = "by Organized Evolution";
  83. 	LogLine[4] = "http://www.organized-evolution.com/Ladder/";
  84.  
  85. 	BannerLog();
  86. }
  87.  
  88. function BannerLog()
  89. {
  90. 	local int 		i;
  91. 	local string 	TestString, BorderString;
  92. 	local string	Prefix, Suffix;
  93.  
  94. 	for (i = 0; i < ArrayCount(LogLine); i++)
  95. 		if ( Len(LogLine[i]) > LogWidth )
  96. 			LogWidth = Len(LogLine[i]);
  97.  
  98. 	LogWidth = LogWidth + 6;  // Account for the [] on each side
  99. 	for (BorderString = ""; Len(BorderString) < LogWidth; BorderString = BorderString $ "~");
  100. 	log("",LOGNAME);
  101. 	log(BorderString,LOGNAME);
  102.  
  103. 	for (i = 0; i < ArrayCount(LogLine); i++)
  104. 	{
  105. 		Prefix = "[] "; Suffix = " []";
  106. 		TestString = Prefix $ LogLine[i] $ Suffix;
  107.  
  108. 		while ( Len(TestString) < LogWidth)
  109. 		{
  110. 			Prefix = Prefix $ " ";
  111. 			if (LogWidth - Len(TestString) > 1)
  112. 				Suffix = " " $ Suffix;
  113.  
  114. 			TestString = Prefix $ LogLine[i] $ Suffix;
  115. 		}
  116.  
  117. 		log(TestString,LOGNAME);
  118. 	}
  119.  
  120. 	log(BorderString,LOGNAME);
  121. 	log("",LOGNAME);
  122. }
  123.  
  124. static function FillPlayInfo(PlayInfo PI)
  125. {
  126. 	Super.FillPlayInfo(PI);
  127.  
  128. 	PI.AddSetting("Server", "DefaultProfileName", default.LPPropsDisplayText, 1, 10, "Text", "32");
  129. }
  130.  
  131.  
  132. defaultproperties
  133. {
  134. 	VER=1.5
  135. 	LadderProfileClass="Ladder.ProfileConfigSet"
  136. 	DisabledText="( Disabled )"
  137. 	LPPropsDisplayText="Default Profile Name"
  138. }