using System;
using System.IO;
using System.Text;
using System.Linq;
using Server.Mobiles;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Network;
using Server.Guilds;
namespace Server.Misc
{
public class StatusPage2 : Timer
{
public static void Initialize()
{
new StatusPage2().Start();
}
public StatusPage2() : base( TimeSpan.FromSeconds( 30.0 ), TimeSpan.FromSeconds( 30.0 ) )
{
Priority = TimerPriority.FiveSeconds;
}
private static string Encode( string input )
{
StringBuilder sb = new StringBuilder( input );
sb.Replace( "&", "&" );
sb.Replace( "<", "<" );
sb.Replace( ">", ">" );
sb.Replace( "\"", """ );
sb.Replace( "'", "'" );
return sb.ToString();
}
protected override void OnTick()
{
//Not sure if this has to be modified, just make sure that you at least manually create the directory that you point this script to
if ( !Directory.Exists( "web" ) )
Directory.CreateDirectory( "web" );
//use forward slashes or else your shard may crash the first time it writes that status.html page
using ( StreamWriter op = new StreamWriter( "c:/web/index2.html" ) ) //If you do not use Reactor as a webserver, put your path to where you want the file created.
{
op.WriteLine( "<html>" );
op.WriteLine( " <head>" );
op.WriteLine( " <title>Ultima Online: Titanes</title>" ); //Modify the address to your shard's hosting address
op.WriteLine( "</head>" );
op.WriteLine( " <body background=\"fondo.JPG\" ");
op.WriteLine( " <h1 align=\"center\"><img border=\"0\" src=\"logo.jpg\" width=\"270\" height=\"50\"></h1>" ); //If you have a logo, put a copy of it in the same folder as the status.html (where it will be) then whatever your logo filename is just put that and the file ending. If you do not have a logo, either make one or comment this line out via a //
op.WriteLine( " <table width=\"100%\">" );
op.WriteLine( " <tr>" );
op.WriteLine( " <td bgcolor=\"#996633\"><font color=\"white\" face=\"Arial Narrow\" size=\"2\">Nombre</font></td><td bgcolor=\"#996633\"><font color=\"white\" face=\"Arial Narrow\" size=\"2\">Muertes</font></td><td bgcolor=\"#996633\"><font color=\"white\" face=\"Arial Narrow\" size=\"2\">Karma / Fama</font></td>" );
op.WriteLine( " </tr>" );
//To Do: Style Sheet
var players = new List<Mobile>(World.Mobiles.Values.Where(x=>x is PlayerMobile));
players.OrderByDescending(p => p.Kills);
for ( int i = 1; i < 11; ++i )
{
Mobile m = players[i];
op.Write( "<tr><td>" );
string namecolor = (m != null ? "#996633" : "#996633");
op.Write( "<font color=" + namecolor + ">" );
op.Write( m.Name );
op.Write( "</td><td>" );
string killscolor = (m != null ? "#996633" : "#996633");
op.Write( "<font color=" + killscolor + ">" );
op.Write( m.Kills );
op.Write( "</td><td>" );
string famecolor = (m != null ? "#996633" : "#996633");
op.Write( "<font color=" + famecolor + ">" );
op.Write( m.Karma );
op.Write( " / " );
op.Write( m.Fame );
op.Write( "</td></tr> " );
op.Write( "</font>" );
}
op.WriteLine( " <tr>" );
op.WriteLine( " </table>" );
op.WriteLine( " </body>" );
op.WriteLine( "</html>" );
}
}
}
}