/// <summary>
        /// Reads the <see cref="AvatarProfileResponseMessage"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="AvatarProfileResponseMessage"/>.
        /// </param>
        public override void ReadMessage(MessageReader reader)
        {
            AvatarData = new AvatarMessageComponent();
            AvatarData.ReadMessageComponent(reader);

            var villageBytes = reader.ReadBytes();

            if (villageBytes.Length != 0)
            {
                var mem = new MemoryStream(villageBytes);
                using (var br = new BinaryReader(mem))
                {
                    var decompressedLength = br.ReadInt32();
                    var compressedVillage  = br.ReadBytes(villageBytes.Length - 4);
                    var villageJson        = ZlibStream.UncompressString(compressedVillage);
                    VillageJson = villageJson;
                }
            }

            TroopsDonated  = reader.ReadInt32();
            TroopsReceived = reader.ReadInt32();
            WarCoolDown    = TimeSpan.FromSeconds(reader.ReadInt32());

            Unknown2 = reader.ReadInt32();
            Unknown3 = reader.ReadBoolean();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads the <see cref="NpcDataMessage"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="NpcDataMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadMessage(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            Unknown1 = reader.ReadInt32();

            NpcVillageJson = reader.ReadString();

            AvatarData = new AvatarMessageComponent();
            AvatarData.ReadMessageComponent(reader);

            Unknown2 = reader.ReadInt32();

            NpcId = reader.ReadInt32();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reads the <see cref="VisitHomeDataMessage"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="VisitHomeDataMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadMessage(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            LastVisit = TimeSpan.FromSeconds(reader.ReadInt32());
            Timestamp = TimeUtils.FromUnixTimestamp(reader.ReadInt32());

            VisitVillageData = new VillageMessageComponent();
            VisitVillageData.ReadMessageComponent(reader);

            VisitAvatarData = new AvatarMessageComponent();
            VisitAvatarData.ReadMessageComponent(reader);

            Unknown1 = reader.ReadInt32();
            Unknown2 = reader.ReadByte();

            OwnAvatarData = new AvatarMessageComponent();
            OwnAvatarData.ReadMessageComponent(reader);
        }
        /// <summary>
        /// Reads the <see cref="OwnHomeDataMessage"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="OwnHomeDataMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadMessage(MessageReader reader)
        {
            ThrowIfReaderNull(reader);

            LastVisit = TimeSpan.FromSeconds(reader.ReadInt32());

            Unknown1 = reader.ReadString(); // -1

            Timestamp      = TimeUtils.FromUnixTimestamp(reader.ReadInt32());
            OwnVillageData = new VillageMessageComponent();
            OwnVillageData.ReadMessageComponent(reader);

            OwnAvatarData = new AvatarMessageComponent();
            OwnAvatarData.ReadMessageComponent(reader);

            Unknown2 = reader.ReadInt32();
            Unknown3 = reader.ReadInt32();

            Unkonwn4 = reader.ReadInt64(); // 1462629754000
            Unknown5 = reader.ReadInt64(); // 1462629754000
            Unknown6 = reader.ReadInt64(); // 1462631554000
        }