Esempio 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);
            }

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

            //if (_specialMovement != null && await _specialMovement.ClickToMove())
            //    return true;

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

            return(false);
        }
Esempio n. 2
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }

            if (IsDone)
            {
                return(false);
            }

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

            if (!InteractionObjectValid)
            {
                GarrisonBase.Err("Interaction Object Id {0} not valid or found!", InteractionEntryId);
                return(false);
            }

            if (GossipHelper.IsOpen)
            {
                int index = QuestHelper.GetAvailableQuestIndexFromGossipFrame(QuestID);
                if (index == -1)
                {
                    GarrisonBase.Err("Failed to find quest {0} in gossip frame!", QuestID);
                    return(false);
                }
                GossipFrame.Instance.SelectAvailableQuest(index);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

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

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

            if (_specialMovement != null && await _specialMovement.ClickToMove())
            {
                return(true);
            }

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

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

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

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

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

            return(false);
        }
Esempio n. 4
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);
        }
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

            //Inject our lua addon code for mission success function
            if (!LuaEvents.LuaAddonInjected)
            {
                if (LuaCommands.TestLuaInjectionCode())
                {//Prevent multiple injections by checking simple function return!
                    LuaEvents.LuaAddonInjected = true;
                }
                else
                {
                    await LuaEvents.InjectLuaAddon();

                    return(true);
                }
            }

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

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

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

            return(false);
        }
