Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#region References
|
||||
using Server.Gumps;
|
||||
#endregion
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class BackgroundPlus : GumpBackground
|
||||
{
|
||||
public bool Override { get; set; }
|
||||
|
||||
public BackgroundPlus(int x, int y, int width, int height, int back)
|
||||
: base(x, y, width, height, back)
|
||||
{
|
||||
Override = true;
|
||||
}
|
||||
|
||||
public BackgroundPlus(int x, int y, int width, int height, int back, bool over)
|
||||
: base(x, y, width, height, back)
|
||||
{
|
||||
Override = over;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#region References
|
||||
using Server.Gumps;
|
||||
#endregion
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class ButtonPlus : GumpButton
|
||||
{
|
||||
private readonly string c_Name;
|
||||
private readonly object c_Callback;
|
||||
private readonly object c_Param;
|
||||
|
||||
public string Name { get { return c_Name; } }
|
||||
|
||||
public ButtonPlus(int x, int y, int normalID, int pressedID, int buttonID, string name, GumpCallback back)
|
||||
: base(x, y, normalID, pressedID, buttonID, GumpButtonType.Reply, 0)
|
||||
{
|
||||
c_Name = name;
|
||||
c_Callback = back;
|
||||
c_Param = "";
|
||||
}
|
||||
|
||||
public ButtonPlus(
|
||||
int x,
|
||||
int y,
|
||||
int normalID,
|
||||
int pressedID,
|
||||
int buttonID,
|
||||
string name,
|
||||
GumpStateCallback back,
|
||||
object param)
|
||||
: base(x, y, normalID, pressedID, buttonID, GumpButtonType.Reply, 0)
|
||||
{
|
||||
c_Name = name;
|
||||
c_Callback = back;
|
||||
c_Param = param;
|
||||
}
|
||||
|
||||
public void Invoke()
|
||||
{
|
||||
if (c_Callback is GumpCallback)
|
||||
{
|
||||
((GumpCallback)c_Callback)();
|
||||
}
|
||||
else if (c_Callback is GumpStateCallback)
|
||||
{
|
||||
((GumpStateCallback)c_Callback)(c_Param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
#region References
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
#endregion
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public delegate void GumpStateCallback(object obj);
|
||||
|
||||
public delegate void GumpCallback();
|
||||
|
||||
public abstract class GumpPlusLight : Gump
|
||||
{
|
||||
public static void RefreshGump(Mobile m, Type type)
|
||||
{
|
||||
if (m.NetState == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var g in m.NetState.Gumps)
|
||||
{
|
||||
if (g is GumpPlusLight && g.GetType() == type)
|
||||
{
|
||||
m.CloseGump(type);
|
||||
((GumpPlusLight)g).NewGump();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Mobile c_Owner;
|
||||
private readonly Hashtable c_Buttons;
|
||||
private readonly Hashtable c_Fields;
|
||||
|
||||
public Mobile Owner { get { return c_Owner; } }
|
||||
|
||||
public GumpPlusLight(Mobile m, int x, int y)
|
||||
: base(x, y)
|
||||
{
|
||||
c_Owner = m;
|
||||
|
||||
c_Buttons = new Hashtable();
|
||||
c_Fields = new Hashtable();
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0), NewGump);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Entries.Clear();
|
||||
c_Buttons.Clear();
|
||||
c_Fields.Clear();
|
||||
}
|
||||
|
||||
public virtual void NewGump()
|
||||
{
|
||||
NewGump(true);
|
||||
}
|
||||
|
||||
public void NewGump(bool clear)
|
||||
{
|
||||
if (clear)
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
BuildGump();
|
||||
|
||||
c_Owner.SendGump(this);
|
||||
}
|
||||
|
||||
public void SameGump()
|
||||
{
|
||||
c_Owner.SendGump(this);
|
||||
}
|
||||
|
||||
protected abstract void BuildGump();
|
||||
|
||||
private int UniqueButton()
|
||||
{
|
||||
var random = 0;
|
||||
|
||||
do
|
||||
{
|
||||
random = Utility.Random(20000);
|
||||
}
|
||||
while (c_Buttons[random] != null);
|
||||
|
||||
return random;
|
||||
}
|
||||
|
||||
private int UniqueTextId()
|
||||
{
|
||||
var random = 0;
|
||||
|
||||
do
|
||||
{
|
||||
random = Utility.Random(20000);
|
||||
}
|
||||
while (c_Buttons[random] != null);
|
||||
|
||||
return random;
|
||||
}
|
||||
|
||||
public void AddBackgroundZero(int x, int y, int width, int height, int back)
|
||||
{
|
||||
AddBackgroundZero(x, y, width, height, back, true);
|
||||
}
|
||||
|
||||
public void AddBackgroundZero(int x, int y, int width, int height, int back, bool over)
|
||||
{
|
||||
var plus = new BackgroundPlus(x, y, width, height, back, over);
|
||||
|
||||
Entries.Insert(0, plus);
|
||||
}
|
||||
|
||||
public new void AddBackground(int x, int y, int width, int height, int back)
|
||||
{
|
||||
AddBackground(x, y, width, height, back, true);
|
||||
}
|
||||
|
||||
public void AddBackground(int x, int y, int width, int height, int back, bool over)
|
||||
{
|
||||
var plus = new BackgroundPlus(x, y, width, height, back, over);
|
||||
|
||||
Add(plus);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int id, GumpCallback callback)
|
||||
{
|
||||
AddButton(x, y, id, id, "None", callback);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int id, GumpStateCallback callback, object arg)
|
||||
{
|
||||
AddButton(x, y, id, id, "None", callback, arg);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int id, string name, GumpCallback callback)
|
||||
{
|
||||
AddButton(x, y, id, id, name, callback);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int id, string name, GumpStateCallback callback, object arg)
|
||||
{
|
||||
AddButton(x, y, id, id, name, callback, arg);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int up, int down, GumpCallback callback)
|
||||
{
|
||||
AddButton(x, y, up, down, "None", callback);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int up, int down, string name, GumpCallback callback)
|
||||
{
|
||||
var id = UniqueButton();
|
||||
|
||||
var button = new ButtonPlus(x, y, up, down, id, name, callback);
|
||||
|
||||
Add(button);
|
||||
|
||||
c_Buttons[id] = button;
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int up, int down, GumpStateCallback callback, object arg)
|
||||
{
|
||||
AddButton(x, y, up, down, "None", callback, arg);
|
||||
}
|
||||
|
||||
public void AddButton(int x, int y, int up, int down, string name, GumpStateCallback callback, object arg)
|
||||
{
|
||||
var id = UniqueButton();
|
||||
|
||||
var button = new ButtonPlus(x, y, up, down, id, name, callback, arg);
|
||||
|
||||
Add(button);
|
||||
|
||||
c_Buttons[id] = button;
|
||||
}
|
||||
|
||||
public void AddHtml(int x, int y, int width, string text)
|
||||
{
|
||||
AddHtml(x, y, width, 21, HTML.White + text, false, false, true);
|
||||
}
|
||||
|
||||
public void AddHtml(int x, int y, int width, string text, bool over)
|
||||
{
|
||||
AddHtml(x, y, width, 21, HTML.White + text, false, false, over);
|
||||
}
|
||||
|
||||
public new void AddHtml(int x, int y, int width, int height, string text, bool back, bool scroll)
|
||||
{
|
||||
AddHtml(x, y, width, height, HTML.White + text, back, scroll, true);
|
||||
}
|
||||
|
||||
public void AddHtml(int x, int y, int width, int height, string text, bool back, bool scroll, bool over)
|
||||
{
|
||||
var html = new HtmlPlus(x, y, width, height, HTML.White + text, back, scroll, over);
|
||||
|
||||
Add(html);
|
||||
}
|
||||
|
||||
public void AddTextField(int x, int y, int width, int height, int color, int back, string name, string text)
|
||||
{
|
||||
var id = UniqueTextId();
|
||||
|
||||
AddImageTiled(x, y, width, height, back);
|
||||
AddTextEntry(x, y, width, height, color, id, text);
|
||||
|
||||
c_Fields[id] = name;
|
||||
c_Fields[name] = text;
|
||||
}
|
||||
|
||||
public string GetTextField(string name)
|
||||
{
|
||||
if (c_Fields[name] == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return c_Fields[name].ToString();
|
||||
}
|
||||
|
||||
public int GetTextFieldInt(string name)
|
||||
{
|
||||
return Utility.ToInt32(GetTextField(name));
|
||||
}
|
||||
|
||||
protected virtual void OnClose()
|
||||
{ }
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
var name = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (info.ButtonID == -5)
|
||||
{
|
||||
NewGump();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var t in info.TextEntries)
|
||||
{
|
||||
c_Fields[c_Fields[t.EntryID].ToString()] = t.Text;
|
||||
}
|
||||
|
||||
if (info.ButtonID == 0)
|
||||
{
|
||||
OnClose();
|
||||
}
|
||||
|
||||
if (c_Buttons[info.ButtonID] == null || !(c_Buttons[info.ButtonID] is ButtonPlus))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
name = ((ButtonPlus)c_Buttons[info.ButtonID]).Name;
|
||||
|
||||
((ButtonPlus)c_Buttons[info.ButtonID]).Invoke();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Errors.Report("An error occured during a gump response. More information can be found on the console.");
|
||||
if (name != "")
|
||||
{
|
||||
Console.WriteLine("{0} gump name triggered an error.", name);
|
||||
}
|
||||
Console.WriteLine(e.Message);
|
||||
Console.WriteLine(e.Source);
|
||||
Console.WriteLine(e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Scripts/SubSystem/TownHouses/Gumps/Gumps Plus Light/HTML.cs
Normal file
17
Scripts/SubSystem/TownHouses/Gumps/Gumps Plus Light/HTML.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class HTML
|
||||
{
|
||||
public static string White { get { return "<BASEFONT COLOR=#FFFFFF>"; } }
|
||||
public static string Red { get { return "<BASEFONT COLOR=#FF0000>"; } }
|
||||
public static string AshRed { get { return "<BASEFONT COLOR=#FF9999>"; } }
|
||||
public static string Green { get { return "<BASEFONT COLOR=#00FF00>"; } }
|
||||
public static string Blue { get { return "<BASEFONT COLOR=#0000FF>"; } }
|
||||
public static string Gray { get { return "<BASEFONT COLOR=#999999>"; } }
|
||||
public static string DarkGray { get { return "<BASEFONT COLOR=#222222>"; } }
|
||||
public static string Black { get { return "<BASEFONT COLOR=#111111>"; } }
|
||||
public static string Yellow { get { return "<BASEFONT COLOR=#FFFF00>"; } }
|
||||
public static string Purple { get { return "<BASEFONT COLOR=#990099>"; } }
|
||||
public static string LightPurple { get { return "<BASEFONT COLOR=#CC00FF>"; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#region References
|
||||
using Server.Gumps;
|
||||
#endregion
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class HtmlPlus : GumpHtml
|
||||
{
|
||||
public bool Override { get; set; }
|
||||
|
||||
public HtmlPlus(int x, int y, int width, int height, string text, bool back, bool scroll)
|
||||
: base(x, y, width, height, text, back, scroll)
|
||||
{
|
||||
Override = true;
|
||||
}
|
||||
|
||||
public HtmlPlus(int x, int y, int width, int height, string text, bool back, bool scroll, bool over)
|
||||
: base(x, y, width, height, text, back, scroll)
|
||||
{
|
||||
Override = over;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#region References
|
||||
using Server;
|
||||
#endregion
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class InfoGump : GumpPlusLight
|
||||
{
|
||||
private readonly int c_Width;
|
||||
private readonly int c_Height;
|
||||
private readonly string c_Text;
|
||||
private readonly bool c_Scroll;
|
||||
|
||||
public InfoGump(Mobile m, int width, int height, string text, bool scroll)
|
||||
: base(m, 100, 100)
|
||||
{
|
||||
c_Width = width;
|
||||
c_Height = height;
|
||||
c_Text = text;
|
||||
c_Scroll = scroll;
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{
|
||||
AddBackground(0, 0, c_Width, c_Height, 0x13BE);
|
||||
|
||||
AddHtml(20, 20, c_Width - 40, c_Height - 40, HTML.White + c_Text, false, c_Scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user