#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,23 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class BackgroundPlus : GumpBackground
|
||||
{
|
||||
private bool c_Override;
|
||||
|
||||
public bool Override{ get{ return c_Override; } set{ c_Override = value; } }
|
||||
|
||||
public BackgroundPlus( int x, int y, int width, int height, int back ) : base( x, y, width, height, back )
|
||||
{
|
||||
c_Override = true;
|
||||
}
|
||||
|
||||
public BackgroundPlus( int x, int y, int width, int height, int back, bool over ) : base( x, y, width, height, back )
|
||||
{
|
||||
c_Override = over;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class ButtonPlus : GumpButton
|
||||
{
|
||||
private string c_Name;
|
||||
private object c_Callback;
|
||||
private 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,261 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
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 (Gump g in m.NetState.Gumps)
|
||||
if (g is GumpPlusLight && g.GetType() == type)
|
||||
{
|
||||
m.CloseGump(type);
|
||||
((GumpPlusLight)g).NewGump();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private Mobile c_Owner;
|
||||
private Hashtable c_Buttons, 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), new TimerCallback(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()
|
||||
{
|
||||
int random = 0;
|
||||
|
||||
do
|
||||
{
|
||||
random = Utility.Random( 20000 );
|
||||
|
||||
}while( c_Buttons[random] != null );
|
||||
|
||||
return random;
|
||||
}
|
||||
|
||||
private int UniqueTextId()
|
||||
{
|
||||
int 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)
|
||||
{
|
||||
BackgroundPlus 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)
|
||||
{
|
||||
BackgroundPlus 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)
|
||||
{
|
||||
int id = UniqueButton();
|
||||
|
||||
ButtonPlus 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 )
|
||||
{
|
||||
int id = UniqueButton();
|
||||
|
||||
ButtonPlus 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, false);
|
||||
}
|
||||
|
||||
public void AddHtml(int x, int y, int width, string text, bool over)
|
||||
{
|
||||
AddHtml(x, y, width, 21, HTML.White + text, false, false, over, false);
|
||||
}
|
||||
|
||||
public 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, false);
|
||||
}
|
||||
|
||||
public void AddHtml(int x, int y, int width, int height, string text, bool back, bool scroll, bool over, bool useBlackTextOutline = false)
|
||||
{
|
||||
HtmlPlus 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)
|
||||
{
|
||||
int id = UniqueTextId();
|
||||
|
||||
AddImageTiled(x, y, width, height, back);
|
||||
base.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 )
|
||||
{
|
||||
string name = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (info.ButtonID == -5)
|
||||
{
|
||||
NewGump();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (TextRelay 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Scripts/Items/Houses/Monopoly/Gumps/Gumps Plus Light/HTML.cs
Normal file
20
Scripts/Items/Houses/Monopoly/Gumps/Gumps Plus Light/HTML.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class HTML
|
||||
{
|
||||
public static string White{ get { return "<BASEFONT Color=#FBFBFB>"; } }
|
||||
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 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class HtmlPlus : GumpHtml
|
||||
{
|
||||
private bool c_Override;
|
||||
|
||||
public bool Override{ get{ return c_Override; } set{ c_Override = value; } }
|
||||
|
||||
public HtmlPlus( int x, int y, int width, int height, string text, bool back, bool scroll ) : base( x, y, width, height, text, back, scroll )
|
||||
{
|
||||
c_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 )
|
||||
{
|
||||
c_Override = over;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.TownHouses
|
||||
{
|
||||
public class InfoGump : GumpPlusLight
|
||||
{
|
||||
private int c_Width, c_Height;
|
||||
private string c_Text;
|
||||
private 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, 3600 );
|
||||
|
||||
AddHtml( 20, 20, c_Width-40, c_Height-40, HTML.White + c_Text, false, c_Scroll );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue