예제 #1
0
        public void UpdateCurrentlyTraining(HtmlDocument htmlDoc, Account acc)
        {
            var ct = TroopsParser.GetTroopsCurrentlyTraining(htmlDoc);

            switch (building)
            {
            case Classificator.BuildingEnum.Barracks:
                Vill.Troops.CurrentlyTraining.Barracks = ct;
                break;

            case Classificator.BuildingEnum.Stable:
                Vill.Troops.CurrentlyTraining.Stable = ct;
                break;

            case Classificator.BuildingEnum.GreatBarracks:
                Vill.Troops.CurrentlyTraining.GB = ct;
                break;

            case Classificator.BuildingEnum.GreatStable:
                Vill.Troops.CurrentlyTraining.GS = ct;
                break;

            case Classificator.BuildingEnum.Workshop:
                Vill.Troops.CurrentlyTraining.Workshop = ct;
                break;
            }
        }
예제 #2
0
        public async Task UpdateTroopsTraining(Account acc)
        {
            foreach (var trainingBuilding in trainingBuildings)
            {
                if (!await VillageHelper.EnterBuilding(acc, Vill, trainingBuilding))
                {
                    continue;
                }

                // Mark troops that user can train in building as researched
                TroopsHelper.UpdateTroopsResearched(Vill, acc.Wb.Html);

                var ct = TroopsParser.GetTroopsCurrentlyTraining(acc.Wb.Html);
                switch (trainingBuilding)
                {
                case Classificator.BuildingEnum.Barracks:
                    Vill.Troops.CurrentlyTraining.Barracks = ct;
                    break;

                case Classificator.BuildingEnum.Stable:
                    Vill.Troops.CurrentlyTraining.Stable = ct;
                    break;

                case Classificator.BuildingEnum.GreatBarracks:
                    Vill.Troops.CurrentlyTraining.GB = ct;
                    break;

                case Classificator.BuildingEnum.GreatStable:
                    Vill.Troops.CurrentlyTraining.GS = ct;
                    break;

                case Classificator.BuildingEnum.Workshop:
                    Vill.Troops.CurrentlyTraining.Workshop = ct;
                    break;
                }
                await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf2.php");

                await Task.Delay(AccountHelper.Delay());
            }
        }
예제 #3
0
        public static DateTime TrainingDuration(HtmlAgilityPack.HtmlDocument html)
        {
            var training = TroopsParser.GetTroopsCurrentlyTraining(html);

            return(training.Count == 0 ? DateTime.MinValue : training.Last().FinishTraining);
        }