예제 #1
0
파일: Program.cs 프로젝트: gzhangx/ccauto
        private static bool TryForceMoveToPrimary(ResourceClicks resourceClick, ProcessingContext context)
        {
            var  baseType       = resourceClick.PrimaryOrSecondary();
            bool skipProcessing = false;

            if (baseType == ResourceClicks.CurBaseType.SecondaryBase)
            {
                resourceClick.MoveToPrimary();
                context.MouseMouseTo(0, 0);
                context.InfoLog("Skip processing since we are in secondary");
                skipProcessing = true;
            }
            return(skipProcessing);
        }
예제 #2
0
파일: Program.cs 프로젝트: gzhangx/ccauto
        private static void DoProcessSecondary(ResourceClicks resourceClick, ProcessingContext context)
        {
            var baseType = resourceClick.PrimaryOrSecondary();

            if (baseType == ResourceClicks.CurBaseType.PrimaryBase)
            {
                resourceClick.MoveToSecondary();
                context.MouseMouseTo(0, 0);
                context.InfoLog("Skip processing since we are in secondary");
            }
            context.InfoLog("sleeping 2s for things to settle down");
            Thread.Sleep(2000);
            resourceClick.Processing(ResourceClicks.CurBaseType.SecondaryBase);
            TryForceMoveToPrimary(resourceClick, context);
        }
예제 #3
0
파일: Program.cs 프로젝트: gzhangx/ccauto
        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();
        }