fix(core): Converts Gump Packets (v1) (#379)
- [X] Converts gump packets
This commit is contained in:
parent
126b80f74b
commit
a278623f38
31 changed files with 790 additions and 763 deletions
|
|
@ -9,13 +9,10 @@ namespace Server.Gumps
|
|||
{
|
||||
private static uint m_NextSerial = 1;
|
||||
|
||||
private static readonly byte[] m_BeginLayout = StringToBuffer("{ ");
|
||||
private static readonly byte[] m_EndLayout = StringToBuffer(" }");
|
||||
|
||||
private static readonly byte[] m_NoMove = StringToBuffer("{ nomove }");
|
||||
private static readonly byte[] m_NoClose = StringToBuffer("{ noclose }");
|
||||
private static readonly byte[] m_NoDispose = StringToBuffer("{ nodispose }");
|
||||
private static readonly byte[] m_NoResize = StringToBuffer("{ noresize }");
|
||||
public static readonly byte[] NoMove = StringToBuffer("{ nomove }");
|
||||
public static readonly byte[] NoClose = StringToBuffer("{ noclose }");
|
||||
public static readonly byte[] NoDispose = StringToBuffer("{ nodispose }");
|
||||
public static readonly byte[] NoResize = StringToBuffer("{ noresize }");
|
||||
|
||||
internal int m_TextEntries, m_Switches;
|
||||
|
||||
|
|
@ -41,7 +38,7 @@ namespace Server.Gumps
|
|||
|
||||
public List<GumpEntry> Entries { get; }
|
||||
|
||||
public uint Serial { get; set; }
|
||||
public Serial Serial { get; set; }
|
||||
|
||||
public int X { get; set; }
|
||||
|
||||
|
|
@ -248,65 +245,11 @@ namespace Server.Gumps
|
|||
public void SendTo(NetState state)
|
||||
{
|
||||
state.AddGump(this);
|
||||
state.Send(Compile(state));
|
||||
state.SendDisplayGump(this, out m_Switches, out m_TextEntries);
|
||||
}
|
||||
|
||||
public static byte[] StringToBuffer(string str) => Encoding.ASCII.GetBytes(str);
|
||||
|
||||
public Packet Compile(NetState ns = null)
|
||||
{
|
||||
IGumpWriter disp;
|
||||
|
||||
if (ns?.Unpack == true)
|
||||
{
|
||||
disp = new DisplayGumpPacked(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
disp = new DisplayGumpFast(this);
|
||||
}
|
||||
|
||||
if (!Draggable)
|
||||
{
|
||||
disp.AppendLayout(m_NoMove);
|
||||
}
|
||||
|
||||
if (!Closable)
|
||||
{
|
||||
disp.AppendLayout(m_NoClose);
|
||||
}
|
||||
|
||||
if (!Disposable)
|
||||
{
|
||||
disp.AppendLayout(m_NoDispose);
|
||||
}
|
||||
|
||||
if (!Resizable)
|
||||
{
|
||||
disp.AppendLayout(m_NoResize);
|
||||
}
|
||||
|
||||
var count = Entries.Count;
|
||||
|
||||
for (var i = 0; i < count; ++i)
|
||||
{
|
||||
var e = Entries[i];
|
||||
|
||||
disp.AppendLayout(m_BeginLayout);
|
||||
e.AppendTo(ns, disp);
|
||||
disp.AppendLayout(m_EndLayout);
|
||||
}
|
||||
|
||||
disp.WriteStrings(Strings);
|
||||
|
||||
disp.Flush();
|
||||
|
||||
m_TextEntries = disp.TextEntries;
|
||||
m_Switches = disp.Switches;
|
||||
|
||||
return (Packet)disp;
|
||||
}
|
||||
|
||||
public virtual void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpAlphaRegion : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("checkertrans");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("checkertrans");
|
||||
|
||||
public GumpAlphaRegion(int x, int y, int width, int height)
|
||||
{
|
||||
|
|
@ -24,23 +24,13 @@ namespace Server.Gumps
|
|||
|
||||
public int Height { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpBackground : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("resizepic");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("resizepic");
|
||||
|
||||
public GumpBackground(int x, int y, int width, int height, int gumpID)
|
||||
{
|
||||
|
|
@ -27,24 +27,13 @@ namespace Server.Gumps
|
|||
|
||||
public int GumpID { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(GumpID);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Server.Gumps
|
|||
|
||||
public class GumpButton : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("button");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("button");
|
||||
|
||||
public GumpButton(
|
||||
int x, int y, int normalID, int pressedID, int buttonID,
|
||||
|
|
@ -42,28 +42,14 @@ namespace Server.Gumps
|
|||
|
||||
public int Param { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(NormalID);
|
||||
disp.AppendLayout(PressedID);
|
||||
disp.AppendLayout((int)Type);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpCheck : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("checkbox");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("checkbox");
|
||||
|
||||
public GumpCheck(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
|
||||
{
|
||||
|
|
@ -30,29 +30,14 @@ namespace Server.Gumps
|
|||
|
||||
public int SwitchID { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(InactiveID);
|
||||
disp.AppendLayout(ActiveID);
|
||||
disp.AppendLayout(InitialState);
|
||||
disp.AppendLayout(SwitchID);
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -21,15 +21,9 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpECHandleInput : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("echandleinput");
|
||||
public override string Compile(NetState ns) => "{ echandleinput }";
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("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,6 +1,5 @@
|
|||
using System.Buffers;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
|
|
@ -24,9 +23,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -6,25 +6,18 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpGroup : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("group");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("group");
|
||||
|
||||
public GumpGroup(int group) => Group = group;
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Group.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpHtml : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("htmlgump");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("htmlgump");
|
||||
|
||||
public GumpHtml(int x, int y, int width, int height, string text, bool background, bool scrollbar)
|
||||
{
|
||||
|
|
@ -33,28 +33,14 @@ namespace Server.Gumps
|
|||
|
||||
public bool Scrollbar { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
disp.AppendLayout(Parent.Intern(Text));
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ namespace Server.Gumps
|
|||
|
||||
public class GumpHtmlLocalized : GumpEntry
|
||||
{
|
||||
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");
|
||||
public static readonly byte[] LayoutNamePlain = Gump.StringToBuffer("xmfhtmlgump");
|
||||
public static readonly byte[] LayoutNameColor = Gump.StringToBuffer("xmfhtmlgumpcolor");
|
||||
public static readonly byte[] LayoutNameArgs = Gump.StringToBuffer("xmfhtmltok");
|
||||
|
||||
public GumpHtmlLocalized(
|
||||
int x, int y, int width, int height, int number,
|
||||
|
|
@ -90,17 +90,6 @@ namespace Server.Gumps
|
|||
|
||||
public GumpHtmlLocalizedType Type { get; set; }
|
||||
|
||||
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
|
||||
{
|
||||
|
|
@ -112,60 +101,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)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case GumpHtmlLocalizedType.Plain:
|
||||
{
|
||||
disp.AppendLayout(m_LayoutNamePlain);
|
||||
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
disp.AppendLayout(Number);
|
||||
disp.AppendLayout(Background);
|
||||
disp.AppendLayout(Scrollbar);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GumpHtmlLocalizedType.Color:
|
||||
{
|
||||
disp.AppendLayout(m_LayoutNameColor);
|
||||
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
disp.AppendLayout(Number);
|
||||
disp.AppendLayout(Background);
|
||||
disp.AppendLayout(Scrollbar);
|
||||
disp.AppendLayout(Color);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GumpHtmlLocalizedType.Args:
|
||||
{
|
||||
disp.AppendLayout(m_LayoutNameArgs);
|
||||
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
disp.AppendLayout(Background);
|
||||
disp.AppendLayout(Scrollbar);
|
||||
disp.AppendLayout(Color);
|
||||
disp.AppendLayout(Number);
|
||||
disp.AppendLayout(Args);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
writer.Write((ushort)0x7B20); // "{ "
|
||||
|
|
@ -174,7 +109,8 @@ namespace Server.Gumps
|
|||
{
|
||||
case GumpHtmlLocalizedType.Plain:
|
||||
{
|
||||
writer.Write(m_LayoutNamePlain);
|
||||
writer.Write(LayoutNamePlain);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
@ -193,7 +129,8 @@ namespace Server.Gumps
|
|||
}
|
||||
case GumpHtmlLocalizedType.Color:
|
||||
{
|
||||
writer.Write(m_LayoutNameColor);
|
||||
writer.Write(LayoutNameColor);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
@ -214,7 +151,8 @@ namespace Server.Gumps
|
|||
}
|
||||
case GumpHtmlLocalizedType.Args:
|
||||
{
|
||||
writer.Write(m_LayoutNameArgs);
|
||||
writer.Write(LayoutNameArgs);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpImage : GumpEntry
|
||||
{
|
||||
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 static readonly byte[] LayoutName = Gump.StringToBuffer("gumppic");
|
||||
public static readonly byte[] HueEquals = Gump.StringToBuffer(" hue=");
|
||||
public static readonly byte[] ClassEquals = Gump.StringToBuffer(" class=");
|
||||
|
||||
public GumpImage(int x, int y, int gumpID, int hue = 0, string cls = null)
|
||||
{
|
||||
|
|
@ -29,58 +29,33 @@ namespace Server.Gumps
|
|||
|
||||
public string Class { get; set; }
|
||||
|
||||
public override string Compile(NetState ns) =>
|
||||
$"{{ 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)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(GumpID);
|
||||
|
||||
if (Hue != 0)
|
||||
{
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
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.Write(HueEquals);
|
||||
writer.WriteAscii(Hue.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Class))
|
||||
{
|
||||
writer.Write(m_ClassEquals);
|
||||
writer.Write(ClassEquals);
|
||||
writer.WriteAscii(Class);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
}
|
||||
|
||||
writer.Write((byte)0x7D); // '}'
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpImageTileButton : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("buttontileart");
|
||||
private static readonly byte[] m_LayoutTooltip = Gump.StringToBuffer(" }{ tooltip");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("buttontileart");
|
||||
public static readonly byte[] LayoutTooltip = Gump.StringToBuffer(" }{ tooltip");
|
||||
|
||||
// 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)
|
||||
|
|
@ -57,43 +57,16 @@ namespace Server.Gumps
|
|||
|
||||
public int LocalizedTooltip { get; set; }
|
||||
|
||||
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} }}";
|
||||
|
||||
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)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(NormalID);
|
||||
disp.AppendLayout(PressedID);
|
||||
disp.AppendLayout((int)Type);
|
||||
disp.AppendLayout(Param);
|
||||
disp.AppendLayout(ButtonID);
|
||||
|
||||
disp.AppendLayout(ItemID);
|
||||
disp.AppendLayout(Hue);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
|
||||
if (LocalizedTooltip > 0)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutTooltip);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
@ -115,16 +88,14 @@ namespace Server.Gumps
|
|||
writer.WriteAscii(Width.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Height.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
|
||||
if (LocalizedTooltip > 0)
|
||||
{
|
||||
writer.Write(m_LayoutTooltip);
|
||||
writer.Write(LayoutTooltip);
|
||||
writer.WriteAscii(LocalizedTooltip.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
}
|
||||
|
||||
writer.Write((byte)0x7D); // " }"
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpImageTiled : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("gumppictiled");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("gumppictiled");
|
||||
|
||||
public GumpImageTiled(int x, int y, int width, int height, int gumpID)
|
||||
{
|
||||
|
|
@ -26,24 +26,13 @@ namespace Server.Gumps
|
|||
public int Height { get; set; }
|
||||
|
||||
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)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpItem : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tilepic");
|
||||
private static readonly byte[] m_LayoutNameHue = Gump.StringToBuffer("tilepichue");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("tilepic");
|
||||
public static readonly byte[] LayoutNameHue = Gump.StringToBuffer("tilepichue");
|
||||
|
||||
public GumpItem(int x, int y, int itemID, int hue = 0)
|
||||
{
|
||||
|
|
@ -25,28 +25,13 @@ namespace Server.Gumps
|
|||
|
||||
public int Hue { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(ItemID);
|
||||
|
||||
if (Hue != 0)
|
||||
{
|
||||
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.Write(Hue == 0 ? LayoutName : LayoutNameHue);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,25 +6,19 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpItemProperty : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("itemproperty");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("itemproperty");
|
||||
|
||||
public GumpItemProperty(uint serial) => Serial = serial;
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Serial.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpLabel : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("text");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("text");
|
||||
|
||||
public GumpLabel(int x, int y, int hue, string text)
|
||||
{
|
||||
|
|
@ -23,23 +23,13 @@ namespace Server.Gumps
|
|||
public int Hue { get; set; }
|
||||
|
||||
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)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpLabelCropped : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("croppedtext");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("croppedtext");
|
||||
|
||||
public GumpLabelCropped(int x, int y, int width, int height, int hue, string text)
|
||||
{
|
||||
|
|
@ -30,27 +30,14 @@ namespace Server.Gumps
|
|||
|
||||
public string Text { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -21,25 +21,19 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpMasterGump : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("mastergump");
|
||||
public static readonly byte[] 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 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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(GumpID.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,25 +6,18 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpPage : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("page");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("page");
|
||||
|
||||
public GumpPage(int page) => Page = page;
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Page.ToString());
|
||||
writer.Write((ushort)0x207D); // " }"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpRadio : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("radio");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("radio");
|
||||
|
||||
public GumpRadio(int x, int y, int inactiveID, int activeID, bool initialState, int switchID)
|
||||
{
|
||||
|
|
@ -30,29 +30,14 @@ namespace Server.Gumps
|
|||
|
||||
public int SwitchID { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(InactiveID);
|
||||
disp.AppendLayout(ActiveID);
|
||||
disp.AppendLayout(InitialState);
|
||||
disp.AppendLayout(SwitchID);
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpSpriteImage : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("picinpic");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("picinpic");
|
||||
|
||||
public GumpSpriteImage(int x, int y, int gumpID, int width, int height, int sx, int sy)
|
||||
{
|
||||
|
|
@ -47,27 +47,14 @@ namespace Server.Gumps
|
|||
public int SX { get; set; }
|
||||
|
||||
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)
|
||||
{
|
||||
disp.AppendLayout(m_LayoutName);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(GumpID);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpTextEntry : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("textentry");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("textentry");
|
||||
|
||||
public GumpTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
|
||||
{
|
||||
|
|
@ -33,30 +33,14 @@ namespace Server.Gumps
|
|||
|
||||
public string InitialText { get; set; }
|
||||
|
||||
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);
|
||||
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++;
|
||||
}
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpTextEntryLimited : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("textentrylimited");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("textentrylimited");
|
||||
|
||||
public GumpTextEntryLimited(
|
||||
int x, int y, int width, int height, int hue, int entryID, string initialText, int size = 0
|
||||
|
|
@ -38,31 +38,14 @@ namespace Server.Gumps
|
|||
|
||||
public int Size { get; set; }
|
||||
|
||||
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);
|
||||
disp.AppendLayout(X);
|
||||
disp.AppendLayout(Y);
|
||||
disp.AppendLayout(Width);
|
||||
disp.AppendLayout(Height);
|
||||
disp.AppendLayout(Hue);
|
||||
disp.AppendLayout(EntryID);
|
||||
disp.AppendLayout(Parent.Intern(InitialText));
|
||||
disp.AppendLayout(Size);
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(X.ToString());
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Y.ToString());
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GumpTooltip : GumpEntry
|
||||
{
|
||||
private static readonly byte[] m_LayoutName = Gump.StringToBuffer("tooltip");
|
||||
public static readonly byte[] LayoutName = Gump.StringToBuffer("tooltip");
|
||||
|
||||
public GumpTooltip(int number, string args)
|
||||
{
|
||||
|
|
@ -33,26 +33,14 @@ namespace Server.Gumps
|
|||
|
||||
public string Args { get; set; }
|
||||
|
||||
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);
|
||||
|
||||
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.Write(LayoutName);
|
||||
writer.Write((byte)0x20); // ' '
|
||||
writer.WriteAscii(Number.ToString());
|
||||
|
||||
if (!string.IsNullOrEmpty(Args))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue