Esempio n. 1
0
        private static void UpdateDorf2Info(Account acc)
        {
            //update server version
            acc.AccInfo.ServerVersion = (acc.Wb.Html.GetElementbyId("sidebarBoxDailyquests") == null ? Classificator.ServerVersionEnum.T4_5 : Classificator.ServerVersionEnum.T4_4);

            //update buildings, currentlyBuilding, resources, capacity
            var activeVill = acc.Villages.FirstOrDefault(x => x.Active);

            if (activeVill == null)
            {
                return;
            }

            //remove any further UpdateDorf1 BotTasks for this village (if below 5min)
            acc.Tasks.RemoveAll(x =>
                                x.GetType() == typeof(UpdateDorf2) &&
                                x.vill == activeVill &&
                                x.ExecuteAt < DateTime.Now.AddMinutes(5)
                                );

            UpdateCurrentlyBuilding(acc, activeVill);

            var buildings = InfrastructureParser.GetBuildings(acc, acc.Wb.Html);

            foreach (var field in buildings)
            {
                var building = activeVill.Build.Buildings.FirstOrDefault(x => x.Id == field.Id);
                building.Level             = field.Level;
                building.Type              = field.Type;
                building.UnderConstruction = field.UnderConstruction;
            }
        }
Esempio n. 2
0
        public static void UpdateDorf2Info(Account acc)
        {
            //update buildings, currentlyBuilding, resources, capacity
            var activeVill = acc.Villages.FirstOrDefault(x => x.Active);

            if (activeVill == null)
            {
                return;
            }

            //remove any further UpdateDorf1 BotTasks for this village (if below 5min)
            acc.Tasks.RemoveAll(x =>
                                x.GetType() == typeof(UpdateDorf2) &&
                                x.Vill == activeVill &&
                                x.ExecuteAt < DateTime.Now.AddMinutes(5)
                                );

            UpdateCurrentlyBuilding(acc, activeVill);

            var buildings = InfrastructureParser.GetBuildings(acc, acc.Wb.Html);

            foreach (var field in buildings)
            {
                var building = activeVill.Build.Buildings.FirstOrDefault(x => x.Id == field.Id);
                building.Level             = field.Level;
                building.Type              = field.Type;
                building.UnderConstruction = field.UnderConstruction;
            }
        }
Esempio n. 3
0
        public static void UpdateDorf2Info(Account acc)
        {
            //update buildings, currentlyBuilding, resources, capacity
            var vill = acc.Villages.FirstOrDefault(x => x.Active);

            if (vill == null)
            {
                return;
            }

            //remove any further UpdateDorf2 BotTasks for this village (if below 5min)
            acc.Tasks.Remove(typeof(UpdateDorf2), vill, 5);

            UpdateCurrentlyBuilding(acc, vill);

            var buildings = InfrastructureParser.GetBuildings(acc, acc.Wb.Html);

            foreach (var field in buildings)
            {
                var building = vill.Build.Buildings.FirstOrDefault(x => x.Id == field.Id);
                building.Level             = field.Level;
                building.Type              = field.Type;
                building.UnderConstruction = field.UnderConstruction;
            }
        }