/************************************************************************* * ModernUO * * Copyright 2019-2020 - ModernUO Development Team * * Email: hi@modernuo.com * * File: OutgoingTargetPackets.cs * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *************************************************************************/ using System; using System.Buffers; using Server.Targeting; namespace Server.Network { public static class OutgoingTargetPackets { public static void SendMultiTargetReq(this NetState ns, MultiTarget t) { if (ns == null || !ns.GetSendBuffer(out var buffer)) { return; } var writer = new CircularBufferWriter(buffer); writer.Write((byte)0x99); // Packet ID writer.Write(t.AllowGround); writer.Write(t.TargetID); writer.Write((byte)t.Flags); writer.Clear(11); writer.Write((short)t.MultiID); writer.Write((short)t.Offset.X); writer.Write((short)t.Offset.Y); writer.Write((short)t.Offset.Z); if (ns.HighSeas) { writer.Write(0); } ns.Send(ref buffer, writer.Position); } public static void SendCancelTarget(this NetState ns) { if (ns == null) { return; } Span span = stackalloc byte[] { 0x6C, // Packet ID 0, // Allow Ground? 0, 0, 0, 0, // Target ID 3, // Flags 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ns.Send(span); } public static void SendTargetReq(this NetState ns, Target t) { if (ns == null || !ns.GetSendBuffer(out var buffer)) { return; } var writer = new CircularBufferWriter(buffer); writer.Write((byte)0x6C); // Packet ID writer.Write(t.AllowGround); writer.Write(t.TargetID); writer.Write((byte)t.Flags); writer.Clear(12); ns.Send(ref buffer, writer.Position); } } }