Go Back   RunUO - Ultima Online Emulation > RunUO > RunUO Post Archive

RunUO Post Archive The Archvie

Reply
 
Thread Tools Display Modes
Old 11-22-2003, 08:49 PM   #1 (permalink)
 
Join Date: Nov 2003
Posts: 7
Default XML Outputs, or something simmilar

Hi,

I think it would be cool if things like the number of players online, number of accounts, highest fame, faction ratings( stuff that the server would already know ) could be outputted to a web page. Like every save, an XML doc could be made that had some info that was chosen by the admins.

I am very sorry if this has already been implemented, but I didnt see it in the docs.

Thanks
-Alask
Alaskan is offline   Reply With Quote
Old 11-22-2003, 08:54 PM   #2 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

You can script this if you wanted.

This is already done in html.
Phantom is offline   Reply With Quote
Old 11-23-2003, 03:39 PM   #3 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

You can use the already made XML commands or the built in XML commands for C# to achieve this. Look at Scripts\Misc\WebStatus.cs to see how the retreive the information.
XxSP1DERxX is offline   Reply With Quote
Old 11-23-2003, 04:22 PM   #4 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

XMLtextWritter ( something like that ) is what Spider is talking about.

How I made my project generator :-)
Phantom is offline   Reply With Quote
Old 11-24-2003, 01:30 PM   #5 (permalink)
 
Join Date: Sep 2002
Posts: 43
Default An XML Example

Here is an XML example for ya:
[code:1]
using System;
using System.IO;
using System.Text;
using System.Collections;
using System.Xml;

using Server;
using Server.Network;
using Server.Guilds;

namespace Server.Web
{
public class PlayerList : Timer
{
public static void Initialize()
{
new PlayerList().Start();
}

public PlayerList() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
{
Priority = TimerPriority.FiveSeconds;
}

protected override void OnTick()
{
if ( !Directory.Exists( "Saves/Web" ) )
Directory.CreateDirectory( "Saves/Web" );

using ( StreamWriter op = new StreamWriter( "Saves/Web/Players.xml" ) )
{
XmlTextWriter xml = new XmlTextWriter( op );

xml.Formatting = Formatting.Indented;
xml.IndentChar = '\t';
xml.Indentation = 1;

xml.WriteStartDocument( true );

xml.WriteStartElement( "WebData" );
xml.WriteAttributeString( "Created", DateTime.Now.ToString() );
xml.WriteAttributeString( "Updated", (DateTime.Now + this.Interval).ToString() );

foreach ( NetState state in NetState.Instances )
{
Mobile m = state.Mobile;

if ( m != null )
{
xml.WriteStartElement( "Mobile" );
xml.WriteAttributeString( "Name", m.Name );
xml.WriteAttributeString( "Access", m.AccessLevel.ToString());
xml.WriteAttributeString( "Kills", m.Kills.ToString());
xml.WriteAttributeString( "Karma", m.Karma.ToString());
xml.WriteAttributeString( "Fame", m.Fame.ToString());


Guild g = m.Guild;
if ( g != null )
{
xml.WriteStartElement( "Guild" );
xml.WriteAttributeString( "Key", g.Id.ToString() );
xml.WriteAttributeString( "GuildName", g.Name.Trim() );
xml.WriteAttributeString( "GuildTitle", m.GuildTitle );
xml.WriteAttributeString( "Abbreviation", g.Abbreviation );
xml.WriteEndElement();
}

xml.WriteStartElement( "Location" );
xml.WriteAttributeString( "Map", m.Map.ToString());
xml.WriteAttributeString( "X", m.X.ToString());
xml.WriteAttributeString( "Y", m.Y.ToString());
xml.WriteAttributeString( "Z", m.Z.ToString());
xml.WriteEndElement();

xml.WriteEndElement();
}
}

xml.Close();

}
}
}
}[/code:1]
KnightD is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5