//TODO add my troops in other villages, with village coords  etc
        //TODO: troops count, troops researched, market stuff

        public void Init(Account acc)
        {
            //TroopsInVillage = new List<TroopsRaw>();
            //MyTroops = new List<TroopsRaw>();
            CurrentlyTraining = new CurrentlyTraining();
            CurrentlyTraining.Init();
            Researched = new List <Classificator.TroopsEnum>();
            Researched.Add(TroopsHelper.TribeFirstTroop(acc.AccInfo.Tribe));

            Levels     = new List <TroopLevel>();
            ToResearch = new List <Classificator.TroopsEnum>();
            ToImprove  = new List <Classificator.TroopsEnum>();
        }
Beispiel #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);
        }