Exemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e) //all villages select from file
        {
            var acc = GetSelectedAcc();

            string location = IoHelperForms.PromptUserForBuidTasksLocation();

            if (location == null)
            {
                return;
            }

            foreach (var vill in acc.Villages)
            {
                IoHelperCore.AddBuildTasksFromFile(acc, vill, location);
            }
        }
Exemplo n.º 2
0
        public override async Task <TaskRes> Execute(Account acc)
        {
            TaskExecutor.RemoveSameTasksForVillage(acc, Vill, typeof(UpdateDorf1), this);
            TaskExecutor.RemoveSameTasksForVillage(acc, Vill, typeof(UpdateDorf2), this);

            await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf1.php"); // Update dorf1

            await Task.Delay(AccountHelper.Delay());

            await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf2.php"); // Update dorf2

            // On new village import the building tasks
            if (ImportTasks && !string.IsNullOrEmpty(acc.NewVillages.BuildingTasksLocationNewVillage))
            {
                IoHelperCore.AddBuildTasksFromFile(acc, Vill, acc.NewVillages.BuildingTasksLocationNewVillage);
            }

            await UpdateTroopsResearchedAndLevels(acc);

            await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf2.php");

            await Task.Delay(AccountHelper.Delay());

            await UpdateTroopsTraining(acc);

            var firstTroop = TroopsHelper.TribeFirstTroop(acc.AccInfo.Tribe);

            Vill.Troops.TroopToTrain = firstTroop;
            Vill.Troops.Researched.Add(firstTroop);

            if (await VillageHelper.EnterBuilding(acc, Vill, Classificator.BuildingEnum.TownHall))
            {
                // Village has town hall, parse celebration duration
                Vill.Expansion.CelebrationEnd = TimeParser.GetCelebrationTime(acc.Wb.Html);
            }

            return(TaskRes.Executed);
        }
Exemplo n.º 3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            var acc = GetSelectedAcc();

            string location = IoHelperForms.PromptUserForBuidTasksLocation();

            if (location == null)
            {
                return;
            }

            for (int i = 0; i < tableModelMain.Rows.Count; i++)
            {
                if (tableModelMain.Rows[i].SelectedItems.Count() > 0)
                {
                    var cells = tableModelMain.Rows[i].Cells;
                    //Village id
                    var id   = Int32.Parse(cells[0].Text);
                    var vill = acc.Villages.First(x => x.Id == id);

                    IoHelperCore.AddBuildTasksFromFile(acc, vill, location);
                }
            }
        }