コード例 #1
0
        public override async Task <TaskRes> Execute(HtmlDocument htmlDoc, ChromeDriver wb, Files.Models.AccModels.Account acc)
        {
            await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/hero.php");

            acc.Hero.HeroInfo = HeroParser.GetHeroInfo(htmlDoc);
            var points = acc.Hero.HeroInfo.AvaliblePoints;

            for (int i = 0; i < 4; i++)
            {
                var amount = acc.Hero.Settings.Upgrades[i];
                if (amount == 0)
                {
                    continue;
                }
                var id     = HeroHelper.AttributeDomId(i);
                var script = $"var attribute = document.getElementById('{id}');";
                script += "var upPoint = attribute.getElementsByClassName('pointsValueSetter')[1];";
                script += "upPoint.getElementsByTagName('a')[0].click();";

                for (int j = 0; j < amount; j++)
                {
                    // Execute the script (set point) to add 1 point
                    wb.ExecuteScript(script);
                }
                await Task.Delay(AccountHelper.Delay());
            }

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

            return(TaskRes.Executed);
        }
コード例 #2
0
        public override async Task <TaskRes> Execute(HtmlDocument htmlDoc, ChromeDriver wb, Files.Models.AccModels.Account acc)
        {
            await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/hero.php?t=1");

            acc.Hero.HeroInfo = HeroParser.GetHeroInfo(htmlDoc);
            var homeVill = HeroParser.GetHeroVillageId(htmlDoc);

            if (homeVill != null)
            {
                acc.Hero.HomeVillageId = homeVill ?? 0;
            }

            if (acc.Hero.HeroInfo.Health > acc.Hero.Settings.MinHealth && acc.Hero.Settings.AutoSendToAdventure)
            {
                TaskExecutor.AddTaskIfNotExists(acc, new StartAdventure()
                {
                    ExecuteAt = DateTime.MinValue.AddMilliseconds(1)
                });
            }
            return(TaskRes.Executed);
        }