Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -25,372 +25,375 @@ using Server.Network;
namespace Server.Gumps
{
public class Gump
{
private List<string> m_Strings;
internal int m_TextEntries, m_Switches;
private static int m_NextSerial = 1;
private int m_Serial;
private int m_X, m_Y;
private bool m_Dragable = true;
private bool m_Closable = true;
private bool m_Resizable = true;
private bool m_Disposable = true;
public static int GetTypeID( Type type )
{
return type.FullName.GetHashCode();
}
public Gump( int x, int y )
{
do
{
m_Serial = m_NextSerial++;
} while ( m_Serial == 0 ); // standard client apparently doesn't send a gump response packet if serial == 0
m_X = x;
m_Y = y;
TypeID = GetTypeID( GetType() );
Entries = new List<GumpEntry>();
m_Strings = new List<string>();
}
public void Invalidate()
{
//if ( m_Strings.Count > 0 )
// m_Strings.Clear();
}
public int TypeID { get; }
public List<GumpEntry> Entries { get; }
public int Serial
{
get => m_Serial;
set
{
if ( m_Serial != value )
{
m_Serial = value;
Invalidate();
}
}
}
public int X
{
get => m_X;
set
{
if ( m_X != value )
{
m_X = value;
Invalidate();
}
}
}
public int Y
{
get => m_Y;
set
{
if ( m_Y != value )
{
m_Y = value;
Invalidate();
}
}
}
public bool Disposable
{
get => m_Disposable;
set
{
if ( m_Disposable != value )
{
m_Disposable = value;
Invalidate();
}
}
}
public bool Resizable
{
get => m_Resizable;
set
{
if ( m_Resizable != value )
{
m_Resizable = value;
Invalidate();
}
}
}
public bool Dragable
{
get => m_Dragable;
set
{
if ( m_Dragable != value )
{
m_Dragable = value;
Invalidate();
}
}
}
public bool Closable
{
get => m_Closable;
set
{
if ( m_Closable != value )
{
m_Closable = value;
Invalidate();
}
}
}
public void AddPage( int page )
{
Add( new GumpPage( page ) );
}
public void AddAlphaRegion( int x, int y, int width, int height )
{
Add( new GumpAlphaRegion( x, y, width, height ) );
}
public void AddBackground( int x, int y, int width, int height, int gumpID )
{
Add( new GumpBackground( x, y, width, height, gumpID ) );
}
public void AddButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param )
{
Add( new GumpButton( x, y, normalID, pressedID, buttonID, type, param ) );
}
public void AddCheck( int x, int y, int inactiveID, int activeID, bool initialState, int switchID )
{
Add( new GumpCheck( x, y, inactiveID, activeID, initialState, switchID ) );
}
public void AddGroup( int group )
{
Add( new GumpGroup( group ) );
}
public void AddTooltip( int number )
{
Add( new GumpTooltip( number ) );
}
public void AddHtml( int x, int y, int width, int height, string text, bool background, bool scrollbar )
{
Add( new GumpHtml( x, y, width, height, text, background, scrollbar ) );
}
public void AddHtmlLocalized( int x, int y, int width, int height, int number, bool background, bool scrollbar )
{
Add( new GumpHtmlLocalized( x, y, width, height, number, background, scrollbar ) );
}
public void AddHtmlLocalized( int x, int y, int width, int height, int number, int color, bool background, bool scrollbar )
{
Add( new GumpHtmlLocalized( x, y, width, height, number, color, background, scrollbar ) );
}
public void AddHtmlLocalized( int x, int y, int width, int height, int number, string args, int color, bool background, bool scrollbar )
{
Add( new GumpHtmlLocalized( x, y, width, height, number, args, color, background, scrollbar ) );
}
public void AddImage( int x, int y, int gumpID )
{
Add( new GumpImage( x, y, gumpID ) );
}
public void AddImage( int x, int y, int gumpID, int hue )
{
Add( new GumpImage( x, y, gumpID, hue ) );
}
public void AddImageTiled( int x, int y, int width, int height, int gumpID )
{
Add( new GumpImageTiled( x, y, width, height, gumpID ) );
}
public void AddImageTiledButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height )
{
Add( new GumpImageTileButton( x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height ) );
}
public void AddImageTiledButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height, int localizedTooltip )
{
Add( new GumpImageTileButton( x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height, localizedTooltip ) );
}
public void AddItem( int x, int y, int itemID )
{
Add( new GumpItem( x, y, itemID ) );
}
public void AddItem( int x, int y, int itemID, int hue )
{
Add( new GumpItem( x, y, itemID, hue ) );
}
public void AddLabel( int x, int y, int hue, string text )
{
Add( new GumpLabel( x, y, hue, text ) );
}
public void AddLabelCropped( int x, int y, int width, int height, int hue, string text )
{
Add( new GumpLabelCropped( x, y, width, height, hue, text ) );
}
public void AddRadio( int x, int y, int inactiveID, int activeID, bool initialState, int switchID )
{
Add( new GumpRadio( x, y, inactiveID, activeID, initialState, switchID ) );
}
public void AddTextEntry( int x, int y, int width, int height, int hue, int entryID, string initialText )
{
Add( new GumpTextEntry( x, y, width, height, hue, entryID, initialText ) );
}
public void AddTextEntry( int x, int y, int width, int height, int hue, int entryID, string initialText, int size ) {
Add( new GumpTextEntryLimited( x, y, width, height, hue, entryID, initialText, size ) );
}
public void AddItemProperty( int serial )
{
Add( new GumpItemProperty( serial ) );
}
public void Add( GumpEntry g )
{
if ( g.Parent != this )
{
g.Parent = this;
}
else if ( !Entries.Contains( g ) )
{
Invalidate();
Entries.Add( g );
}
}
public void Remove( GumpEntry g )
{
if (g == null || !Entries.Contains(g))
return;
Invalidate();
Entries.Remove( g );
g.Parent = null;
}
public int Intern( string value )
{
int indexOf = m_Strings.IndexOf( value );
if ( indexOf >= 0 )
{
return indexOf;
}
Invalidate();
m_Strings.Add( value );
return m_Strings.Count - 1;
}
public void SendTo( NetState state )
{
state.AddGump( this );
state.Send( Compile( state ) );
}
public static byte[] StringToBuffer( string str )
{
return Encoding.ASCII.GetBytes( str );
}
private static byte[] m_BeginLayout = StringToBuffer( "{ " );
private static byte[] m_EndLayout = StringToBuffer( " }" );
private static byte[] m_NoMove = StringToBuffer( "{ nomove }" );
private static byte[] m_NoClose = StringToBuffer( "{ noclose }" );
private static byte[] m_NoDispose = StringToBuffer( "{ nodispose }" );
private static byte[] m_NoResize = StringToBuffer( "{ noresize }" );
private Packet Compile()
{
return Compile( null );
}
private Packet Compile( NetState ns )
{
IGumpWriter disp;
if ( ns != null && ns.Unpack )
disp = new DisplayGumpPacked( this );
else
disp = new DisplayGumpFast( this );
if ( !m_Dragable )
disp.AppendLayout( m_NoMove );
if ( !m_Closable )
disp.AppendLayout( m_NoClose );
if ( !m_Disposable )
disp.AppendLayout( m_NoDispose );
if ( !m_Resizable )
disp.AppendLayout( m_NoResize );
int count = Entries.Count;
GumpEntry e;
for ( int i = 0; i < count; ++i )
{
e = Entries[i];
disp.AppendLayout( m_BeginLayout );
e.AppendTo( ns, disp );
disp.AppendLayout( m_EndLayout );
}
disp.WriteStrings( m_Strings );
disp.Flush();
m_TextEntries = disp.TextEntries;
m_Switches = disp.Switches;
return disp as Packet;
}
public virtual void OnResponse( NetState sender, RelayInfo info )
{
}
public virtual void OnServerClose( NetState owner )
{
}
}
}
public class Gump
{
private static int m_NextSerial = 1;
private static byte[] m_BeginLayout = StringToBuffer("{ ");
private static byte[] m_EndLayout = StringToBuffer(" }");
private static byte[] m_NoMove = StringToBuffer("{ nomove }");
private static byte[] m_NoClose = StringToBuffer("{ noclose }");
private static byte[] m_NoDispose = StringToBuffer("{ nodispose }");
private static byte[] m_NoResize = StringToBuffer("{ noresize }");
private bool m_Closable = true;
private bool m_Disposable = true;
private bool m_Dragable = true;
private bool m_Resizable = true;
private int m_Serial;
private List<string> m_Strings;
internal int m_TextEntries, m_Switches;
private int m_X, m_Y;
public Gump(int x, int y)
{
do
{
m_Serial = m_NextSerial++;
} while (m_Serial == 0); // standard client apparently doesn't send a gump response packet if serial == 0
m_X = x;
m_Y = y;
TypeID = GetTypeID(GetType());
Entries = new List<GumpEntry>();
m_Strings = new List<string>();
}
public int TypeID{ get; }
public List<GumpEntry> Entries{ get; }
public int Serial
{
get => m_Serial;
set
{
if (m_Serial != value)
{
m_Serial = value;
Invalidate();
}
}
}
public int X
{
get => m_X;
set
{
if (m_X != value)
{
m_X = value;
Invalidate();
}
}
}
public int Y
{
get => m_Y;
set
{
if (m_Y != value)
{
m_Y = value;
Invalidate();
}
}
}
public bool Disposable
{
get => m_Disposable;
set
{
if (m_Disposable != value)
{
m_Disposable = value;
Invalidate();
}
}
}
public bool Resizable
{
get => m_Resizable;
set
{
if (m_Resizable != value)
{
m_Resizable = value;
Invalidate();
}
}
}
public bool Dragable
{
get => m_Dragable;
set
{
if (m_Dragable != value)
{
m_Dragable = value;
Invalidate();
}
}
}
public bool Closable
{
get => m_Closable;
set
{
if (m_Closable != value)
{
m_Closable = value;
Invalidate();
}
}
}
public static int GetTypeID(Type type)
{
return type.FullName.GetHashCode();
}
public void Invalidate()
{
//if ( m_Strings.Count > 0 )
// m_Strings.Clear();
}
public void AddPage(int page)
{
Add(new GumpPage(page));
}
public void AddAlphaRegion(int x, int y, int width, int height)
{
Add(new GumpAlphaRegion(x, y, width, height));
}
public void AddBackground(int x, int y, int width, int height, int gumpID)
{
Add(new GumpBackground(x, y, width, height, gumpID));
}
public void AddButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param)
{
Add(new GumpButton(x, y, normalID, pressedID, buttonID, type, param));
}
public void AddCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
Add(new GumpCheck(x, y, inactiveID, activeID, initialState, switchID));
}
public void AddGroup(int group)
{
Add(new GumpGroup(group));
}
public void AddTooltip(int number)
{
Add(new GumpTooltip(number));
}
public void AddHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
{
Add(new GumpHtml(x, y, width, height, text, background, scrollbar));
}
public void AddHtmlLocalized(int x, int y, int width, int height, int number, bool background, bool scrollbar)
{
Add(new GumpHtmlLocalized(x, y, width, height, number, background, scrollbar));
}
public void AddHtmlLocalized(int x, int y, int width, int height, int number, int color, bool background,
bool scrollbar)
{
Add(new GumpHtmlLocalized(x, y, width, height, number, color, background, scrollbar));
}
public void AddHtmlLocalized(int x, int y, int width, int height, int number, string args, int color,
bool background, bool scrollbar)
{
Add(new GumpHtmlLocalized(x, y, width, height, number, args, color, background, scrollbar));
}
public void AddImage(int x, int y, int gumpID)
{
Add(new GumpImage(x, y, gumpID));
}
public void AddImage(int x, int y, int gumpID, int hue)
{
Add(new GumpImage(x, y, gumpID, hue));
}
public void AddImageTiled(int x, int y, int width, int height, int gumpID)
{
Add(new GumpImageTiled(x, y, width, height, gumpID));
}
public void AddImageTiledButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type,
int param, int itemID, int hue, int width, int height)
{
Add(new GumpImageTileButton(x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height));
}
public void AddImageTiledButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type,
int param, int itemID, int hue, int width, int height, int localizedTooltip)
{
Add(new GumpImageTileButton(x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height,
localizedTooltip));
}
public void AddItem(int x, int y, int itemID)
{
Add(new GumpItem(x, y, itemID));
}
public void AddItem(int x, int y, int itemID, int hue)
{
Add(new GumpItem(x, y, itemID, hue));
}
public void AddLabel(int x, int y, int hue, string text)
{
Add(new GumpLabel(x, y, hue, text));
}
public void AddLabelCropped(int x, int y, int width, int height, int hue, string text)
{
Add(new GumpLabelCropped(x, y, width, height, hue, text));
}
public void AddRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
Add(new GumpRadio(x, y, inactiveID, activeID, initialState, switchID));
}
public void AddTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
{
Add(new GumpTextEntry(x, y, width, height, hue, entryID, initialText));
}
public void AddTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText, int size)
{
Add(new GumpTextEntryLimited(x, y, width, height, hue, entryID, initialText, size));
}
public void AddItemProperty(int serial)
{
Add(new GumpItemProperty(serial));
}
public void Add(GumpEntry g)
{
if (g.Parent != this)
{
g.Parent = this;
}
else if (!Entries.Contains(g))
{
Invalidate();
Entries.Add(g);
}
}
public void Remove(GumpEntry g)
{
if (g == null || !Entries.Contains(g))
return;
Invalidate();
Entries.Remove(g);
g.Parent = null;
}
public int Intern(string value)
{
int indexOf = m_Strings.IndexOf(value);
if (indexOf >= 0) return indexOf;
Invalidate();
m_Strings.Add(value);
return m_Strings.Count - 1;
}
public void SendTo(NetState state)
{
state.AddGump(this);
state.Send(Compile(state));
}
public static byte[] StringToBuffer(string str)
{
return Encoding.ASCII.GetBytes(str);
}
private Packet Compile()
{
return Compile(null);
}
private Packet Compile(NetState ns)
{
IGumpWriter disp;
if (ns != null && ns.Unpack)
disp = new DisplayGumpPacked(this);
else
disp = new DisplayGumpFast(this);
if (!m_Dragable)
disp.AppendLayout(m_NoMove);
if (!m_Closable)
disp.AppendLayout(m_NoClose);
if (!m_Disposable)
disp.AppendLayout(m_NoDispose);
if (!m_Resizable)
disp.AppendLayout(m_NoResize);
int count = Entries.Count;
GumpEntry e;
for (int i = 0; i < count; ++i)
{
e = Entries[i];
disp.AppendLayout(m_BeginLayout);
e.AppendTo(ns, disp);
disp.AppendLayout(m_EndLayout);
}
disp.WriteStrings(m_Strings);
disp.Flush();
m_TextEntries = disp.TextEntries;
m_Switches = disp.Switches;
return disp as Packet;
}
public virtual void OnResponse(NetState sender, RelayInfo info)
{
}
public virtual void OnServerClose(NetState owner)
{
}
}
}

