Esempio n. 1
0
 /// <summary>
 ///     Adds a new myvillage to account
 ///     and fires a new event.
 /// </summary>
 /// <param name="mv">Myvillage village.</param>
 public void AddVillage(MyVillage mv)
 {
     MyVillages.Add(mv.Id, mv);
 }
Esempio n. 2
0
        /// <summary>
        ///     Gets missing buildings for given village.
        /// </summary>
        /// <param name="mv">My village object.</param>
        /// <returns>Missing buildings list.</returns>
        public IList<BuildingData> MissingBuildings(MyVillage mv)
        {
            var missingBuildings = new List<BuildingData>();

            foreach (BuildingData req in BuildingRequirements)
            {
                Building b = mv.Buildings
                    .FirstOrDefault(i => i.Type == req.Type);
                if ((b == null) || (b.Level != req.Level))
                {
                    missingBuildings.Add(req);
                }
            }

            return missingBuildings;
        }
Esempio n. 3
0
 /// <summary>
 ///     Adds a new myvillage to account
 ///     and fires a new event.
 /// </summary>
 /// <param name="mv">Myvillage village.</param>
 public void AddVillage(MyVillage mv)
 {
     MyVillages.Add(mv.Id, mv);
 }
Esempio n. 4
0
        /// <summary>
        ///     Gets missing researches for given village.
        /// </summary>
        /// <param name="mv">My village object.</param>
        /// <returns>Missing researches list.</returns>
        public IList<Research> MissingResearches(MyVillage mv)
        {
            var missingResearches = new List<Research>();

            foreach (Research req in ResearchRequirements)
            {
                if (mv.Researches.ContainsKey(req.TroopType))
                {
                    Research r = mv.Researches[req.TroopType];

                    if ((r.Armoury != req.Armoury) ||
                        (r.Blacksmith != req.Blacksmith))
                    {
                        missingResearches.Add(req);
                    }
                }
                else
                {
                    missingResearches.Add(req);
                }
            }

            return missingResearches;
        }