|
||
|
|
#1 (permalink) |
|
Join Date: Nov 2003
Posts: 7
|
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 |
|
|
|
|
|
#5 (permalink) |
|
Join Date: Sep 2002
Posts: 43
|
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] |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|