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