#W# Added Knives TownHouses. Also wrote my own static house system that is configured with a cfg file.
This commit is contained in:
parent
3132211847
commit
dc5e0577fd
31 changed files with 7009 additions and 11 deletions
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class Errors
|
||||
{
|
||||
private static ArrayList s_ErrorLog = new ArrayList();
|
||||
private static ArrayList s_Checked = new ArrayList();
|
||||
|
||||
public static ArrayList ErrorLog{ get{ return s_ErrorLog; } }
|
||||
public static ArrayList Checked{ get{ return s_Checked; } }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
RUOVersion.AddCommand("TownHouseErrors", AccessLevel.Counselor, new TownHouseCommandHandler(OnErrors));
|
||||
RUOVersion.AddCommand("the", AccessLevel.Counselor, new TownHouseCommandHandler(OnErrors));
|
||||
|
||||
EventSink.Login += new LoginEventHandler( OnLogin );
|
||||
}
|
||||
|
||||
private static void OnErrors( CommandInfo e )
|
||||
{
|
||||
if ( e.ArgString == null || e.ArgString == "" )
|
||||
new ErrorsGump( e.Mobile );
|
||||
else
|
||||
Report( e.ArgString + " - " + e.Mobile.Name );
|
||||
}
|
||||
|
||||
private static void OnLogin( LoginEventArgs e )
|
||||
{
|
||||
if ( e.Mobile.AccessLevel != AccessLevel.Player
|
||||
&& s_ErrorLog.Count != 0
|
||||
&& !s_Checked.Contains( e.Mobile ) )
|
||||
new ErrorsNotifyGump( e.Mobile );
|
||||
}
|
||||
|
||||
public static void Report( string error )
|
||||
{
|
||||
s_ErrorLog.Add( String.Format( "<B>{0}</B><BR>{1}<BR>", DateTime.Now, error ) );
|
||||
|
||||
s_Checked.Clear();
|
||||
|
||||
Notify();
|
||||
}
|
||||
|
||||
private static void Notify()
|
||||
{
|
||||
foreach( NetState state in NetState.Instances )
|
||||
{
|
||||
if ( state.Mobile == null )
|
||||
continue;
|
||||
|
||||
if ( state.Mobile.AccessLevel != AccessLevel.Player )
|
||||
Notify( state.Mobile );
|
||||
}
|
||||
}
|
||||
|
||||
public static void Notify( Mobile m )
|
||||
{
|
||||
if ( m.HasGump( typeof( ErrorsGump ) ) )
|
||||
new ErrorsGump( m );
|
||||
else
|
||||
new ErrorsNotifyGump( m );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class ErrorsGump : GumpPlusLight
|
||||
{
|
||||
public ErrorsGump( Mobile m ) : base( m, 100, 100 )
|
||||
{
|
||||
Errors.Checked.Add(m);
|
||||
|
||||
m.CloseGump( typeof( ErrorsGump ) );
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{
|
||||
int width = 400;
|
||||
int y = 10;
|
||||
|
||||
AddHtml(0, y, width, "<CENTER>TownHouse Errors");
|
||||
AddImage(width / 2 - 100, y + 2, 0x39);
|
||||
AddImage(width / 2 + 70, y + 2, 0x3B);
|
||||
|
||||
AddButton(width - 20, y, 0x5689, 0x5689, "Help", new GumpCallback(Help));
|
||||
|
||||
string str = HTML.Black;
|
||||
foreach( string text in Errors.ErrorLog )
|
||||
str += text;
|
||||
|
||||
AddHtml( 20, y+=25, width-40, 200, str, true, true );
|
||||
|
||||
y += 200;
|
||||
|
||||
if ( Owner.AccessLevel >= AccessLevel.Administrator )
|
||||
{
|
||||
AddButton( width/2-30, y+=10, 0x98B, 0x98B, "Clear", new GumpCallback( ClearLog ) );
|
||||
AddHtml( width/2-23, y+3, 51, "<CENTER>Clear");
|
||||
}
|
||||
|
||||
AddBackgroundZero(0, 0, width, y + 40, 0x1400);
|
||||
}
|
||||
|
||||
private void Help()
|
||||
{
|
||||
NewGump();
|
||||
new InfoGump( Owner, 300, 300, HTML.White + " Errors reported by either the TownHouse system or other staff members! Administrators have the power to clear this list. All staff members can report an error using the [TownHouseErrors command.", true );
|
||||
}
|
||||
|
||||
private void ClearLog()
|
||||
{
|
||||
Errors.ErrorLog.Clear();
|
||||
NewGump();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class ErrorsNotifyGump : GumpPlusLight
|
||||
{
|
||||
public ErrorsNotifyGump( Mobile m ) : base( m, 250, 100 )
|
||||
{
|
||||
m.CloseGump( typeof( ErrorsNotifyGump ) );
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{
|
||||
AddButton( 0, 0, 0x1590, 0x1590, "Errors", new GumpCallback( Errors ) );
|
||||
AddItem(20, 20, 0x22C4);
|
||||
}
|
||||
|
||||
private void Errors()
|
||||
{
|
||||
new ErrorsGump( Owner );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue