Adds missing gump components. (#111)

This commit is contained in:
Kamron Batman 2020-04-24 21:31:31 -07:00 • committed by GitHub
parent 18b7cee52a
commit c116dff3e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 531 additions and 1045 deletions

View file

@ -36,27 +36,20 @@ namespace Server.Gumps
private static readonly byte[] m_NoClose = StringToBuffer("{ noclose }"); private static readonly byte[] m_NoClose = StringToBuffer("{ noclose }");
private static readonly byte[] m_NoDispose = StringToBuffer("{ nodispose }"); private static readonly byte[] m_NoDispose = StringToBuffer("{ nodispose }");
private static readonly byte[] m_NoResize = StringToBuffer("{ noresize }"); private static readonly byte[] m_NoResize = StringToBuffer("{ noresize }");
private bool m_Closable = true;
private bool m_Disposable = true;
private bool m_Draggable = true;
private bool m_Resizable = true;
private uint m_Serial;
private readonly List<string> m_Strings; private readonly List<string> m_Strings;
internal int m_TextEntries, m_Switches; internal int m_TextEntries, m_Switches;
private int m_X, m_Y;
public Gump(int x, int y) public Gump(int x, int y)
{ {
do do
{ {
m_Serial = m_NextSerial++; Serial = m_NextSerial++;
} while (m_Serial == 0); // standard client apparently doesn't send a gump response packet if serial == 0 } while (Serial == 0); // standard client apparently doesn't send a gump response packet if serial == 0
m_X = x; X = x;
m_Y = y; Y = y;
TypeID = GetTypeID(GetType()); TypeID = GetTypeID(GetType());
@ -64,109 +57,26 @@ namespace Server.Gumps
m_Strings = new List<string>(); m_Strings = new List<string>();
} }
public int TypeID{ get; } public int TypeID { get; }
public List<GumpEntry> Entries{ get; } public List<GumpEntry> Entries { get; }
public uint Serial public uint Serial { get; set; }
{
get => m_Serial;
set
{
if (m_Serial != value)
{
m_Serial = value;
Invalidate();
}
}
}
public int X public int X { get; set; }
{
get => m_X;
set
{
if (m_X != value)
{
m_X = value;
Invalidate();
}
}
}
public int Y public int Y { get; set; }
{
get => m_Y;
set
{
if (m_Y != value)
{
m_Y = value;
Invalidate();
}
}
}
public bool Disposable public bool Disposable { get; set; } = true;
{
get => m_Disposable;
set
{
if (m_Disposable != value)
{
m_Disposable = value;
Invalidate();
}
}
}
public bool Resizable public bool Resizable { get; set; } = true;
{
get => m_Resizable;
set
{
if (m_Resizable != value)
{
m_Resizable = value;
Invalidate();
}
}
}
public bool Draggable public bool Draggable { get; set; } = true;
{
get => m_Draggable;
set
{
if (m_Draggable != value)
{
m_Draggable = value;
Invalidate();
}
}
}
public bool Closable public bool Closable { get; set; } = true;
{
get => m_Closable;
set
{
if (m_Closable != value)
{
m_Closable = value;
Invalidate();
}
}
}
public static int GetTypeID(Type type) => type?.FullName?.GetHashCode() ?? -1; public static int GetTypeID(Type type) => type?.FullName?.GetHashCode() ?? -1;
public void Invalidate()
{
//if ( m_Strings.Count > 0 )
// m_Strings.Clear();
}
public void AddPage(int page) public void AddPage(int page)
{ {
Add(new GumpPage(page)); Add(new GumpPage(page));
@ -198,9 +108,9 @@ namespace Server.Gumps
Add(new GumpGroup(group)); Add(new GumpGroup(group));
} }
public void AddTooltip(int number) public void AddTooltip(int number, string args)
{ {
Add(new GumpTooltip(number)); Add(new GumpTooltip(number, args));
} }
public void AddHtml(int x, int y, int width, int height, string text, bool background = false, bool scrollbar = false) public void AddHtml(int x, int y, int width, int height, string text, bool background = false, bool scrollbar = false)
@ -208,7 +118,8 @@ namespace Server.Gumps
Add(new GumpHtml(x, y, width, height, text, background, 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 = false, bool scrollbar = false) public void AddHtmlLocalized(int x, int y, int width, int height, int number, bool background = false,
bool scrollbar = false)
{ {
Add(new GumpHtmlLocalized(x, y, width, height, number, background, scrollbar)); Add(new GumpHtmlLocalized(x, y, width, height, number, background, scrollbar));
} }
@ -264,7 +175,7 @@ namespace Server.Gumps
public void AddTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText) 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)); 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) public void AddTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText, int size)
@ -277,6 +188,21 @@ namespace Server.Gumps
Add(new GumpItemProperty(serial)); Add(new GumpItemProperty(serial));
} }
public void AddSpriteImage(int x, int y, int gumpID, int width, int height, int sx, int sy)
{
Add(new GumpSpriteImage(x, y, gumpID, width, height, sx, sy));
}
public void AddECHandleInput()
{
Add(new GumpECHandleInput());
}
public void AddGumpIDOverride(int gumpID)
{
Add(new GumpMasterGump(gumpID));
}
public void Add(GumpEntry g) public void Add(GumpEntry g)
{ {
if (g.Parent != this) if (g.Parent != this)
@ -285,7 +211,6 @@ namespace Server.Gumps
} }
else if (!Entries.Contains(g)) else if (!Entries.Contains(g))
{ {
Invalidate();
Entries.Add(g); Entries.Add(g);
} }
} }
@ -295,18 +220,16 @@ namespace Server.Gumps
if (g == null || !Entries.Contains(g)) if (g == null || !Entries.Contains(g))
return; return;
Invalidate();
Entries.Remove(g); Entries.Remove(g);
g.Parent = null; g.Parent = null;
} }
public int Intern(string value) public int Intern(string value)
{ {
int indexOf = m_Strings.IndexOf(value); var indexOf = m_Strings.IndexOf(value);
if (indexOf >= 0) return indexOf; if (indexOf >= 0) return indexOf;
Invalidate();
m_Strings.Add(value); m_Strings.Add(value);
return m_Strings.Count - 1; return m_Strings.Count - 1;
} }
@ -328,23 +251,23 @@ namespace Server.Gumps
else else
disp = new DisplayGumpFast(this); disp = new DisplayGumpFast(this);
if (!m_Draggable) if (!Draggable)
disp.AppendLayout(m_NoMove); disp.AppendLayout(m_NoMove);
if (!m_Closable) if (!Closable)
disp.AppendLayout(m_NoClose); disp.AppendLayout(m_NoClose);
if (!m_Disposable) if (!Disposable)
disp.AppendLayout(m_NoDispose); disp.AppendLayout(m_NoDispose);
if (!m_Resizable) if (!Resizable)
disp.AppendLayout(m_NoResize); disp.AppendLayout(m_NoResize);
int count = Entries.Count; var count = Entries.Count;
for (int i = 0; i < count; ++i) for (var i = 0; i < count; ++i)
{ {
GumpEntry e = Entries[i]; var e = Entries[i];
disp.AppendLayout(m_BeginLayout); disp.AppendLayout(m_BeginLayout);
e.AppendTo(ns, disp); e.AppendTo(ns, disp);

View file

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

View file

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

View file

@ -31,88 +31,46 @@ namespace Server.Gumps
public class GumpButton : GumpEntry public class GumpButton : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("button"); private static readonly 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, public GumpButton(int x, int y, int normalID, int pressedID, int buttonID,
GumpButtonType type = GumpButtonType.Reply, int param = 0) GumpButtonType type = GumpButtonType.Reply, int param = 0)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_ID1 = normalID; NormalID = normalID;
m_ID2 = pressedID; PressedID = pressedID;
m_ButtonID = buttonID; ButtonID = buttonID;
m_Type = type; Type = type;
m_Param = param; Param = param;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int NormalID public int NormalID { get; set; }
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int PressedID public int PressedID { get; set; }
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int ButtonID public int ButtonID { get; set; }
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public GumpButtonType Type public GumpButtonType Type { get; set; }
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
Gump parent = Parent; public int Param { get; set; }
parent?.Invalidate(); public override string Compile(NetState ns) =>
} $"{{ button {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} }}";
}
}
public int Param
{
get => m_Param;
set => Delta(ref m_Param, value);
}
public override string Compile(NetState ns) => $"{{ button {m_X} {m_Y} {m_ID1} {m_ID2} {(int)m_Type} {m_Param} {m_ButtonID} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_ID1); disp.AppendLayout(NormalID);
disp.AppendLayout(m_ID2); disp.AppendLayout(PressedID);
disp.AppendLayout((int)m_Type); disp.AppendLayout((int)Type);
disp.AppendLayout(m_Param); disp.AppendLayout(Param);
disp.AppendLayout(m_ButtonID); disp.AppendLayout(ButtonID);
} }
} }
} }

