Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
83
Scripts/SubSystem/TownHouses/Gumps/Error Reporting/Errors.cs
Normal file
83
Scripts/SubSystem/TownHouses/Gumps/Error Reporting/Errors.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using Server;
|
||||
using Server.Network;
|
||||
#endregion
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class Errors
|
||||
{
|
||||
private static readonly ArrayList s_ErrorLog = new ArrayList();
|
||||
private static readonly 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.Developer, OnErrors);
|
||||
|
||||
EventSink.Login += 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.UtcNow, error));
|
||||
|
||||
s_Checked.Clear();
|
||||
|
||||
Notify();
|
||||
}
|
||||
|
||||
private static void Notify()
|
||||
{
|
||||
foreach (var 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,65 @@
|
||||
#region References
|
||||
using Server;
|
||||
#endregion
|
||||
|
||||
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()
|
||||
{
|
||||
var width = 400;
|
||||
var 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", Help);
|
||||
|
||||
var 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", 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,26 @@
|
||||
#region References
|
||||
using Server;
|
||||
#endregion
|
||||
|
||||
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", Errors);
|
||||
AddItem(20, 20, 0x22C4);
|
||||
}
|
||||
|
||||
private void Errors()
|
||||
{
|
||||
new ErrorsGump(Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user