示例#1
0
        public List <CommandInfo> Processing(Func <ImgChecksAndTags, bool> tagCheck = null, bool doCenter = true)
        {
            Utils.doScreenShoot(_imgName);
            var sb = new StringBuilder();

            sb.Append($"-input {_imgName} -top {topX} ");
            foreach (var clk in clicks)
            {
                if (tagCheck != null)
                {
                    if (!tagCheck(clk))
                    {
                        continue;
                    }
                }
                sb.Append($"-name {clk.ImageName} -match {clk.ImageName} {clk.Threadshold} ");
            }
            var results = Utils.GetAppInfo(sb.ToString(), context);

            results.ForEach(r =>
            {
                r.imgInfo = clicks.FirstOrDefault(c => c.ImageName == r.extraInfo);
                if (r.imgInfo != null && doCenter)
                {
                    r.x = r.x + (r.imgInfo.center.x);
                    r.y = r.y + (r.imgInfo.center.y);
                }
            });
            return(results.OrderBy(x => x.cmpRes).ToList());
        }
示例#2
0
        protected void DonateArchier()
        {
            Utils.doScreenShoot(ProcessorMapByText.tempImgName);
            var dw    = Utils.GetAppInfo($"-input {ProcessorMapByText.tempImgName} -name dw  -match data\\check\\donate_archer.png 300", context);
            var dwbtn = dw.FirstOrDefault(dwf => dwf.decision == "true");

            if (dwbtn != null)
            {
                context.MoveMouseAndClick(50 + dwbtn.x, 50 + dwbtn.y);
                for (int cli = 0; cli < 5; cli++)
                {
                    context.MouseClick();
                }
            }
        }
示例#3
0
 public CommandInfo FindSpot(string name, int retry = 5, string printDebug = "")
 {
     for (int retryi = 0; retryi < retry; retryi++)
     {
         context.DebugLog($"{printDebug}Trying to find SINGLEMATCH for {name}");
         var cmds  = Utils.GetAppInfo(name, context);
         var found = cmds.FirstOrDefault(cmd => cmd.command == "SINGLEMATCH");
         if (found != null && found.decision == "true")
         {
             context.InfoLog($"{printDebug}matching {name} found {found.cmpRes} {found.decision}");
             context.LogMatchAnalyst(name, found.cmpRes);
             return(found);
         }
         else
         {
             context.InfoLog($"{printDebug}matching {name} NOT found {found.cmpRes} {found.decision}");
         }
         context.Sleep(1000);
     }
     return(null);
 }
示例#4
0
        public void ProcessDonate(CommandInfo cmd)
        {
            if (cmd.cmpRes > 2)
            {
                return;
            }

            var donatedPos = new List <CommandInfo>();
            //ImgChecksAndTags("donatebutton1.png", "INFO_DonateButtonFound", Point(51,19)),
            var processed = new List <CommandInfo>();

            for (int i = 0; i < 5; i++)
            {
                //if (context.vdcontroller.humanMode) break;
                context.MoveMouseAndClick(cmd.x, cmd.y);
                bool found = false;
                context.Sleep(2000);
                Utils.doScreenShoot(ProcessorMapByText.tempImgName);
                context.DebugLog("DEBUGPRINTINFO trying to find donation button");
                //-matchRect 227,102,140,600_200
                const int donateRectx = 227;
                const int donateRecty = 102;
                var       results     = Utils.GetAppInfo($"-input {ProcessorMapByText.tempImgName} -name donate -matchRect {donateRectx},{donateRecty},140,600_200 -top 5  -match data\\check\\donatebutton.png 1900", context);
                foreach (var donate in results)
                {
                    //if (context.vdcontroller.humanMode) break;
                    if (donatedPos.Any(dp => dp.y == donate.y))
                    {
                        continue;
                    }
                    donatedPos.Add(donate);
                    if (donate.decision == "true")
                    {
                        if (processed.Any(p =>
                        {
                            return(Math.Abs(p.y - donate.y) < 20);
                        }))
                        {
                            continue;
                        }
                        processed.Add(donate);
                        found = true;
                        context.Sleep(100);
                        context.MoveMouseAndClick(donateRectx + donate.x + 55, donateRecty + donate.y + 23);
                        context.Sleep(1000);
                        for (int dwretry = 0; dwretry < 2; dwretry++)
                        {
                            Utils.doScreenShoot(ProcessorMapByText.tempImgName);
                            var dw    = Utils.GetAppInfo($"-input {ProcessorMapByText.tempImgName} -name dw  -match data\\check\\donate_wizard.png 300", context);
                            var dwbtn = dw.FirstOrDefault(dwf => dwf.decision == "true");
                            if (dwbtn != null)
                            {
                                context.MoveMouseAndClick(50 + dwbtn.x, 50 + dwbtn.y);
                                for (int cli = 0; cli < 5; cli++)
                                {
                                    context.MouseClick();
                                }
                                break;
                            }
                        }
                        DonateArchier();
                        context.DoStdClicks();
                    }
                }
                if (!found)
                {
                    break;
                }
            }
        }
示例#5
0
 internal List <CommandInfo> GetAppInfo(string argument = "-check")
 {
     return(Utils.GetAppInfo(argument, this));
 }