示例#1
0
    // Start is called before the first frame update
    protected override void Start()
    {
        plantLootBehavior = GetComponent <LootBehavior>();

        base.Start();
        SetupPlantStats(myPType);
    }
示例#2
0
        public async static Task <bool> RootLogic()
        {
            CheckPulseTime();
            AnitAfk();
            // Is bot dead? if so, release and run back to corpse
            if (await DeathBehavior.ExecuteCoroutine())
            {
                return(true);
            }

            if (await HandleCombat())
            {
                // reset the autoBlacklist timer
                MoveToPoolTimer.Reset();
                return(true);
            }

            if (await HandleVendoring())
            {
                return(true);
            }

            if (!StyxWoW.Me.IsAlive || StyxWoW.Me.Combat || RoutineManager.Current.NeedRest)
            {
                return(false);
            }

            if (BotPoi.Current.Type == PoiType.None && LootTargeting.Instance.FirstObject != null)
            {
                SetLootPoi(LootTargeting.Instance.FirstObject);
            }

            // Fishing Logic

            if (await DoFishing())
            {
                return(true);
            }

            var poiGameObject = BotPoi.Current.AsObject as WoWGameObject;

            // only loot when POI is not set to a fishing pool.
            if (!StyxWoW.Me.IsFlying &&
                (BotPoi.Current.Type != PoiType.Harvest ||
                 (poiGameObject != null && poiGameObject.SubType != WoWGameObjectType.FishingHole)) &&
                await LootBehavior.ExecuteCoroutine())
            {
                return(true);
            }

            return(await FollowPath());
        }
示例#3
0
        //Candies
        static BehaviorDef Behaves(
            string name,
            Behavior movement  = null,
            Behavior attack    = null,
            Behavior reproduce = null,
            LootBehavior loot  = null,
            params ConditionalBehavior[] condBehaviors)
        {
            if (loot != null)
            {
                Array.Resize(ref condBehaviors, condBehaviors.Length + 1);
                condBehaviors[condBehaviors.Length - 1] = loot;
            }

            return(new BehaviorDef(
                       movement ?? NullBehavior.Instance,
                       attack ?? NullBehavior.Instance,
                       reproduce ?? NullBehavior.Instance,
                       condBehaviors));
        }
示例#4
0
 public static Composite CreateAutoLootTree()
 {
     return(new Decorator(delegate
     {
         if (WillBot.Plugin.TreeHelper.CanTickMap() && CommonBehavior.DoLooting(ignoreStrongBox: true))
         {
             return true;
         }
         else
         {
             autoLootingDone = true;
             return false;
         }
     },
                          new Sequence(
                              new Inverter(CommonBehavior.MoveTo(x => WillBot.Me.ClosestItemToLoot?.GridPos,
                                                                 y => WillBot.Me.ClosestItemToLoot?.LabelOnGround?.ItemOnGround?.Pos, CommonBehavior.LootingMovementSpec)),
                              LootBehavior.TryToPickLootCloseToPlayer()
                              )));
 }
示例#5
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()
                                         ))));
        }