View file

@ -18,62 +18,60 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpAlphaRegion : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
public class GumpAlphaRegion : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("checkertrans");
private int m_Width, m_Height;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpAlphaRegion(int x, int y, int width, int height)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public GumpAlphaRegion( int x, int y, int width, int height )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public override string Compile( NetState ns )
{
return $"{{ checkertrans {m_X} {m_Y} {m_Width} {m_Height} }}";
}
public override string Compile(NetState ns)
{
return $"{{ checkertrans {m_X} {m_Y} {m_Width} {m_Height} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "checkertrans" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
}
}
}

View file

@ -18,71 +18,69 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpBackground : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
private int m_GumpID;
public class GumpBackground : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("resizepic");
private int m_GumpID;
private int m_Width, m_Height;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpBackground(int x, int y, int width, int height, int gumpID)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_GumpID = gumpID;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int GumpID
{
get => m_GumpID;
set => Delta( ref m_GumpID, value );
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public GumpBackground( int x, int y, int width, int height, int gumpID )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_GumpID = gumpID;
}
public int GumpID
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public override string Compile( NetState ns )
{
return $"{{ resizepic {m_X} {m_Y} {m_GumpID} {m_Width} {m_Height} }}";
}
public override string Compile(NetState ns)
{
return $"{{ resizepic {m_X} {m_Y} {m_GumpID} {m_Width} {m_Height} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "resizepic" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_GumpID );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_GumpID);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
}
}
}

View file

@ -18,105 +18,103 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public enum GumpButtonType
{
Page = 0,
Reply = 1
}
public enum GumpButtonType
{
Page = 0,
Reply = 1
}
public class GumpButton : GumpEntry
{
private int m_X, m_Y;
private int m_ID1, m_ID2;
private int m_ButtonID;
private GumpButtonType m_Type;
private int m_Param;
public class GumpButton : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("button");
private int m_ButtonID;
private int m_ID1, m_ID2;
private int m_Param;
private GumpButtonType m_Type;
private int m_X, m_Y;
public GumpButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param )
{
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
}
public GumpButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param)
{
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
}
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int NormalID
{
get => m_ID1;
set => Delta( ref m_ID1, value );
}
public int NormalID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int PressedID
{
get => m_ID2;
set => Delta( ref m_ID2, value );
}
public int PressedID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int ButtonID
{
get => m_ButtonID;
set => Delta( ref m_ButtonID, value );
}
public int ButtonID
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public GumpButtonType Type
{
get => m_Type;
set
{
if ( m_Type != value )
{
m_Type = value;
public GumpButtonType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
Gump parent = Parent;
Gump parent = Parent;
parent?.Invalidate();
}
}
}
parent?.Invalidate();
}
}
}
public int Param
{
get => m_Param;
set => Delta( ref m_Param, value );
}
public int Param
{
get => m_Param;
set => Delta(ref m_Param, value);
}
public override string Compile( NetState ns )
{
return $"{{ button {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} }}";
}
public override string Compile(NetState ns)
{
return $"{{ button {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "button" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_ID1 );
disp.AppendLayout( m_ID2 );
disp.AppendLayout( (int)m_Type );
disp.AppendLayout( m_Param );
disp.AppendLayout( m_ButtonID );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout((int)m_Type);
disp.AppendLayout(m_Param);
disp.AppendLayout(m_ButtonID);
}
}
}

View file

@ -18,82 +18,80 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpCheck : GumpEntry
{
private int m_X, m_Y;
private int m_ID1, m_ID2;
private bool m_InitialState;
private int m_SwitchID;
public class GumpCheck : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("checkbox");
private int m_ID1, m_ID2;
private bool m_InitialState;
private int m_SwitchID;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
m_X = x;
m_Y = y;
m_ID1 = inactiveID;
m_ID2 = activeID;
m_InitialState = initialState;
m_SwitchID = switchID;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int InactiveID
{
get => m_ID1;
set => Delta( ref m_ID1, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int ActiveID
{
get => m_ID2;
set => Delta( ref m_ID2, value );
}
public int InactiveID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public bool InitialState
{
get => m_InitialState;
set => Delta( ref m_InitialState, value );
}
public int ActiveID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int SwitchID
{
get => m_SwitchID;
set => Delta( ref m_SwitchID, value );
}
public bool InitialState
{
get => m_InitialState;
set => Delta(ref m_InitialState, value);
}
public GumpCheck( int x, int y, int inactiveID, int activeID, bool initialState, int switchID )
{
m_X = x;
m_Y = y;
m_ID1 = inactiveID;
m_ID2 = activeID;
m_InitialState = initialState;
m_SwitchID = switchID;
}
public int SwitchID
{
get => m_SwitchID;
set => Delta(ref m_SwitchID, value);
}
public override string Compile( NetState ns )
{
return $"{{ checkbox {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}";
}
public override string Compile(NetState ns)
{
return $"{{ checkbox {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "checkbox" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout(m_InitialState);
disp.AppendLayout(m_SwitchID);
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_ID1 );
disp.AppendLayout( m_ID2 );
disp.AppendLayout( m_InitialState );
disp.AppendLayout( m_SwitchID );
disp.Switches++;
}
}
disp.Switches++;
}
}
}

