Exemple #1
0
        /// <summary>
        /// Reads the <see cref="AvatarData"/> from the specified <see cref="MessageReader"/>.
        /// </summary>
        /// <param name="reader">
        /// <see cref="MessageReader"/> that will be used to read the <see cref="AvatarData"/>.
        /// </param>
        public void Read(MessageReader reader)
        {
            OwnVillageData = new VillageData();
            OwnVillageData.Read(reader);

            UserID = reader.ReadInt64();
            UserID2 = reader.ReadInt64();
            OwnClanData = new ClanData();
            if (reader.ReadBoolean())
            {
                OwnClanData.ID = reader.ReadInt64();
                OwnClanData.Name = reader.ReadString();
                OwnClanData.Badge = reader.ReadInt32();
                OwnClanData.Role = reader.ReadInt32();
                OwnClanData.Level = reader.ReadInt32();
                OwnClanData.Unknown1 = reader.ReadByte();
            }
            Unknown1 = reader.ReadInt32();

            Unknown2 = reader.ReadInt32();
            Unknown3 = reader.ReadInt32();
            Unknown4 = reader.ReadInt32();
            Unknown5 = reader.ReadInt32();
            Unknown6 = reader.ReadInt32();
            Unknown7 = reader.ReadInt32();
            Unknown8 = reader.ReadInt32();
            Unknown9 = reader.ReadInt32();
            Unknown10 = reader.ReadInt32();
            Unknown11 = reader.ReadInt32();

            League = reader.ReadInt32();
            AllianceCastleLevel = reader.ReadInt32();
            AllianceCastleTotalCapacity = reader.ReadInt32();
            AllianceCastleUsedCapacity = reader.ReadInt32();
            TownHallLevel = reader.ReadInt32();
            Name = reader.ReadString();

            Unknown12 = reader.ReadInt32();

            Level = reader.ReadInt32();
            Experience = reader.ReadInt32();
            Gems = reader.ReadInt32();
            FreeGems = reader.ReadInt32();

            Unknown13 = reader.ReadInt32();
            Unknown14 = reader.ReadInt32();

            Trophies = reader.ReadInt32();

            AttacksWon = reader.ReadInt32();
            AttacksLost = reader.ReadInt32();
            DefensesWon = reader.ReadInt32();
            DefensesLost = reader.ReadInt32();
            Unknown19 = reader.ReadInt32();
            Unknown20 = reader.ReadInt32();
            Unknown21 = reader.ReadInt32();
            Unknown22 = reader.ReadByte();
            Unknown23 = reader.ReadInt64();

            IsNamed = reader.ReadBoolean();

            Unknown24 = reader.ReadInt32();
            Unknown25 = reader.ReadInt32();
            Unknown26 = reader.ReadInt32();
            Unknown27 = reader.ReadInt32();

            ResourcesCapacity = Slot.ReadSlotArray<ResourceCapacitySlot>(reader);
            ResourcesAmount = Slot.ReadSlotArray<ResourceAmountSlot>(reader);
            Units = Slot.ReadSlotArray<UnitSlot>(reader);
            Spells = Slot.ReadSlotArray<SpellSlot>(reader);
            UnitUpgrades = Slot.ReadSlotArray<UnitUpgradeSlot>(reader);
            SpellUpgrades = Slot.ReadSlotArray<SpellUpgradeSlot>(reader);
            HeroUpgrades = Slot.ReadSlotArray<HeroUpgradeSlot>(reader);
            HeroHealths = Slot.ReadSlotArray<HeroHealthSlot>(reader);
            HeroStates = Slot.ReadSlotArray<HeroStateSlot>(reader);
            TutorialProgess = Slot.ReadSlotArray<TutorialProgressSlot>(reader);
            Acheivements = Slot.ReadSlotArray<AchievementSlot>(reader);
            AcheivementProgress = Slot.ReadSlotArray<AchievementProgessSlot>(reader);
            NpcStars = Slot.ReadSlotArray<NpcStarSlot>(reader);
            NpcGold = Slot.ReadSlotArray<NpcGoldSlot>(reader);
            NpcElixir = Slot.ReadSlotArray<NpcElixirSlot>(reader);

            Unknown28 = reader.ReadInt32();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AvatarData"/> class from
        /// the specified <see cref="Avatar"/>.
        /// </summary>
        /// <param name="avatar"><see cref="Avatar"/> from which the data will be set.</param>
        public AvatarData(Avatar avatar)
        {
            OwnVillageData = new VillageData()
            {
                UserID = avatar.ID,
                ShieldDuration = avatar.ShieldDuration,
                Unknown2 = 1200,
                Unknown3 = 60,
                Compressed = true,
                Home = avatar.Home,
            };

            UserID = avatar.ID;
            UserID2 = avatar.ID; //TODO: Might be something different.

            if (avatar.Alliance != null)
            {
                OwnClanData = new ClanData()
                {
                    ID = avatar.Alliance.ID,
                    Name = avatar.Alliance.Name,
                    Badge = avatar.Alliance.Badge,
                    Role = avatar.Alliance.Role,
                    Level = avatar.Alliance.Level
                };
            }

            League = avatar.League;
            Name = avatar.Name;

            Unknown12 = -1;

            Experience = avatar.Experience;
            Level = avatar.Level;
            Gems = avatar.Gems;
            FreeGems = avatar.FreeGems;

            Unknown13 = 1200;
            Unknown14 = 60;

            Trophies = avatar.Trophies;

            Unknown22 = 1;
            Unknown23 = 946720861000;

            IsNamed = avatar.IsNamed;

            Unknown27 = 1;

            ResourcesCapacity = new ResourceCapacitySlot[0];
            ResourcesAmount = new ResourceAmountSlot[0];
            Units = new UnitSlot[0];
            Spells = new SpellSlot[0];
            UnitUpgrades = new UnitUpgradeSlot[0];
            SpellUpgrades = new SpellUpgradeSlot[0];
            HeroUpgrades = new HeroUpgradeSlot[0];
            HeroHealths = new HeroHealthSlot[0];
            HeroStates = new HeroStateSlot[0];
            TutorialProgess = new TutorialProgressSlot[0];
            Acheivements = new AchievementSlot[0];
            AcheivementProgress = new AchievementProgessSlot[0];
            NpcStars = new NpcStarSlot[0];
            NpcGold = new NpcGoldSlot[0];
            NpcElixir = new NpcElixirSlot[0];
        }