Esempio n. 1
0
        static void checkLoop(ProcessingContext context)
        {
            //Utils.doScreenShoot("tstimgs\\full.png");

            context.DebugLog("Getting app info");
            //cmds = Utils.GetAppInfo("-name allfull -screenshoot");
            //cmds = Utils.GetAppInfo("-name c5 -matchRect 79,32,167,22_200 -screenshoot");
            context.GetToEntrance();
            context.DebugLog("Do shift");
            context.DoShift();
            var controller = context.vdcontroller;

            controller.Init();
            while (controller.canContinue())
            {
                try
                {
                    controller.CustomAction(context);
                    DoProcess(context);
                } catch (SwitchProcessingActionException swa)
                {
                    controller.Log("info", "switch action " + swa.Message);
                }
            }
        }
Esempio n. 2
0
        private static void GenerateAccountPics(ProcessingContext context, int who)
        {
            context.DebugLog("------------------Generate account pics");
            context.GetToEntrance();
            var fullImg = $"tstimgs\\accountFull_{who}.png";

            Utils.doScreenShoot(fullImg);
            //Utils.GetAppInfo($"-name data\\accounts\\img_act{who}.png -input {fullImg} {SwitchAccount.acctNameMatchRect} -imagecorp");
        }
Esempio n. 3
0
        private static void DoProcess(ProcessingContext context)
        {
            var controller = context.vdcontroller;

            //context.DebugLog("TODOREMOVETEMP");
            //Thread.Sleep(5000);
            //context.MouseDragTo(1024/2, 768/2, 1024/4, 768/4); //Christmas hack

            var  resourceClick  = new ResourceClicks(context);
            var  baseType       = resourceClick.PrimaryOrSecondary();
            bool skipProcessing = TryForceMoveToPrimary(resourceClick, context);

            resourceClick.Processing(baseType);
            skipProcessing = TryForceMoveToPrimary(resourceClick, context);
            context.DebugLog("ENDTODOREMOVETEMP");

            resourceClick.RearmAll();

            new ActionJunkRemove(context).Process();
            new ActionUpgrade(context).Process();
            //while(controller.humanMode && controller.CurState != ProcessState.SwitchAccount)
            //{
            //    controller.Sleep(100);
            //}
            var switchAccount = new SwitchAccount(context);

            context.GetToEntrance();
            context.DebugLog("In Entrance, sleep 100");
            context.Sleep(1000);
            int acct = switchAccount.CheckAccount();

            if (acct <= 0)
            {
                context.InfoLog("failed to get account, try again");
                context.Sleep(4000);
                acct = switchAccount.CheckAccount();
            }
            context.InfoLog($"===>Step gen acct pic {acct}");
            switchAccount.CurAccount = acct;
            GenerateAccountPics(context, switchAccount.CurAccount);
            context.InfoLog($"===>Step Using account {switchAccount.CurAccount}");
            context.vdcontroller.NotifyStartingAccount(switchAccount);
            if (!skipProcessing)
            {
                if (controller.DoDonate())
                {
                    var train = new ActionTrainUnits(context);
                    train.ProcessCommand(context);
                }

                if (controller.DoDonate() && controller.doDonate)
                {
                    context.InfoLog("===>Step Donate");
                    //cmds = Utils.GetAppInfo();
                    ProcessDonate(context, context.GetToEntrance());
                    context.GetToEntrance();
                }
                if (controller.DoBuilds() && !controller.switchAccountOnly)
                {
                    context.InfoLog("===>Step textmap");
                    new ProcessorMapByText(context).ProcessCommand(acct);
                }
            }

            DoProcessSecondary(resourceClick, context);

            switchAccount.CurAccount = controller.CheckSetCurAccount(acct);
            context.InfoLog("===>Step SwitchAccount");
            switchAccount.Process();
            context.InfoLog("===>Step get to entrance");
            context.GetToEntrance();
            context.Sleep(4000);
            controller.DoneCurProcessing();
        }