Esempio n. 6
0
        private async Task <bool> Movement()
        {
            if (LuaEvents.MailOpen)
            {
                return(false);
            }

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

                //No object found..
                IsDone = true;
                GarrisonBase.Err("Could not find mail box object!");
                return(false);
            }

            if (Mailbox.WithinInteractRange)
            {
                Mailbox.Interact();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await Coroutine.Sleep(StyxWoW.Random.Next(1250, 2555));

                return(true);
            }

            if (_movement == null)
            {
                _movement = new Movement(Mailbox.Location, 6f, name: "Mailbox");
            }

            await _movement.MoveTo(false);

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


            if (Building.Type == BuildingType.TradingPost && Building.WorkOrderNpcEntryId != -1)
            {
                if (!_checkedReagent)
                {
                    WorkOrder.TradePostReagentTypes workOrderReagent;
                    workOrderReagent = WorkOrder.GetTradePostNPCReagent(Building.WorkOrderNpcEntryId);
                    if (!BaseSettings.CurrentSettings.TradePostReagents.HasFlag(workOrderReagent))
                    {
                        //Does not have the current reagent set!
                        return(false);
                    }

                    var currency   = WorkOrder.GetTradePostItemAndQuanityRequired(workOrderReagent);
                    var totalCount = WorkOrder.GetTotalWorkorderStartups(currency);
                    if (totalCount <= 0)
                    {
                        //Not enough reagents.
                        return(false);
                    }

                    _checkedReagent = true;
                }
            }

            if (Building.Type == BuildingType.Barn && !Building.CheckedWorkOrderStartUp && CurrentBarnCurrceny == null)
            {
                //TODO:: Further Testing!
                //Gossip Dialog
                //0: Gossip
                //1: Gossip (Barn Level 2+ Only)
                //2: Gossip (Barn Level 3+ Only)
                //3: Fur
                //4: Fur Large
                //5: Leather
                //6: Leather Large
                //7: Meat
                //8: Meat Large

                bool found       = false;
                var  removalList = new List <int>();
                for (int i = 0; i < BarnWorkOrderCurrencies.Count; i++)
                {
                    Tuple <CraftingReagents, int>[] item = BarnWorkOrderCurrencies[i];
                    switch (item[0].Item1)
                    {
                    case CraftingReagents.CagedMightyWolf:
                    case CraftingReagents.FurryCagedBeast:
                        if (!BaseSettings.CurrentSettings.BarnWorkOrderFur)
                        {
                            removalList.Add(i);
                            continue;
                        }
                        break;

                    case CraftingReagents.CagedMightyClefthoof:
                    case CraftingReagents.LeatheryCagedBeast:
                        if (!BaseSettings.CurrentSettings.BarnWorkOrderLeather)
                        {
                            removalList.Add(i);
                            continue;
                        }
                        break;

                    case CraftingReagents.CagedMightyRiverbeast:
                    case CraftingReagents.MeatyCagedBeast:
                        if (!BaseSettings.CurrentSettings.BarnWorkOrderMeat)
                        {
                            removalList.Add(i);
                            continue;
                        }
                        break;
                    }

                    var totalCount = WorkOrder.GetTotalWorkorderStartups(item);
                    if (totalCount <= 0)
                    {
                        removalList.Add(i);
                        continue;
                    }

                    CurrentBarnCurrceny = item;
                    found = true;
                    break;
                }

                if (!found)
                {
                    Building.CheckedWorkOrderStartUp = true;
                    //if (_specialMovement != null)
                    //{
                    //    _specialMovement.UseDeqeuedPoints(true);
                    //    if (_specialMovement.CurrentMovementQueue.Count == 0)
                    //    {
                    //        return false;
                    //    }

                    //    return true;
                    //}

                    return(false);
                }


                _updateBarnGossipWorkOrderEntries();
                GarrisonBase.Debug("Staring Work Order for Barn using {0} at gossip index {1}", CurrentBarnCurrceny[0].Item1.ToString(), BarnGossipIndex);

                foreach (var i in removalList.OrderByDescending(i => i))
                {
                    BarnWorkOrderCurrencies.RemoveAt(i);
                }
            }

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

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

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

            //if (_specialMovement != null && await _specialMovement.ClickToMove())
            //    return true;

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

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

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



            if (GossipHelper.IsOpen)
            {
                if (GossipHelper.GossipOptions.All(o => o.Type != GossipEntry.GossipEntryType.Vendor))
                {
                    //Could not find Vendor Option!
                    GarrisonBase.Err("Primal Trader behavior could not find vendoring gossip!");
                    return(false);
                }
                var gossipEntryVendor = GossipHelper.GossipOptions.FirstOrDefault(o => o.Type == GossipEntry.GossipEntryType.Vendor);

                QuestManager.GossipFrame.SelectGossipOption(gossipEntryVendor.Index);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

            if (MerchantHelper.IsOpen)
            {
                await Coroutine.Yield();

                if (ExchangeItemInfo.Cost <= TotalPrimalSpiritCount)
                {
                    if (StyxWoW.Me.IsMoving)
                    {
                        await CommonCoroutines.StopMoving();
                    }

                    await Coroutine.Sleep(StyxWoW.Random.Next(1005, 1666));

                    bool success = false;

                    await CommonCoroutines.WaitForLuaEvent("BAG_UPDATE",
                                                           StyxWoW.Random.Next(1255, 1777),
                                                           null,
                                                           () => success = MerchantHelper.BuyItem(ExchangeItemInfo.ItemId, 1, true));

                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    await Coroutine.Yield();

                    if (success)
                    {
                        return(true);
                    }
                }

                IsDone = true;
                return(false);
            }

            if (InteractionObject != null)
            {
                if (InteractionObject.WithinInteractRange)
                {
                    if (StyxWoW.Me.IsMoving)
                    {
                        await CommonCoroutines.StopMoving();
                    }
                    await CommonCoroutines.SleepForLagDuration();

                    InteractionObject.Interact();
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }

                if (_npcMovement == null)
                {
                    _npcMovement = new Movement(InteractionObject, InteractionObject.InteractRange - 0.25f);
                }

                await _npcMovement.MoveTo(false);

                return(true);
            }


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

            if (!QuestHelper.QuestContainedInQuestLog(QuestID) || QuestHelper.GetQuestFromQuestLog(QuestID).IsCompleted)
            {
                return(false);
            }

            if (Building.WorkOrder == null || Building.WorkOrder.TotalWorkorderStartups() == 0)
            {
                return(false);
            }

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

            if (GossipHelper.IsOpen)
            {
                GossipFrame.Instance.SelectGossipOption(0);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

            if (LuaCommands.IsGarrisonCapacitiveDisplayFrame())
            {
                if (!LuaCommands.ClickStartOrderButtonEnabled())
                {
                    Building.CheckedWorkOrderStartUp = true;
                    GarrisonBase.Log("Order Button Disabled!");
                    return(false);
                }


                LuaCommands.ClickStartOrderButton();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            if (InteractionObject != null && InteractionObject.IsValid)
            {
                if (InteractionObject.WithinInteractRange)
                {
                    TreeRoot.StatusText = String.Format("Behavior {0} Quest NPC Interact", Type.ToString());
                    InteractionObject.Interact();
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }

                if (_npcMovement == null)
                {
                    _npcMovement = new Movement(InteractionObject.Location, InteractionObject.InteractRange - 0.25f);
                }

                await _npcMovement.ClickToMove(false);

                return(true);
            }

            return(false);
        }