View file

@ -25,68 +25,41 @@ namespace Server.Gumps
public class GumpCheck : GumpEntry public class GumpCheck : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("checkbox"); private static readonly 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 GumpCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID) public GumpCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_ID1 = inactiveID; InactiveID = inactiveID;
m_ID2 = activeID; ActiveID = activeID;
m_InitialState = initialState; InitialState = initialState;
m_SwitchID = switchID; SwitchID = switchID;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int InactiveID public int InactiveID { get; set; }
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int ActiveID public int ActiveID { get; set; }
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public bool InitialState public bool InitialState { get; set; }
{
get => m_InitialState;
set => Delta(ref m_InitialState, value);
}
public int SwitchID public int SwitchID { get; set; }
{
get => m_SwitchID;
set => Delta(ref m_SwitchID, value);
}
public override string Compile(NetState ns) => $"{{ checkbox {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}"; public override string Compile(NetState ns) =>
$"{{ checkbox {X} {Y} {InactiveID} {ActiveID} {(InitialState ? 1 : 0)} {SwitchID} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_ID1); disp.AppendLayout(InactiveID);
disp.AppendLayout(m_ID2); disp.AppendLayout(ActiveID);
disp.AppendLayout(m_InitialState); disp.AppendLayout(InitialState);
disp.AppendLayout(m_SwitchID); disp.AppendLayout(SwitchID);
disp.Switches++; disp.Switches++;
} }