View file

@ -22,63 +22,47 @@ using Server.Network;
namespace Server.Gumps
{
public abstract class GumpEntry
{
private Gump m_Parent;
public abstract class GumpEntry
{
private Gump m_Parent;
protected GumpEntry()
{
}
public Gump Parent
{
get => m_Parent;
set
{
if (m_Parent != value)
{
m_Parent?.Remove(this);
protected void Delta( ref int var, int val )
{
if ( var != val )
{
var = val;
}
}
m_Parent = value;
protected void Delta( ref bool var, bool val )
{
if ( var != val )
{
var = val;
}
}
m_Parent?.Add(this);
}
}
}
protected void Delta( ref string var, string val )
{
if ( var != val )
{
var = val;
}
}
protected void Delta(ref int var, int val)
{
if (var != val) var = val;
}
protected void Delta( ref object[] var, object[] val )
{
if ( var != val )
{
var = val;
}
}
protected void Delta(ref bool var, bool val)
{
if (var != val) var = val;
}
public Gump Parent
{
get => m_Parent;
set
{
if ( m_Parent != value )
{
m_Parent?.Remove( this );
protected void Delta(ref string var, string val)
{
if (var != val) var = val;
}
m_Parent = value;
protected void Delta(ref object[] var, object[] val)
{
if (var != val) var = val;
}
m_Parent?.Add( this );
}
}
}
public abstract string Compile( NetState ns );
public abstract void AppendTo( NetState ns, IGumpWriter disp );
}
public abstract string Compile(NetState ns);
public abstract void AppendTo(NetState ns, IGumpWriter disp);
}
}

View file

@ -18,37 +18,35 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpGroup : GumpEntry
{
private int m_Group;
public class GumpGroup : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("group");
private int m_Group;
public GumpGroup( int group )
{
m_Group = group;
}
public GumpGroup(int group)
{
m_Group = group;
}
public int Group
{
get => m_Group;
set => Delta( ref m_Group, value );
}
public int Group
{
get => m_Group;
set => Delta(ref m_Group, value);
}
public override string Compile( NetState ns )
{
return $"{{ group {m_Group} }}";
}
public override string Compile(NetState ns)
{
return $"{{ group {m_Group} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "group" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_Group );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Group);
}
}
}

View file

@ -18,89 +18,87 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpHtml : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
private string m_Text;
private bool m_Background, m_Scrollbar;
public class GumpHtml : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("htmlgump");
private bool m_Background, m_Scrollbar;
private string m_Text;
private int m_Width, m_Height;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Text = text;
m_Background = background;
m_Scrollbar = scrollbar;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public string Text
{
get => m_Text;
set => Delta( ref m_Text, value );
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public bool Background
{
get => m_Background;
set => Delta( ref m_Background, value );
}
public string Text
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public bool Scrollbar
{
get => m_Scrollbar;
set => Delta( ref m_Scrollbar, value );
}
public bool Background
{
get => m_Background;
set => Delta(ref m_Background, value);
}
public GumpHtml( int x, int y, int width, int height, string text, bool background, bool scrollbar )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Text = text;
m_Background = background;
m_Scrollbar = scrollbar;
}
public bool Scrollbar
{
get => m_Scrollbar;
set => Delta(ref m_Scrollbar, value);
}
public override string Compile( NetState ns )
{
return
$"{{ htmlgump {m_X} {m_Y} {m_Width} {m_Height} {Parent.Intern(m_Text)} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}";
}
public override string Compile(NetState ns)
{
return
$"{{ htmlgump {m_X} {m_Y} {m_Width} {m_Height} {Parent.Intern(m_Text)} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "htmlgump" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( Parent.Intern( m_Text ) );
disp.AppendLayout( m_Background );
disp.AppendLayout( m_Scrollbar );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(Parent.Intern(m_Text));
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
}
}
}

View file

