Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
69
Scripts/SubSystem/Utilities v1.03/Error Reporting/Errors.cs
Normal file
69
Scripts/SubSystem/Utilities v1.03/Error Reporting/Errors.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
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()
|
||||
{
|
||||
CommandSystem.Register("Errors", AccessLevel.Counselor, new CommandEventHandler(OnErrors));
|
||||
|
||||
EventSink.Login += new LoginEventHandler( OnLogin );
|
||||
}
|
||||
|
||||
private static void OnErrors( CommandEventArgs e )
|
||||
{
|
||||
if ( e.ArgString == null || e.ArgString == "" )
|
||||
ErrorsGump.SendTo( 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 ) )
|
||||
ErrorsNotifyGump.SendTo( 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 ) ) )
|
||||
ErrorsGump.SendTo( m );
|
||||
else
|
||||
ErrorsNotifyGump.SendTo( m );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class ErrorsGump : GumpPlus
|
||||
{
|
||||
private static string s_Help = " Errors reported by either this chat system or other staff members! Administrators have the power to clear this list. All staff members can report an error using the [errors <text> command.";
|
||||
|
||||
public static void SendTo( Mobile m )
|
||||
{
|
||||
new ErrorsGump( m );
|
||||
Errors.Checked.Add( m );
|
||||
}
|
||||
|
||||
private const int Width = 400;
|
||||
private const int Height = 400;
|
||||
|
||||
public ErrorsGump( Mobile m ) : base( m, 100, 100 )
|
||||
{
|
||||
m.CloseGump( typeof( ErrorsGump ) );
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{try{
|
||||
|
||||
AddBackground( 0, 0, Width, Height, 0xE10 );
|
||||
|
||||
AddButton( Width-20, Height-20, 0x5689, 0x5689, "Help", new TimerCallback( Help ) );
|
||||
|
||||
int y = 0;
|
||||
|
||||
AddHtml( 0, y+=15, Width, 45, HTML.White + "<CENTER>Error Log", false, false );
|
||||
AddBackground( 30, y+=20, Width-60, 3, 0x13BE );
|
||||
|
||||
string str = HTML.Black;
|
||||
foreach( string text in Errors.ErrorLog )
|
||||
str += text;
|
||||
|
||||
AddHtml( 20, y+=20, Width-40, Height-y-50, str, true, true );
|
||||
|
||||
if ( Owner.AccessLevel >= AccessLevel.Administrator )
|
||||
{
|
||||
AddButton( Width/2-30, Height-40, 0x98B, 0x98B, "Clear log", new TimerCallback( ClearLog ) );
|
||||
AddHtml( Width/2-23, Height-37, 51, 20, HTML.White + "<CENTER>Clear", false, false );
|
||||
}
|
||||
|
||||
}catch{ Errors.Report( String.Format( "ErrorsGump-> BuildGump-> |{0}|", Owner ) ); } }
|
||||
|
||||
private void Help()
|
||||
{
|
||||
NewGump();
|
||||
InfoGump.SendTo( Owner, 300, 300, HTML.White + s_Help, true );
|
||||
}
|
||||
|
||||
private void ClearLog()
|
||||
{
|
||||
Errors.ErrorLog.Clear();
|
||||
Owner.SendMessage( "The error log is now clear." );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class ErrorsNotifyGump : GumpPlus
|
||||
{
|
||||
public static void SendTo( Mobile m )
|
||||
{
|
||||
new ErrorsNotifyGump( m );
|
||||
}
|
||||
|
||||
public ErrorsNotifyGump( Mobile m ) : base( m, 100, 100 )
|
||||
{
|
||||
m.CloseGump( typeof( ErrorsNotifyGump ) );
|
||||
|
||||
Override = false;
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{
|
||||
AddItem( 0, 2, 0x25C6 );
|
||||
AddButton( 33, 40, 0x1523, 0x1523, "Errors", new TimerCallback( Errors ) );
|
||||
}
|
||||
|
||||
private void Errors()
|
||||
{
|
||||
ErrorsGump.SendTo( Owner );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user