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

            reader.ReadByte();
            reader.ReadUShort();
            Type     = (SpeechType)reader.ReadByte();
            Color    = reader.ReadUShort();
            Font     = reader.ReadUShort();
            Language = reader.ReadString(4);
            if (((int)Type & 0xC0) != 0)
            {
                ushort rawBytes     = reader.ReadUShort();
                int    keywordCount = (rawBytes & 0x0FFF) >> 4;
                if (keywordCount > 0)
                {
                    reader.ReadByte();
                    keywordCount--;
                }
                while (keywordCount != 0)
                {
                    reader.ReadUShort();
                    keywordCount--;
                }

                Text = reader.ReadNullTerminatedString();
            }
            else
            {
                Text = reader.ReadNullTerminatedUnicodeString();
            }
        }
Ejemplo n.º 2
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(3);
            byte type = reader.ReadByte();

            if (type == 0x24)
            {
                string skillText = reader.ReadNullTerminatedString();

                bool skillFound = false;
                foreach (var pair in skills)
                {
                    if (skillText.Equals(pair.Value))
                    {
                        Skill      = pair.Key;
                        skillFound = true;
                        break;
                    }
                }
                if (!skillFound)
                {
                    throw new NotImplementedException($"Unknown skill text: {skillText ?? "null"}");
                }
            }
        }
Ejemplo n.º 3
0
        public override void Deserialize(Packet rawPacket)
        {
            this.rawPacket = rawPacket;
            var reader = new ArrayPacketReader(rawPacket.Payload);

            reader.Skip(1);
            int size = reader.ReadUShort();

            Id    = reader.ReadObjectId();
            Model = reader.ReadModelId();
            Type  = (SpeechType)reader.ReadByte();
            Color = (Color)reader.ReadUShort();
            Font  = reader.ReadUShort();

            Name = reader.ReadNullTerminatedString();
            if (size > 44)
            {
                reader.Position = 44;
            }
            Message = reader.ReadNullTerminatedString();
        }
Ejemplo n.º 4
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());
            reader.ReadByte(); // ignoring flags
            Name  = reader.ReadString(30);
            Affix = reader.ReadNullTerminatedString();
        }