Beispiel #1
0
        /// <summary>
        /// Checks demolish time.
        /// </summary>
        /// <param name="htmlDoc">The html of the page</param>
        /// <param name="acc">account</param>
        public DateTime NextDemolishTime(Account acc)
        {
            var table = acc.Wb.Html.GetElementbyId("demolish");

            if (table == null) //No building is being demolished
            {
                return(DateTime.Now);
            }
            //Re-execute the demolish building task
            return(DateTime.Now.Add(TimeParser.ParseTimer(table)).AddSeconds(2));
        }
        /// <summary>
        /// PostCheckTask. Add new demolish task after this one finishes.
        /// </summary>
        /// <param name="htmlDoc">The html of the page</param>
        /// <param name="acc">account</param>
        public void CheckDemolishTime(HtmlDocument htmlDoc, Account acc)
        {
            var table = htmlDoc.GetElementbyId("demolish");

            if (table == null) //No building is being demolished
            {
                this.NextExecute = DateTime.Now;
                return;
            }
            //Re-execute the demolish building task
            this.NextExecute = DateTime.Now.Add(TimeParser.ParseTimer(table)).AddSeconds(2);
        }
        /// <summary>
        /// Checks demolish time.
        /// </summary>
        /// <param name="acc">account</param>
        public async Task <DateTime> NextDemolishTime(Account acc)
        {
            // Is this needed?
            if (!await VillageHelper.EnterBuilding(acc, Vill, Classificator.BuildingEnum.MainBuilding))
            {
                return(DateTime.Now);
            }

            var table = acc.Wb.Html.GetElementbyId("demolish");

            if (table == null) //No building is being demolished
            {
                return(DateTime.Now);
            }
            //Re-execute the demolish building task

            var time = DateTime.Now.Add(TimeParser.ParseTimer(table));

            return(time.AddSeconds(2));
        }