Example #1
0
        public override void Deserialize(Packet rawPacket)
        {
            _rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);

            Serial               = reader.ReadUInt();
            BoatSpeed            = reader.ReadByte();
            (MovingDirection, _) = reader.ReadDirection();
            (FacingDirection, _) = reader.ReadDirection();
            ushort x = reader.ReadUShort();
            ushort y = reader.ReadUShort();
            ushort z = reader.ReadUShort();

            int count = reader.ReadUShort();

            PositionEntities = new PositionEntity[count];
            for (int i = 0; i < count; i++)
            {
                uint   cSerial = reader.ReadUInt();
                ushort cx      = reader.ReadUShort();
                ushort cy      = reader.ReadUShort();
                ushort cz      = reader.ReadUShort();

                PositionEntities[i] = new PositionEntity(cSerial, new Location3D(cx, cy, 0));
            }
        }
Example #2
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);

            PlayerId = reader.ReadObjectId();
            uint unknown1 = reader.ReadUInt();

            BodyType = reader.ReadModelId();
            ushort xloc     = reader.ReadUShort();
            ushort yloc     = reader.ReadUShort();
            byte   unknown2 = reader.ReadByte();
            sbyte  zloc     = reader.ReadSByte();

            Location = new Location3D(xloc, yloc, zloc);
            (Direction, MovementType) = reader.ReadDirection();

            //reader.Skip(5);

            //var minX = reader.ReadUShort();
            //var minY = reader.ReadUShort();
            //var maxX = reader.ReadUShort();
            //var maxY = reader.ReadUShort();
            //MapBoundary = new MapBoundary(minX, minY, maxX, maxY);
        }
Example #3
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);
            uint   rawId   = reader.ReadUInt();
            ushort rawType = reader.ReadUShort();

            uint finalId;

            if ((rawId & 0x80000000) != 0)
            {
                finalId = rawId - 0x80000000;
                Amount  = reader.ReadUShort();
            }
            else
            {
                Amount  = 1;
                finalId = rawId;
            }
            Id = new ObjectId(finalId);

            if ((rawType & 0x8000) != 0)
            {
                throw new PacketParsingException(rawPacket, "Not implementated: Type & 0x8000");
            }

            Type = rawType;

            ushort xloc = reader.ReadUShort();
            ushort yloc = reader.ReadUShort();

            if ((xloc & 0x8000) != 0)
            {
                xloc -= 0x8000;

                (Facing, _) = reader.ReadDirection();
            }

            sbyte zloc = reader.ReadSByte();

            if ((yloc & 0x8000) != 0)
            {
                yloc -= 0x8000;
                Dye   = (Color)reader.ReadUShort();
            }

            if ((yloc & 0x4000) != 0)
            {
                yloc -= 0x4000;
                Flags = (ObjectFlag)reader.ReadByte();
            }

            Location = new Location3D(xloc, yloc, zloc);
        }
Example #4
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);

            PlayerId = reader.ReadObjectId();
            Type     = reader.ReadModelId();
            Location = new Location3D(reader.ReadUShort(), reader.ReadUShort(), reader.ReadSByte());
            (Direction, MovementType) = reader.ReadDirection();
            Color = reader.ReadColor();
            Flags = reader.ReadByte();
        }
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);

            SequenceKey = reader.ReadByte();
            ushort xloc = reader.ReadUShort();
            ushort yloc = reader.ReadUShort();

            (Direction, MovementType) = reader.ReadDirection();
            sbyte zloc = reader.ReadSByte();

            Location = new Location3D(xloc, yloc, zloc);
        }
Example #6
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);

            Id       = reader.ReadObjectId();
            Type     = reader.ReadModelId();
            Location = new Location3D(reader.ReadUShort(), reader.ReadUShort(), reader.ReadSByte());
            (Direction, MovementType) = reader.ReadDirection();
            Color     = (Color)reader.ReadUShort();
            Flags     = reader.ReadByte();
            Notoriety = (Notoriety)reader.ReadByte();

            var items  = new List <Item>();
            var itemId = reader.ReadUInt();

            while (itemId != 0x00000000)
            {
                var   type  = reader.ReadUShort();
                var   layer = (Layer)reader.ReadByte();
                Color?color = null;

                if ((type & 0x8000) != 0)
                {
                    type -= 0x8000;
                    color = (Color)reader.ReadUShort();
                }

                var item = new Item(new ObjectId(itemId), new ModelId(type), 1, new Location3D(0, 0, 0), containerId: Id,
                                    layer: layer, color: color);

                items.Add(item);

                itemId = reader.ReadUInt();
            }

            Items = items.ToArray();
        }
Example #7
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);

            PlayerId = reader.ReadObjectId();
            BodyType = reader.ReadModelId();
            reader.Skip(1); // unknown

            Color = reader.ReadColor();
            Flags = reader.ReadByte();

            var xloc = reader.ReadUShort();
            var yloc = reader.ReadUShort();

            reader.Skip(2); // unknown
            (Direction, MovementType) = reader.ReadDirection();
            var zloc = reader.ReadSByte();

            Location = new Location3D(xloc, yloc, zloc);
        }
Example #8
0
 public override void Deserialize(Packet rawPacket)
 {
     (Direction, MovementType) = ArrayPacketReader.ReadDirection(rawPacket.Payload, 1);
     SequenceKey = rawPacket.Payload[2];
 }