View file

@ -0,0 +1,37 @@
/*************************************************************************
* ModernUO *
* Copyright (C) 2020 - ModernUO Development Team *
* Email: hi@modernuo.com *
* File: GumpECHandleInput.cs *
* Created: 2020/04/24 - Updated: 2020/04/24 *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpECHandleInput : GumpEntry
{
public override string Compile(NetState ns) => "{ echandleinput }";
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("echandleinput");
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
}
}
}

View file

@ -42,31 +42,6 @@ namespace Server.Gumps
} }
} }
protected void Delta(ref uint var, uint val)
{
var = val;
}
protected void Delta(ref int var, int val)
{
var = val;
}
protected void Delta(ref bool var, bool val)
{
var = val;
}
protected void Delta(ref string var, string val)
{
var = val;
}
protected void Delta(ref object[] var, object[] val)
{
var = val;
}
public abstract string Compile(NetState ns); public abstract string Compile(NetState ns);
public abstract void AppendTo(NetState ns, IGumpWriter disp); public abstract void AppendTo(NetState ns, IGumpWriter disp);
} }

View file

@ -25,22 +25,17 @@ namespace Server.Gumps
public class GumpGroup : GumpEntry public class GumpGroup : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("group"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("group");
private int m_Group;
public GumpGroup(int group) => m_Group = group; public GumpGroup(int group) => Group = group;
public int Group public int Group { get; set; }
{
get => m_Group;
set => Delta(ref m_Group, value);
}
public override string Compile(NetState ns) => $"{{ group {m_Group} }}"; public override string Compile(NetState ns) => $"{{ group {Group} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Group); disp.AppendLayout(Group);
} }
} }
} }

View file

@ -25,76 +25,45 @@ namespace Server.Gumps
public class GumpHtml : GumpEntry public class GumpHtml : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("htmlgump"); private static readonly 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 GumpHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar) public GumpHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_Width = width; Width = width;
m_Height = height; Height = height;
m_Text = text; Text = text;
m_Background = background; Background = background;
m_Scrollbar = scrollbar; Scrollbar = scrollbar;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public string Text public string Text { get; set; }
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public bool Background public bool Background { get; set; }
{
get => m_Background;
set => Delta(ref m_Background, value);
}
public bool Scrollbar public bool Scrollbar { get; set; }
{
get => m_Scrollbar;
set => Delta(ref m_Scrollbar, value);
}
public override string Compile(NetState ns) => $"{{ 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) =>
$"{{ htmlgump {X} {Y} {Width} {Height} {Parent.Intern(Text)} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_Width); disp.AppendLayout(Width);
disp.AppendLayout(m_Height); disp.AppendLayout(Height);
disp.AppendLayout(Parent.Intern(m_Text)); disp.AppendLayout(Parent.Intern(Text));
disp.AppendLayout(m_Background); disp.AppendLayout(Background);
disp.AppendLayout(m_Scrollbar); disp.AppendLayout(Scrollbar);
} }
} }
} }

View file

@ -34,12 +34,7 @@ namespace Server.Gumps
private static readonly byte[] m_LayoutNamePlain = Gump.StringToBuffer("xmfhtmlgump"); private static readonly byte[] m_LayoutNamePlain = Gump.StringToBuffer("xmfhtmlgump");
private static readonly byte[] m_LayoutNameColor = Gump.StringToBuffer("xmfhtmlgumpcolor"); private static readonly byte[] m_LayoutNameColor = Gump.StringToBuffer("xmfhtmlgumpcolor");
private static readonly byte[] m_LayoutNameArgs = Gump.StringToBuffer("xmfhtmltok"); private static readonly 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 int m_Width, m_Height; private int m_Width, m_Height;
private int m_X, m_Y; private int m_X, m_Y;
@ -50,11 +45,11 @@ namespace Server.Gumps
m_Y = y; m_Y = y;
m_Width = width; m_Width = width;
m_Height = height; m_Height = height;
m_Number = number; Number = number;
m_Background = background; Background = background;
m_Scrollbar = scrollbar; Scrollbar = scrollbar;
m_Type = GumpHtmlLocalizedType.Plain; Type = GumpHtmlLocalizedType.Plain;
} }
public GumpHtmlLocalized(int x, int y, int width, int height, int number, int color, public GumpHtmlLocalized(int x, int y, int width, int height, int number, int color,
@ -64,12 +59,12 @@ namespace Server.Gumps
m_Y = y; m_Y = y;
m_Width = width; m_Width = width;
m_Height = height; m_Height = height;
m_Number = number; Number = number;
m_Color = color; Color = color;
m_Background = background; Background = background;
m_Scrollbar = scrollbar; Scrollbar = scrollbar;
m_Type = GumpHtmlLocalizedType.Color; Type = GumpHtmlLocalizedType.Color;
} }
public GumpHtmlLocalized(int x, int y, int width, int height, int number, string args, int color, public GumpHtmlLocalized(int x, int y, int width, int height, int number, string args, int color,
@ -81,147 +76,99 @@ namespace Server.Gumps
m_Y = y; m_Y = y;
m_Width = width; m_Width = width;
m_Height = height; m_Height = height;
m_Number = number; Number = number;
m_Args = args; Args = args;
m_Color = color; Color = color;
m_Background = background; Background = background;
m_Scrollbar = scrollbar; Scrollbar = scrollbar;
m_Type = GumpHtmlLocalizedType.Args; Type = GumpHtmlLocalizedType.Args;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Number public int Number { get; set; }
{
get => m_Number;
set => Delta(ref m_Number, value);
}
public string Args public string Args { get; set; }
{
get => m_Args;
set => Delta(ref m_Args, value);
}
public int Color public int Color { get; set; }
{
get => m_Color;
set => Delta(ref m_Color, value);
}
public bool Background public bool Background { get; set; }
{
get => m_Background;
set => Delta(ref m_Background, value);
}
public bool Scrollbar public bool Scrollbar { get; set; }
{
get => m_Scrollbar;
set => Delta(ref m_Scrollbar, value);
}
public GumpHtmlLocalizedType Type public GumpHtmlLocalizedType Type { get; set; }
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
Parent?.Invalidate();
}
}
}
public override string Compile(NetState ns) public override string Compile(NetState ns)
{ {
return m_Type switch return Type switch
{ {
GumpHtmlLocalizedType.Plain => GumpHtmlLocalizedType.Plain =>
$"{{ xmfhtmlgump {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} }}", $"{{ xmfhtmlgump {X} {Y} {Width} {Height} {Number} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} }}",
GumpHtmlLocalizedType.Color => GumpHtmlLocalizedType.Color =>
$"{{ xmfhtmlgumpcolor {m_X} {m_Y} {m_Width} {m_Height} {m_Number} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} }}", $"{{ xmfhtmlgumpcolor {X} {Y} {Width} {Height} {Number} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} {Color} }}",
_ => _ =>
$"{{ xmfhtmltok {m_X} {m_Y} {m_Width} {m_Height} {(m_Background ? 1 : 0)} {(m_Scrollbar ? 1 : 0)} {m_Color} {m_Number} @{m_Args}@ }}" $"{{ xmfhtmltok {X} {Y} {Width} {Height} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} {Color} {Number} @{Args}@ }}"
}; };
} }
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
switch (m_Type) switch (Type)
{ {
case GumpHtmlLocalizedType.Plain: case GumpHtmlLocalizedType.Plain:
{ {
disp.AppendLayout(m_LayoutNamePlain); disp.AppendLayout(m_LayoutNamePlain);
disp.AppendLayout(m_X); disp.AppendLayout(m_X);
disp.AppendLayout(m_Y); disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width); disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height); disp.AppendLayout(m_Height);
disp.AppendLayout(m_Number); disp.AppendLayout(Number);
disp.AppendLayout(m_Background); disp.AppendLayout(Background);
disp.AppendLayout(m_Scrollbar); disp.AppendLayout(Scrollbar);
break; break;
} }
case GumpHtmlLocalizedType.Color: case GumpHtmlLocalizedType.Color:
{ {
disp.AppendLayout(m_LayoutNameColor); disp.AppendLayout(m_LayoutNameColor);
disp.AppendLayout(m_X); disp.AppendLayout(m_X);
disp.AppendLayout(m_Y); disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width); disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height); disp.AppendLayout(m_Height);
disp.AppendLayout(m_Number); disp.AppendLayout(Number);
disp.AppendLayout(m_Background); disp.AppendLayout(Background);
disp.AppendLayout(m_Scrollbar); disp.AppendLayout(Scrollbar);
disp.AppendLayout(m_Color); disp.AppendLayout(Color);
break; break;
} }
case GumpHtmlLocalizedType.Args: case GumpHtmlLocalizedType.Args:
{ {
disp.AppendLayout(m_LayoutNameArgs); disp.AppendLayout(m_LayoutNameArgs);
disp.AppendLayout(m_X); disp.AppendLayout(m_X);
disp.AppendLayout(m_Y); disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width); disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height); disp.AppendLayout(m_Height);
disp.AppendLayout(m_Background); disp.AppendLayout(Background);
disp.AppendLayout(m_Scrollbar); disp.AppendLayout(Scrollbar);
disp.AppendLayout(m_Color); disp.AppendLayout(Color);
disp.AppendLayout(m_Number); disp.AppendLayout(Number);
disp.AppendLayout(m_Args); disp.AppendLayout(Args);
break; break;
} }
} }
} }
} }

View file

@ -26,57 +26,37 @@ namespace Server.Gumps
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppic"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppic");
private static readonly byte[] m_HueEquals = Gump.StringToBuffer(" hue="); private static readonly 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, int hue = 0) public GumpImage(int x, int y, int gumpID, int hue = 0)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_GumpID = gumpID; GumpID = gumpID;
m_Hue = hue; Hue = hue;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int GumpID public int GumpID { get; set; }
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile(NetState ns) => public override string Compile(NetState ns) =>
m_Hue == 0 ? $"{{ gumppic {m_X} {m_Y} {m_GumpID} }}" : Hue == 0 ? $"{{ gumppic {X} {Y} {GumpID} }}" : $"{{ gumppic {X} {Y} {GumpID} hue={Hue} }}";
$"{{ gumppic {m_X} {m_Y} {m_GumpID} hue={m_Hue} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_GumpID); disp.AppendLayout(GumpID);
if (m_Hue != 0) if (Hue != 0)
{ {
disp.AppendLayout(m_HueEquals); disp.AppendLayout(m_HueEquals);
disp.AppendLayoutNS(m_Hue); disp.AppendLayoutNS(Hue);
} }
} }
} }

View file

@ -26,68 +26,39 @@ namespace Server.Gumps
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("buttontileart"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("buttontileart");
private static readonly byte[] m_LayoutTooltip = Gump.StringToBuffer(" }{ tooltip"); private static readonly 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_Param;
private GumpButtonType m_Type; private GumpButtonType m_Type;
private int m_Width; // 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)
//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;
public GumpImageTileButton(int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, 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 = -1) int itemID, int hue, int width, int height, int localizedTooltip = -1)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_ID1 = normalID; NormalID = normalID;
m_ID2 = pressedID; PressedID = pressedID;
m_ButtonID = buttonID; ButtonID = buttonID;
m_Type = type; m_Type = type;
m_Param = param; Param = param;
m_ItemID = itemID; ItemID = itemID;
m_Hue = hue; Hue = hue;
m_Width = width; Width = width;
m_Height = height; Height = height;
LocalizedTooltip = localizedTooltip; LocalizedTooltip = localizedTooltip;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int NormalID public int NormalID { get; set; }
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int PressedID public int PressedID { get; set; }
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int ButtonID public int ButtonID { get; set; }
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public GumpButtonType Type public GumpButtonType Type
{ {
@ -98,69 +69,47 @@ namespace Server.Gumps
{ {
m_Type = value; m_Type = value;
Gump parent = Parent; var parent = Parent;
parent?.Invalidate();
} }
} }
} }
public int Param public int Param { get; set; }
{
get => m_Param;
set => Delta(ref m_Param, value);
}
public int ItemID public int ItemID { get; set; }
{
get => m_ItemID;
set => Delta(ref m_ItemID, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int LocalizedTooltip{ get; set; } public int LocalizedTooltip { get; set; }
public override string Compile(NetState ns) public override string Compile(NetState ns)
{ {
if (LocalizedTooltip > 0) if (LocalizedTooltip > 0)
return 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} }}"; $"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}";
return 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} }}"; $"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
} }
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_ID1); disp.AppendLayout(NormalID);
disp.AppendLayout(m_ID2); disp.AppendLayout(PressedID);
disp.AppendLayout((int)m_Type); disp.AppendLayout((int)m_Type);
disp.AppendLayout(m_Param); disp.AppendLayout(Param);
disp.AppendLayout(m_ButtonID); disp.AppendLayout(ButtonID);
disp.AppendLayout(m_ItemID); disp.AppendLayout(ItemID);
disp.AppendLayout(m_Hue); disp.AppendLayout(Hue);
disp.AppendLayout(m_Width); disp.AppendLayout(Width);
disp.AppendLayout(m_Height); disp.AppendLayout(Height);
if (LocalizedTooltip > 0) if (LocalizedTooltip > 0)
{ {

View file

@ -25,7 +25,6 @@ namespace Server.Gumps
public class GumpImageTiled : GumpEntry public class GumpImageTiled : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppictiled"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppictiled");
private int m_GumpID;
private int m_Width, m_Height; private int m_Width, m_Height;
private int m_X, m_Y; private int m_X, m_Y;
@ -35,40 +34,20 @@ namespace Server.Gumps
m_Y = y; m_Y = y;
m_Width = width; m_Width = width;
m_Height = height; m_Height = height;
m_GumpID = gumpID; GumpID = gumpID;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int GumpID public int GumpID { get; set; }
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public override string Compile(NetState ns) => $"{{ gumppictiled {m_X} {m_Y} {m_Width} {m_Height} {m_GumpID} }}"; public override string Compile(NetState ns) => $"{{ gumppictiled {X} {Y} {Width} {Height} {GumpID} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
@ -77,7 +56,7 @@ namespace Server.Gumps
disp.AppendLayout(m_Y); disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width); disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height); disp.AppendLayout(m_Height);
disp.AppendLayout(m_GumpID); disp.AppendLayout(GumpID);
} }
} }
} }

View file

@ -26,55 +26,35 @@ namespace Server.Gumps
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tilepic"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tilepic");
private static readonly byte[] m_LayoutNameHue = Gump.StringToBuffer("tilepichue"); private static readonly 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, int hue = 0) public GumpItem(int x, int y, int itemID, int hue = 0)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_ItemID = itemID; ItemID = itemID;
m_Hue = hue; Hue = hue;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int ItemID public int ItemID { get; set; }
{
get => m_ItemID;
set => Delta(ref m_ItemID, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public override string Compile(NetState ns) => public override string Compile(NetState ns) =>
m_Hue == 0 ? $"{{ tilepic {m_X} {m_Y} {m_ItemID} }}" : Hue == 0 ? $"{{ tilepic {X} {Y} {ItemID} }}" : $"{{ tilepichue {X} {Y} {ItemID} {Hue} }}";
$"{{ tilepichue {m_X} {m_Y} {m_ItemID} {m_Hue} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_Hue == 0 ? m_LayoutName : m_LayoutNameHue); disp.AppendLayout(Hue == 0 ? m_LayoutName : m_LayoutNameHue);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_ItemID); disp.AppendLayout(ItemID);
if (m_Hue != 0) if (Hue != 0)
disp.AppendLayout(m_Hue); disp.AppendLayout(Hue);
} }
} }
} }

View file

@ -25,22 +25,17 @@ namespace Server.Gumps
public class GumpItemProperty : GumpEntry public class GumpItemProperty : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("itemproperty"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("itemproperty");
private uint m_Serial;
public GumpItemProperty(uint serial) => m_Serial = serial; public GumpItemProperty(uint serial) => Serial = serial;
public uint Serial public uint Serial { get; set; }
{
get => m_Serial;
set => Delta(ref m_Serial, value);
}
public override string Compile(NetState ns) => $"{{ itemproperty {m_Serial} }}"; public override string Compile(NetState ns) => $"{{ itemproperty {Serial} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Serial); disp.AppendLayout(Serial);
} }
} }
} }

View file

@ -25,51 +25,32 @@ namespace Server.Gumps
public class GumpLabel : GumpEntry public class GumpLabel : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("text"); private static readonly 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) public GumpLabel(int x, int y, int hue, string text)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_Hue = hue; Hue = hue;
m_Text = text; Text = text;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string Text public string Text { get; set; }
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public override string Compile(NetState ns) => $"{{ text {m_X} {m_Y} {m_Hue} {Parent.Intern(m_Text)} }}"; public override string Compile(NetState ns) => $"{{ text {X} {Y} {Hue} {Parent.Intern(Text)} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_Hue); disp.AppendLayout(Hue);
disp.AppendLayout(Parent.Intern(m_Text)); disp.AppendLayout(Parent.Intern(Text));
} }
} }
} }

View file

@ -25,68 +25,41 @@ namespace Server.Gumps
public class GumpLabelCropped : GumpEntry public class GumpLabelCropped : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("croppedtext"); private static readonly 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 GumpLabelCropped(int x, int y, int width, int height, int hue, string text) public GumpLabelCropped(int x, int y, int width, int height, int hue, string text)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_Width = width; Width = width;
m_Height = height; Height = height;
m_Hue = hue; Hue = hue;
m_Text = text; Text = text;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public string Text public string Text { get; set; }
{
get => m_Text;
set => Delta(ref m_Text, value);
}
public override string Compile(NetState ns) => $"{{ croppedtext {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {Parent.Intern(m_Text)} }}"; public override string Compile(NetState ns) =>
$"{{ croppedtext {X} {Y} {Width} {Height} {Hue} {Parent.Intern(Text)} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_Width); disp.AppendLayout(Width);
disp.AppendLayout(m_Height); disp.AppendLayout(Height);
disp.AppendLayout(m_Hue); disp.AppendLayout(Hue);
disp.AppendLayout(Parent.Intern(m_Text)); disp.AppendLayout(Parent.Intern(Text));
} }
} }
} }

View file

@ -0,0 +1,42 @@
/*************************************************************************
* ModernUO *
* Copyright (C) 2020 - ModernUO Development Team *
* Email: hi@modernuo.com *
* File: GumpMasterGump.cs *
* Created: 2020/04/24 - Updated: 2020/04/24 *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
using Server.Network;
namespace Server.Gumps
{
public class GumpMasterGump : GumpEntry
{
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("mastergump");
public GumpMasterGump(int gumpID) => GumpID = gumpID;
public int GumpID { get; set; }
public override string Compile(NetState ns) => $"{{ mastergump {GumpID} }}";
public override void AppendTo(NetState ns, IGumpWriter disp)
{
disp.AppendLayout(m_LayoutName);
disp.AppendLayout(GumpID);
}
}
}

View file

@ -25,22 +25,17 @@ namespace Server.Gumps
public class GumpPage : GumpEntry public class GumpPage : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("page"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("page");
private int m_Page;
public GumpPage(int page) => m_Page = page; public GumpPage(int page) => Page = page;
public int Page public int Page { get; set; }
{
get => m_Page;
set => Delta(ref m_Page, value);
}
public override string Compile(NetState ns) => $"{{ page {m_Page} }}"; public override string Compile(NetState ns) => $"{{ page {Page} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Page); disp.AppendLayout(Page);
} }
} }
} }

View file

@ -25,68 +25,41 @@ namespace Server.Gumps
public class GumpRadio : GumpEntry public class GumpRadio : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("radio"); private static readonly 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 GumpRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID) public GumpRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_ID1 = inactiveID; InactiveID = inactiveID;
m_ID2 = activeID; ActiveID = activeID;
m_InitialState = initialState; InitialState = initialState;
m_SwitchID = switchID; SwitchID = switchID;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int InactiveID public int InactiveID { get; set; }
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int ActiveID public int ActiveID { get; set; }
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public bool InitialState public bool InitialState { get; set; }
{
get => m_InitialState;
set => Delta(ref m_InitialState, value);
}
public int SwitchID public int SwitchID { get; set; }
{
get => m_SwitchID;
set => Delta(ref m_SwitchID, value);
}
public override string Compile(NetState ns) => $"{{ radio {m_X} {m_Y} {m_ID1} {m_ID2} {(m_InitialState ? 1 : 0)} {m_SwitchID} }}"; public override string Compile(NetState ns) =>
$"{{ radio {X} {Y} {InactiveID} {ActiveID} {(InitialState ? 1 : 0)} {SwitchID} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_ID1); disp.AppendLayout(InactiveID);
disp.AppendLayout(m_ID2); disp.AppendLayout(ActiveID);
disp.AppendLayout(m_InitialState); disp.AppendLayout(InitialState);
disp.AppendLayout(m_SwitchID); disp.AppendLayout(SwitchID);
disp.Switches++; disp.Switches++;
} }

View file

@ -4,77 +4,45 @@ namespace Server.Gumps
{ {
public class GumpSpriteImage : GumpEntry public class GumpSpriteImage : GumpEntry
{ {
private int m_X, m_Y, m_SX, m_SY;
private int m_Width, m_Height;
private int m_GumpID;
public GumpSpriteImage(int x, int y, int gumpID, int width, int height, int sx, int sy) public GumpSpriteImage(int x, int y, int gumpID, int width, int height, int sx, int sy)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_GumpID = gumpID; GumpID = gumpID;
m_Width = width; Width = width;
m_Height = height; Height = height;
m_SX = sx; SX = sx;
m_SY = sy; SY = sy;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int GumpID public int GumpID { get; set; }
{
get => m_GumpID;
set => Delta(ref m_GumpID, value);
}
public int SX public int SX { get; set; }
{
get => m_SX;
set => Delta(ref m_SX, value);
}
public int SY public int SY { get; set; }
{
get => m_SY;
set => Delta(ref m_SY, value);
}
public override string Compile(NetState ns) => $"{{ picinpic {m_X} {m_Y} {m_GumpID} {m_Width} {m_Height} {m_SX} {m_SY} }}"; public override string Compile(NetState ns) => $"{{ picinpic {X} {Y} {GumpID} {Width} {Height} {SX} {SY} }}";
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("picinpic"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("picinpic");
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_GumpID); disp.AppendLayout(GumpID);
disp.AppendLayout(m_Width); disp.AppendLayout(Width);
disp.AppendLayout(m_Height); disp.AppendLayout(Height);
disp.AppendLayout(m_SX); disp.AppendLayout(SX);
disp.AppendLayout(m_SY); disp.AppendLayout(SY);
} }
} }
} }

View file

@ -25,77 +25,45 @@ namespace Server.Gumps
public class GumpTextEntry : GumpEntry public class GumpTextEntry : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("textentry"); private static readonly 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 GumpTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText) public GumpTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
{ {
m_X = x; X = x;
m_Y = y; Y = y;
m_Width = width; Width = width;
m_Height = height; Height = height;
m_Hue = hue; Hue = hue;
m_EntryID = entryID; EntryID = entryID;
m_InitialText = initialText; InitialText = initialText;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int EntryID public int EntryID { get; set; }
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public string InitialText public string InitialText { get; set; }
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public override string Compile(NetState ns) => $"{{ textentry {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} }}"; public override string Compile(NetState ns) =>
$"{{ textentry {X} {Y} {Width} {Height} {Hue} {EntryID} {Parent.Intern(InitialText)} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_X); disp.AppendLayout(X);
disp.AppendLayout(m_Y); disp.AppendLayout(Y);
disp.AppendLayout(m_Width); disp.AppendLayout(Width);
disp.AppendLayout(m_Height); disp.AppendLayout(Height);
disp.AppendLayout(m_Hue); disp.AppendLayout(Hue);
disp.AppendLayout(m_EntryID); disp.AppendLayout(EntryID);
disp.AppendLayout(Parent.Intern(m_InitialText)); disp.AppendLayout(Parent.Intern(InitialText));
disp.TextEntries++; disp.TextEntries++;
} }

View file

@ -25,10 +25,6 @@ namespace Server.Gumps
public class GumpTextEntryLimited : GumpEntry public class GumpTextEntryLimited : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("textentrylimited"); private static readonly 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_Width, m_Height;
private int m_X, m_Y; private int m_X, m_Y;
@ -38,61 +34,30 @@ namespace Server.Gumps
m_Y = y; m_Y = y;
m_Width = width; m_Width = width;
m_Height = height; m_Height = height;
m_Hue = hue; Hue = hue;
m_EntryID = entryID; EntryID = entryID;
m_InitialText = initialText; InitialText = initialText;
m_Size = size; Size = size;
} }
public int X public int X { get; set; }
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y public int Y { get; set; }
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width public int Width { get; set; }
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height public int Height { get; set; }
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue public int Hue { get; set; }
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int EntryID public int EntryID { get; set; }
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public string InitialText public string InitialText { get; set; }
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public int Size public int Size { get; set; }
{
get => m_Size;
set => Delta(ref m_Size, value);
}
public override string Compile(NetState ns) => $"{{ 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) =>
$"{{ textentrylimited {X} {Y} {Width} {Height} {Hue} {EntryID} {Parent.Intern(InitialText)} {Size} }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
@ -101,10 +66,10 @@ namespace Server.Gumps
disp.AppendLayout(m_Y); disp.AppendLayout(m_Y);
disp.AppendLayout(m_Width); disp.AppendLayout(m_Width);
disp.AppendLayout(m_Height); disp.AppendLayout(m_Height);
disp.AppendLayout(m_Hue); disp.AppendLayout(Hue);
disp.AppendLayout(m_EntryID); disp.AppendLayout(EntryID);
disp.AppendLayout(Parent.Intern(m_InitialText)); disp.AppendLayout(Parent.Intern(InitialText));
disp.AppendLayout(m_Size); disp.AppendLayout(Size);
disp.TextEntries++; disp.TextEntries++;
} }

View file

@ -1,22 +1,22 @@
/*************************************************************************** /*************************************************************************
* GumpTooltip.cs * ModernUO *
* ------------------- * Copyright (C) 2020 - ModernUO Development Team *
* begin : May 1, 2002 * Email: hi@modernuo.com *
* copyright : (C) The RunUO Software Team * File: GumpTooltip.cs - Created: 2020/04/24 - Updated: 2020/04/24 *
* email : info@runuo.com * *
* * This program is free software: you can redistribute it and/or modify *
* $Id$ * it under the terms of the GNU General Public License as published by *
* * the Free Software Foundation, either version 3 of the License, or *
***************************************************************************/ * (at your option) any later version. *
* *
/*************************************************************************** * This program is distributed in the hope that it will be useful, *
* * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* This program is free software; you can redistribute it and/or modify * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* it under the terms of the GNU General Public License as published by * GNU General Public License for more details. *
* the Free Software Foundation; either version 2 of the License, or * *
* (at your option) any later version. * You should have received a copy of the GNU General Public License *
* * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/ *************************************************************************/
using Server.Network; using Server.Network;
@ -25,22 +25,24 @@ namespace Server.Gumps
public class GumpTooltip : GumpEntry public class GumpTooltip : GumpEntry
{ {
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tooltip"); private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tooltip");
private int m_Number;
public GumpTooltip(int number) => m_Number = number; public GumpTooltip(int number, string args)
public int Number
{ {
get => m_Number; Number = number;
set => Delta(ref m_Number, value); Args = args;
} }
public override string Compile(NetState ns) => $"{{ tooltip {m_Number} }}"; public int Number { get; set; }
public string Args { get; set; }
public override string Compile(NetState ns) => $"{{ tooltip {Number} @{Args}@ }}";
public override void AppendTo(NetState ns, IGumpWriter disp) public override void AppendTo(NetState ns, IGumpWriter disp)
{ {
disp.AppendLayout(m_LayoutName); disp.AppendLayout(m_LayoutName);
disp.AppendLayout(m_Number); disp.AppendLayout(Number);
disp.AppendLayout(Args);
} }
} }
} }

View file

@ -28,9 +28,9 @@ namespace Server.Gumps
Text = text; Text = text;
} }
public int EntryID{ get; } public int EntryID { get; }
public string Text{ get; } public string Text { get; }
} }
public class RelayInfo public class RelayInfo
@ -42,15 +42,15 @@ namespace Server.Gumps
TextEntries = textEntries; 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) public bool IsSwitched(int switchID)
{ {
for (int i = 0; i < Switches.Length; ++i) for (var i = 0; i < Switches.Length; ++i)
if (Switches[i] == switchID) if (Switches[i] == switchID)
return true; return true;
@ -59,7 +59,7 @@ namespace Server.Gumps
public TextRelay GetTextEntry(int entryID) public TextRelay GetTextEntry(int entryID)
{ {
for (int i = 0; i < TextEntries.Length; ++i) for (var i = 0; i < TextEntries.Length; ++i)
if (TextEntries[i].EntryID == entryID) if (TextEntries[i].EntryID == entryID)
return TextEntries[i]; return TextEntries[i];