fix(core): Adds Gump component functionality (#377)
- [X] Adds gump close packet - [X] Fixes gump tooltip - [X] Adds new compile/append functions for the new gump packets
This commit is contained in:
parent
cc91fe2b10
commit
3b413371dc
40 changed files with 1696 additions and 137 deletions
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -24,6 +26,8 @@ namespace Server.Gumps
|
|||
|
||||
public override string Compile(NetState ns) => $"{{ checkertrans {X} {Y} {Width} {Height} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ checkertrans {X} {Y} {Width} {Height} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -32,5 +36,19 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -27,6 +29,8 @@ namespace Server.Gumps
|
|||
|
||||
public override string Compile(NetState ns) => $"{{ resizepic {X} {Y} {GumpID} {Width} {Height} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ resizepic {X} {Y} {GumpID} {Width} {Height} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -36,5 +40,21 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(GumpID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -43,6 +45,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ button {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ button {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -54,5 +59,25 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Param);
|
||||
disp.AppendLayout(ButtonID);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(NormalID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(PressedID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(((int)Type).ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Param.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(ButtonID.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -31,6 +33,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ checkbox {X} {Y} {InactiveID} {ActiveID} {(InitialState ? 1 : 0)} {SwitchID} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ checkbox {X} {Y} {InactiveID} {ActiveID} {(InitialState ? 1 : 0)} {SwitchID} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -43,5 +48,25 @@ namespace Server.Gumps
|
|||
|
||||
disp.Switches++;
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(InactiveID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(ActiveID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(InitialState ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(SwitchID.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
|
||||
switches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -21,10 +23,16 @@ namespace Server.Gumps
|
|||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("echandleinput");
|
||||
public override string Compile(NetState ns) => "{ echandleinput }";
|
||||
public override string Compile(OrderedHashSet<string> strings) => "{ echandleinput }";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.WriteAscii("{ echandleinput }");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -23,6 +25,11 @@ namespace Server.Gumps
|
|||
}
|
||||
|
||||
public abstract string Compile(NetState ns);
|
||||
public abstract string Compile(OrderedHashSet<string> strings);
|
||||
public abstract void AppendTo(NetState ns, IGumpWriter disp);
|
||||
|
||||
// TODO: Replace OrderedHashSet with InsertOnlyHashSet, a copy of HashSet that is ReadOnly compatible, but includes
|
||||
// a public AddIfNotPresent function that returns the index of the element
|
||||
public abstract void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -11,11 +13,20 @@ namespace Server.Gumps
|
|||
public int Group { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ group {Group} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ group {Group} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(Group);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(Group.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -34,6 +36,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ htmlgump {X} {Y} {Width} {Height} {Parent.Intern(Text)} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ htmlgump {X} {Y} {Width} {Height} {strings.GetOrAdd(Text)} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -45,5 +50,25 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Background);
|
||||
disp.AppendLayout(Scrollbar);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(strings.GetOrAdd(Text).ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -88,9 +90,19 @@ namespace Server.Gumps
|
|||
|
||||
public GumpHtmlLocalizedType Type { get; set; }
|
||||
|
||||
public override string Compile(NetState ns)
|
||||
{
|
||||
return Type switch
|
||||
public override string Compile(NetState ns) =>
|
||||
Type switch
|
||||
{
|
||||
GumpHtmlLocalizedType.Plain =>
|
||||
$"{{ xmfhtmlgump {X} {Y} {Width} {Height} {Number} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} }}",
|
||||
GumpHtmlLocalizedType.Color =>
|
||||
$"{{ xmfhtmlgumpcolor {X} {Y} {Width} {Height} {Number} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} {Color} }}",
|
||||
_ =>
|
||||
$"{{ xmfhtmltok {X} {Y} {Width} {Height} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} {Color} {Number} @{Args}@ }}"
|
||||
};
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
Type switch
|
||||
{
|
||||
GumpHtmlLocalizedType.Plain =>
|
||||
$"{{ xmfhtmlgump {X} {Y} {Width} {Height} {Number} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} }}",
|
||||
|
|
@ -99,7 +111,6 @@ namespace Server.Gumps
|
|||
_ =>
|
||||
$"{{ xmfhtmltok {X} {Y} {Width} {Height} {(Background ? 1 : 0)} {(Scrollbar ? 1 : 0)} {Color} {Number} @{Args}@ }}"
|
||||
};
|
||||
}
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
|
|
@ -154,5 +165,81 @@ namespace Server.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case GumpHtmlLocalizedType.Plain:
|
||||
{
|
||||
writer.Write(m_LayoutNamePlain);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Number.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0
|
||||
|
||||
break;
|
||||
}
|
||||
case GumpHtmlLocalizedType.Color:
|
||||
{
|
||||
writer.Write(m_LayoutNameColor);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Number.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Color.ToString());
|
||||
|
||||
break;
|
||||
}
|
||||
case GumpHtmlLocalizedType.Args:
|
||||
{
|
||||
writer.Write(m_LayoutNameArgs);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Background ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(Scrollbar ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Color.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Number.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)0x40); // '@'
|
||||
writer.WriteAscii(Args ?? "");
|
||||
writer.Write((byte)0x40); // '@'
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -6,13 +8,15 @@ namespace Server.Gumps
|
|||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppic");
|
||||
private static readonly byte[] m_HueEquals = Gump.StringToBuffer(" hue=");
|
||||
private static readonly byte[] m_ClassEquals = Gump.StringToBuffer(" class=");
|
||||
|
||||
public GumpImage(int x, int y, int gumpID, int hue = 0)
|
||||
public GumpImage(int x, int y, int gumpID, int hue = 0, string cls = null)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
GumpID = gumpID;
|
||||
Hue = hue;
|
||||
Class = cls;
|
||||
}
|
||||
|
||||
public int X { get; set; }
|
||||
|
|
@ -23,8 +27,13 @@ namespace Server.Gumps
|
|||
|
||||
public int Hue { get; set; }
|
||||
|
||||
public string Class { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) =>
|
||||
Hue == 0 ? $"{{ gumppic {X} {Y} {GumpID} }}" : $"{{ gumppic {X} {Y} {GumpID} hue={Hue} }}";
|
||||
$"{{ gumppic {X} {Y} {GumpID}{(Hue == 0 ? "" : $"hue={Hue}")}{(string.IsNullOrEmpty(Class) ? "" : $"class={Class}")} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ gumppic {X} {Y} {GumpID}{(Hue == 0 ? "" : $"hue={Hue}")}{(string.IsNullOrEmpty(Class) ? "" : $"class={Class}")} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
|
|
@ -38,6 +47,40 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(m_HueEquals);
|
||||
disp.AppendLayoutNS(Hue);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Class))
|
||||
{
|
||||
disp.AppendLayout(m_ClassEquals);
|
||||
disp.AppendLayoutNS(Class);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(GumpID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
|
||||
if (Hue != 0)
|
||||
{
|
||||
writer.Write(m_HueEquals);
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Class))
|
||||
{
|
||||
writer.Write(m_ClassEquals);
|
||||
writer.WriteAscii(Class);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
}
|
||||
|
||||
writer.Write((byte)0x7D); // '}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -7,9 +9,8 @@ namespace Server.Gumps
|
|||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("buttontileart");
|
||||
private static readonly byte[] m_LayoutTooltip = Gump.StringToBuffer(" }{ tooltip");
|
||||
|
||||
private GumpButtonType m_Type;
|
||||
|
||||
// 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)
|
||||
|
||||
public GumpImageTileButton(
|
||||
int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param,
|
||||
|
|
@ -21,7 +22,7 @@ namespace Server.Gumps
|
|||
NormalID = normalID;
|
||||
PressedID = pressedID;
|
||||
ButtonID = buttonID;
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
Param = param;
|
||||
|
||||
ItemID = itemID;
|
||||
|
|
@ -42,19 +43,7 @@ namespace Server.Gumps
|
|||
|
||||
public int ButtonID { get; set; }
|
||||
|
||||
public GumpButtonType Type
|
||||
{
|
||||
get => m_Type;
|
||||
set
|
||||
{
|
||||
if (m_Type != value)
|
||||
{
|
||||
m_Type = value;
|
||||
|
||||
var parent = Parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
public GumpButtonType Type { get; set; }
|
||||
|
||||
public int Param { get; set; }
|
||||
|
||||
|
|
@ -68,17 +57,15 @@ namespace Server.Gumps
|
|||
|
||||
public int LocalizedTooltip { get; set; }
|
||||
|
||||
public override string Compile(NetState ns)
|
||||
{
|
||||
if (LocalizedTooltip > 0)
|
||||
{
|
||||
return
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}";
|
||||
}
|
||||
public override string Compile(NetState ns) =>
|
||||
LocalizedTooltip > 0 ?
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}" :
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
|
||||
|
||||
return
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)m_Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
|
||||
}
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
LocalizedTooltip > 0 ?
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}{{ tooltip {LocalizedTooltip} }}" :
|
||||
$"{{ buttontileart {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} {ItemID} {Hue} {Width} {Height} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
|
|
@ -87,7 +74,7 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(NormalID);
|
||||
disp.AppendLayout(PressedID);
|
||||
disp.AppendLayout((int)m_Type);
|
||||
disp.AppendLayout((int)Type);
|
||||
disp.AppendLayout(Param);
|
||||
disp.AppendLayout(ButtonID);
|
||||
|
||||
|
|
@ -102,5 +89,42 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(LocalizedTooltip);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(NormalID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(PressedID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(((int)Type).ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Param.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(ButtonID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(ItemID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
|
||||
if (LocalizedTooltip > 0)
|
||||
{
|
||||
writer.Write(m_LayoutTooltip);
|
||||
writer.WriteAscii(LocalizedTooltip.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
}
|
||||
|
||||
writer.Write((byte)0x7D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -26,6 +28,7 @@ namespace Server.Gumps
|
|||
public int GumpID { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ gumppictiled {X} {Y} {Width} {Height} {GumpID} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ gumppictiled {X} {Y} {Width} {Height} {GumpID} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
|
|
@ -36,5 +39,21 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Height);
|
||||
disp.AppendLayout(GumpID);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(GumpID.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -26,6 +28,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
Hue == 0 ? $"{{ tilepic {X} {Y} {ItemID} }}" : $"{{ tilepichue {X} {Y} {ItemID} {Hue} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
Hue == 0 ? $"{{ tilepic {X} {Y} {ItemID} }}" : $"{{ tilepichue {X} {Y} {ItemID} {Hue} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(Hue == 0 ? m_LayoutName : m_LayoutNameHue);
|
||||
|
|
@ -38,5 +43,23 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Hue);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write(Hue == 0 ? m_LayoutName : m_LayoutNameHue);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(ItemID.ToString());
|
||||
|
||||
if (Hue != 0)
|
||||
{
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
}
|
||||
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -11,11 +13,20 @@ namespace Server.Gumps
|
|||
public uint Serial { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ itemproperty {Serial} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ itemproperty {Serial} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(Serial);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(Serial.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -23,6 +25,7 @@ namespace Server.Gumps
|
|||
public string Text { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ text {X} {Y} {Hue} {Parent.Intern(Text)} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ text {X} {Y} {Hue} {strings.GetOrAdd(Text)} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
|
|
@ -32,5 +35,19 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Hue);
|
||||
disp.AppendLayout(Parent.Intern(Text));
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(strings.GetOrAdd(Text).ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -31,6 +33,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ croppedtext {X} {Y} {Width} {Height} {Hue} {Parent.Intern(Text)} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ croppedtext {X} {Y} {Width} {Height} {Hue} {strings.GetOrAdd(Text)} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -41,5 +46,23 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(Hue);
|
||||
disp.AppendLayout(Parent.Intern(Text));
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(strings.GetOrAdd(Text).ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -26,11 +28,20 @@ namespace Server.Gumps
|
|||
public int GumpID { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ mastergump {GumpID} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ mastergump {GumpID} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(GumpID);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(GumpID.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -11,11 +13,20 @@ namespace Server.Gumps
|
|||
public int Page { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ page {Page} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) => $"{{ page {Page} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(Page);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(Page.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -31,6 +33,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ radio {X} {Y} {InactiveID} {ActiveID} {(InitialState ? 1 : 0)} {SwitchID} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ radio {X} {Y} {InactiveID} {ActiveID} {(InitialState ? 1 : 0)} {SwitchID} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -43,5 +48,25 @@ namespace Server.Gumps
|
|||
|
||||
disp.Switches++;
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(InactiveID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(ActiveID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)(InitialState ? 0x31 : 0x30)); // 1 or 0
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(SwitchID.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
|
||||
switches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -47,6 +49,8 @@ namespace Server.Gumps
|
|||
public int SY { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ picinpic {X} {Y} {GumpID} {Width} {Height} {SX} {SY} }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ picinpic {X} {Y} {GumpID} {Width} {Height} {SX} {SY} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
|
|
@ -59,5 +63,25 @@ namespace Server.Gumps
|
|||
disp.AppendLayout(SX);
|
||||
disp.AppendLayout(SY);
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(GumpID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(SX.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(SY.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -34,6 +36,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ textentry {X} {Y} {Width} {Height} {Hue} {EntryID} {Parent.Intern(InitialText)} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ textentry {X} {Y} {Width} {Height} {Hue} {EntryID} {strings.GetOrAdd(InitialText)} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -47,5 +52,27 @@ namespace Server.Gumps
|
|||
|
||||
disp.TextEntries++;
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(EntryID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(strings.GetOrAdd(InitialText).ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
|
||||
entries++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -39,6 +41,9 @@ namespace Server.Gumps
|
|||
public override string Compile(NetState ns) =>
|
||||
$"{{ textentrylimited {X} {Y} {Width} {Height} {Hue} {EntryID} {Parent.Intern(InitialText)} {Size} }}";
|
||||
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
$"{{ textentrylimited {X} {Y} {Width} {Height} {Hue} {EntryID} {strings.GetOrAdd(InitialText)} {Size} }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
|
|
@ -53,5 +58,29 @@ namespace Server.Gumps
|
|||
|
||||
disp.TextEntries++;
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(EntryID.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(strings.GetOrAdd(InitialText).ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Size.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
|
||||
entries++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
|
|
@ -31,13 +33,37 @@ namespace Server.Gumps
|
|||
|
||||
public string Args { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) => $"{{ tooltip {Number} @{Args}@ }}";
|
||||
public override string Compile(NetState ns) =>
|
||||
string.IsNullOrEmpty(Args) ? $"{{ tooltip {Number} }}" : $"{{ tooltip {Number} @{Args}@ }}";
|
||||
public override string Compile(OrderedHashSet<string> strings) =>
|
||||
string.IsNullOrEmpty(Args) ? $"{{ tooltip {Number} }}" : $"{{ tooltip {Number} @{Args}@ }}";
|
||||
|
||||
public override void AppendTo(NetState ns, IGumpWriter disp)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(Number);
|
||||
disp.AppendLayout(Args);
|
||||
|
||||
if (!string.IsNullOrEmpty(Args))
|
||||
{
|
||||
disp.AppendLayout(Args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
writer.Write(m_LayoutName);
|
||||
writer.WriteAscii(Number.ToString());
|
||||
|
||||
if (!string.IsNullOrEmpty(Args))
|
||||
{
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.Write((byte)0x40); // '@'
|
||||
writer.WriteAscii(Args);
|
||||
writer.Write((byte)0x40); // '@'
|
||||
}
|
||||
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue