Example #1
0
        public static Composite IdentifyUniquesInPlayerInventory()
        {
            // Until_x_  return success . Watch out in priorityselectors

            return(new Inverter(new UntilFailure(
                                    new Sequence(
                                        OpenStash(),
                                        new Action(delegate
            {
                var ret = TryGetDataForUnidUniqueInInventory();
                if (ret.Item1 == false)
                {
                    WillBot.LogMessageCombo("Unable to find more unique items to identify");
                    return RunStatus.Failure;
                }
                tempUniqueItemInInventory = ret.Item3;
                return RunStatus.Success;
            }),
                                        MapPrepBehavior.ApplyCurrencyItemToItem(() => ItemStrings.ScrollOfWisdom, () => tempUniqueItemInInventory.GetClientRect()),
                                        new Action(delegate
            {
                Thread.Sleep(300);
                return RunStatus.Success;
            })
                                        )

                                    )));
        }
Example #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()
                                         ))));
        }