Beispiel #1
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);

            DialogId = reader.ReadUInt();
            MenuId   = reader.ReadUShort();
            var questionLength = reader.ReadByte();

            Question = reader.ReadString(questionLength);
            var responsesCount = reader.ReadByte();

            if (responsesCount == byte.MaxValue)
            {
                throw new PacketParsingException(rawPacket, $"Responses count is {responsesCount}. Cannot have byte 1 based index for all responses (last index would be 256 which cannot be encoded to a single byte).");
            }

            Responses = new DialogBoxResponse[responsesCount];


            for (byte i = 0; i < responsesCount; i++)
            {
                var modelId            = reader.ReadModelId();
                var color              = reader.ReadColor();
                var responseTextLength = reader.ReadByte();
                var responseText       = reader.ReadString(responseTextLength);

                Responses[i] = new DialogBoxResponse((byte)(i + 1), modelId, color, responseText);
            }
        }
Beispiel #2
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);
            ItemId = reader.ReadObjectId();
            Type   = reader.ReadModelId();
            reader.Skip(1);
            Layer    = reader.ReadLayer();
            PlayerId = reader.ReadObjectId();
            Color    = reader.ReadColor();
        }
Beispiel #3
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);
            var length = reader.ReadUShort();

            Type       = (SpeechType)reader.ReadByte();
            Color      = reader.ReadColor();
            SpeechFont = reader.ReadUShort();
            Message    = reader.ReadString(length - 8);
        }
Beispiel #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();
        }
Beispiel #5
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);

            SpeakerId   = reader.ReadObjectId();
            SpeakerBody = reader.ReadModelId();
            Type        = (SpeechType)reader.ReadByte();
            Color       = reader.ReadColor();
            Font        = reader.ReadUShort();
            MessageId   = new MessageId(reader.ReadInt());
            Name        = reader.ReadString(29);
            Arguments   = reader.ReadNullTerminatedUnicodeString();
        }
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(4);

            Id     = reader.ReadObjectId();
            Type   = reader.ReadModelId();
            Facing = (Direction)reader.ReadByte();
            Amount = reader.ReadUShort();
            reader.ReadUShort(); // second amount?
            Location = new Location3D(reader.ReadUShort(), reader.ReadUShort(), reader.ReadSByte());
            Layer    = reader.ReadLayer();
            Color    = reader.ReadColor();

            reader.ReadByte(); // flags
        }
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;

            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);

            var packetSize = reader.ReadUShort();

            SpeakerId   = reader.ReadObjectId();
            SpeakerBody = reader.ReadModelId();
            reader.ReadByte(); // type
            Color     = reader.ReadColor();
            Font      = reader.ReadUShort();
            MessageId = new MessageId(reader.ReadInt());
            reader.ReadByte(); // ignoring flags
            Name  = reader.ReadString(30);
            Affix = reader.ReadNullTerminatedString();
        }
        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);
        }