예제 #1
0
        /// <summary>
        ///     (Non-Blocking) Shortcut method to use a healthstone on the player.
        /// </summary>
        /// <returns>Returns true if the item was successfully used.</returns>
        public static async Task <bool> UseHealthstone()
        {
            if (!SpellManager.GlobalCooldown &&
                Me.Specialization == WoWSpec.DruidGuardian
                ? SettingsManager.Instance.GuardianHealthstoneEnabled &&
                Me.HealthPercent <= SettingsManager.Instance.GuardianHealthstoneMinHealth
                : SettingsManager.Instance.HealthstoneEnabled &&
                Me.HealthPercent <= SettingsManager.Instance.HealthstoneMinHealth)
            {
                var healthstone = Me.BagItems
                                  .SingleOrDefault(o => o.Entry == HealthstoneEntryId);

                if (healthstone != null && healthstone.CooldownTimeLeft.TotalMilliseconds == 0)
                {
                    healthstone.Use();
                    Log.Equipment("Used Healthstone on Me.");

                    await CommonCoroutines.SleepForLagDuration();

                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        public async Task <bool> PhaseTwoLogic()
        {
            var barrel = Barrel;

            if (barrel != null)
            {
                barrel.Interact();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            var enemies = Enemies;

            if (enemies.Any())
            {
                foreach (var enemy in enemies)
                {
                    if (!Query.IsViable(enemy))
                    {
                        continue;
                    }
                    enemy.Interact(true);
                    await CommonCoroutines.SleepForRandomReactionTime();
                }
                return(true);
            }
            return(false);
        }
예제 #3
0
파일: Spell.cs 프로젝트: Jon310/Mystical
        public static async Task <bool> CastOnGround(int spell, WoWUnit unit, bool reqs)
        {
            var sp    = WoWSpell.FromId(spell);
            var sname = sp != null ? sp.Name : "#" + spell;

            if (!reqs || !SpellManager.CanCast(spell) || unit == null)
            {
                return(false);
            }

            var onLocation = unit.Location;

            if (!SpellManager.Cast(spell))
            {
                return(false);
            }

            if (!await Coroutine.Wait(1000, () => StyxWoW.Me.CurrentPendingCursorSpell != null))
            {
                Logging.Write(Colors.DarkRed, "Cursor Spell Didn't happen");
                return(false);
            }

            SpellManager.ClickRemoteLocation(onLocation);
            Log.WritetoFile(LogLevel.Diagnostic, String.Format("Casting {0}", sname));
            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Specifies the current target when casting spell and sleeps for lag
        /// </summary>
        /// <param name="Spell"></param>
        /// <param name="reqs"></param>
        /// <returns></returns>
        public async Task <bool> Cast(int Spell, Color newColor, bool reqs = true)
        {
            if (!CurrentTarget.IsValidCombatUnit())
            {
                return(false);
            }
            if (!reqs)
            {
                //L.combatLog("Trying to cast: " + WoWSpell.FromId(Spell).Name + (String.IsNullOrEmpty(addLog) ? "" : " - " + addLog));
                return(false);
            }

            if (!SpellManager.CanCast(WoWSpell.FromId(Spell), CurrentTarget, false, false, false)) //Should we check for if out currentTarget is moving? *Second false
            {
                return(false);
            }
            if (!SpellManager.Cast(Spell, CurrentTarget))
            {
                return(false);
            }
            //lastSpellCast = Spell;
            combatLog("^" + WoWSpell.FromId(Spell).Name, newColor);
            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #5
0
        private static async Task <bool> Looting()
        {
            if (StyxWoW.Me.IsMoving && await CommonCoroutines.StopMoving())
            {
                await CommonCoroutines.SleepForLagDuration();
            }

            if (TargetManager.LootableObject.IsValid)
            {
                bool success = await CommonCoroutines.WaitForLuaEvent(
                    "LOOT_CLOSED",
                    4200,
                    null,
                    TargetManager.LootableObject.Interact);

                if (TargetManager.LootableObject.InteractionAttempts > 1)
                {
                    GarrisonBase.Debug("LootObject interaction attempts has excedeed max! Ignoring {0}", TargetManager.LootableObject.Name);
                    IgnoreLootableObject();
                    ResetLoot();
                    return(false);
                }

                if (success)
                {
                    await CheckLootFrame();

                    IgnoreLootableObject();
                    ResetLoot();
                }
            }

            return(true);
        }
예제 #6
0
        public static async Task <bool> CastGroundOnMe(int Spell, System.Windows.Media.Color newColor, bool reqs = true, string addLog = "")
        {
            foreach (var item in GroundSpellBlacklist)
            {
                if (item.SpellId == Spell && item.IsBlacklisted())
                {
                    return(false);
                }
            }
            if (!reqs)
            {
                return(false);
            }
            //L.combatLog("Trying to cast: " + WoWSpell.FromId(Spell).Name + (String.IsNullOrEmpty(addLog) ? "" : " - " + addLog));
            if (!SpellManager.CanCast(WoWSpell.FromId(Spell)))
            {
                return(false);
            }

            if (await GCD(Spell, newColor, true, "CastGround") &&
                !await Coroutine.Wait(1000, () => Me.CurrentPendingCursorSpell != null))
            {
                AddSpellToBlacklist(Spell);
                L.diagnosticsLog("No Cursor Detected");
                return(false);
            }
            lastSpellCast = Spell;
            if (SpellManager.ClickRemoteLocation(Me.Location) == false)
            {
                AddSpellToBlacklist(Spell);
            }
            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #7
0
        // does nothing if no baits are in bag
        public async static Task <bool> Applybait()
        {
            if (StyxWoW.Me.IsCasting || IsBait)
            {
                return(false);
            }

            if (!BaitRecastTimer.IsFinished)
            {
                return(false);
            }

            BaitRecastTimer.Reset();
            var mainHand = StyxWoW.Me.Inventory.Equipped.MainHand;

            if (mainHand == null || mainHand.ItemInfo.WeaponClass != WoWItemWeaponClass.FishingPole)
            {
                return(false);
            }

            foreach (var baitInBag in GetBaits())
            {
                if (baitInBag != null && baitInBag.Use())
                {
                    AutoAnglerBot.Log("Applying bait: {0}", baitInBag.GetItemName());
                    await CommonCoroutines.SleepForLagDuration();

                    return(true);
                }
            }
            return(false);
        }
예제 #8
0
 private static async Task <bool> CheckLootFrame()
 {
     if (!LootTimer.IsFinished)
     {
         // loot everything.
         if (AutoAnglerBot.Instance.LootFrameIsOpen)
         {
             for (int i = 0; i < LootFrame.Instance.LootItems; i++)
             {
                 LootSlotInfo lootInfo = LootFrame.Instance.LootInfo(i);
                 if (AutoAnglerBot.Instance.FishCaught.ContainsKey(lootInfo.LootName))
                 {
                     AutoAnglerBot.Instance.FishCaught[lootInfo.LootName] += (uint)lootInfo.LootQuantity;
                 }
                 else
                 {
                     AutoAnglerBot.Instance.FishCaught.Add(lootInfo.LootName, (uint)lootInfo.LootQuantity);
                 }
             }
             LootFrame.Instance.LootAll();
             LootTimer.Stop();
             await CommonCoroutines.SleepForLagDuration();
         }
         return(true);
     }
     return(false);
 }
예제 #9
0
        public static async Task <bool> UseItem(PawsItem item)
        {
            if (item == null || Me.HasAura(SpellBook.Prowl) || Me.Mounted || Me.IsInTravelForm() || Me.IsDead)
            {
                return(false);
            }

            if (item.Conditions.Any(condition => !condition.Instance.Satisfied()))
            {
                return(false);
            }

            var theItem = Me.BagItems
                          .SingleOrDefault(o => o.Entry == item.Entry);

            if (theItem == null || theItem.CooldownTimeLeft.TotalMilliseconds != 0)
            {
                return(false);
            }
            theItem.Use();

            Log.Equipment(string.Format("Item [{0}] used.", theItem.Name));

            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #10
0
        /// <summary>
        /// Does not specify a target when casting a spell and sleeps for lag
        /// </summary>
        /// <param name="Spell">The spell you wish to cast.</param>
        /// <param name="reqs">The requirements to cast the spell.</param>
        /// <returns></returns>
        public static async Task <bool> GCD(int Spell, System.Windows.Media.Color newColor, bool reqs = true, string addLog = "", bool sleep = true)
        {
            if (!reqs)
            {
                //L.combatLog("Trying to cast: " + WoWSpell.FromId(Spell).Name + (String.IsNullOrEmpty(addLog) ? "" : " - " + addLog));
                return(false);
            }
            //if (SpellManager.GlobalCooldown || !SpellManager.CanCast(Spell))
            //    return false;
            if (OnCooldown(Spell))
            {
                return(false);
            }
            if (!SpellManager.Cast(Spell))
            {
                return(false);
            }
            lastSpellCast = Spell;
            L.combatLog("*" + WoWSpell.FromId(Spell).Name + (String.IsNullOrEmpty(addLog) || !GeneralSettings.Instance.GeneralDebug ? "" : " - " + addLog), newColor);
            if (sleep)
            {
                await CommonCoroutines.SleepForLagDuration();
            }
            else
            {
                await Coroutine.Yield();
            }

            return(true);
        }
예제 #11
0
파일: Spell.cs 프로젝트: Jon310/Mystical
        public static async Task <bool> CoCast(int spell, WoWUnit unit, bool reqs, bool cancel)
        {
            var sp    = WoWSpell.FromId(spell);
            var sname = sp != null ? sp.Name : "#" + spell;

            if (unit == null || !reqs || !SpellManager.CanCast(spell, unit, true))
            {
                return(false);
            }

            if (!SpellManager.Cast(spell, unit))
            {
                return(false);
            }

            if (!await Coroutine.Wait(GetSpellCastTime(sname), () => cancel) && GetSpellCastTime(sname).TotalSeconds > 0)
            {
                SpellManager.StopCasting();
                Log.WriteLog("Canceling " + sname + ".");
                return(false);
            }

            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #12
0
 private async Task UseSpeedBuff()
 {
     if (UseVehicleButton(SpeedButton))
     {
         await CommonCoroutines.SleepForLagDuration();
     }
 }
예제 #13
0
        private static async Task <bool> VendorInteraction(C_WoWObject vendor, List <C_WoWItem> items)
        {
            TreeRoot.StatusText = "Vendor Interaction Behavior";

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

                if (GossipHelper.GossipOptions.All(o => o.Type != GossipEntry.GossipEntryType.Vendor))
                {
                    //Could not find Vendor Option!
                    GarrisonBase.Debug("Vendor Gossip Has No Option for Vendoring!");
                    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)
            {
                if (items.Count > 0)
                {
                    foreach (var item in items)
                    {
                        GarrisonBase.Debug("Vendoring Item {0} ({1}) Quality {2}", item.Name, item.Entry, item.Quality);
                        MerchantFrame.Instance.SellItem(item.ref_WoWItem);
                        await CommonCoroutines.SleepForRandomUiInteractionTime();

                        await Coroutine.Yield();

                        if (!MerchantHelper.IsOpen)
                        {
                            break;
                        }
                    }

                    return(true);
                }

                //No vendor items found..
                return(false);
            }

            if (StyxWoW.Me.IsMoving)
            {
                await CommonCoroutines.StopMoving();
            }
            await CommonCoroutines.SleepForLagDuration();

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

            return(true);
        }
예제 #14
0
        // does nothing if no lures are in bag
        public async static Task <bool> Applylure()
        {
            if (StyxWoW.Me.IsCasting || IsLureOnPole)
            {
                return(false);
            }

            if (!LureRecastTimer.IsFinished)
            {
                return(false);
            }

            LureRecastTimer.Reset();
            var mainHand = StyxWoW.Me.Inventory.Equipped.MainHand;

            if (mainHand == null || mainHand.ItemInfo.WeaponClass != WoWItemWeaponClass.FishingPole)
            {
                return(false);
            }

            // Ancient Pandaren Fishing Charm
            WoWItem ancientPandarenFishingCharm = StyxWoW.Me.BagItems
                                                  .FirstOrDefault(r => r.Entry == AncientPandarenFishingCharmItemId);

            if (ancientPandarenFishingCharm != null && !StyxWoW.Me.HasAura(AncientPandarenFishingCharmAuraId))
            {
                AutoAnglerBot.Log("Appling Ancient Pandaren Fishing Charm lure");
                ancientPandarenFishingCharm.Use();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            // Fishing Hats
            WoWItem head = StyxWoW.Me.Inventory.Equipped.Head;

            if (head != null && Utility.FishingHatIds.Any(hat => hat == head.Entry && hat != 118393)) // Checking for Draenor tentacle hat
            {
                AutoAnglerBot.Log("Appling Fishing Hat lure to fishing pole");
                head.Use();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            foreach (var kv in Lures)
            {
                WoWItem lureInBag = Utility.GetItemInBag(kv.Key);
                if (lureInBag != null && lureInBag.Use())
                {
                    AutoAnglerBot.Log("Appling {0} to fishing pole", kv.Value);
                    await CommonCoroutines.SleepForLagDuration();

                    return(true);
                }
            }
            return(false);
        }
예제 #15
0
        private async Task MailItems(string recipient, string subject)
        {
            var lua = string.Format("SendMail ('{0}', '{1}' ,'');  ",
                                    recipient.ToFormatedUTF8(), subject.ToFormatedUTF8());

            PBLog.Debug("MailItem: Sending mail");
            Lua.DoString(lua);
            await CommonCoroutines.SleepForLagDuration();
        }
예제 #16
0
        private async Task AimAngle()
        {
            double angleAdjust = GetAimAdjustment();

            QBCLog.DeveloperInfo("(Aim Angle) adjusting current angle {0} by {1} to {2}", GetAimAngle(), angleAdjust, AIM_ANGLE);

            Lua.DoString("VehicleAimDecrement({0})", angleAdjust);

            await CommonCoroutines.SleepForLagDuration();
        }
예제 #17
0
        /// <summary>
        ///     (Non-Blocking) Attempts to face the specified target.
        /// </summary>
        /// <returns>Returns true if we are able to safely face the target</returns>
        public static async Task FaceTarget(WoWUnit target, Func <bool> conditionCheck = null)
        {
            if (conditionCheck != null && !conditionCheck())
            {
                return;
            }

            target.Face();
            await CommonCoroutines.SleepForLagDuration();
        }
예제 #18
0
        private async Task <bool> AimDirection()
        {
            const double normRotation = TRAMP_LEFT_SIDE > TRAMP_RIGHT_SIDE ? 0 : 360;

            QBCLog.DeveloperInfo("(AimRotation) Trampoline Boundary - Left Edge: {0}  Right Edge: {1}", TRAMP_LEFT_SIDE, TRAMP_RIGHT_SIDE);

            WoWMovement.MovementDirection whichWay;
            string dirCmd;

            // left/right - get current direction and turn until on trampoline
            if (Me.Transport.RotationDegrees < TRAMP_RIGHT_SIDE)
            {
                whichWay = WoWMovement.MovementDirection.TurnLeft;
                dirCmd   = "TurnLeft";
            }
            else if ((Me.Transport.RotationDegrees + normRotation) > (TRAMP_LEFT_SIDE + normRotation))
            {
                whichWay = WoWMovement.MovementDirection.TurnRight;
                dirCmd   = "TurnRight";
            }
            else // if (whichWay == WoWMovement.MovementDirection.None)
            {
                QBCLog.DeveloperInfo("(AimRotation) Done, Ending Rotation: {0}", Me.Transport.RotationDegrees);
                return(false);
            }

            QBCLog.DeveloperInfo("(AimRotation) Current Rotation: {0} - {1}", Me.Transport.RotationDegrees, whichWay.ToString().ToUpper());
#if WOWMOVEMENT_TIMED_TURNS_STOPFAILING
            WoWMovement.Move(whichWay, TimeSpan.FromMilliseconds(10));
            WoWMovement.MoveStop(whichWay);
            // loop until we actually move
            while (0.001 > (currRotation - Me.Transport.RotationDegrees))
            {
                await CommonCoroutines.SleepForLagDuration();
            }
#elif WOWMOVEMENT_TURNS_STOPFAILING
            WoWMovement.Move(whichWay);
            await Coroutine.Sleep(10);

            WoWMovement.MoveStop(whichWay);
            // loop until we actually move
            while (0.001 > (currRotation - Me.Transport.RotationDegrees))
            {
                await CommonCoroutines.SleepForLagDuration();
            }
#else
            // doing LUA calls these because WoWMovement API doesn't stop turning quickly enough
            Lua.DoString(dirCmd + "Start()");
            await Coroutine.Sleep(10);

            Lua.DoString(dirCmd + "Stop()");
#endif
            return(true);
        }
예제 #19
0
        /// <summary>Buys an item from the specified wow object.</summary>
        /// <param name="wowObject">The wow object. Navigates to <paramref name="searchLocation" /> null</param>
        /// <param name="searchLocation">The search location of <paramref name="wowObject" />.</param>
        /// <param name="itemId">The item identifier.</param>
        /// <param name="quantity">The quantity to buy.</param>
        /// <param name="movementBy">The movement type to use.</param>
        /// <param name="navigationFailedAction">
        ///     The action to take if <paramref name="wowObject" /> or
        ///     <paramref name="searchLocation" /> cant be navigated to
        /// </param>
        /// <param name="notFoundAction">
        ///     The action to take if
        ///     <paramref name="wowObject" /> is not found at
        ///     <paramref name="searchLocation" />.
        /// </param>
        /// <param name="noVendorFrameAction">
        ///     The action to take if interaction with
        ///     <paramref name="wowObject" /> didn't open a vendor frame.
        /// </param>
        /// <param name="itemNotFoundAction">The action to take if <paramref name="wowObject"/> does not offer <paramref name="itemId"/> </param>
        /// <param name="insufficientFundsAction">The action to take if toon doesn't have enough funds to buy <paramref name="itemId"/> </param>
        /// <returns></returns>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public static async Task <bool> BuyItem(
            WoWObject wowObject,
            Vector3 searchLocation,
            int itemId,
            int quantity,
            MovementByType movementBy      = MovementByType.FlightorPreferred,
            Action navigationFailedAction  = null,
            Action notFoundAction          = null,
            Action noVendorFrameAction     = null,
            Action itemNotFoundAction      = null,
            Action insufficientFundsAction = null)
        {
            if (!MerchantFrame.Instance.IsVisible)
            {
                return(await Gossip(
                           wowObject,
                           searchLocation,
                           movementBy,
                           navigationFailedAction,
                           notFoundAction,
                           null,
                           noVendorFrameAction,
                           GossipEntry.GossipEntryType.Vendor));
            }

            var item = MerchantFrame.Instance.GetAllMerchantItems().FirstOrDefault(i => i.ItemId == itemId);

            if (item == null)
            {
                if (itemNotFoundAction != null)
                {
                    itemNotFoundAction();
                }
                return(false);
            }

            if (!MerchantFrame.Instance.BuyItem(item.Index, quantity))
            {
                if (insufficientFundsAction != null)
                {
                    insufficientFundsAction();
                }
                return(false);
            }

            await CommonCoroutines.SleepForRandomUiInteractionTime();

            MerchantFrame.Instance.Close();
            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #20
0
        public static async Task <bool> MailItems()
        {
            WoWPoint mboxLoc = BotPoi.Current.Location;
            var      mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().
                               FirstOrDefault(
                m => m.SubType == WoWGameObjectType.Mailbox &&
                m.Location.Distance(mboxLoc) < 10);

            if (mailbox == null)
            {
                if (Me.Location.DistanceSqr(BotPoi.Current.Location) > 4 * 4)
                {
                    Flightor.MoveTo(BotPoi.Current.Location);
                    return(true);
                }

                var profile = ProfileManager.CurrentOuterProfile;
                if (profile != null)
                {
                    profile.MailboxManager.Blacklist.Add(BotPoi.Current.AsMailbox);
                }

                BotPoi.Clear(string.Format("Unable to find mailbox @ {0}", BotPoi.Current.Location));
                return(false);
            }
            if (!mailbox.WithinInteractRange)
            {
                return(await FlyTo(BotPoi.Current.Location));
            }

            if (!mailbox.WithinInteractRange)
            {
                return(await FlyTo(mailbox.Location, mailbox.SafeName));
            }

            if (!MailFrame.Instance.IsVisible)
            {
                mailbox.Interact();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            await Vendors.MailAllItemsCoroutine();

            Vendor ven = ProfileManager.CurrentOuterProfile.VendorManager.GetClosestVendor();

            BotPoi.Current = ven != null ? new BotPoi(ven, PoiType.Repair) : new BotPoi(PoiType.None);
            return(true);
        }
예제 #21
0
        private static async Task ClickGossipOption(GossipEntry gossipEntry, int gossipPage)
        {
            // Log the gossip option we're about to take...
            QBCLog.DeveloperInfo(
                "Selecting Gossip Option({0}) on page {1}: \"{2}\"",
                gossipEntry.Index + 1,
                gossipPage,
                gossipEntry.Text);

            GossipFrame.Instance.SelectGossipOption(gossipEntry.Index);
            await CommonCoroutines.SleepForLagDuration();

            await CommonCoroutines.SleepForRandomUiInteractionTime();
        }
예제 #22
0
        public async static Task <bool> EquipItem(WoWItem item, WoWInventorySlot slot)
        {
            if (!Utility.EquipItem(item, slot))
            {
                return(false);
            }
            await CommonCoroutines.SleepForLagDuration();

            if (!await Coroutine.Wait(4000, () => !item.IsDisabled))
            {
                return(false);
            }
            return(true);
        }
예제 #23
0
        private async Task DoQuest(WoWUnit hammer)
        {
            // make sure bot does not try to handle combat or anything else that can interrupt with quest behavior.
            LevelBot.BehaviorFlags &= ~(BehaviorFlags.Combat | BehaviorFlags.Loot | BehaviorFlags.FlightPath | BehaviorFlags.Vendor);

            if (hammer.DistanceSqr > 45 * 45)
            {
                Navigator.MoveTo(hammer.Location);
                await Coroutine.Sleep(100);
            }
            else
            {
                while (!StyxWoW.Me.QuestLog.GetQuestById(24817).IsCompleted&& StyxWoW.Me.IsAlive && Query.IsViable(hammer))
                {
                    if (StyxWoW.Me.CurrentTargetGuid != hammer.Guid)
                    {
                        hammer.Target();
                        await CommonCoroutines.SleepForLagDuration();

                        continue;
                    }

                    if (!StyxWoW.Me.IsSafelyFacing(hammer))
                    {
                        hammer.Face();
                        await Coroutine.Wait(2000, () => !Query.IsViable(hammer) || StyxWoW.Me.IsSafelyFacing(hammer));
                    }

                    try
                    {
                        WoWMovement.Move(WoWMovement.MovementDirection.Backwards);
                        await Coroutine.Sleep(200);
                    }
                    finally
                    {
                        WoWMovement.MoveStop(WoWMovement.MovementDirection.Backwards);
                    }

                    if (CastPetAction(3) || CastPetAction(2) || CastPetAction(1))
                    {
                        await CommonCoroutines.SleepForRandomReactionTime();
                    }

                    await Coroutine.Yield();

                    hammer = Hammer;
                }
            }
        }
예제 #24
0
        private async static Task <bool> CastLine()
        {
            if (!LineRecastTimer.IsFinished)
            {
                return(false);
            }
            LineRecastTimer.Reset();
            _castCounter++;
            SpellManager.Cast("Fishing");
            await CommonCoroutines.SleepForLagDuration();

            StyxWoW.ResetAfk();
            InactivityDetector.Reset();
            return(true);
        }
예제 #25
0
        /// <summary>
        ///     (Non-Blocking) Attempts to clear the player's current target.
        /// </summary>
        /// <returns>Returns true if we are able to clear the target</returns>
        public static async Task <bool> ClearMyDeadTarget()
        {
            if (MyCurrentTarget == null || !MyCurrentTarget.IsDead)
            {
                return(false);
            }
            Me.ClearTarget();
            Log.AppendLine(
                string.Format("Clearing dead target {0} [{1}]", MyCurrentTarget.SafeName, MyCurrentTarget.Guid),
                Colors.Bisque);

            await CommonCoroutines.SleepForLagDuration();

            return(false);
        }
예제 #26
0
        private async Task UseTalismanOfFlameAscendancy()
        {
            WoWItem item = ObjectManager.GetObjectsOfType <WoWItem>().FirstOrDefault(i => i != null && i.Entry == 54814);

            if (item == null)
            {
                QBCLog.Fatal("Quest item \"Talisman of Flame Ascendancy\" not in inventory.");
                TreeRoot.Stop();
                return;
            }

            Log("Use: {0}", item.SafeName);
            item.Use(true);
            await CommonCoroutines.SleepForLagDuration();
        }
예제 #27
0
        /// <summary>
        ///     (Non-Blocking) Attempts to use the specified item on the provided target.
        /// </summary>
        /// <returns>Returns true if the item was successfully used.</returns>
        public static async Task <bool> UseItem(WoWItem item, WoWUnit target)
        {
            if (item == null)
            {
                return(false);
            }

            item.Use(target.Guid);
            Log.Equipment(string.Format("Item ({0}) used on {1} [{2}]", item.SafeName, item.IsMe
                ? "Me"
                : target.SafeName, UnitManager.GuidToUnitId(target.Guid)));

            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }
예제 #28
0
        /// <summary>
        ///     Determines if the player's minions are being attacked and will attempt to target the enemy.
        /// </summary>
        public async Task <bool> CheckForMyMinionsBeingAttacked()
        {
            if (Me.Combat)
            {
                if (!_minionTimer.IsRunning)
                {
                    _minionTimer.Restart();
                }
                if (_minionTimer.ElapsedMilliseconds >= _minionTimerIntervalMs)
                {
                    if (Me.Minions != null && Me.Minions.Count > 0)
                    {
                        if (Me.CurrentTarget == null || Me.Minions.Any(o => o == Me.CurrentTarget))
                        {
                            foreach (var minion in Me.Minions)
                            {
                                if (!minion.IsDead && minion.CurrentTarget != null && minion.CurrentTarget.Attackable)
                                {
                                    _minionTimer.Restart();

                                    Log.AppendLine(
                                        string.Format("Switched to target attacking my minion: {0} [{1}]",
                                                      minion.CurrentTarget.SafeName, GuidToUnitId(minion.CurrentTarget.Guid)),
                                        Colors.HotPink);

                                    minion.CurrentTarget.Target();
                                    BotPoi.Current = new BotPoi(minion.CurrentTarget, PoiType.Kill);

                                    await CommonCoroutines.SleepForLagDuration();

                                    return(true);
                                }
                            }
                        }
                    }

                    _minionTimer.Restart();
                }
            }
            else
            {
                _minionTimer.Reset();
            }

            return(false);
        }
예제 #29
0
        public static async Task <bool> VendorItems()
        {
            Vendor  ven    = BotPoi.Current.AsVendor;
            WoWUnit vendor = ObjectManager.GetObjectsOfType <WoWUnit>().
                             FirstOrDefault(m => m.Entry == ven.Entry || m.Entry == ven.Entry2);

            if (vendor == null)
            {
                if (Me.Location.DistanceSqr(BotPoi.Current.Location) > 4 * 4)
                {
                    return(await FlyTo(BotPoi.Current.Location, "Vendor"));
                }

                // just wait at location, maybe vendor got killed by opposite faction
                return(true);
            }


            if (!vendor.WithinInteractRange)
            {
                return(await FlyTo(vendor.Location, vendor.SafeName));
            }

            if (!MerchantFrame.Instance.IsVisible)
            {
                vendor.Interact();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            // sell all poor and common items not in protected Items list.
            List <WoWItem> itemList = StyxWoW.Me.BagItems.Where(
                i => !ProtectedItemsManager.Contains(i.Entry) &&
                !i.IsSoulbound && !i.IsConjured &&
                (i.Quality == WoWItemQuality.Poor || i.Quality == WoWItemQuality.Common)).ToList();

            foreach (var item in itemList)
            {
                item.UseContainerItem();
                await Coroutine.Sleep(Utility.Rnd.Next(200, 500));
            }
            MerchantFrame.Instance.RepairAllItems();
            BotPoi.Current = new BotPoi(PoiType.None);
            return(true);
        }
예제 #30
0
        public async Task <bool> HotkeysMethod()
        {
            // TODO unify methods
            // TODO hotkey for steed

            if (Globals.ActivateBurst)
            {
                Helpers.Logger.PrintLog("Cooldown Hotkey: activating");
                return(await BurstMethod());
            }

            if (Globals.ActivateDivineSteed)
            {
                if (SpellManager.GlobalCooldown)
                {
                    return(true);
                }

                Globals.ActivateDivineSteed = false;
                return(await DivineSteed.Cast(StyxWoW.Me));
            }

            if (SpellBooks.Global.Hotkeys.HoJCheck(HammerOfJustice))
            {
                if (SpellManager.GlobalCooldown)
                {
                    return(true);
                }

                // Cast spell and set bool back to false
                // If it doesn't cast, return true for the tree to repeat
                if (!await HammerOfJustice.Cast(Globals.HoJTarget))
                {
                    return(true);
                }

                Helpers.Logger.PrintLog("HoJ Hotkey on {0}", Globals.HoJTarget.SafeName);
                Globals.HoJTarget = null;
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            return(false);
        }