@ -18,215 +18,214 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public enum GumpHtmlLocalizedType
{
Plain,
Color,
Args
}
public enum GumpHtmlLocalizedType
{
Plain,
Color,
Args
}
public class GumpHtmlLocalized : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
private int m_Number;
private string m_Args;
private int m_Color;
private bool m_Background, m_Scrollbar;
public class GumpHtmlLocalized : GumpEntry
{
private static byte[] m_LayoutNamePlain = Gump.StringToBuffer("xmfhtmlgump");
private static byte[] m_LayoutNameColor = Gump.StringToBuffer("xmfhtmlgumpcolor");
private static byte[] m_LayoutNameArgs = Gump.StringToBuffer("xmfhtmltok");
private string m_Args;
private bool m_Background, m_Scrollbar;
private int m_Color;
private int m_Number;
private GumpHtmlLocalizedType m_Type;
private GumpHtmlLocalizedType m_Type;
private int m_Width, m_Height;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpHtmlLocalized(int x, int y, int width, int height, int number, bool background, bool scrollbar)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Background = background;
m_Scrollbar = scrollbar;
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
m_Type = GumpHtmlLocalizedType.Plain;
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public GumpHtmlLocalized(int x, int y, int width, int height, int number, int color, bool background, bool scrollbar)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Color = color;
m_Background = background;
m_Scrollbar = scrollbar;
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
m_Type = GumpHtmlLocalizedType.Color;
}
public int Number
{
get => m_Number;
set => Delta( ref m_Number, value );
}
public GumpHtmlLocalized(int x, int y, int width, int height, int number, string args, int color, bool background,
bool scrollbar)
{
// Are multiple arguments unsupported? And what about non ASCII arguments?
public string Args
{
get => m_Args;
set => Delta( ref m_Args, value );
}
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Args = args;
m_Color = color;
m_Background = background;
m_Scrollbar = scrollbar;
public int Color
{
get => m_Color;
set => Delta( ref m_Color, value );
}
m_Type = GumpHtmlLocalizedType.Args;
}
public bool Background
{
get => m_Background;
set => Delta( ref m_Background, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public bool Scrollbar
{
get => m_Scrollbar;
set => Delta( ref m_Scrollbar, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public GumpHtmlLocalizedType Type
{
get => m_Type;
set
{
if ( m_Type != value )
{
m_Type = value;
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
Parent?.Invalidate();
}
}
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public GumpHtmlLocalized( int x, int y, int width, int height, int number, bool background, bool scrollbar )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Background = background;
m_Scrollbar = scrollbar;
public int Number
{
get => m_Number;
set => Delta(ref m_Number, value);
}
m_Type = GumpHtmlLocalizedType.Plain;
}
public string Args
{
get => m_Args;
set => Delta(ref m_Args, value);
}
public GumpHtmlLocalized( int x, int y, int width, int height, int number, int color, bool background, bool scrollbar )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Color = color;
m_Background = background;
m_Scrollbar = scrollbar;
public int Color
{
get => m_Color;
set => Delta(ref m_Color, value);
}
m_Type = GumpHtmlLocalizedType.Color;
}
public bool Background
{
get => m_Background;
set => Delta(ref m_Background, value);
}
public GumpHtmlLocalized( int x, int y, int width, int height, int number, string args, int color, bool background, bool scrollbar )
{
// Are multiple arguments unsupported? And what about non ASCII arguments?
public bool Scrollbar
{
get => m_Scrollbar;
set => Delta(ref m_Scrollbar, value);
}
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Number = number;
m_Args = args;
m_Color = color;
m_Background = background;
m_Scrollbar = scrollbar;
public GumpHtmlLocalizedType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
m_Type = GumpHtmlLocalizedType.Args;
}
Parent?.Invalidate();
}
}
}
public override string Compile( NetState ns )
{
switch ( m_Type )
{
case GumpHtmlLocalizedType.Plain:
return
$"{{ xmfhtmlgump {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}";
public override string Compile(NetState ns)
{
switch (m_Type)
{
case GumpHtmlLocalizedType.Plain:
return
$"{{ xmfhtmlgump {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}";
case GumpHtmlLocalizedType.Color:
return
$"{{ xmfhtmlgumpcolor {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} }}";
case GumpHtmlLocalizedType.Color:
return
$"{{ xmfhtmlgumpcolor {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} }}";
default: // GumpHtmlLocalizedType.Args
return
$"{{ xmfhtmltok {m_X} {m_Y} {m_Width} {m_Height} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} {m_Number} @{m_Args}@ }}";
}
}
default: // GumpHtmlLocalizedType.Args
return
$"{{ xmfhtmltok {m_X} {m_Y} {m_Width} {m_Height} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} {m_Number} @{m_Args}@ }}";
}
}
private static byte[] m_LayoutNamePlain = Gump.StringToBuffer( "xmfhtmlgump" );
private static byte[] m_LayoutNameColor = Gump.StringToBuffer( "xmfhtmlgumpcolor" );
private static byte[] m_LayoutNameArgs = Gump.StringToBuffer( "xmfhtmltok" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
switch (m_Type)
{
case GumpHtmlLocalizedType.Plain:
{
disp.AppendLayout(m_LayoutNamePlain);
public override void AppendTo( NetState ns, IGumpWriter disp )
{
switch ( m_Type )
{
case GumpHtmlLocalizedType.Plain:
{
disp.AppendLayout( m_LayoutNamePlain );
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Number);
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_Number );
disp.AppendLayout( m_Background );
disp.AppendLayout( m_Scrollbar );
break;
}
break;
}
case GumpHtmlLocalizedType.Color:
{
disp.AppendLayout(m_LayoutNameColor);
case GumpHtmlLocalizedType.Color:
{
disp.AppendLayout( m_LayoutNameColor );
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Number);
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
disp.AppendLayout(m_Color);
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_Number );
disp.AppendLayout( m_Background );
disp.AppendLayout( m_Scrollbar );
disp.AppendLayout( m_Color );
break;
}
break;
}
case GumpHtmlLocalizedType.Args:
{
disp.AppendLayout(m_LayoutNameArgs);
case GumpHtmlLocalizedType.Args:
{
disp.AppendLayout( m_LayoutNameArgs );
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Background);
disp.AppendLayout(m_Scrollbar);
disp.AppendLayout(m_Color);
disp.AppendLayout(m_Number);
disp.AppendLayout(m_Args);
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_Background );
disp.AppendLayout( m_Scrollbar );
disp.AppendLayout( m_Color );
disp.AppendLayout( m_Number );
disp.AppendLayout( m_Args );
break;
}
}
}
}
break;
}
}
}
}
}

View file

@ -18,75 +18,73 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpImage : GumpEntry
{
private int m_X, m_Y;
private int m_GumpID;
private int m_Hue;
public class GumpImage : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("gumppic");
private static byte[] m_HueEquals = Gump.StringToBuffer(" hue=");
private int m_GumpID;
private int m_Hue;
private int m_X, m_Y;
public GumpImage( int x, int y, int gumpID ) : this( x, y, gumpID, 0 )
{
}
public GumpImage(int x, int y, int gumpID) : this(x, y, gumpID, 0)
{
}
public GumpImage( int x, int y, int gumpID, int hue )
{
m_X = x;
m_Y = y;
m_GumpID = gumpID;
m_Hue = hue;
}
public GumpImage(int x, int y, int gumpID, int hue)
{
m_X = x;
m_Y = y;
m_GumpID = gumpID;
m_Hue = hue;
}
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int GumpID
{
get => m_GumpID;
set => Delta( ref m_GumpID, value );
}
public int GumpID
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public int Hue
{
get => m_Hue;
set => Delta( ref m_Hue, value );
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile( NetState ns )
{
if ( m_Hue == 0 )
return $"{{ gumppic {m_X} {m_Y} {m_GumpID} }}";
return $"{{ gumppic {m_X} {m_Y} {m_GumpID} hue={m_Hue} }}";
}
public override string Compile(NetState ns)
{
if (m_Hue == 0)
return $"{{ gumppic {m_X} {m_Y} {m_GumpID} }}";
return $"{{ gumppic {m_X} {m_Y} {m_GumpID} hue={m_Hue} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "gumppic" );
private static byte[] m_HueEquals = Gump.StringToBuffer( " hue=" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_GumpID);
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_GumpID );
if ( m_Hue != 0 )
{
disp.AppendLayout( m_HueEquals );
disp.AppendLayoutNS( m_Hue );
}
}
}
if (m_Hue != 0)
{
disp.AppendLayout(m_HueEquals);
disp.AppendLayoutNS(m_Hue);
}
}
}
}

