ModernUO/Projects/Server/Gumps/GumpAlphaRegion.cs
Kamron Batman a278623f38
fix(core): Converts Gump Packets (v1) (#379)
- [X] Converts gump packets
2021-01-05 01:17:34 -08:00

44 lines
1.3 KiB
C#

using System.Buffers;
using Server.Collections;
using Server.Network;
namespace Server.Gumps
{
public class GumpAlphaRegion : GumpEntry
{
public static readonly byte[] LayoutName = Gump.StringToBuffer("checkertrans");
public GumpAlphaRegion(int x, int y, int width, int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public override string Compile(OrderedHashSet<string> strings) => $"{{ checkertrans {X} {Y} {Width} {Height} }}";
public override void AppendTo(ref SpanWriter writer, OrderedHashSet<string> strings, ref int entries, ref int switches)
{
writer.Write((ushort)0x7B20); // "{ "
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(Width.ToString());
writer.Write((byte)0x20); // ' '
writer.WriteAscii(Height.ToString());
writer.Write((ushort)0x207D); // " }"
}
}
}