コード例 #1
0
        public static Composite SellCrItemsToVendor()
        {
            return(new Decorator(delegate
            {
                if (GetNumberOfCrRecipeSetsInInventory() == 1 && chaosRecipeSetsSoldThisCycle < 10)
                {
                    return true;
                }
                return false;
            },
                                 new Sequence(
                                     CommonBehavior.CloseOpenPanels(),
                                     SellBehavior.FindVendor(),
                                     SellBehavior.MoveToAndOpenVendor(),
                                     SellBehavior.OpenVendorSellScreen(),
                                     new Action(delegate
            {
                Input.KeyDown(Keys.LControlKey);
                Thread.Sleep(10);
                foreach (var item in GameController.Game.IngameState.IngameUi.InventoryPanel[InventoryIndex.PlayerInventory].VisibleInventoryItems)
                {
                    if (IsCrItem(item))
                    {
                        Mouse.SetCursorPosAndLeftOrRightClick(item.GetClientRectCache, Latency, randomClick: true);
                        Thread.Sleep(Latency);
                    }
                }
                Input.KeyUp(Keys.LControlKey);
                Thread.Sleep(Latency + 100);

                if (IsNpcOfferValid())
                {
                    // click accept button
                    Console.WriteLine("Offer correct");
                    chaosRecipeSetsSoldThisCycle += 1;
                    hasInitializedSets = false;
                    var acceptButton = WillBot.gameController.IngameState.IngameUi.VendorAcceptButton;
                    Mouse.SetCursorPosAndLeftOrRightClick(acceptButton.GetClientRectCache, Latency, randomClick: true);
                    return RunStatus.Success;
                }
                else
                {
                    Console.WriteLine("Offer incorrect");
                    // need to fail gracefully somehow..
                    return RunStatus.Failure;
                }
            }),
                                     // Testing purposes.. Create a loop.
                                     // Close panels.
                                     // Run stashie
                                     //
                                     CommonBehavior.CloseOpenPanels(),
                                     CommonBehavior.CloseOpenPanels(),
                                     CommonBehavior.CloseOpenPanels()
                                     //new Action(delegate { WillBot.Me.HasStashedItemsThisTownCycle = false; return RunStatus.Success; }),
                                     //TownBehavior.Stashie()

                                     )
                                 ));
        }
コード例 #2
0
        private Composite CreateTree()
        {
            return(new PrioritySelector(

                       new Decorator(x => GameController.Game.IsPreGame == true, LoginBehavior.TryEnterGameFromLoginScreen(x => 3)),
                       new Decorator(x => TreeHelper.CanTickTown(), CommonBehavior.TownToHideout()),

                       new Decorator(x => TreeHelper.CanTickHideout(), new PrioritySelector(
                                         new Decorator(x => (DateTime.Now.Subtract(previousBreakTime) > breakInterval), new Action(delegate
            {
                previousBreakTime = DateTime.Now;
                var breakLength = new TimeSpan(hours: 0, minutes: MathHepler.Randomizer.Next(8, 15), seconds: 0);
                Thread.Sleep(breakLength);
                return RunStatus.Failure;
            }
                                                                                                                                   )),
                                         //new Inverter(CommonBehavior.CloseOpenPanels()),
                                         CommonBehavior.HandleDestroyItemPopup(),
                                         CharacterAbilityTrees.ActivateNecroAuras(),
                                         new Action(delegate
            {
                CommonBehavior.CouldNotFindValidPositionToExplore = false;
                WillBot.Me.enemies.LastKilledMonsterTime = DateTime.Now;
                return RunStatus.Failure;
            }),
                                         SellBehavior.SellItems(sellUnidCrItems: true),
                                         TownBehavior.IdentifyUniquesInPlayerInventory(),
                                         TownBehavior.Stashie(),
                                         //ChaosRecipeBehavior.ChaosRecipeHandler(),



                                         // TownBehavior.EnterBloodAquaducts())),
                                         MapPrepBehavior.GetOpenAndEnterMap())),
                       new Decorator(x => TreeHelper.CanTickDead(),
                                     AreaBehavior.DiedBehavior()),
                       new Decorator(x => TreeHelper.CanTickMap(),// !PlayerHelper.isPlayerDead(),
                                     new PrioritySelector(

                                         //new Inverter(CommonBehavior.CloseOpenPanels()),
                                         new Inverter(CommonBehavior.CloseOpenPanelsIfOpenPanels()),
                                         new Decorator(delegate
            {
                // if not killed a monster in the last x seconds -> exit map
                if (DateTime.Now.Subtract(WillBot.Me.enemies.LastKilledMonsterTime).TotalSeconds > 60)
                {
                    return true;
                }
                return false;
            },
                                                       CommonBehavior.OpenAndEnterTownPortal()
                                                       ),
                                         CharacterAbilityTrees.CreateNecroBuffTree(),
                                         new Decorator(ret => CommonBehavior.DoCombat(), NecroCombat.NecroCombatComposite()),
                                         LevelGemsBehavior.LevelGems(),
                                         LootBehavior.BuildLootComposite(),
                                         ChestBehavior.DoOpenNearbyChest(),
                                         AreaBehavior.InteractWithLabelOnGroundOpenable(() => WillBot.Me.TimelessMonolith),
                                         AreaBehavior.InteractWithLabelOnGroundOpenable(() => WillBot.Me.EssenceMonsterMonolith),
                                         AreaBehavior.InteractWithLabelOnGroundOpenable(() => WillBot.Me.HarvestChest),
                                         AreaBehavior.InteractWithLabelOnGroundOpenable(() => WillBot.Me.StrongBox),
                                         AreaBehavior.InteractWithLabelOnGroundOpenable(() => WillBot.Me.BlightPumpInMap),
                                         //AreaBehavior.DefendBlightPumpMap(),

                                         AreaBehavior.OpenDeliriumMirror(),
                                         CommonBehavior.MoveToUnkillableUniqueMonster(),
                                         //CommonBehavior.MoveToDeliriumPause(),
                                         new Decorator(x => CommonBehavior.DoMoveToMonster(),
                                                       CommonBehavior.MoveTo(ret => WillBot.Me.enemies.ClosestMonsterEntity?.GridPos, x => WillBot.Me.enemies.ClosestMonsterEntity?.Pos,
                                                                             CommonBehavior.DefaultMovementSpec)),
                                         new Action(delegate
            {
                AreaBehavior.UpdateAreaTransitions();
                return RunStatus.Failure;
            }),

                                         new Decorator(delegate
            {
                if (CommonBehavior.DoMoveToMonster() == false && CommonBehavior.DoCombat() == false && CommonBehavior.DoMoveToNonKillableUniqueMonster() == false)
                {
                    WillBot.LogMessageCombo($"Checking for exit/area transitions");
                    return true;
                }
                return false;
            },
                                                       new PrioritySelector(
                                                           CommonBehavior.HandleDestroyItemPopup(),
                                                           AreaBehavior.TryDoAreaTransition(),
                                                           new Decorator(delegate
            {
                if (CommonBehavior.MapComplete())
                {
                    WillBot.LogMessageCombo($"Exiting map due to map complete criterias fulfilled, explored more than {WillBot.Settings.MapAreaExploration}");
                    return true;
                }
                return false;
            },
                                                                         CommonBehavior.OpenAndEnterTownPortal()
                                                                         ),
                                                           new Decorator(delegate
            {
                if (CommonBehavior.CouldNotFindValidPositionToExplore == true)
                {
                    WillBot.LogMessageCombo("Exiting map due to not finding a valid position to explore");
                    return true;
                }
                return false;
            },
                                                                         CommonBehavior.OpenAndEnterTownPortal()
                                                                         ),
                                                           new Decorator(
                                                               delegate
            {
                if (WillBot.Me.IsPlayerInventoryFull == true)
                {
                    WillBot.LogMessageCombo("Exiting map due to inventory full.");
                    return true;
                }
                return false;
            },
                                                               CommonBehavior.OpenAndEnterTownPortal())
                                                           )),
                                         CommonBehavior.DoExploringComposite()
                                         ))));
        }