View file

@ -18,157 +18,161 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpImageTileButton : GumpEntry
{
//Note, on OSI, The tooltip supports ONLY clilocs as far as I can figure out, and the tooltip ONLY works after the buttonTileArt (as far as I can tell from testing)
private int m_X, m_Y;
private int m_ID1, m_ID2;
private int m_ButtonID;
private GumpButtonType m_Type;
private int m_Param;
public class GumpImageTileButton : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("buttontileart");
private static byte[] m_LayoutTooltip = Gump.StringToBuffer(" }{ tooltip");
private int m_ButtonID;
private int m_Height;
private int m_Hue;
private int m_ID1, m_ID2;
private int m_ItemID;
private int m_Hue;
private int m_Width;
private int m_Height;
private int m_ItemID;
private int m_Param;
private GumpButtonType m_Type;
public GumpImageTileButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height ) : this(x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height, -1 )
{
}
public GumpImageTileButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height, int localizedTooltip )
{
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
private int m_Width;
m_ItemID = itemID;
m_Hue = hue;
m_Width = width;
m_Height = height;
//Note, on OSI, The tooltip supports ONLY clilocs as far as I can figure out, and the tooltip ONLY works after the buttonTileArt (as far as I can tell from testing)
private int m_X, m_Y;
LocalizedTooltip = localizedTooltip;
}
public GumpImageTileButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param,
int itemID, int hue, int width, int height) : this(x, y, normalID, pressedID, buttonID, type, param, itemID, hue,
width, height, -1)
{
}
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpImageTileButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param,
int itemID, int hue, int width, int height, int localizedTooltip)
{
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
m_ItemID = itemID;
m_Hue = hue;
m_Width = width;
m_Height = height;
public int NormalID
{
get => m_ID1;
set => Delta( ref m_ID1, value );
}
LocalizedTooltip = localizedTooltip;
}
public int PressedID
{
get => m_ID2;
set => Delta( ref m_ID2, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int ButtonID
{
get => m_ButtonID;
set => Delta( ref m_ButtonID, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public GumpButtonType Type
{
get => m_Type;
set
{
if ( m_Type != value )
{
m_Type = value;
public int NormalID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
Gump parent = Parent;
public int PressedID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
parent?.Invalidate();
}
}
}
public int ButtonID
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public int Param
{
get => m_Param;
set => Delta( ref m_Param, value );
}
public GumpButtonType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
public int ItemID
{
get => m_ItemID;
set => Delta( ref m_ItemID, value );
}
Gump parent = Parent;
public int Hue
{
get => m_Hue;
set => Delta( ref m_Hue, value );
}
parent?.Invalidate();
}
}
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Param
{
get => m_Param;
set => Delta(ref m_Param, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int ItemID
{
get => m_ItemID;
set => Delta(ref m_ItemID, value);
}
public int LocalizedTooltip { get; set; }
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile( NetState ns )
{
if ( LocalizedTooltip > 0 )
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {LocalizedTooltip} }}";
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}";
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "buttontileart" );
private static byte[] m_LayoutTooltip = Gump.StringToBuffer( " }{ tooltip" );
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_ID1 );
disp.AppendLayout( m_ID2 );
disp.AppendLayout( (int)m_Type );
disp.AppendLayout( m_Param );
disp.AppendLayout( m_ButtonID );
public int LocalizedTooltip{ get; set; }
disp.AppendLayout( m_ItemID );
disp.AppendLayout( m_Hue );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
public override string Compile(NetState ns)
{
if (LocalizedTooltip > 0)
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {LocalizedTooltip} }}";
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}";
}
if ( LocalizedTooltip > 0 )
{
disp.AppendLayout( m_LayoutTooltip );
disp.AppendLayout( LocalizedTooltip );
}
}
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout((int)m_Type);
disp.AppendLayout(m_Param);
disp.AppendLayout(m_ButtonID);
disp.AppendLayout(m_ItemID);
disp.AppendLayout(m_Hue);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
if (LocalizedTooltip > 0)
{
disp.AppendLayout(m_LayoutTooltip);
disp.AppendLayout(LocalizedTooltip);
}
}
}
}

View file

@ -18,71 +18,69 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpImageTiled : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
private int m_GumpID;
public class GumpImageTiled : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("gumppictiled");
private int m_GumpID;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpImageTiled( int x, int y, int width, int height, int gumpID )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_GumpID = gumpID;
}
public GumpImageTiled(int x, int y, int width, int height, int gumpID)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_GumpID = gumpID;
}
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int GumpID
{
get => m_GumpID;
set => Delta( ref m_GumpID, value );
}
public int GumpID
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public override string Compile( NetState ns )
{
return $"{{ gumppictiled {m_X} {m_Y} {m_Width} {m_Height} {m_GumpID} }}";
}
public override string Compile(NetState ns)
{
return $"{{ gumppictiled {m_X} {m_Y} {m_Width} {m_Height} {m_GumpID} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "gumppictiled" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_GumpID );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_GumpID);
}
}
}

View file

@ -18,72 +18,70 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpItem : GumpEntry
{
private int m_X, m_Y;
private int m_ItemID;
private int m_Hue;
public class GumpItem : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("tilepic");
private static byte[] m_LayoutNameHue = Gump.StringToBuffer("tilepichue");
private int m_Hue;
private int m_ItemID;
private int m_X, m_Y;
public GumpItem( int x, int y, int itemID ) : this( x, y, itemID, 0 )
{
}
public GumpItem(int x, int y, int itemID) : this(x, y, itemID, 0)
{
}
public GumpItem( int x, int y, int itemID, int hue )
{
m_X = x;
m_Y = y;
m_ItemID = itemID;
m_Hue = hue;
}
public GumpItem(int x, int y, int itemID, int hue)
{
m_X = x;
m_Y = y;
m_ItemID = itemID;
m_Hue = hue;
}
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int ItemID
{
get => m_ItemID;
set => Delta( ref m_ItemID, value );
}
public int ItemID
{
get => m_ItemID;
set => Delta(ref m_ItemID, value);
}
public int Hue
{
get => m_Hue;
set => Delta( ref m_Hue, value );
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile( NetState ns )
{
if ( m_Hue == 0 )
return $"{{ tilepic {m_X} {m_Y} {m_ItemID} }}";
return $"{{ tilepichue {m_X} {m_Y} {m_ItemID} {m_Hue} }}";
}
public override string Compile(NetState ns)
{
if (m_Hue == 0)
return $"{{ tilepic {m_X} {m_Y} {m_ItemID} }}";
return $"{{ tilepichue {m_X} {m_Y} {m_ItemID} {m_Hue} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "tilepic" );
private static byte[] m_LayoutNameHue = Gump.StringToBuffer( "tilepichue" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_Hue == 0 ? m_LayoutName : m_LayoutNameHue);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ItemID);
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_Hue == 0 ? m_LayoutName : m_LayoutNameHue );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_ItemID );
if ( m_Hue != 0 )
disp.AppendLayout( m_Hue );
}
}
if (m_Hue != 0)
disp.AppendLayout(m_Hue);
}
}
}

