コード例 #1
0
        /// <summary>
        /// Writes the <see cref="OwnHomeDataMessage"/> to the specified <see cref="MessageWriter"/>.
        /// </summary>
        /// <param name="writer">
        /// <see cref="MessageWriter"/> that will be used to write the <see cref="OwnHomeDataMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/> is null.</exception>
        /// <exception cref="InvalidOperationException"><see cref="OwnVillageData"/> is null.</exception>
        /// <exception cref="InvalidOperationException"><see cref="OwnAvatarData"/> is null.</exception>
        public override void WriteMessage(MessageWriter writer)
        {
            ThrowIfWriterNull(writer);

            if (OwnVillageData == null)
            {
                throw new InvalidOperationException("OwnVillageData cannot be null.");
            }
            if (OwnAvatarData == null)
            {
                throw new InvalidOperationException("OwnAvatarData cannot be null.");
            }

            writer.Write((int)LastVisit.TotalSeconds);

            writer.Write(Unknown1); // -1

            writer.Write((int)TimeUtils.ToUnixTimestamp(Timestamp));
            OwnVillageData.WriteMessageComponent(writer);

            OwnAvatarData.WriteMessageComponent(writer);

            writer.Write(Unknown2);
            writer.Write(Unknown3);

            writer.Write(Unkonwn4); // 1462629754000
            writer.Write(Unknown5); // 1462629754000
            writer.Write(Unknown6); // 1462631554000
        }
コード例 #2
0
        /// <summary>
        /// Writes the <see cref="VisitHomeDataMessage"/> to the specified <see cref="MessageWriter"/>.
        /// </summary>
        /// <param name="writer">
        /// <see cref="MessageWriter"/> that will be used to write the <see cref="VisitHomeDataMessage"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/> is null.</exception>
        /// <exception cref="InvalidOperationException"><see cref="VisitVillageData"/> is null.</exception>
        /// <exception cref="InvalidOperationException"><see cref="VisitAvatarData"/> is null.</exception>
        /// <exception cref="InvalidOperationException"><see cref="OwnAvatarData"/> is null.</exception>
        public override void WriteMessage(MessageWriter writer)
        {
            ThrowIfWriterNull(writer);

            if (VisitVillageData == null)
            {
                throw new InvalidOperationException("EnemyVillageData cannot be null.");
            }
            if (VisitAvatarData == null)
            {
                throw new InvalidOperationException("EnemyHomeAvatarData cannot be null.");
            }
            if (OwnAvatarData == null)
            {
                throw new InvalidOperationException("OwnAvatarData cannot be null.");
            }

            writer.Write((int)LastVisit.TotalSeconds);
            writer.Write((int)TimeUtils.ToUnixTimestamp(Timestamp));
            VisitVillageData.WriteMessageComponent(writer);
            VisitAvatarData.WriteMessageComponent(writer);

            writer.Write(Unknown1);
            writer.Write(Unknown2);

            OwnAvatarData.WriteMessageComponent(writer);
        }