public static void SendDisplayBoatHS(this NetState ns, Mobile beholder, BaseBoat boat)
        {
            if (ns?.HighSeas != true)
            {
                return;
            }

            var minLength = PacketContainerBuilder.MinPacketLength
                            + OutgoingEntityPackets.MaxWorldEntityPacketLength
                            * 5; // Minimum of boat, hold, planks, and the player

            using var builder = new PacketContainerBuilder(stackalloc byte[minLength]);

            Span <byte> buffer = builder.GetSpan(OutgoingEntityPackets.MaxWorldEntityPacketLength);

            foreach (var entity in boat.GetMovingEntities(true))
            {
                if (!beholder.CanSee(entity))
                {
                    continue;
                }

                buffer.InitializePacket();
                var bytesWritten = OutgoingEntityPackets.CreateWorldEntity(buffer, entity, true);
                builder.Advance(bytesWritten);
            }

            ns.Send(builder.Finalize());
        }
Beispiel #2
0
        private void SendGMItem(NetState ns)
        {
            // GM Packet
            var buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();

            int length;

            if (ns.StygianAbyss)
            {
                length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
                BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], _gmItemId);
Beispiel #3
0
    public static void SendWorldItem(this NetState ns, Item item)
    {
        if (ns.CannotSendPackets())
        {
            return;
        }

        Span <byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();

        var length = ns.StygianAbyss ?
                     OutgoingEntityPackets.CreateWorldEntity(buffer, item, ns.HighSeas) :
                     CreateWorldItem(buffer, item);

        ns.Send(buffer[..length]);