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:
Kamron Batman 2021-01-02 19:08:35 -08:00 • committed by GitHub
parent cc91fe2b10
commit 3b413371dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 1696 additions and 137 deletions

View file

@ -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); // " }"
}
}
}