Exemple #1
0
        public void Process()
        {
            var items = upgradeBuildingFinder.Processing();

            foreach (var itm in items)
            {
                if (itm.x > 200)
                {
                    if (!StandardClicks.isRegionGood(itm))
                    {
                        context.InfoLog($"found too far skipp {itm.extraInfo} {itm.x}/{itm.y}");
                        continue;
                    }
                    context.InfoLog($"found {itm.extraInfo} {itm.x}/{itm.y}");
                    var cmdres      = ActionStructureNameReco.GetNameAtPoint(context, itm);
                    var numBuilders = NumBuilders(context, cmdres);
                    if (numBuilders == 0)
                    {
                        context.InfoLog($"No builder");
                        return;
                    }
                    Thread.Sleep(1000);
                    var nameLevel = ActionStructureNameReco.GetStructureName(itm, cmdres, context);
                    if (nameLevel == null)
                    {
                        cmdres    = ActionStructureNameReco.GetNameAtPoint(context, itm);
                        nameLevel = ActionStructureNameReco.GetStructureName(itm, cmdres, context);
                        if (nameLevel == null)
                        {
                            context.InfoLog($"failed reco namelevel {itm.extraInfo} {itm.x}/{itm.y}");
                            continue;
                        }
                    }
                    var goodNames = ActionStructureNameReco.GetGoodNames();

                    foreach (var gname in goodNames)
                    {
                        if (gname.ToLower() == nameLevel.name.ToLower())
                        {
                            context.DebugLog($"found match name {gname}");
                            //context.MoveMouseAndClick(itm);
                            //Thread.Sleep(1000);
                            var upgGrood = canUpgrade(context, numBuilders);
                            if (upgGrood != null && upgGrood.extraInfo.Contains("Good"))
                            {
                                context.MoveMouseAndClick(upgGrood);
                                Upgraded();
                                numBuilders--;
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        public List <CommandInfo> Processing(CurBaseType baseType)
        {
            string filterby = "";

            switch (baseType)
            {
            case CurBaseType.Unknown:
                return(new List <CommandInfo>());

            case CurBaseType.PrimaryBase:
                filterby = "primary";
                break;

            case CurBaseType.SecondaryBase:
                filterby = "secondary";
                break;
            }
            var res = ldr.Processing(clk =>
            {
                return(clk.ImageName.Contains(filterby));
            });

            foreach (var clk in res)
            {
                var yoff = 0;
                if (clk.extraInfo.IndexOf("_drop") > 0)
                {
                    yoff = 10;
                }
                if (clk.extraInfo.Contains("primary_grave.png"))
                {
                    if (!StandardClicks.isRegionGood(clk))
                    {
                        context.InfoLog($"Bad click for gravy {clk.extraInfo} {clk.x}/{clk.y}");
                        continue;
                    }
                }
                if (clk.y > 700)
                {
                    context.InfoLog($"Bad click for {clk.extraInfo} {clk.x}/{clk.y}");
                    continue;
                }
                context.MoveMouseAndClick(clk.x, clk.y + yoff);
            }
            return(res);
        }
Exemple #3
0
        public void Process()
        {
            var numBuilders = getNumBuilders();

            if (numBuilders == 0)
            {
                context.InfoLog($"No builder");
                return;
            }
            const int SLEEPS = 5;
            var       junks  = junkFinder.Processing();

            foreach (var junk in junks)
            {
                if (StandardClicks.isRegionGood(junk) && junk.decision == "true")
                {
                    context.DebugLog($"Found {junk.extraInfo} {junk.cmpRes}");
                    context.MoveMouseAndClick(junk);
                    Thread.Sleep(1000);
                    var btn = buttons.ProcessingWithRetryTop1();
                    if (btn != null && btn.decision == "true")
                    {
                        context.MoveMouseAndClick(btn);
                        Thread.Sleep(1000);
                        int found = 0;
                        for (int i = 0; i < 30; i += SLEEPS)
                        {
                            btn = buttons.ProcessingWithRetryTop1();
                            if (btn != null && btn.decision == "true" && btn.extraInfo.Contains("cancelremove"))
                            {
                                found++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        if (found == 0)
                        {
                            context.DebugLog($"Wait not found, sleep 15s");
                            Thread.Sleep(1000 * 15);
                        }
                    }
                }
            }
        }