|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
Join Date: Feb 2004
Posts: 108
|
Hi! I will add the number of the connected client in the statuspage but i don't know how i can do that. I'm usign a custom webstatus and this is the code:
Code:
using System;
using System.IO;
using System.Text;
using System.Collections;
using Server.Mobiles;
using Server;
using Server.Network;
using Server.Guilds;
using Server.Menus.Questions;
using Server.Menus;
using Server.Items;
namespace Server.Misc
{
public class StatusPage : Timer
{
public static void Initialize()
{
new StatusPage().Start();
}
public StatusPage()
: base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(60.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()
{
if (!Directory.Exists("web"))
Directory.CreateDirectory("web");
using (StreamWriter op = new StreamWriter("web/status.html"))
{
op.WriteLine("<html>");
op.WriteLine(" <head>");
op.WriteLine(" <title>RunUo Status</title>");
op.WriteLine(" </head>");
op.WriteLine(" <body bgProperties=fixed bgcolor=#000000>");
/* op.WriteLine( " <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">" );
op.WriteLine( " </tr>" );
op.WriteLine( " <td width=\"0%\" align=\"left\"> <img src=\"1.gif\">" );
op.WriteLine( " <td width=\"10%\" align=\"left\"> <img src=\"2.gif\">" );
op.WriteLine( " <td width=\"0%\" align=\"right\"> <img src=\"1.gif\">" );
op.WriteLine( " </table>" );*/
op.WriteLine(" <br>");
op.WriteLine(" <br>");
op.WriteLine(" <table width=\"100%\">");
op.WriteLine(" <tr>");
op.WriteLine(" <td> align=\"center\" <font color=\"#FFCC00\">Nome</font></td> <td> align=\"center\" <font color=\"#FFCC00\">Gilda</font></td> <td> align=\"center\" <font color=\"#FFCC00\">Titolo</font></td> <td> align=\"center\" <font color=\"#FFCC00\">Uccisioni</font></td> <td> align=\"center\" <font color=\"#FFCC00\">Karma</font></td> <td> align=\"center\" <font color=\"#FFCC00\">Fama</font></td>");
op.WriteLine(" </tr>");
foreach (NetState state in NetState.Instances)
{
Mobile m = state.Mobile;
if (m != null)
{
if (m.AccessLevel > AccessLevel.Counselor && !m.Hidden)
{
op.Write(" <tr><td><font color=#FFCC00><b>");
op.Write(m.Name);
op.Write("</font></td>");
//////////////////////////////////NAME//////////////////////////////////////////////////////////////////////////
////////////////////////////////GUILD//////////////////////////////////////////////////////////////////////////////
op.Write("<td><font color=\"#FFCC00\"><b>");
Guild g = m.Guild as Guild;
if (g != null)
{
op.Write("[");
op.Write(Encode(g.Abbreviation));
op.Write("]");
}
else
{
op.Write("");
}
op.Write("</font></td>");
///////////////////////////////////GUILD//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////TITLE//////////////////////////////////////////////////////////////////////////////////
op.Write("<td><font color=\"#FFCC00"><b>");
string title = m.GuildTitle;
if (title != null)
title = title.Trim();
else
title = "";
if (title.Length > 0)
{
op.Write(Encode(title));
}
op.Write("</font></td>");
/////////////////////////////////////TITLE//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////Sum.Stat//////////////////////////////////////////////////////////////////////////////////
/*op.Write( "<td bgColor=#8e9b44><font color=\"black\"><b>");
op.Write( m.RawStatTotal);
op.Write( "</font></td>");*/
/////////////////////////////////////Sum.Stat//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////Sum.Skill//////////////////////////////////////////////////////////////////////////////////
/*op.Write( "<td bgColor=#8e9b44><font color=\"black\"><b>");
op.Write( m.SkillsTotal);
op.Write( "</font></td>");*/
/////////////////////////////////////Sum.Skill//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////Kills//////////////////////////////////////////////////////////////////////////////////
op.Write("<td><font color=\"#FFCC00\"><b>");
op.Write(m.Kills);
op.Write("</font></td>");
/////////////////////////////////////Kills//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////Karma//////////////////////////////////////////////////////////////////////////////////
op.Write("<td><font color=\"#FFCC00\"><b>");
op.Write(m.Karma);
op.Write("</font></td>");
/////////////////////////////////////Karma//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////Fame//////////////////////////////////////////////////////////////////////////////////
op.Write("<td<font color=\"#FFCC00"><b>");
op.Write(m.Fame);
op.Write("</font></td>");
/////////////////////////////////////Fame//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////Citizen//////////////////////////////////////////////////////////////////////////////////
op.Write("<td><font color=\"#FFCC00\"><b>");
PlayerMobile pm = (PlayerMobile)m;
op.Write(pm.RaceType);
op.Write("</font></td>");
/////////////////////////////////////Citizen//////////////////////////////////////////////////////////////////////////////////
}
op.WriteLine(" <tr>");
op.WriteLine(" </table>");
op.WriteLine(" </body>");
op.WriteLine("</html>");
}
}
}
}
}
}
|
|
|
|
|
|
#2 (permalink) |
|
Forum Novice
Join Date: Feb 2004
Posts: 108
|
Ok i tried more and i find the way but i have another question..How can i write the name or karma ecc.. in the right place? For example i want that account number have to be written after a certain string for example:
Code:
op.WriteLine("<html>");
op.WriteLine(" <head>");
op.WriteLine(" <title>RunUo</title>");
op.WriteLine(" </head>");
op.WriteLine(" <body bgProperties=fixed bgcolor=#000000>");
op.WriteLine(" <p align=\"left\"> <b><font size=\"7\" face=\"Vivaldi\" color=\"#FFCC00\">RunUo Status</font></b><font size=\"5\"><br><font color=\"#FFCC00\">Connected Client:</font></font><br></p> ");
This is the code i use to calculate the client: Code:
foreach (NetState state in NetState.Instances)
{
int t = NetState.Instances.Count;
if (t != 0)
{
ArrayList KList = new ArrayList(NetState.Instances);
for (int s = 0; s < t; ++s)
{
NetState nsk = KList[s] as NetState;
if (nsk == null)
continue;
Mobile mk = nsk.Mobile;
if (mk == null)
{
continue;
}
}
op.Write(" <tr><td><font color=#FFCC00><b>");
op.Write(t);
op.Write("</font></td>");
}
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|