From c116dff3e85bee6a4178214092a86267932dbef7 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Fri, 24 Apr 2020 21:31:31 -0700 Subject: [PATCH] Adds missing gump components. (#111) --- Projects/Server/Gumps/Gump.cs | 159 ++++----------- Projects/Server/Gumps/GumpAlphaRegion.cs | 46 ++--- Projects/Server/Gumps/GumpBackground.cs | 57 ++---- Projects/Server/Gumps/GumpButton.cs | 88 +++------ Projects/Server/Gumps/GumpCheck.cs | 69 ++----- Projects/Server/Gumps/GumpECHandleInput.cs | 37 ++++ Projects/Server/Gumps/GumpEntry.cs | 25 --- Projects/Server/Gumps/GumpGroup.cs | 15 +- Projects/Server/Gumps/GumpHtml.cs | 79 +++----- Projects/Server/Gumps/GumpHtmlLocalized.cs | 185 +++++++----------- Projects/Server/Gumps/GumpImage.cs | 48 ++--- Projects/Server/Gumps/GumpImageTileButton.cs | 121 ++++-------- Projects/Server/Gumps/GumpImageTiled.cs | 39 +--- Projects/Server/Gumps/GumpItem.cs | 50 ++--- Projects/Server/Gumps/GumpItemProperty.cs | 15 +- Projects/Server/Gumps/GumpLabel.cs | 47 ++--- Projects/Server/Gumps/GumpLabelCropped.cs | 69 ++----- Projects/Server/Gumps/GumpMasterGump.cs | 42 ++++ Projects/Server/Gumps/GumpPage.cs | 15 +- Projects/Server/Gumps/GumpRadio.cs | 69 ++----- Projects/Server/Gumps/GumpSpriteImage.cs | 76 +++---- Projects/Server/Gumps/GumpTextEntry.cs | 80 +++----- Projects/Server/Gumps/GumpTextEntryLimited.cs | 71 ++----- Projects/Server/Gumps/GumpTooltip.cs | 58 +++--- Projects/Server/Gumps/RelayInfo.cs | 16 +- 25 files changed, 531 insertions(+), 1045 deletions(-) create mode 100644 Projects/Server/Gumps/GumpECHandleInput.cs create mode 100644 Projects/Server/Gumps/GumpMasterGump.cs diff --git a/Projects/Server/Gumps/Gump.cs b/Projects/Server/Gumps/Gump.cs index f9b94881e..ca0b43cc2 100644 --- a/Projects/Server/Gumps/Gump.cs +++ b/Projects/Server/Gumps/Gump.cs @@ -36,27 +36,20 @@ namespace Server.Gumps private static readonly byte[] m_NoClose = StringToBuffer("{ noclose }"); private static readonly byte[] m_NoDispose = StringToBuffer("{ nodispose }"); 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 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 + Serial = m_NextSerial++; + } while (Serial == 0); // standard client apparently doesn't send a gump response packet if serial == 0 - m_X = x; - m_Y = y; + X = x; + Y = y; TypeID = GetTypeID(GetType()); @@ -64,109 +57,26 @@ namespace Server.Gumps m_Strings = new List(); } - public int TypeID{ get; } + public int TypeID { get; } - public List Entries{ get; } + public List Entries { get; } - public uint Serial - { - get => m_Serial; - set - { - if (m_Serial != value) - { - m_Serial = value; - Invalidate(); - } - } - } + public uint Serial { get; set; } - public int X - { - get => m_X; - set - { - if (m_X != value) - { - m_X = value; - Invalidate(); - } - } - } + public int X { get; set; } - public int Y - { - get => m_Y; - set - { - if (m_Y != value) - { - m_Y = value; - Invalidate(); - } - } - } + public int Y { get; set; } - public bool Disposable - { - get => m_Disposable; - set - { - if (m_Disposable != value) - { - m_Disposable = value; - Invalidate(); - } - } - } + public bool Disposable { get; set; } = true; - public bool Resizable - { - get => m_Resizable; - set - { - if (m_Resizable != value) - { - m_Resizable = value; - Invalidate(); - } - } - } + public bool Resizable { get; set; } = true; - public bool Draggable - { - get => m_Draggable; - set - { - if (m_Draggable != value) - { - m_Draggable = value; - Invalidate(); - } - } - } + public bool Draggable { get; set; } = true; - public bool Closable - { - get => m_Closable; - set - { - if (m_Closable != value) - { - m_Closable = value; - Invalidate(); - } - } - } + public bool Closable { get; set; } = true; 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) { Add(new GumpPage(page)); @@ -198,9 +108,9 @@ namespace Server.Gumps 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) @@ -208,7 +118,8 @@ namespace Server.Gumps 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)); } @@ -264,7 +175,7 @@ namespace Server.Gumps 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) @@ -277,6 +188,21 @@ namespace Server.Gumps 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) { if (g.Parent != this) @@ -285,7 +211,6 @@ namespace Server.Gumps } else if (!Entries.Contains(g)) { - Invalidate(); Entries.Add(g); } } @@ -295,18 +220,16 @@ namespace Server.Gumps 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); + var indexOf = m_Strings.IndexOf(value); if (indexOf >= 0) return indexOf; - Invalidate(); m_Strings.Add(value); return m_Strings.Count - 1; } @@ -328,23 +251,23 @@ namespace Server.Gumps else disp = new DisplayGumpFast(this); - if (!m_Draggable) + if (!Draggable) disp.AppendLayout(m_NoMove); - if (!m_Closable) + if (!Closable) disp.AppendLayout(m_NoClose); - if (!m_Disposable) + if (!Disposable) disp.AppendLayout(m_NoDispose); - if (!m_Resizable) + if (!Resizable) 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); e.AppendTo(ns, disp); diff --git a/Projects/Server/Gumps/GumpAlphaRegion.cs b/Projects/Server/Gumps/GumpAlphaRegion.cs index 165d37f98..62b2bc066 100644 --- a/Projects/Server/Gumps/GumpAlphaRegion.cs +++ b/Projects/Server/Gumps/GumpAlphaRegion.cs @@ -25,50 +25,32 @@ namespace Server.Gumps public class GumpAlphaRegion : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_Width = width; - m_Height = height; + X = x; + Y = y; + Width = width; + Height = height; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_X); - disp.AppendLayout(m_Y); - disp.AppendLayout(m_Width); - disp.AppendLayout(m_Height); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(Width); + disp.AppendLayout(Height); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpBackground.cs b/Projects/Server/Gumps/GumpBackground.cs index 3c96f17f2..1c861e5c9 100644 --- a/Projects/Server/Gumps/GumpBackground.cs +++ b/Projects/Server/Gumps/GumpBackground.cs @@ -25,59 +25,36 @@ namespace Server.Gumps public class GumpBackground : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_Width = width; - m_Height = height; - m_GumpID = gumpID; + X = x; + Y = y; + Width = width; + Height = height; + GumpID = gumpID; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int GumpID - { - get => m_GumpID; - set => Delta(ref m_GumpID, value); - } + public int GumpID { get; set; } - 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_X); - disp.AppendLayout(m_Y); - disp.AppendLayout(m_GumpID); - disp.AppendLayout(m_Width); - disp.AppendLayout(m_Height); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(GumpID); + disp.AppendLayout(Width); + disp.AppendLayout(Height); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpButton.cs b/Projects/Server/Gumps/GumpButton.cs index dd6c7ec8e..cd2a74905 100644 --- a/Projects/Server/Gumps/GumpButton.cs +++ b/Projects/Server/Gumps/GumpButton.cs @@ -31,88 +31,46 @@ namespace Server.Gumps public class GumpButton : GumpEntry { 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, GumpButtonType type = GumpButtonType.Reply, int param = 0) { - m_X = x; - m_Y = y; - m_ID1 = normalID; - m_ID2 = pressedID; - m_ButtonID = buttonID; - m_Type = type; - m_Param = param; + X = x; + Y = y; + NormalID = normalID; + PressedID = pressedID; + ButtonID = buttonID; + Type = type; + Param = param; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int NormalID - { - get => m_ID1; - set => Delta(ref m_ID1, value); - } + public int NormalID { get; set; } - public int PressedID - { - get => m_ID2; - set => Delta(ref m_ID2, value); - } + public int PressedID { get; set; } - public int ButtonID - { - get => m_ButtonID; - set => Delta(ref m_ButtonID, value); - } + public int ButtonID { get; set; } - public GumpButtonType Type - { - get => m_Type; - set - { - if (m_Type != value) - { - m_Type = value; + public GumpButtonType Type { get; set; } - Gump parent = Parent; + public int Param { get; set; } - parent?.Invalidate(); - } - } - } - - 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 string Compile(NetState ns) => + $"{{ button {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {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); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(NormalID); + disp.AppendLayout(PressedID); + disp.AppendLayout((int)Type); + disp.AppendLayout(Param); + disp.AppendLayout(ButtonID); } } } diff --git a/Projects/Server/Gumps/GumpCheck.cs b/Projects/Server/Gumps/GumpCheck.cs index 61f47f6db..2820245ae 100644 --- a/Projects/Server/Gumps/GumpCheck.cs +++ b/Projects/Server/Gumps/GumpCheck.cs @@ -25,70 +25,43 @@ namespace Server.Gumps public class GumpCheck : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_ID1 = inactiveID; - m_ID2 = activeID; - m_InitialState = initialState; - m_SwitchID = switchID; + X = x; + Y = y; + InactiveID = inactiveID; + ActiveID = activeID; + InitialState = initialState; + SwitchID = switchID; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int InactiveID - { - get => m_ID1; - set => Delta(ref m_ID1, value); - } + public int InactiveID { get; set; } - public int ActiveID - { - get => m_ID2; - set => Delta(ref m_ID2, value); - } + public int ActiveID { get; set; } - public bool InitialState - { - get => m_InitialState; - set => Delta(ref m_InitialState, value); - } + public bool InitialState { get; set; } - public int SwitchID - { - get => m_SwitchID; - set => Delta(ref m_SwitchID, value); - } + public int SwitchID { get; set; } - 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) { 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.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(InactiveID); + disp.AppendLayout(ActiveID); + disp.AppendLayout(InitialState); + disp.AppendLayout(SwitchID); disp.Switches++; } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpECHandleInput.cs b/Projects/Server/Gumps/GumpECHandleInput.cs new file mode 100644 index 000000000..a652775ee --- /dev/null +++ b/Projects/Server/Gumps/GumpECHandleInput.cs @@ -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 . * + *************************************************************************/ + +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); + } + } +} diff --git a/Projects/Server/Gumps/GumpEntry.cs b/Projects/Server/Gumps/GumpEntry.cs index 54ba4b573..cbea208c9 100644 --- a/Projects/Server/Gumps/GumpEntry.cs +++ b/Projects/Server/Gumps/GumpEntry.cs @@ -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 void AppendTo(NetState ns, IGumpWriter disp); } diff --git a/Projects/Server/Gumps/GumpGroup.cs b/Projects/Server/Gumps/GumpGroup.cs index 7eb0f154e..c30d499af 100644 --- a/Projects/Server/Gumps/GumpGroup.cs +++ b/Projects/Server/Gumps/GumpGroup.cs @@ -25,22 +25,17 @@ namespace Server.Gumps public class GumpGroup : GumpEntry { 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 - { - get => m_Group; - set => Delta(ref m_Group, value); - } + public int Group { get; set; } - 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_Group); + disp.AppendLayout(Group); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpHtml.cs b/Projects/Server/Gumps/GumpHtml.cs index b70bee5cb..f55888dd9 100644 --- a/Projects/Server/Gumps/GumpHtml.cs +++ b/Projects/Server/Gumps/GumpHtml.cs @@ -25,76 +25,45 @@ namespace Server.Gumps public class GumpHtml : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_Width = width; - m_Height = height; - m_Text = text; - m_Background = background; - m_Scrollbar = scrollbar; + X = x; + Y = y; + Width = width; + Height = height; + Text = text; + Background = background; + Scrollbar = scrollbar; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public string Text - { - get => m_Text; - set => Delta(ref m_Text, value); - } + public string Text { get; set; } - public bool Background - { - get => m_Background; - set => Delta(ref m_Background, value); - } + public bool Background { get; set; } - public bool Scrollbar - { - get => m_Scrollbar; - set => Delta(ref m_Scrollbar, value); - } + public bool Scrollbar { get; set; } - 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) { 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); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(Width); + disp.AppendLayout(Height); + disp.AppendLayout(Parent.Intern(Text)); + disp.AppendLayout(Background); + disp.AppendLayout(Scrollbar); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpHtmlLocalized.cs b/Projects/Server/Gumps/GumpHtmlLocalized.cs index 8db25a304..4f31b54b6 100644 --- a/Projects/Server/Gumps/GumpHtmlLocalized.cs +++ b/Projects/Server/Gumps/GumpHtmlLocalized.cs @@ -34,12 +34,7 @@ namespace Server.Gumps private static readonly byte[] m_LayoutNamePlain = Gump.StringToBuffer("xmfhtmlgump"); private static readonly byte[] m_LayoutNameColor = Gump.StringToBuffer("xmfhtmlgumpcolor"); 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_X, m_Y; @@ -50,11 +45,11 @@ namespace Server.Gumps m_Y = y; m_Width = width; m_Height = height; - m_Number = number; - m_Background = background; - m_Scrollbar = scrollbar; + Number = number; + Background = background; + Scrollbar = scrollbar; - m_Type = GumpHtmlLocalizedType.Plain; + Type = GumpHtmlLocalizedType.Plain; } 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_Width = width; m_Height = height; - m_Number = number; - m_Color = color; - m_Background = background; - m_Scrollbar = scrollbar; + Number = number; + Color = color; + Background = background; + 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, @@ -81,147 +76,99 @@ namespace Server.Gumps m_Y = y; m_Width = width; m_Height = height; - m_Number = number; - m_Args = args; - m_Color = color; - m_Background = background; - m_Scrollbar = scrollbar; + Number = number; + Args = args; + Color = color; + Background = background; + Scrollbar = scrollbar; - m_Type = GumpHtmlLocalizedType.Args; + Type = GumpHtmlLocalizedType.Args; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int Number - { - get => m_Number; - set => Delta(ref m_Number, value); - } + public int Number { get; set; } - public string Args - { - get => m_Args; - set => Delta(ref m_Args, value); - } + public string Args { get; set; } - public int Color - { - get => m_Color; - set => Delta(ref m_Color, value); - } + public int Color { get; set; } - public bool Background - { - get => m_Background; - set => Delta(ref m_Background, value); - } + public bool Background { get; set; } - public bool Scrollbar - { - get => m_Scrollbar; - set => Delta(ref m_Scrollbar, value); - } + public bool Scrollbar { get; set; } - public GumpHtmlLocalizedType Type - { - get => m_Type; - set - { - if (m_Type != value) - { - m_Type = value; - - Parent?.Invalidate(); - } - } - } + public GumpHtmlLocalizedType Type { get; set; } public override string Compile(NetState ns) { - return m_Type switch + return Type switch { 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 => - $"{{ 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) { - switch (m_Type) + switch (Type) { case GumpHtmlLocalizedType.Plain: - { - disp.AppendLayout(m_LayoutNamePlain); + { + 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(Number); + disp.AppendLayout(Background); + disp.AppendLayout(Scrollbar); - break; - } + break; + } case GumpHtmlLocalizedType.Color: - { - disp.AppendLayout(m_LayoutNameColor); + { + 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(Number); + disp.AppendLayout(Background); + disp.AppendLayout(Scrollbar); + disp.AppendLayout(Color); - break; - } + break; + } case GumpHtmlLocalizedType.Args: - { - disp.AppendLayout(m_LayoutNameArgs); + { + 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(Background); + disp.AppendLayout(Scrollbar); + disp.AppendLayout(Color); + disp.AppendLayout(Number); + disp.AppendLayout(Args); - break; - } + break; + } } } } diff --git a/Projects/Server/Gumps/GumpImage.cs b/Projects/Server/Gumps/GumpImage.cs index dad0341ce..17782c7e9 100644 --- a/Projects/Server/Gumps/GumpImage.cs +++ b/Projects/Server/Gumps/GumpImage.cs @@ -26,57 +26,37 @@ namespace Server.Gumps { private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppic"); 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) { - m_X = x; - m_Y = y; - m_GumpID = gumpID; - m_Hue = hue; + X = x; + Y = y; + GumpID = gumpID; + Hue = hue; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int GumpID - { - get => m_GumpID; - set => Delta(ref m_GumpID, value); - } + public int GumpID { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } public override string Compile(NetState ns) => - m_Hue == 0 ? $"{{ gumppic {m_X} {m_Y} {m_GumpID} }}" : - $"{{ gumppic {m_X} {m_Y} {m_GumpID} hue={m_Hue} }}"; + Hue == 0 ? $"{{ gumppic {X} {Y} {GumpID} }}" : $"{{ gumppic {X} {Y} {GumpID} hue={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); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(GumpID); - if (m_Hue != 0) + if (Hue != 0) { disp.AppendLayout(m_HueEquals); - disp.AppendLayoutNS(m_Hue); + disp.AppendLayoutNS(Hue); } } } diff --git a/Projects/Server/Gumps/GumpImageTileButton.cs b/Projects/Server/Gumps/GumpImageTileButton.cs index 37af7c24a..2bcfdb801 100644 --- a/Projects/Server/Gumps/GumpImageTileButton.cs +++ b/Projects/Server/Gumps/GumpImageTileButton.cs @@ -26,68 +26,39 @@ namespace Server.Gumps { private static readonly byte[] m_LayoutName = Gump.StringToBuffer("buttontileart"); 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 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) - private int m_X, m_Y; + // 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) 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) { - m_X = x; - m_Y = y; - m_ID1 = normalID; - m_ID2 = pressedID; - m_ButtonID = buttonID; + X = x; + Y = y; + NormalID = normalID; + PressedID = pressedID; + ButtonID = buttonID; m_Type = type; - m_Param = param; + Param = param; - m_ItemID = itemID; - m_Hue = hue; - m_Width = width; - m_Height = height; + ItemID = itemID; + Hue = hue; + Width = width; + Height = height; LocalizedTooltip = localizedTooltip; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int NormalID - { - get => m_ID1; - set => Delta(ref m_ID1, value); - } + public int NormalID { get; set; } - public int PressedID - { - get => m_ID2; - set => Delta(ref m_ID2, value); - } + public int PressedID { get; set; } - public int ButtonID - { - get => m_ButtonID; - set => Delta(ref m_ButtonID, value); - } + public int ButtonID { get; set; } public GumpButtonType Type { @@ -98,69 +69,47 @@ namespace Server.Gumps { m_Type = value; - Gump parent = Parent; - - parent?.Invalidate(); + var parent = Parent; } } } - public int Param - { - get => m_Param; - set => Delta(ref m_Param, value); - } + public int Param { get; set; } - public int ItemID - { - get => m_ItemID; - set => Delta(ref m_ItemID, value); - } + public int ItemID { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int LocalizedTooltip{ get; set; } + public int LocalizedTooltip { get; set; } 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} }}"; + $"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {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} }}"; + $"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}"; } 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(X); + disp.AppendLayout(Y); + disp.AppendLayout(NormalID); + disp.AppendLayout(PressedID); disp.AppendLayout((int)m_Type); - disp.AppendLayout(m_Param); - disp.AppendLayout(m_ButtonID); + disp.AppendLayout(Param); + disp.AppendLayout(ButtonID); - disp.AppendLayout(m_ItemID); - disp.AppendLayout(m_Hue); - disp.AppendLayout(m_Width); - disp.AppendLayout(m_Height); + disp.AppendLayout(ItemID); + disp.AppendLayout(Hue); + disp.AppendLayout(Width); + disp.AppendLayout(Height); if (LocalizedTooltip > 0) { diff --git a/Projects/Server/Gumps/GumpImageTiled.cs b/Projects/Server/Gumps/GumpImageTiled.cs index b3b099b82..aa373fb0a 100644 --- a/Projects/Server/Gumps/GumpImageTiled.cs +++ b/Projects/Server/Gumps/GumpImageTiled.cs @@ -25,7 +25,6 @@ namespace Server.Gumps public class GumpImageTiled : GumpEntry { private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppictiled"); - private int m_GumpID; private int m_Width, m_Height; private int m_X, m_Y; @@ -35,40 +34,20 @@ namespace Server.Gumps m_Y = y; m_Width = width; m_Height = height; - m_GumpID = gumpID; + GumpID = gumpID; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int GumpID - { - get => m_GumpID; - set => Delta(ref m_GumpID, value); - } + public int GumpID { get; set; } - 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) { @@ -77,7 +56,7 @@ namespace Server.Gumps disp.AppendLayout(m_Y); disp.AppendLayout(m_Width); disp.AppendLayout(m_Height); - disp.AppendLayout(m_GumpID); + disp.AppendLayout(GumpID); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpItem.cs b/Projects/Server/Gumps/GumpItem.cs index a43cc4dd0..b0cd9ae6f 100644 --- a/Projects/Server/Gumps/GumpItem.cs +++ b/Projects/Server/Gumps/GumpItem.cs @@ -26,55 +26,35 @@ namespace Server.Gumps { private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tilepic"); 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) { - m_X = x; - m_Y = y; - m_ItemID = itemID; - m_Hue = hue; + X = x; + Y = y; + ItemID = itemID; + Hue = hue; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int ItemID - { - get => m_ItemID; - set => Delta(ref m_ItemID, value); - } + public int ItemID { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } public override string Compile(NetState ns) => - m_Hue == 0 ? $"{{ tilepic {m_X} {m_Y} {m_ItemID} }}" : - $"{{ tilepichue {m_X} {m_Y} {m_ItemID} {m_Hue} }}"; + Hue == 0 ? $"{{ tilepic {X} {Y} {ItemID} }}" : $"{{ tilepichue {X} {Y} {ItemID} {Hue} }}"; 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); + disp.AppendLayout(Hue == 0 ? m_LayoutName : m_LayoutNameHue); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(ItemID); - if (m_Hue != 0) - disp.AppendLayout(m_Hue); + if (Hue != 0) + disp.AppendLayout(Hue); } } } diff --git a/Projects/Server/Gumps/GumpItemProperty.cs b/Projects/Server/Gumps/GumpItemProperty.cs index b4b43e9be..0ef3458a8 100644 --- a/Projects/Server/Gumps/GumpItemProperty.cs +++ b/Projects/Server/Gumps/GumpItemProperty.cs @@ -25,22 +25,17 @@ namespace Server.Gumps public class GumpItemProperty : GumpEntry { 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 - { - get => m_Serial; - set => Delta(ref m_Serial, value); - } + public uint Serial { get; set; } - 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_Serial); + disp.AppendLayout(Serial); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpLabel.cs b/Projects/Server/Gumps/GumpLabel.cs index 623363484..150a575ee 100644 --- a/Projects/Server/Gumps/GumpLabel.cs +++ b/Projects/Server/Gumps/GumpLabel.cs @@ -25,51 +25,32 @@ namespace Server.Gumps public class GumpLabel : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_Hue = hue; - m_Text = text; + X = x; + Y = y; + Hue = hue; + Text = text; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } - public string Text - { - get => m_Text; - set => Delta(ref m_Text, value); - } + public string Text { get; set; } - 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_X); - disp.AppendLayout(m_Y); - disp.AppendLayout(m_Hue); - disp.AppendLayout(Parent.Intern(m_Text)); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(Hue); + disp.AppendLayout(Parent.Intern(Text)); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpLabelCropped.cs b/Projects/Server/Gumps/GumpLabelCropped.cs index cd988ab59..e2fb3a7be 100644 --- a/Projects/Server/Gumps/GumpLabelCropped.cs +++ b/Projects/Server/Gumps/GumpLabelCropped.cs @@ -25,68 +25,41 @@ namespace Server.Gumps public class GumpLabelCropped : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_Width = width; - m_Height = height; - m_Hue = hue; - m_Text = text; + X = x; + Y = y; + Width = width; + Height = height; + Hue = hue; + Text = text; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } - public string Text - { - get => m_Text; - set => Delta(ref m_Text, value); - } + public string Text { get; set; } - 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) { 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)); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(Width); + disp.AppendLayout(Height); + disp.AppendLayout(Hue); + disp.AppendLayout(Parent.Intern(Text)); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpMasterGump.cs b/Projects/Server/Gumps/GumpMasterGump.cs new file mode 100644 index 000000000..8db1ae08a --- /dev/null +++ b/Projects/Server/Gumps/GumpMasterGump.cs @@ -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 . * + *************************************************************************/ + +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); + } + } +} diff --git a/Projects/Server/Gumps/GumpPage.cs b/Projects/Server/Gumps/GumpPage.cs index 7e0ebd9d2..33e313b4b 100644 --- a/Projects/Server/Gumps/GumpPage.cs +++ b/Projects/Server/Gumps/GumpPage.cs @@ -25,22 +25,17 @@ namespace Server.Gumps public class GumpPage : GumpEntry { 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 - { - get => m_Page; - set => Delta(ref m_Page, value); - } + public int Page { get; set; } - 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_Page); + disp.AppendLayout(Page); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpRadio.cs b/Projects/Server/Gumps/GumpRadio.cs index 153d9b319..688036460 100644 --- a/Projects/Server/Gumps/GumpRadio.cs +++ b/Projects/Server/Gumps/GumpRadio.cs @@ -25,70 +25,43 @@ namespace Server.Gumps public class GumpRadio : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_ID1 = inactiveID; - m_ID2 = activeID; - m_InitialState = initialState; - m_SwitchID = switchID; + X = x; + Y = y; + InactiveID = inactiveID; + ActiveID = activeID; + InitialState = initialState; + SwitchID = switchID; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int InactiveID - { - get => m_ID1; - set => Delta(ref m_ID1, value); - } + public int InactiveID { get; set; } - public int ActiveID - { - get => m_ID2; - set => Delta(ref m_ID2, value); - } + public int ActiveID { get; set; } - public bool InitialState - { - get => m_InitialState; - set => Delta(ref m_InitialState, value); - } + public bool InitialState { get; set; } - public int SwitchID - { - get => m_SwitchID; - set => Delta(ref m_SwitchID, value); - } + public int SwitchID { get; set; } - 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) { 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.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(InactiveID); + disp.AppendLayout(ActiveID); + disp.AppendLayout(InitialState); + disp.AppendLayout(SwitchID); disp.Switches++; } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpSpriteImage.cs b/Projects/Server/Gumps/GumpSpriteImage.cs index b7cea8135..5b98d8192 100644 --- a/Projects/Server/Gumps/GumpSpriteImage.cs +++ b/Projects/Server/Gumps/GumpSpriteImage.cs @@ -4,77 +4,45 @@ namespace Server.Gumps { 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) { - m_X = x; - m_Y = y; - m_GumpID = gumpID; - m_Width = width; - m_Height = height; - m_SX = sx; - m_SY = sy; + X = x; + Y = y; + GumpID = gumpID; + Width = width; + Height = height; + SX = sx; + SY = sy; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int GumpID - { - get => m_GumpID; - set => Delta(ref m_GumpID, value); - } + public int GumpID { get; set; } - public int SX - { - get => m_SX; - set => Delta(ref m_SX, value); - } + public int SX { get; set; } - public int SY - { - get => m_SY; - set => Delta(ref m_SY, value); - } + public int SY { get; set; } - 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"); 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); - disp.AppendLayout(m_SX); - disp.AppendLayout(m_SY); + disp.AppendLayout(X); + disp.AppendLayout(Y); + disp.AppendLayout(GumpID); + disp.AppendLayout(Width); + disp.AppendLayout(Height); + disp.AppendLayout(SX); + disp.AppendLayout(SY); } } } diff --git a/Projects/Server/Gumps/GumpTextEntry.cs b/Projects/Server/Gumps/GumpTextEntry.cs index e364281e2..de570b730 100644 --- a/Projects/Server/Gumps/GumpTextEntry.cs +++ b/Projects/Server/Gumps/GumpTextEntry.cs @@ -25,79 +25,47 @@ namespace Server.Gumps public class GumpTextEntry : GumpEntry { 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) { - m_X = x; - m_Y = y; - m_Width = width; - m_Height = height; - m_Hue = hue; - m_EntryID = entryID; - m_InitialText = initialText; + X = x; + Y = y; + Width = width; + Height = height; + Hue = hue; + EntryID = entryID; + InitialText = initialText; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } - public int EntryID - { - get => m_EntryID; - set => Delta(ref m_EntryID, value); - } + public int EntryID { get; set; } - public string InitialText - { - get => m_InitialText; - set => Delta(ref m_InitialText, value); - } + public string InitialText { get; set; } - 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) { 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(X); + disp.AppendLayout(Y); + disp.AppendLayout(Width); + disp.AppendLayout(Height); + disp.AppendLayout(Hue); + disp.AppendLayout(EntryID); + disp.AppendLayout(Parent.Intern(InitialText)); disp.TextEntries++; } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/GumpTextEntryLimited.cs b/Projects/Server/Gumps/GumpTextEntryLimited.cs index 11538ac2b..7fba3d4a0 100644 --- a/Projects/Server/Gumps/GumpTextEntryLimited.cs +++ b/Projects/Server/Gumps/GumpTextEntryLimited.cs @@ -25,10 +25,6 @@ namespace Server.Gumps public class GumpTextEntryLimited : GumpEntry { 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_X, m_Y; @@ -38,61 +34,30 @@ namespace Server.Gumps m_Y = y; m_Width = width; m_Height = height; - m_Hue = hue; - m_EntryID = entryID; - m_InitialText = initialText; - m_Size = size; + Hue = hue; + EntryID = entryID; + InitialText = initialText; + Size = size; } - public int X - { - get => m_X; - set => Delta(ref m_X, value); - } + public int X { get; set; } - public int Y - { - get => m_Y; - set => Delta(ref m_Y, value); - } + public int Y { get; set; } - public int Width - { - get => m_Width; - set => Delta(ref m_Width, value); - } + public int Width { get; set; } - public int Height - { - get => m_Height; - set => Delta(ref m_Height, value); - } + public int Height { get; set; } - public int Hue - { - get => m_Hue; - set => Delta(ref m_Hue, value); - } + public int Hue { get; set; } - public int EntryID - { - get => m_EntryID; - set => Delta(ref m_EntryID, value); - } + public int EntryID { get; set; } - public string InitialText - { - get => m_InitialText; - set => Delta(ref m_InitialText, value); - } + public string InitialText { get; set; } - public int Size - { - get => m_Size; - set => Delta(ref m_Size, value); - } + public int Size { get; set; } - 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) { @@ -101,10 +66,10 @@ namespace Server.Gumps 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.AppendLayout(Hue); + disp.AppendLayout(EntryID); + disp.AppendLayout(Parent.Intern(InitialText)); + disp.AppendLayout(Size); disp.TextEntries++; } diff --git a/Projects/Server/Gumps/GumpTooltip.cs b/Projects/Server/Gumps/GumpTooltip.cs index f05672bd8..3a32702b9 100644 --- a/Projects/Server/Gumps/GumpTooltip.cs +++ b/Projects/Server/Gumps/GumpTooltip.cs @@ -1,22 +1,22 @@ -/*************************************************************************** - * GumpTooltip.cs - * ------------------- - * begin : May 1, 2002 - * copyright : (C) The RunUO Software Team - * email : info@runuo.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * 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 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ +/************************************************************************* + * ModernUO * + * Copyright (C) 2020 - ModernUO Development Team * + * Email: hi@modernuo.com * + * File: GumpTooltip.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 . * + *************************************************************************/ using Server.Network; @@ -25,22 +25,24 @@ namespace Server.Gumps public class GumpTooltip : GumpEntry { private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tooltip"); - private int m_Number; - public GumpTooltip(int number) => m_Number = number; - - public int Number + public GumpTooltip(int number, string args) { - get => m_Number; - set => Delta(ref m_Number, value); + Number = number; + 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) { disp.AppendLayout(m_LayoutName); - disp.AppendLayout(m_Number); + disp.AppendLayout(Number); + disp.AppendLayout(Args); } } -} \ No newline at end of file +} diff --git a/Projects/Server/Gumps/RelayInfo.cs b/Projects/Server/Gumps/RelayInfo.cs index c8e52eb9b..796c4c6cb 100644 --- a/Projects/Server/Gumps/RelayInfo.cs +++ b/Projects/Server/Gumps/RelayInfo.cs @@ -28,9 +28,9 @@ namespace Server.Gumps Text = text; } - public int EntryID{ get; } + public int EntryID { get; } - public string Text{ get; } + public string Text { get; } } public class RelayInfo @@ -42,15 +42,15 @@ namespace Server.Gumps 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) + for (var i = 0; i < Switches.Length; ++i) if (Switches[i] == switchID) return true; @@ -59,11 +59,11 @@ namespace Server.Gumps 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) return TextEntries[i]; return null; } } -} \ No newline at end of file +}