Botpack
Class ServerInfo

source: e:\games\UnrealTournament\Botpack\Classes\ServerInfo.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Botpack.ServerInfo
Direct Known Subclasses:ServerInfoTeam

class ServerInfo
extends Engine.Info


Variables
 string AdminText
 string BestFPHText
 string BestNameText
 string BestRecordSetText
 string BotText
 string ContactInfoText
 string EMailText
 string FragsLoggedText
 string FragsText
 string GameStatsText
 string GameTypeText
 string GamesHostedText
 string MOTD
 FontInfo MyFonts
 string NameText
 string PlayersText
 string ServerInfoText
 string ServerStatsText
 string TopPlayersText
 string UnknownText
 string VictimsText


Function Summary
 void Destroyed()
 void DrawContactInfo(Canvas C, GameReplicationInfo GRI)
 void DrawGameStats(Canvas C, GameReplicationInfo GRI)
 void DrawLeaderBoard(Canvas C, GameReplicationInfo GRI)
 void DrawMOTD(Canvas C, GameReplicationInfo GRI)
 void DrawServerStats(Canvas C, GameReplicationInfo GRI)
 void DrawShortContactInfo(Canvas C, GameReplicationInfo GRI)
 void DrawShortMOTD(Canvas C, GameReplicationInfo GRI)
 void DrawTitle(Canvas C)
 void PostBeginPlay()
 void RenderInfo(Canvas C)



Source Code


