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,9 +18,7 @@
*
***************************************************************************/
using System.Buffers;
using Server.Buffers;
using Server.Collections;
using Server.Network;
namespace Server.Gumps
{
@ -32,56 +30,89 @@ namespace Server.Gumps
public class GumpButton : GumpEntry
{
private static 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)
{
X = x;
Y = y;
NormalID = normalID;
PressedID = pressedID;
ButtonID = buttonID;
Type = type;
Param = param;
m_X = x;
m_Y = y;
m_ID1 = normalID;
m_ID2 = pressedID;
m_ButtonID = buttonID;
m_Type = type;
m_Param = param;
}
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 NormalID { get; set; }
public int NormalID
{
get => m_ID1;
set => Delta(ref m_ID1, value);
}
public int PressedID { get; set; }
public int PressedID
{
get => m_ID2;
set => Delta(ref m_ID2, value);
}
public int ButtonID { get; set; }
public int ButtonID
{
get => m_ButtonID;
set => Delta(ref m_ButtonID, value);
}
public GumpButtonType Type { get; set; }
public GumpButtonType Type
{
get => m_Type;
set
{
if (m_Type != value)
{
m_Type = value;
public int Param { get; set; }
Gump parent = Parent;
public override string Compile(ArraySet<string> strings) => $"{{ button {X} {Y} {NormalID} {PressedID} {(int)Type} {Param} {ButtonID} }}";
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 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(68));
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.Write((byte)0x7D); // '}'
buffer.Advance(writer.WrittenCount);
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);
}
}
}