View file

@ -18,37 +18,35 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpItemProperty : GumpEntry
{
private int m_Serial;
public class GumpItemProperty : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("itemproperty");
private int m_Serial;
public GumpItemProperty( int serial )
{
m_Serial = serial;
}
public GumpItemProperty(int serial)
{
m_Serial = serial;
}
public int Serial
{
get => m_Serial;
set => Delta( ref m_Serial, value );
}
public int Serial
{
get => m_Serial;
set => Delta(ref m_Serial, value);
}
public override string Compile( NetState ns )
{
return $"{{ itemproperty {m_Serial} }}";
}
public override string Compile(NetState ns)
{
return $"{{ itemproperty {m_Serial} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "itemproperty" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_Serial );
}
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Serial);
}
}
}

View file

@ -18,63 +18,61 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpLabel : GumpEntry
{
private int m_X, m_Y;
private int m_Hue;
private string m_Text;
public class GumpLabel : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("text");
private int m_Hue;
private string m_Text;
private int m_X, m_Y;
public GumpLabel( int x, int y, int hue, string text )
{
m_X = x;
m_Y = y;
m_Hue = hue;
m_Text = text;
}
public GumpLabel(int x, int y, int hue, string text)
{
m_X = x;
m_Y = y;
m_Hue = hue;
m_Text = text;
}
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Hue
{
get => m_Hue;
set => Delta( ref m_Hue, value );
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string Text
{
get => m_Text;
set => Delta( ref m_Text, value );
}
public string Text
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public override string Compile( NetState ns )
{
return $"{{ text {m_X} {m_Y} {m_Hue} {Parent.Intern(m_Text)} }}";
}
public override string Compile(NetState ns)
{
return $"{{ text {m_X} {m_Y} {m_Hue} {Parent.Intern(m_Text)} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "text" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Hue );
disp.AppendLayout( Parent.Intern( m_Text ) );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Hue);
disp.AppendLayout(Parent.Intern(m_Text));
}
}
}

View file

@ -18,80 +18,78 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpLabelCropped : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
private int m_Hue;
private string m_Text;
public class GumpLabelCropped : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("croppedtext");
private int m_Hue;
private string m_Text;
private int m_Width, m_Height;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpLabelCropped(int x, int y, int width, int height, int hue, string text)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_Text = text;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Hue
{
get => m_Hue;
set => Delta( ref m_Hue, value );
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public string Text
{
get => m_Text;
set => Delta( ref m_Text, value );
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public GumpLabelCropped( int x, int y, int width, int height, int hue, string text )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_Text = text;
}
public string Text
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public override string Compile( NetState ns )
{
return $"{{ croppedtext {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {Parent.Intern(m_Text)} }}";
}
public override string Compile(NetState ns)
{
return $"{{ croppedtext {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {Parent.Intern(m_Text)} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "croppedtext" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_Hue );
disp.AppendLayout( Parent.Intern( m_Text ) );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue);
disp.AppendLayout(Parent.Intern(m_Text));
}
}
}

View file

@ -18,37 +18,35 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpPage : GumpEntry
{
private int m_Page;
public class GumpPage : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("page");
private int m_Page;
public GumpPage( int page )
{
m_Page = page;
}
public GumpPage(int page)
{
m_Page = page;
}
public int Page
{
get => m_Page;
set => Delta( ref m_Page, value );
}
public int Page
{
get => m_Page;
set => Delta(ref m_Page, value);
}
public override string Compile( NetState ns )
{
return $"{{ page {m_Page} }}";
}
public override string Compile(NetState ns)
{
return $"{{ page {m_Page} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "page" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_Page );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Page);
}
}
}

View file

@ -18,82 +18,80 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpRadio : GumpEntry
{
private int m_X, m_Y;
private int m_ID1, m_ID2;
private bool m_InitialState;
private int m_SwitchID;
public class GumpRadio : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("radio");
private int m_ID1, m_ID2;
private bool m_InitialState;
private int m_SwitchID;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{
m_X = x;
m_Y = y;
m_ID1 = inactiveID;
m_ID2 = activeID;
m_InitialState = initialState;
m_SwitchID = switchID;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int InactiveID
{
get => m_ID1;
set => Delta( ref m_ID1, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int ActiveID
{
get => m_ID2;
set => Delta( ref m_ID2, value );
}
public int InactiveID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public bool InitialState
{
get => m_InitialState;
set => Delta( ref m_InitialState, value );
}
public int ActiveID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int SwitchID
{
get => m_SwitchID;
set => Delta( ref m_SwitchID, value );
}
public bool InitialState
{
get => m_InitialState;
set => Delta(ref m_InitialState, value);
}
public GumpRadio( int x, int y, int inactiveID, int activeID, bool initialState, int switchID )
{
m_X = x;
m_Y = y;
m_ID1 = inactiveID;
m_ID2 = activeID;
m_InitialState = initialState;
m_SwitchID = switchID;
}
public int SwitchID
{
get => m_SwitchID;
set => Delta(ref m_SwitchID, value);
}
public override string Compile( NetState ns )
{
return $"{{ radio {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}";
}
public override string Compile(NetState ns)
{
return $"{{ radio {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "radio" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_ID1);
disp.AppendLayout(m_ID2);
disp.AppendLayout(m_InitialState);
disp.AppendLayout(m_SwitchID);
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_ID1 );
disp.AppendLayout( m_ID2 );
disp.AppendLayout( m_InitialState );
disp.AppendLayout( m_SwitchID );
disp.Switches++;
}
}
disp.Switches++;
}
}
}

View file

@ -18,92 +18,90 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpTextEntry : GumpEntry
{
private int m_X, m_Y;
private int m_Width, m_Height;
private int m_Hue;
private int m_EntryID;
private string m_InitialText;
public class GumpTextEntry : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("textentry");
private int m_EntryID;
private int m_Hue;
private string m_InitialText;
private int m_Width, m_Height;
private int m_X, m_Y;
public int X
{
get => m_X;
set => Delta( ref m_X, value );
}
public GumpTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
}
public int Y
{
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Width
{
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Height
{
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Hue
{
get => m_Hue;
set => Delta( ref m_Hue, value );
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int EntryID
{
get => m_EntryID;
set => Delta( ref m_EntryID, value );
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string InitialText
{
get => m_InitialText;
set => Delta( ref m_InitialText, value );
}
public int EntryID
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public GumpTextEntry( int x, int y, int width, int height, int hue, int entryID, string initialText )
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
}
public string InitialText
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public override string Compile( NetState ns )
{
return
$"{{ textentry {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} }}";
}
public override string Compile(NetState ns)
{
return
$"{{ textentry {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "textentry" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue);
disp.AppendLayout(m_EntryID);
disp.AppendLayout(Parent.Intern(m_InitialText));
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_Hue );
disp.AppendLayout( m_EntryID );
disp.AppendLayout( Parent.Intern( m_InitialText ) );
disp.TextEntries++;
}
}
disp.TextEntries++;
}
}
}

View file

@ -18,88 +18,99 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps {
public class GumpTextEntryLimited : GumpEntry {
private int m_X, m_Y;
private int m_Width, m_Height;
private int m_Hue;
private int m_EntryID;
private string m_InitialText;
private int m_Size;
namespace Server.Gumps
{
public class GumpTextEntryLimited : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("textentrylimited");
private int m_EntryID;
private int m_Hue;
private string m_InitialText;
private int m_Size;
private int m_Width, m_Height;
private int m_X, m_Y;
public int X {
get => m_X;
set => Delta( ref m_X, value );
}
public GumpTextEntryLimited(int x, int y, int width, int height, int hue, int entryID, string initialText, int size)
{
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
m_Size = size;
}
public int Y {
get => m_Y;
set => Delta( ref m_Y, value );
}
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Width {
get => m_Width;
set => Delta( ref m_Width, value );
}
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Height {
get => m_Height;
set => Delta( ref m_Height, value );
}
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Hue {
get => m_Hue;
set => Delta( ref m_Hue, value );
}
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int EntryID {
get => m_EntryID;
set => Delta( ref m_EntryID, value );
}
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string InitialText {
get => m_InitialText;
set => Delta( ref m_InitialText, value );
}
public int EntryID
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public int Size {
get => m_Size;
set => Delta( ref m_Size, value );
}
public string InitialText
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public GumpTextEntryLimited( int x, int y, int width, int height, int hue, int entryID, string initialText, int size ) {
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
m_Size = size;
}
public int Size
{
get => m_Size;
set => Delta(ref m_Size, value);
}
public override string Compile( NetState ns ) {
return
$"{{ textentrylimited {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} {m_Size} }}";
}
public override string Compile(NetState ns)
{
return
$"{{ textentrylimited {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} {m_Size} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "textentrylimited" );
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X);
disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue);
disp.AppendLayout(m_EntryID);
disp.AppendLayout(Parent.Intern(m_InitialText));
disp.AppendLayout(m_Size);
public override void AppendTo( NetState ns, IGumpWriter disp ) {
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_X );
disp.AppendLayout( m_Y );
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
disp.AppendLayout( m_Hue );
disp.AppendLayout( m_EntryID );
disp.AppendLayout( Parent.Intern( m_InitialText ) );
disp.AppendLayout( m_Size );
disp.TextEntries++;
}
}
disp.TextEntries++;
}
}
}

View file

@ -18,37 +18,35 @@
*
***************************************************************************/
using System;
using Server.Network;
namespace Server.Gumps
{
public class GumpTooltip : GumpEntry
{
private int m_Number;
public class GumpTooltip : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("tooltip");
private int m_Number;
public GumpTooltip( int number )
{
m_Number = number;
}
public GumpTooltip(int number)
{
m_Number = number;
}
public int Number
{
get => m_Number;
set => Delta( ref m_Number, value );
}
public int Number
{
get => m_Number;
set => Delta(ref m_Number, value);
}
public override string Compile( NetState ns )
{
return $"{{ tooltip {m_Number} }}";
}
public override string Compile(NetState ns)
{
return $"{{ tooltip {m_Number} }}";
}
private static byte[] m_LayoutName = Gump.StringToBuffer( "tooltip" );
public override void AppendTo( NetState ns, IGumpWriter disp )
{
disp.AppendLayout( m_LayoutName );
disp.AppendLayout( m_Number );
}
}
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Number);
}
}
}

View file

@ -20,58 +20,50 @@
namespace Server.Gumps
{
public class TextRelay
{
public TextRelay( int entryID, string text )
{
EntryID = entryID;
Text = text;
}
public class TextRelay
{
public TextRelay(int entryID, string text)
{
EntryID = entryID;
Text = text;
}
public int EntryID { get; }
public int EntryID{ get; }
public string Text { get; }
}
public string Text{ get; }
}
public class RelayInfo
{
public RelayInfo( int buttonID, int[] switches, TextRelay[] textEntries )
{
ButtonID = buttonID;
Switches = switches;
TextEntries = textEntries;
}
public class RelayInfo
{
public RelayInfo(int buttonID, int[] switches, TextRelay[] textEntries)
{
ButtonID = buttonID;
Switches = switches;
TextEntries = textEntries;
}
public int ButtonID { get; }
public int ButtonID{ get; }
public int[] Switches { get; }
public int[] Switches{ get; }
public TextRelay[] TextEntries { get; }
public TextRelay[] TextEntries{ get; }
public bool IsSwitched( int switchID )
{
for ( int i = 0; i < Switches.Length; ++i )
{
if ( Switches[i] == switchID )
{
return true;
}
}
public bool IsSwitched(int switchID)
{
for (int i = 0; i < Switches.Length; ++i)
if (Switches[i] == switchID)
return true;
return false;
}
return false;
}
public TextRelay GetTextEntry( int entryID )
{
for ( int i = 0; i < TextEntries.Length; ++i )
{
if ( TextEntries[i].EntryID == entryID )
{
return TextEntries[i];
}
}
public TextRelay GetTextEntry(int entryID)
{
for (int i = 0; i < TextEntries.Length; ++i)
if (TextEntries[i].EntryID == entryID)
return TextEntries[i];
return null;
}
}
return null;
}
}
}