00001	class ServerInfo extends Info;
00002	
00003	var localized string ServerInfoText;
00004	var localized string ContactInfoText;
00005	var localized string NameText;
00006	var localized string AdminText;
00007	var localized string EMailText;
00008	var localized string UnknownText;
00009	var localized string MOTD;
00010	var localized string ServerStatsText;
00011	var localized string FragsLoggedText;
00012	var localized string GamesHostedText;
00013	var localized string VictimsText;
00014	var localized string GameStatsText;
00015	var localized string GameTypeText;
00016	var localized string PlayersText;
00017	var localized string FragsText;
00018	var localized string TopPlayersText;
00019	var localized string BestNameText;
00020	var localized string BestFPHText;
00021	var localized string BestRecordSetText;
00022	var localized string BotText;
00023	
00024	var FontInfo MyFonts;
00025	
00026	function Destroyed()
00027	{
00028		Super.Destroyed();
00029		if ( MyFonts != None )
00030			MyFonts.Destroy();
00031	}
00032	
00033	function PostBeginPlay()
00034	{
00035		Super.PostBeginPlay();
00036		MyFonts = FontInfo(spawn(Class<Actor>(DynamicLoadObject(class'ChallengeHUD'.default.FontInfoClass, class'Class'))));
00037	}
00038	
00039	function RenderInfo( canvas C )
00040	{
00041		local GameReplicationInfo GRI;
00042		GRI = PlayerPawn(Owner).GameReplicationInfo;
00043	
00044		DrawTitle(C);
00045	
00046		if (C.ClipX > 512)
00047		{
00048			DrawContactInfo(C, GRI);
00049			DrawMOTD(C, GRI);
00050			DrawServerStats(C, GRI);
00051			DrawGameStats(C, GRI);
00052			DrawLeaderBoard(C, GRI);
00053		} else {
00054			DrawShortContactInfo(C, GRI);
00055			DrawShortMOTD(C, GRI);
00056		}
00057	}
00058	
00059	function DrawTitle( canvas C )
00060	{
00061		local float XL, YL;
00062	
00063		C.Font = MyFonts.GetHugeFont( C.ClipX );
00064		C.DrawColor.R = 9;
00065		C.DrawColor.G = 151;
00066		C.DrawColor.B = 247;
00067	
00068		C.StrLen( ServerInfoText, XL, YL );
00069		C.SetPos( (C.ClipX - XL) / 2, YL );
00070		C.DrawText( ServerInfoText, True );
00071	}
00072	
00073	function DrawContactInfo( canvas C, GameReplicationInfo GRI )
00074	{
00075		local float XL, YL, XL2, YL2;
00076	
00077		C.DrawColor.R = 9;
00078		C.DrawColor.G = 151;
00079		C.DrawColor.B = 247;
00080	
00081		C.Font = MyFonts.GetBigFont( C.ClipX );
00082		C.StrLen( "TEMP", XL, YL );
00083	
00084		C.SetPos( C.ClipX / 8, (C.ClipY / 8) );
00085		C.DrawText( ContactInfoText, True);
00086	
00087		C.DrawColor.R = 0;
00088		C.DrawColor.G = 128;
00089		C.DrawColor.B = 255;
00090	
00091		C.Font = MyFonts.GetSmallFont( C.ClipX );
00092		C.StrLen( "TEMP", XL2, YL2 );
00093	
00094		C.SetPos( C.ClipX / 8, (C.ClipY / 8) + (YL+1) );
00095		C.DrawText( NameText, True);
00096	
00097		C.SetPos( C.ClipX / 8, (C.ClipY / 8) + (YL+1) + (YL2+1) );
00098		C.DrawText( AdminText, True);
00099	
00100		C.SetPos( C.ClipX / 8, (C.ClipY / 8) + (YL+1) + (YL2+1)*2 );
00101		C.DrawText( EMailText, True);
00102	
00103		C.DrawColor.R = 255;
00104		C.DrawColor.G = 255;
00105		C.DrawColor.B = 255;
00106	
00107		C.SetPos( (C.ClipX / 8) + XL2*2, (C.ClipY / 8) + (YL+1) );
00108		C.DrawText( GRI.ServerName, True);
00109	
00110		C.SetPos( (C.ClipX / 8) + XL2*2, (C.ClipY / 8) + (YL+1) + (YL2+1) );
00111		if (GRI.AdminName != "")
00112			C.DrawText( GRI.AdminName, True );
00113		else
00114			C.DrawText( UnknownText, True );
00115	
00116		C.SetPos( (C.ClipX / 8) + XL2*2, (C.ClipY / 8) + (YL+1) + (YL2+1)*2 );
00117		if (GRI.AdminEmail != "")
00118			C.DrawText( GRI.AdminEmail, True );
00119		else
00120			C.DrawText( UnknownText, True );
00121	}
00122	
00123	function DrawMOTD( canvas C, GameReplicationInfo GRI )
00124	{
00125		local float XL, YL, XL2, YL2;
00126	
00127		C.DrawColor.R = 9;
00128		C.DrawColor.G = 151;
00129		C.DrawColor.B = 247;
00130	
00131		C.Font = MyFonts.GetBigFont( C.ClipX );
00132		C.StrLen( "TEMP", XL, YL );
00133	
00134		C.SetPos( (C.ClipX / 8)*5, C.ClipY / 8 );
00135		C.DrawText( MOTD, True);
00136	
00137		C.DrawColor.R = 255;
00138		C.DrawColor.G = 255;
00139		C.DrawColor.B = 255;
00140	
00141		C.Font = MyFonts.GetSmallFont( C.ClipX );
00142		C.StrLen( "TEMP", XL2, YL2 );
00143	
00144		C.StrLen( GRI.MOTDLine1, XL2, YL2 );
00145		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8) + (YL+1) );
00146		C.DrawText( GRI.MOTDLine1, True );
00147	
00148		C.StrLen( GRI.MOTDLine2, XL2, YL2 );
00149		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8) + (YL+1) + (YL2+1) );
00150		C.DrawText( GRI.MOTDLine2, True );
00151	
00152		C.StrLen( GRI.MOTDLine3, XL2, YL2 );
00153		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8) + (YL+1) + (YL2+1)*2 );
00154		C.DrawText( GRI.MOTDLine3, True );
00155	
00156		C.StrLen( GRI.MOTDLine4, XL2, YL2 );
00157		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8) + (YL+1) + (YL2+1)*3 );
00158		C.DrawText( GRI.MOTDLine4, True );
00159	}
00160	
00161	function DrawServerStats( canvas C, GameReplicationInfo GRI )
00162	{
00163		local float XL, YL, XL2, YL2;
00164		local TournamentGameReplicationInfo TGRI;
00165	
00166		C.DrawColor.R = 9;
00167		C.DrawColor.G = 151;
00168		C.DrawColor.B = 247;
00169	
00170		C.Font = MyFonts.GetBigFont( C.ClipX );
00171		C.StrLen( "TEMP", XL, YL );
00172	
00173		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8)*3 );
00174		C.DrawText( ServerStatsText, True);
00175	
00176		C.DrawColor.R = 0;
00177		C.DrawColor.G = 128;
00178		C.DrawColor.B = 255;
00179	
00180		C.Font = MyFonts.GetSmallFont( C.ClipX );
00181		C.StrLen( "TEMP", XL2, YL2 );
00182	
00183		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8)*3 + (YL+1) );
00184		C.DrawText( GamesHostedText, True);
00185	
00186		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8)*3 + (YL+1) + (YL2+1) );
00187		C.DrawText( FragsLoggedText, True);
00188	
00189		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8)*3 + (YL+1) + (YL2+1)*2 );
00190		C.DrawText( VictimsText, True);
00191	
00192		C.DrawColor.R = 255;
00193		C.DrawColor.G = 255;
00194		C.DrawColor.B = 255;
00195	
00196		TGRI = TournamentGameReplicationInfo(GRI);
00197	
00198		C.SetPos( (C.ClipX / 8)*6, (C.ClipY / 8)*3 + (YL+1) );
00199		C.DrawText( TGRI.TotalGames, True);
00200	
00201		C.SetPos( (C.ClipX / 8)*6, (C.ClipY / 8)*3 + (YL+1) + (YL2+1) );
00202		C.DrawText( TGRI.TotalFrags, True);
00203	
00204		C.SetPos( (C.ClipX / 8)*6, (C.ClipY / 8)*3 + (YL+1) + (YL2+1)*2 );
00205		C.DrawText( TGRI.TotalDeaths, True);
00206	}
00207	
00208	function DrawGameStats( canvas C, GameReplicationInfo GRI )
00209	{
00210		local float XL, YL, XL2, YL2;
00211		local TournamentGameReplicationInfo TGRI;
00212		local int i, NumBots;
00213	
00214		C.DrawColor.R = 9;
00215		C.DrawColor.G = 151;
00216		C.DrawColor.B = 247;
00217	
00218		C.Font = MyFonts.GetBigFont( C.ClipX );
00219		C.StrLen( "TEMP", XL, YL );
00220	
00221		C.SetPos( (C.ClipX / 8), (C.ClipY / 8)*3 );
00222		C.DrawText( GameStatsText, True);
00223	
00224		C.DrawColor.R = 0;
00225		C.DrawColor.G = 128;
00226		C.DrawColor.B = 255;
00227	
00228		C.Font = MyFonts.GetSmallFont( C.ClipX );
00229		C.StrLen( "TEMP", XL2, YL2 );
00230	
00231		C.SetPos( (C.ClipX / 8), (C.ClipY / 8)*3 + (YL+1) );
00232		C.DrawText( GameTypeText, True);
00233	
00234		C.SetPos( (C.ClipX / 8), (C.ClipY / 8)*3 + (YL+1) + (YL2+1) );
00235		C.DrawText( PlayersText, True);
00236	
00237		C.SetPos( (C.ClipX / 8), (C.ClipY / 8)*3 + (YL+1) + (YL2+1)*2 );
00238		C.DrawText( FragsText, True);
00239	
00240		C.DrawColor.R = 255;
00241		C.DrawColor.G = 255;
00242		C.DrawColor.B = 255;
00243	
00244		C.SetPos( (C.ClipX / 8)*2, (C.ClipY / 8)*3 + (YL+1) );
00245		C.DrawText( GRI.GameName, True);
00246	
00247		for (i=0; i<32; i++)
00248			if ((GRI.PRIArray[i] != None) && (GRI.PRIArray[i].bIsABot))
00249				NumBots++;
00250		C.SetPos( (C.ClipX / 8)*2, (C.ClipY / 8)*3 + (YL+1) + (YL2+1) );
00251		C.DrawText( GRI.NumPlayers$"   ["$NumBots@BotText$"]", True);
00252	
00253		C.SetPos( (C.ClipX / 8)*2, (C.ClipY / 8)*3 + (YL+1) + (YL2+1)*2 );
00254		C.DrawText( GRI.SumFrags, True);
00255	}
00256	
00257	function DrawLeaderBoard( canvas C, GameReplicationInfo GRI )
00258	{
00259		local float XL, YL;
00260		local int i;
00261		local TournamentGameReplicationInfo TGRI;
00262	
00263		C.DrawColor.R = 9;
00264		C.DrawColor.G = 151;
00265		C.DrawColor.B = 247;
00266	
00267		C.Font = MyFonts.GetBigFont( C.ClipX );
00268		C.StrLen( TopPlayersText, XL, YL );
00269	
00270		C.SetPos( (C.ClipX - XL) / 2, (C.ClipY / 8)*5 );
00271		C.DrawText( TopPlayersText, True);
00272	
00273		C.DrawColor.R = 0;
00274		C.DrawColor.G = 128;
00275		C.DrawColor.B = 255;
00276	
00277		C.Font = MyFonts.GetSmallFont( C.ClipX );
00278	
00279		C.SetPos( C.ClipX / 8, (C.ClipY / 8)*5 + (YL+1) );
00280		C.DrawText( BestNameText, True);
00281	
00282		C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8)*5 + (YL+1) );
00283		C.DrawText( BestFPHText, True);
00284	
00285		C.SetPos( (C.ClipX / 8)*6, (C.ClipY / 8)*5 + (YL+1) );
00286		C.DrawText( BestRecordSetText, True);
00287	
00288		C.DrawColor.R = 255;
00289		C.DrawColor.G = 255;
00290		C.DrawColor.B = 255;
00291	
00292		TGRI = TournamentGameReplicationInfo(GRI);
00293		for (i=0; i<3; i++)
00294		{
00295			C.SetPos( C.ClipX / 8, (C.ClipY / 8)*5 + (YL+1)*(i+2) );
00296			if ( TGRI.BestPlayers[i] != "" )
00297				C.DrawText( TGRI.BestPlayers[i], True);
00298			else
00299				C.DrawText( "--", True);
00300	
00301			C.SetPos( (C.ClipX / 8)*5, (C.ClipY / 8)*5 + (YL+1)*(i+2) );
00302			if ( TGRI.BestPlayers[i] != "" )
00303				C.DrawText( TGRI.BestFPHs[i], True);
00304			else
00305				C.DrawText( "--", True);
00306	
00307			C.SetPos( (C.ClipX / 8)*6, (C.ClipY / 8)*5 + (YL+1)*(i+2) );
00308			if ( TGRI.BestPlayers[i] != "" )
00309				C.DrawText( TGRI.BestRecordDate[i], True);
00310			else
00311				C.DrawText( "--", True);
00312		}
00313	}
00314	
00315	function DrawShortContactInfo( canvas C, GameReplicationInfo GRI )
00316	{
00317		local float XL, YL, XL2, YL2;
00318	
00319		C.DrawColor.R = 9;
00320		C.DrawColor.G = 151;
00321		C.DrawColor.B = 247;
00322	
00323		C.Font = MyFonts.GetBigFont( C.ClipX );
00324		C.StrLen( ContactInfoText, XL, YL );
00325	
00326		C.SetPos( (C.ClipX-XL)/2, (C.ClipY / 4) );
00327		C.DrawText( ContactInfoText, True);
00328	
00329		C.DrawColor.R = 0;
00330		C.DrawColor.G = 128;
00331		C.DrawColor.B = 255;
00332	
00333		C.Font = MyFonts.GetSmallFont( C.ClipX );
00334		C.StrLen( "TEMP", XL2, YL2 );
00335	
00336		C.SetPos( C.ClipX / 4, (C.ClipY / 4) + (YL+1) );
00337		C.DrawText( NameText, True);
00338	
00339		C.SetPos( C.ClipX / 4, (C.ClipY / 4) + (YL+1) + (YL2+1) );
00340		C.DrawText( AdminText, True);
00341	
00342		C.SetPos( C.ClipX / 4, (C.ClipY / 4) + (YL+1) + (YL2+1)*2 );
00343		C.DrawText( EMailText, True);
00344	
00345		C.DrawColor.R = 255;
00346		C.DrawColor.G = 255;
00347		C.DrawColor.B = 255;
00348	
00349		C.SetPos( (C.ClipX / 4) + XL2*2, (C.ClipY / 4) + (YL+1) );
00350		C.DrawText( GRI.ServerName, True);
00351	
00352		C.SetPos( (C.ClipX / 4) + XL2*2, (C.ClipY / 4) + (YL+1) + (YL2+1) );
00353		if (GRI.AdminName != "")
00354			C.DrawText( GRI.AdminName, True );
00355		else
00356			C.DrawText( UnknownText, True );
00357	
00358		C.SetPos( (C.ClipX / 4) + XL2*2, (C.ClipY / 4) + (YL+1) + (YL2+1)*2 );
00359		if (GRI.AdminEmail != "")
00360			C.DrawText( GRI.AdminEmail, True );
00361		else
00362			C.DrawText( UnknownText, True );
00363	}
00364	
00365	function DrawShortMOTD( canvas C, GameReplicationInfo GRI )
00366	{
00367		local float XL, YL, XL2, YL2;
00368	
00369		C.DrawColor.R = 9;
00370		C.DrawColor.G = 151;
00371		C.DrawColor.B = 247;
00372	
00373		C.Font = MyFonts.GetBigFont( C.ClipX );
00374		C.StrLen( MOTD, XL, YL );
00375	
00376		C.SetPos( (C.ClipX-XL)/2, C.ClipY/2 );
00377		C.DrawText( MOTD, True);
00378	
00379		C.DrawColor.R = 255;
00380		C.DrawColor.G = 255;
00381		C.DrawColor.B = 255;
00382	
00383		C.Font = MyFonts.GetSmallFont( C.ClipX );
00384		C.StrLen( "TEMP", XL2, YL2 );
00385	
00386		C.StrLen( GRI.MOTDLine1, XL2, YL2 );
00387		C.SetPos( (C.ClipX/8)*3, (C.ClipY/2) + (YL+1) );
00388		C.DrawText( GRI.MOTDLine1, True );
00389	
00390		C.StrLen( GRI.MOTDLine2, XL2, YL2 );
00391		C.SetPos( (C.ClipX/8)*3, (C.ClipY/2) + (YL+1) + (YL2+1) );
00392		C.DrawText( GRI.MOTDLine2, True );
00393	
00394		C.StrLen( GRI.MOTDLine3, XL2, YL2 );
00395		C.SetPos( (C.ClipX/8)*3, (C.ClipY/2) + (YL+1) + (YL2+1)*2 );
00396		C.DrawText( GRI.MOTDLine3, True );
00397	
00398		C.StrLen( GRI.MOTDLine4, XL2, YL2 );
00399		C.SetPos( (C.ClipX/8)*3, (C.ClipY/2) + (YL+1) + (YL2+1)*3 );
00400		C.DrawText( GRI.MOTDLine4, True );
00401	}
00402	
00403	defaultproperties
00404	{
00405	     ServerInfoText="Server Info"
00406	     ContactInfoText="Contact Info"
00407	     NameText="Name:"
00408	     AdminText="Admin:"
00409	     EMailText="EMail:"
00410	     UnknownText="Unknown"
00411	     MOTD="Message of the Day"
00412	     ServerStatsText="Server Stats"
00413	     FragsLoggedText="Frags Logged:"
00414	     GamesHostedText="Games Hosted:"
00415	     VictimsText="Lives Claimed:"
00416	     GameStatsText="Game Stats"
00417	     GameTypeText="GameType:"
00418	     PlayersText="Players:"
00419	     FragsText="Total Frags:"
00420	     TopPlayersText="Top Players [Frags per Hour]"
00421	     BestNameText="Name"
00422	     BestFPHText="Best FPH"
00423	     BestRecordSetText="Record Set"
00424	     BotText="Bots"
00425	}

End Source Code