Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -18,66 +18,86 @@
*
***************************************************************************/
using System.Buffers;
using Server.Buffers;
using Server.Collections;
using Server.Network;
namespace Server.Gumps
{
public class GumpTextEntry : GumpEntry
{
private static byte[] m_LayoutName = Gump.StringToBuffer("textentry");
private int m_EntryID;
private int m_Hue;
private string m_InitialText;
private int m_Width, m_Height;
private int m_X, m_Y;
public GumpTextEntry(int x, int y, int width, int height, int hue, int entryID, string initialText)
{
X = x;
Y = y;
Width = width;
Height = height;
Hue = hue;
EntryID = entryID;
InitialText = initialText;
m_X = x;
m_Y = y;
m_Width = width;
m_Height = height;
m_Hue = hue;
m_EntryID = entryID;
m_InitialText = initialText;
}
public int X { get; set; }
public int X
{
get => m_X;
set => Delta(ref m_X, value);
}
public int Y { get; set; }
public int Y
{
get => m_Y;
set => Delta(ref m_Y, value);
}
public int Width { get; set; }
public int Width
{
get => m_Width;
set => Delta(ref m_Width, value);
}
public int Height { get; set; }
public int Height
{
get => m_Height;
set => Delta(ref m_Height, value);
}
public int Hue { get; set; }
public int Hue
{
get => m_Hue;
set => Delta(ref m_Hue, value);
}
public int EntryID { get; set; }
public int EntryID
{
get => m_EntryID;
set => Delta(ref m_EntryID, value);
}
public string InitialText { get; set; }
public string InitialText
{
get => m_InitialText;
set => Delta(ref m_InitialText, value);
}
public override string Compile(NetState ns) => $"{{ textentry {m_X} {m_Y} {m_Width} {m_Height} {m_Hue} {m_EntryID} {Parent.Intern(m_InitialText)} }}";
private static readonly byte[] m_LayoutName = Gump.StringToBuffer(" { textentry ");
public override void AppendTo(ArrayBufferWriter<byte> buffer, ArraySet<string> strings, ref int entries, ref int switches)
public override void AppendTo(NetState ns, IGumpWriter disp)
{
SpanWriter writer = new SpanWriter(buffer.GetSpan(90));
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.Add(InitialText).ToString());
writer.Write((byte)0x20); // ' '
writer.Write((byte)0x7D); // '}'
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));
buffer.Advance(writer.WrittenCount);
entries++;
disp.TextEntries++;
}
}
}
}