Ejemplo n.º 1
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

            if (await StartMovement.MoveTo())
            {
                return(true);
            }



            TargetManager.UpdateLootableTarget();

            if (_movement == null || _movement.CurrentMovementQueue.Count == 0)
            {
                if (_movementQueue.Count > 0)
                {
                    _movement = new Movement(_movementQueue.Dequeue(), 5f, name: "Herbing");
                }
            }

            if (ObjectCacheManager.FoundHerbObject)
            {
                if (_movementQueue.Count > 0)
                {
                    if (_movement != null)
                    {
                        if (await _movement.MoveTo())
                        {
                            return(true);
                        }
                    }

                    return(true);
                }
            }

            if (await EndMovement.MoveTo())
            {
                return(true);
            }

            BaseSettings.CurrentSettings.LastCheckedHerbString = LuaCommands.GetGameTime().ToString("yyyy-MM-ddTHH:mm:ss");
            BaseSettings.SerializeToXML(BaseSettings.CurrentSettings);
            TargetManager.ShouldLoot = false;

            return(false);
        }
        private async Task <bool> Interaction()
        {
            if (InteractionObject != null && InteractionObject.IsValid)
            {
                if (entryId == 0)
                {
                    entryId = InteractionObject.Entry;
                }
                GarrisonBase.Log("Activating " + InteractionObject.Name + ", waiting...");
                InteractionObject.Interact();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await Coroutine.Wait(5000, () => !StyxWoW.Me.IsCasting && !InteractionObject.IsValid);

                await Coroutine.Sleep(StyxWoW.Random.Next(1999, 3001));

                return(true);
            }

            Building.CanActivate = false;

            if (Building.Type == BuildingType.HerbGarden || Building.Type == BuildingType.Mines)
            {//Since activating herb/mine building resets the nodes, we should reset our last checked so we can redo it..
                if (Building.Type == BuildingType.HerbGarden)
                {
                    BaseSettings.CurrentSettings.LastCheckedHerbString = "0001-01-01T00:00:00";
                }
                else
                {
                    BaseSettings.CurrentSettings.LastCheckedMineString = "0001-01-01T00:00:00";
                }

                BaseSettings.SerializeToXML(BaseSettings.CurrentSettings);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

            // ObjectCacheManager.UpdateLootableTarget();

            if (_movement == null || _movement.CurrentMovementQueue.Count == 0)
            {
                if (_movementQueue.Count > 0)
                {
                    //while (_movementQueue.Count > 0)
                    //{
                    //    if (ObjectCacheManager.GetGameObjectsNearPoint(_movementQueue.Peek(), 50f, WoWObjectTypes.OreVein).Count==0)
                    //    {
                    //        GarrisonBase.Debug("Dequeueing point from mine movement!");
                    //        _movementQueue.Dequeue();
                    //        continue;
                    //    }

                    //    break;
                    //}

                    if (_movementQueue.Count > 0)
                    {
                        _movement = new Movement(_movementQueue.Dequeue(), 5f, name: "Mining");
                        TargetManager.LootDistance += 10f;
                    }
                }
            }

            if (ObjectCacheManager.FoundOreObject)
            {
                if (_movementQueue.Count > 0)
                {
                    if (_movement != null)
                    {
                        if (await _movement.MoveTo())
                        {
                            return(true);
                        }
                    }

                    return(true);
                }
            }

            if (await EndMovement.MoveTo())
            {
                return(true);
            }

            BaseSettings.CurrentSettings.LastCheckedMineString = LuaCommands.GetGameTime().ToString("yyyy-MM-ddTHH:mm:ss");
            BaseSettings.SerializeToXML(BaseSettings.CurrentSettings);
            TargetManager.ShouldLoot = false;

            return(false);
        }