コード例 #1
0
        public CatFormPowerShiftAbility()
            : base(WoWSpell.FromId(SpellBook.CatForm))
        {
            Category = AbilityCategory.Buff;

            // No conditions.
        }
コード例 #2
0
ファイル: Premed.cs プロジェクト: Joshuahelmle/BotA
 public Premed()
     : base(WoWSpell.FromId(SpellBook.CastPremed), true, true)
 {
     Category = AbilityCategory.Combat;
     Conditions.Add(new BooleanCondition(Me.ComboPoints <= 4));
     Conditions.Add(new ImStealthedCondition());
 }
コード例 #3
0
        public HealingTouchMyAllyAbility()
            : base(WoWSpell.FromId(SpellBook.HealingTouch))
        {
            Category = AbilityCategory.Heal;

            RequiredConditions.Add(new TargetDoesNotHaveAuraCondition(TargetType.Me, SpellBook.Prowl));
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: HolyPaladinBrain.cs プロジェクト: Fernir/cleanLayer
 protected override void OnBeforeAction(ActionBase action)
 {
     if (WoWParty.NumPartyMembers > 0 && HelpfulTarget.IsValid && HelpfulTarget.HealthPercentage > 60)
     {
         var tank = HelpfulTargets.OrderByDescending(m => m.MaxHealth).First() ?? WoWPlayer.Invalid;
         if (tank.IsValid && !tank.IsDead && tank.Distance < Globals.MaxDistance)
         {
             var beacon = WoWSpell.GetSpell("Beacon of Light");
             if (beacon.IsValid &&
                 beacon.IsReady &&
                 !tank.Auras["Beacon of Light"].IsValid)
             {
                 Log.WriteLine("Casting {0} on {1}", beacon.Name, tank.Name);
                 beacon.Cast(tank);
                 Sleep(Globals.SpellWait);
             }
         }
     }
     if (action != null)
     {
         var aw = WoWSpell.GetSpell("Avenging Wrath");
         if (aw.IsValid && aw.IsReady)
         {
             Log.WriteLine("Popping {0}", aw.Name);
             aw.Cast();
             Sleep(Globals.SpellWait);
         }
     }
 }
コード例 #7
0
        static public Composite Cast(int spellId, CanRunDecoratorDelegate cond, WoWUnitDelegate target)
        {
            return(new Decorator(ret => target != null && cond(ret) && CanCast(spellId),
                                 new Action(ret =>
            {
                SpellManager.Cast(spellId, target(ret));
                Logging.Write(LogLevel.Diagnostic, Colors.White, "" + WoWSpell.FromId(spellId).Name);
                string temp;
                if (target(ret).IsPlayer)
                {
                    temp = "Casting " + WoWSpell.FromId(spellId).Name + " on Player at " +
                           Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                           Rogue.mCurrentEnergy + " energy";
                }
                else
                {
                    temp = "Casting " + WoWSpell.FromId(spellId).Name + " on " + target(ret).Name + " at " +
                           Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                           Rogue.mCurrentEnergy + " energy";
                }

                Logging.Write(LogLevel.Normal, temp);
            }
                                            )
                                 ));
        }
コード例 #8
0
ファイル: ShadowReflection.cs プロジェクト: Joshuahelmle/BotA
 public override async Task <bool> CastOnTarget(WoWUnit target)
 {
     Conditions.Clear();
     if (MustWaitForGlobalCooldown)
     {
         Conditions.Add(new IsOffGlobalCooldownCondition());
     }
     if (MustWaitForSpellCooldown)
     {
         Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
     }
     Conditions.Add(new BooleanCondition(SettingsManager.Instance.UseShadowReflection));
     Conditions.Add(new BooleanCondition(target != null));
     Conditions.Add(new InMeeleRangeCondition(target));
     Conditions.Add(new ConditionSwitchTester(
                        new BooleanCondition(Me.Specialization == Styx.WoWSpec.RogueSubtlety),
                        new ConditionAndList(
                            new CoolDownLeftMaxCondition(WoWSpell.FromId(SpellBook.AuraShadowDance), System.TimeSpan.FromSeconds(1)),
                            new TargetAuraUpCondition(Me, WoWSpell.FromId(SpellBook.CastSliceNDice))), // <-- If in Subtlety Specc
                        new ConditionSwitchTester(
                            new BooleanCondition(Me.Specialization == Styx.WoWSpec.RogueAssassination),
                            new TargetAuraUpCondition(target, WoWSpell.FromId(SpellBook.CastRupture)) // <-- If in AssaSpecc
                            )                                                                         // Add Combat here
                        ));
     Conditions.Add(new ConditionSwitchTester(
                        new BooleanCondition(SettingsManager.Instance.ShadowReflectionOnlyOnBoss),
                        new OnlyOnBossCondition()));
     return(await base.CastOnTarget(target));
 }
コード例 #9
0
        private int GetMaxRepeat(WoWSpell recipe)
        {
            int maxRepeat     = int.MaxValue;
            var spellReagents = recipe.InternalInfo.SpellReagents;

            if (!spellReagents.HasValue)
            {
                return(maxRepeat);
            }

            for (int index = 0; index < spellReagents.Value.Reagent.Length; index++)
            {
                var reagent = spellReagents.Value.Reagent[index];
                if (reagent == 0)
                {
                    continue;
                }
                var required = spellReagents.Value.ReagentCount[index];
                if (required <= 0)
                {
                    continue;
                }
                var numInBags = StyxWoW.Me.BagItems.Sum(i => i != null && i.IsValid && i.Entry == reagent ? i.StackCount : 0);
                var repeatNum = (int)(numInBags / required);
                if (repeatNum < maxRepeat)
                {
                    maxRepeat = repeatNum;
                }
            }
            return(maxRepeat);
        }
コード例 #10
0
        public override void OnStart()
        {
            var skillLine = (SkillLine)TradeSkillId;

            if (!Enum.GetValues(typeof(SkillLine)).Cast <SkillLine>().Contains(skillLine))
            {
                QBCLog.ProfileError("TradeSkillId {0} is not a valid tradeskill Id.", TradeSkillId);
            }

            // special case for Runeforging since it's not considered a profession.
            _recipeSpell = skillLine == SkillLine.Runeforging
                ? WoWSpell.FromId(TradeSkillItemId)
                : GetRecipeSpell(TradeSkillItemId);

            if (_recipeSpell == null || !_recipeSpell.IsValid)
            {
                QBCLog.ProfileError("TradeSkillItemId {0} is not a valid Item or Spell Id.", TradeSkillId);
            }
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // If the quest is complete, this behavior is already done...
            // So we don't want to falsely inform the user of things that will be skipped.
            if (!IsDone)
            {
                this.UpdateGoalText(QuestId);
            }
        }
コード例 #11
0
ファイル: WrathAbility.cs プロジェクト: Lbniese/PawsPremium
 public WrathAbility()
     : base(WoWSpell.FromId(SpellBook.Wrath))
 {
     Conditions.Add(new MeHasAttackableTargetCondition());
     Conditions.Add(new MeIsFacingTargetCondition());
     Conditions.Add(new MyTargetDistanceCondition(0, 38));
 }
コード例 #12
0
        private void update()
        {
            var spellId   = spellid_input.Value;
            var spellname = spellname_txt.Text;

            CurrentEclipse_lbl.Text   = StyxWoW.Me.CurrentEclipse.ToString(CultureInfo.InvariantCulture);
            ChanneledSpellID_lbl.Text = StyxWoW.Me.ChanneledCastingSpellId.ToString(CultureInfo.InvariantCulture);

            WoWSpell spell;

            SpellManager.Spells.TryGetValue(spellname, out spell);
            // Fishing for KeyNotFoundException's yay!
            if (spell != null)
            {
                spellId = spell.Id;
            }

            WoWSpell test = WoWSpell.FromId((int)spellId);

            // populate values
            if (test != null)
            {
                spellid_lbl.Text              = test.Id.ToString(CultureInfo.InvariantCulture);
                smHasSpell_lbl.Text           = SpellManager.HasSpell(test).ToString(CultureInfo.InvariantCulture);
                smCanCast_lbl.Text            = SpellManager.CanCast(test).ToString(CultureInfo.InvariantCulture);
                spellname_lbl.Text            = test.Name;
                spellCancast_lbl.Text         = test.CanCast.ToString(CultureInfo.InvariantCulture);
                smIsValid_lbl.Text            = test.IsValid.ToString(CultureInfo.InvariantCulture);
                smCooldownTimeLeftid_lbl.Text = test.CooldownTimeLeft.ToString();
                smCooldownid_lbl.Text         = test.Cooldown.ToString(CultureInfo.InvariantCulture);
                smCooldownTimeLeft_lbl.Text   = SpellManager.Spells[spellname].CooldownTimeLeft.ToString();
            }
        }
コード例 #13
0
        private static void CastDeathgate()
        {
            if (s_Me.IsCasting || s_Me.IsChanneling || s_Me.IsMoving)
            {
                return;
            }

            var deathGateRemainingCooldown = WoWSpell.FromId(DeathgateId).CooldownTimeLeft.Seconds;

            if (!WoWSpell.FromId(DeathgateId).Cooldown)
            {
                if (!SpellManager.CanCast(DeathgateId))
                {
                    return;
                }

                SpellManager.Cast(DeathgateId);
            }
            else
            {
                if (deathGateRemainingCooldown > 0 && deathGateRemainingCooldown < 45)
                {
                    QBCLog.Info("Waiting for Death Gate to get off cooldown. {0} seconds remaining.", deathGateRemainingCooldown);
                }
            }
        }
コード例 #14
0
ファイル: StealthAbility.cs プロジェクト: Joshuahelmle/BotA
 public StealthAbility() : base(WoWSpell.FromId(SpellBook.CastStealth), true, true)
 {
     base.Category = AbilityCategory.Buff;
     base.Conditions.Add(new TargetNotAuraUpCondition(Me, WoWSpell.FromId(SpellBook.AuraStealth)));
     base.Conditions.Add(new ImNotStealthedCondition());
     base.Conditions.Add(new BooleanCondition(SettingsManager.Instance.AlwaysStealth));
 }
コード例 #15
0
 public RacialsBloodElfAbility()
     : base(WoWSpell.FromId(SpellBook.RacialBloodElfArcaneTorrent), false, true)
 {
     base.Category = AbilityCategory.Buff;
     base.Conditions.Add(new BooleanCondition(SettingsManager.Instance.UseBloodElfRacial));
     base.Conditions.Add(new IsRaceCondition(WoWRace.BloodElf));
 }
コード例 #16
0
ファイル: CombatBuff.cs プロジェクト: Joshuahelmle/BotA
 private static async Task <bool> UseRacialToClearLoC()
 {
     if (Main.Debug)
     {
         Log.Diagnostics("In UseRacialToClearLoc() call");
     }
     if (!_locDelay.IsRunning)
     {
         _locDelay.Start();
         return(false);
     }
     if (_locDelay.ElapsedMilliseconds > SettingsManager.Instance.LoCDelay)
     {
         if (WoWSpell.FromId(SpellBook.RacialHumanEveryManForHimself).CooldownTimeLeft.TotalMilliseconds == 0)
         {
             if (await Abilities.Cast <Shared.Racials.RacialHumanAbility>(Me))
             {
                 _locDelay.Reset();
                 return(true);
             }
         }
         else
         {
             Log.Diagnostics("Human Racial is on Cooldown.");
         }
         return(true);
     }
     return(true);
 }
コード例 #17
0
        public static bool Cast2(int Spell, System.Windows.Media.Color newColor, bool reqs = true, string addLog = "", bool sleep = true)
        {
            //if (Spell == Helpers.Spell_Book.Glide)
            //{
            //    L.debugLog("Glide: " + reqs.ToString());
            //}

            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;
            L.combatLog("^" + WoWSpell.FromId(Spell).Name + (String.IsNullOrEmpty(addLog) || !GeneralSettings.Instance.GeneralDebug ? "" : " - " + addLog), newColor);

            return(true);
        }
コード例 #18
0
ファイル: PetManager.cs プロジェクト: jaydeshow/CLU
        /// <summary>Returns a summoned pet</summary>
        /// <param name="nameID">the id of the spell</param>
        /// <param name="cond">The conditions that must be true</param>
        /// <param name="label">A descriptive label for the clients GUI logging output</param>
        /// <returns>The cast pet summon spell.</returns>
        public static Composite CastPetSummonSpell(int nameID, CanRunDecoratorDelegate cond, string label)
        {
            WoWSpell summonPet = WoWSpell.FromId(nameID);

            if (summonPet.CastTime > 0)
            {
                Spell.KnownChanneledSpells.Add(summonPet.Name);
            }

            return(new Decorator(
                       delegate(object a)
            {
                if (!cond(a))
                {
                    return false;
                }

                if (!Spell.CanCast(summonPet.ToString()))
                {
                    return false;
                }

                return true;
            },
                       new Decorator(ret => !Me.GotAlivePet && PetTimer.IsFinished,
                                     new Sequence(
                                         new Action(a => CLULogger.Log(" {0}", label)),
                                         new Action(a => SpellManager.Cast(summonPet)),
                                         Spell.CreateWaitForLagDuration(),
                                         new Wait(5, a => Me.GotAlivePet || !Me.IsCasting,
                                                  new PrioritySelector(
                                                      new Decorator(a => StyxWoW.Me.IsCasting, new Action(ret => SpellManager.StopCasting())),
                                                      new ActionAlwaysSucceed()))))));
        }
コード例 #19
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);
        }
コード例 #20
0
 public ForceOfNatureAbility()
     : base(WoWSpell.FromId(SpellBook.ForceOfNature), true, true)
 {
     RequiredConditions.Add(new MeHasAttackableTargetCondition());
     RequiredConditions.Add(new TargetDoesNotHaveAuraCondition(TargetType.Me, SpellBook.Prowl));
     RequiredConditions.Add(new MyTargetDistanceCondition(0, 10));
 }
コード例 #21
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);
        }
コード例 #22
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);
        }
コード例 #23
0
        /// <summary>
        /// <para>The default declaration defines an instant use ability that is on the GCD</para>
        /// <para>mustWaitForGlobalCooldown = true</para>
        /// <para>mustWaitForSpellCooldown = false</para>
        /// </summary>
        public AbilityBase(WoWSpell spell, bool mustWaitForGlobalCooldown = true, bool mustWaitForSpellCooldown = false)
        {
            this.Category   = AbilityCategory.Normal;
            this.DrCategory = DrCategory.None;

            if (spell == null)
            {
                throw new AbilityException("Spell cannot be null");
            }

            this.Spell = spell;

            MustWaitForGlobalCooldown = mustWaitForGlobalCooldown;
            MustWaitForSpellCooldown  = mustWaitForSpellCooldown;

            this.Conditions = new List <ICondition>();

            if (MustWaitForGlobalCooldown)
            {
                this.Conditions.Add(new IsOffGlobalCooldownCondition());
            }
            if (MustWaitForSpellCooldown)
            {
                this.Conditions.Add(new SpellIsNotOnCooldownCondition(this.Spell));
            }
            if (Category == AbilityCategory.Combat)
            {
                this.Conditions.Add(new InMeeleRangeCondition());
            }
        }
コード例 #24
0
ファイル: Trinket.cs プロジェクト: rhoninsk/novas-addons
        public static void Pulse()
        {
            // Loop threw each of our
            foreach (KeyValuePair <String, WoWAura> entry in StyxWoW.Me.ActiveAuras)
            {
                // Create our spell that is on us so we can use it
                WoWSpell Spell = WoWSpell.FromId(entry.Value.SpellId);

                // Anything Blacklisted contine;
                if (lIgnore.Contains(Spell.Name))
                {
                    continue;
                }

                // if theres something we need to trinket, lets do it
                if (lTrinket.Contains(Spell.Mechanic) || lBlacklist.Contains(Spell.Name))
                {
                    if (entry.Value.TimeLeft.Seconds >= 3)
                    {
                        Log.WriteDebug("Trinketing - Name: {0}  Timeleft: {1}", Spell.Name, entry.Value.TimeLeft);
                        UseTrinket();
                    }
                }
            }
        }
コード例 #25
0
        public CatFormAbility()
            : base(WoWSpell.FromId(SpellBook.CatForm))
        {
            Category = AbilityCategory.Buff;

            RequiredConditions.Add(new MeIsNotInCatFormCondition());
        }
コード例 #26
0
ファイル: Dispatch.cs プロジェクト: Joshuahelmle/BotA
 public override async Task <bool> CastOnTarget(WoWUnit target)
 {
     Conditions.Clear();
     if (MustWaitForGlobalCooldown)
     {
         Conditions.Add(new IsOffGlobalCooldownCondition());
     }
     if (MustWaitForSpellCooldown)
     {
         Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
     }
     Conditions.Add(new BooleanCondition(target != null));
     Conditions.Add(new InMeeleRangeCondition(target));
     Conditions.Add(Energy);
     Conditions.Add(new ConditionOrList(
                        new TargetIsInHealthRangeCondition(target, 0, 35),
                        new ConditionAndList(
                            new TargetAuraUpCondition(Me, WoWSpell.FromId(SpellBook.AuraBlindside)),
                            new ConditionOrList(
                                new TargetAuraUpCondition(Me, WoWSpell.FromId(SpellBook.CastEnvenom)),
                                new AuraMaxRemaningTimeCondition(TimeSpan.FromSeconds(1), WoWSpell.FromId(SpellBook.AuraBlindside), Me))
                            )));
     Conditions.Add(new ConditionSwitchTester(
                        new BooleanCondition(SettingsManager.Instance.T184PEnabled),
                        new WillNotCapComboPointsCondition(3),
                        new WillNotCapComboPointsCondition(1)));
     return(await base.CastOnTarget(target));
 }
コード例 #27
0
 public WarStompAbility()
     : base(WoWSpell.FromId(SpellBook.TaurenRacialWarStomp), true, true)
 {
     RequiredConditions.Add(new MeHasAttackableTargetCondition());
     RequiredConditions.Add(new MeIsFacingTargetCondition());
     RequiredConditions.Add(new TargetDoesNotHaveAuraCondition(TargetType.Me, SpellBook.Prowl));
 }
コード例 #28
0
ファイル: VanishOffensive.cs プロジェクト: Joshuahelmle/BotA
        public override async Task <bool> CastOnTarget(WoWUnit target)
        {
            Conditions.Clear();
            if (MustWaitForGlobalCooldown)
            {
                Conditions.Add(new IsOffGlobalCooldownCondition());
            }
            if (MustWaitForSpellCooldown)
            {
                Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
            }
            Conditions.Add(new BooleanCondition(target != null));
            Conditions.Add(new InMeeleRangeCondition(target));
            Conditions.Add(new BooleanCondition(Me.AuraStacks(SpellBook.AuraAnticipation) <= 1));
            Conditions.Add(new ConditionSwitchTester(
                               new BooleanCondition(SettingsManager.Instance.OffensiveVanishOnlyOnBoss),
                               new OnlyOnBossCondition()));
            Conditions.Add(new BooleanCondition(SettingsManager.Instance.UseVanish));
            //  t18 bonus! add if you got t18
            Conditions.Add(new ConditionSwitchTester(
                               new BooleanCondition(SettingsManager.Instance.T184PEnabled),
                               new ConditionAndList(
                                   new TargetNotAuraUpCondition(Me, WoWSpell.FromId(SpellBook.AuraDeathlyShadows)),
                                   new ConditionOrList(
                                       new CoolDownLeftMaxCondition(WoWSpell.FromId(SpellBook.AuraShadowDance), System.TimeSpan.FromSeconds(1)),
                                       new CoolDownLeftMinCondition(WoWSpell.FromId(SpellBook.AuraShadowDance), System.TimeSpan.FromSeconds(7)))),
                               new ConditionAndList(
                                   new ImNotStealthedCondition(),
                                   new TargetNotAuraUpCondition(target, WoWSpell.FromId(SpellBook.AuraFindWeakness)))));

            return(await base.CastOnTarget(target));
        }
コード例 #29
0
 public RacialOrcBloodFuryAbility()
     : base(WoWSpell.FromId(SpellBook.RacialOrcBloodFury), false, true)
 {
     base.Category = AbilityCategory.Buff;
     base.Conditions.Add(new BooleanCondition(SettingsManager.Instance.UseOrcRacial));
     base.Conditions.Add(new IsRaceCondition(WoWRace.Orc));
 }
コード例 #30
0
        public SavageRoarAbility()
            : base(WoWSpell.FromId(SpellBook.SavageRoar))
        {
            Category = AbilityCategory.Buff;

            RequiredConditions.Add(new MeIsInCatFormCondition());
        }
コード例 #31
0
        protected MeleeFeralAbilityBase(WoWSpell spell, bool savageRoarCheck)
            : base(spell)
        {
            SavageRoarCheck = savageRoarCheck;

            RequiredConditions.Add(new MeHasAttackableTargetCondition());
            RequiredConditions.Add(new MeIsFacingTargetCondition());
            RequiredConditions.Add(new MeIsInCatFormCondition());
            RequiredConditions.Add(new MyTargetIsWithinMeleeRangeCondition());
        }
コード例 #32
0
ファイル: CrowdControl.cs プロジェクト: Asphodan/Alphabuddy
 /// <summary>
 /// Returns true if the movement imparing effects are breakable via a usable spell
 /// </summary>
 /// <param name="spell">The spell to check for</param>
 /// <returns>True if we should use the spell</returns>
 private static bool freeMeSpellUsage(WoWSpell spell)
 {
     if (spell != null)
     {
         switch (spell.Name)
         {
             case "Berserker Rage":
                 return StyxWoW.Me.GetAllAuras().Any(a => a.Spell.Mechanic == WoWSpellMechanic.Fleeing || a.Spell.Mechanic == WoWSpellMechanic.Sapped || a.Spell.Mechanic == WoWSpellMechanic.Incapacitated);
             default:
                 return false;
         }
     }
     return false;
 }
コード例 #33
0
ファイル: AbilityBase.cs プロジェクト: Lbniese/PawsPremium
        /// <summary>
        ///     <para>The default declaration defines an instant use ability that is on the GCD</para>
        ///     <para>mustWaitForGlobalCooldown = true</para>
        ///     <para>mustWaitForSpellCooldown = false</para>
        /// </summary>
        protected AbilityBase(WoWSpell spell, bool mustWaitForGlobalCooldown = true, bool mustWaitForSpellCooldown = false)
        {
            Category = AbilityCategory.Normal;

            if (spell == null)
                throw new AbilityException("Spell cannot be null");

            Spell = spell;

            MustWaitForGlobalCooldown = mustWaitForGlobalCooldown;
            MustWaitForSpellCooldown = mustWaitForSpellCooldown;

            Conditions = new List<ICondition>();
            RequiredConditions = new List<ICondition>();
        }
コード例 #34
0
ファイル: AbilityBase.cs プロジェクト: Joshuahelmle/BotA
        /// <summary>
        /// <para>The default declaration defines an instant use ability that is on the GCD</para>
        /// <para>mustWaitForGlobalCooldown = true</para>
        /// <para>mustWaitForSpellCooldown = false</para>
        /// </summary>
        public AbilityBase(WoWSpell spell, bool mustWaitForGlobalCooldown = true, bool mustWaitForSpellCooldown = false)
        {
            this.Category = AbilityCategory.Normal;
            this.DrCategory = DrCategory.None;

            if (spell == null)
                throw new AbilityException("Spell cannot be null");

            this.Spell = spell;

            MustWaitForGlobalCooldown = mustWaitForGlobalCooldown;
            MustWaitForSpellCooldown = mustWaitForSpellCooldown;

            this.Conditions = new List<ICondition>();

            if (MustWaitForGlobalCooldown) this.Conditions.Add(new IsOffGlobalCooldownCondition());
            if (MustWaitForSpellCooldown) this.Conditions.Add(new SpellIsNotOnCooldownCondition(this.Spell));
            if(Category == AbilityCategory.Combat)
            this.Conditions.Add(new InMeeleRangeCondition());
        }
コード例 #35
0
ファイル: Racials.cs プロジェクト: Asphodan/Alphabuddy
        /// <summary>
        /// Returns true if the racials conditions are met
        /// </summary>
        /// <param name="racial">the racial to check for</param>
        /// <returns>true if we can use the racial</returns>
        private static bool RacialUsageSatisfied(WoWSpell racial)
        {
            if (racial != null)
            {
                switch (racial.Name)
                {
                    case "Stoneform":
                        return StyxWoW.Me.GetAllAuras().Any(a => a.Spell.Mechanic == WoWSpellMechanic.Bleeding || a.Spell.DispelType == WoWDispelType.Disease || a.Spell.DispelType == WoWDispelType.Poison);
                    case "Escape Artist":
                        return StyxWoW.Me.Rooted;
                    case "Every Man for Himself":
                        return Unit.UnitIsControlled(StyxWoW.Me,false);
                    case "Shadowmeld":
                        return false;
                    case "Gift of the Naaru":
                        return StyxWoW.Me.HealthPercent <= 80;
                    case "Darkflight":
                        return false;
                    case "Blood Fury":
                        return true;
                    case "War Stomp":
                        return false;
                    case "Berserking":
                        return true;
                    case "Will of the Forsaken":
                        return Unit.UnitIsControlled(StyxWoW.Me, false);
                    case "Cannibalize":
                        return false;
                    case "Arcane Torrent":
                        return StyxWoW.Me.ManaPercent < 91 && StyxWoW.Me.Class != WoWClass.DeathKnight;
                    case "Rocket Barrage":
                        return true;

                    default:
                        return false;
                }
            }

            return false;
        }
コード例 #36
0
ファイル: Spell.cs プロジェクト: aash/Singular
        /// <summary>
        /// checked if the spell has an instant cast, the spell is one which can be cast while moving, or we have an aura active which allows moving without interrupting casting.  
        /// does not check whether you are presently moving, only whether you could cast if you are moving
        /// </summary>
        /// <param name="spell">spell to cast</param>
        /// <returns>true if spell can be cast while moving, false if it cannot</returns>
        private static bool AllowMovingWhileCasting(WoWSpell spell)
        {
            // quick return for instant spells
            if (spell.IsInstantCast() && !spell.IsChanneled)
            {
                if (SingularSettings.DebugSpellCasting)
                    Logger.WriteFile( "MoveWhileCasting[{0}]: true, since instant cast and not a funnel spell", spell.Name );
                return true;
            }

            // assume we cant move, but check for class specific buffs which allow movement while casting
            bool allowMovingWhileCasting = false;
            if (Me.Class == WoWClass.Shaman)
                allowMovingWhileCasting = spell.Name == "Lightning Bolt";
            else if (TalentManager.CurrentSpec == WoWSpec.MageFire)
                allowMovingWhileCasting = spell.Name == "Scorch";
            else if (Me.Class == WoWClass.Hunter)
                allowMovingWhileCasting = spell.Name == "Steady Shot" || (spell.Name == "Aimed Shot" && TalentManager.HasGlyph("Aimed Shot")) || spell.Name == "Cobra Shot";
            else if (Me.Class == WoWClass.Warlock)
                allowMovingWhileCasting = (spell.Name == "Incinerate" || spell.Name == "Malefic Grasp" || spell.Name == "Shadow Bolt") && ClassSpecific.Warlock.Common.HasTalent(ClassSpecific.Warlock.WarlockTalents.KiljaedensCunning);

            //            if (!allowMovingWhileCasting && Me.ZoneId == 5723)
            //                allowMovingWhileCasting = Me.HasAura("Molten Feather");

            if (!allowMovingWhileCasting)
            {
                allowMovingWhileCasting = HaveAllowMovingWhileCastingAura(spell);

                // we will atleast check spell cooldown... we may still end up wasting buff, but this reduces the chance
                if (!allowMovingWhileCasting && spell.CooldownTimeLeft == TimeSpan.Zero )
                {
                    bool castSuccess = CastBuffToAllowCastingWhileMoving();
                    if (castSuccess)
                        allowMovingWhileCasting = HaveAllowMovingWhileCastingAura();
                }
            }

            return allowMovingWhileCasting;
        }
コード例 #37
0
 /// <summary>
 ///     <para>Defines an instant use ability that is on the GCD</para>
 ///     <para>mustWaitForGlobalCooldown = true</para>
 ///     <para>mustWaitForSpellCooldown = false</para>
 /// </summary>
 public PandemicAbilityBase(WoWSpell spell, bool mustWaitForGlobalCooldown = true,
     bool mustWaitForSpellCooldown = false)
     : base(spell, mustWaitForGlobalCooldown, mustWaitForSpellCooldown)
 {
     PandemicConditions = new List<ICondition>();
 }
コード例 #38
0
 public MeDoesNotKnowSpellCondition(WoWSpell spell)
 {
     Spell = spell;
 }
コード例 #39
0
ファイル: Spell.cs プロジェクト: aash/Singular
        public static bool CanCastHackHaveEnoughPower(WoWSpell spell, WoWUnit unit)
        {
#if USE_LUA_POWERCHECK
            string usablecmd = string.Format("return IsUsableSpell(\"{0}\")", spell.Name);
            List<string> ret = Lua.GetReturnValues(usablecmd);
            if ( ret == null || !ret.Any())
            {
                if (SingularSettings.DebugSpellCanCast)
                    Logger.WriteFile( "CanCast[{0}]: IsUsable check failed with null", spell.Name);
                return false;
            }

            if (ret[0] != "1")
            {
                if (SingularSettings.DebugSpellCanCast)
                {
                    uint currentPower = Me.CurrentPower;
                    string ptype = Me.PowerType.ToString();

                    if (Me.Class == WoWClass.Druid)
                    {
                        if (Me.Shapeshift == ShapeshiftForm.Cat || Me.Shapeshift == ShapeshiftForm.Bear || Me.Shapeshift == ShapeshiftForm.DireBear)
                        {
                            if (Me.HealingSpellIds.Contains(spell.Id))
                            {
                                ptype = "Mana";
                                currentPower = Me.CurrentMana;
                            }
                            else if (spell.PowerCost >= 100)
                            {
                                ptype = "Mana";
                                currentPower = Me.CurrentMana;
                            }
                        }
                    }
                    
                    if (ret.Count() > 1 && ret[1] == "1")
                        Logger.WriteFile( "CanCast[{0}]: insufficient power ({1} cost={2} have={3})", spell.Name, ptype, spell.PowerCost, currentPower);
                    else
                        Logger.WriteFile( "CanCast[{0}]: not usable atm ({1} cost={2} have={3})", spell.Name, ptype, spell.PowerCost, currentPower);
                }

                return false;
            }

#elif PRE_WOD
            bool formSwitch = false;
            uint currentPower = Me.CurrentPower;
            if (Me.Class == WoWClass.Druid)
            {
                if (Me.Shapeshift == ShapeshiftForm.Cat || Me.Shapeshift == ShapeshiftForm.Bear || Me.Shapeshift == ShapeshiftForm.DireBear)
                {
                    if (spell.IsHeal())
                    {
                        formSwitch = true;
                        currentPower = Me.CurrentMana;
                    }
                    else if (spell.PowerCost >= 100)
                    {
                        formSwitch = true;
                        currentPower = Me.CurrentMana;
                    }
                }
            }

            if (currentPower < (uint)spell.PowerCost)
            {
                if (SingularSettings.DebugSpellCasting)
                    Logger.WriteFile( "CanCast[{0}]: insufficient power (need {1:F0}, have {2:F0} {3})", spell.Name, spell.PowerCost, currentPower, formSwitch ? "Mana in Form" : Me.PowerType.ToString());
                return false;
            }
#else
            if (!spell.CanCast)
            {
                return false;
            }
#endif
            return true;
        }
コード例 #40
0
ファイル: HBApi.cs プロジェクト: aash/GarrisonButler
        /// <summary>
        /// Safe spell casting. Wait for it to be done or if anything wrong happened return failed. 
        /// </summary>
        /// <param name="spell"></param>
        /// <returns></returns>
        internal static async Task<ActionResult> CastSpell(WoWSpell spell)
        {
            if (Me.Mounted)
            {
                await CommonCoroutines.Dismount("Dismounting to cast " + spell.Name + ".");
                await CommonCoroutines.SleepForLagDuration();
            }

            if (Me.IsMoving)
            {
                WoWMovement.MoveStop();
                await CommonCoroutines.SleepForLagDuration();
            }

            if (Me.IsCasting)
            {
                GarrisonButler.Diagnostic("Error casting {0}, already casting at the moment.", spell.Name);
                return ActionResult.Failed;
            }

            try
            {
                spell.Cast();
                await CommonCoroutines.SleepForLagDuration();
                var timeOutLimit = (int) spell.CastTime + 10000;
                if (!await Buddy.Coroutines.Coroutine.Wait(timeOutLimit, () => !Me.IsCasting))
                {
                    GarrisonButler.Diagnostic("Timed out while waiting for spell={0}, castTime={1}, timeOutLimit={2}.",
                        spell.Name, spell.CastTime, timeOutLimit);
                    return ActionResult.Failed;
                }
                await CommonCoroutines.SleepForLagDuration();
            }
            catch (Exception e)
            {
                GarrisonButler.Diagnostic(e.ToString());
                GarrisonButler.Log("Failed casting {0}.", spell.Name);
                return ActionResult.Failed;
            }
            GarrisonButler.Log("Successful cast of {0}.", spell.Name);
            return ActionResult.Done;
        }
コード例 #41
0
 public CoolDownLeftMaxCondition(WoWSpell spell, TimeSpan maxTimeLeft)
 {
     this.Spell = spell;
     this.MaxTimeLeft = maxTimeLeft;
 }
コード例 #42
0
ファイル: Spell.cs プロジェクト: aash/Singular
        // always create passing the existing context so it is preserved for delegate usage
        internal CastContext(object ctx, SpellFindDelegate ssd, UnitSelectionDelegate onUnit, HasGcd gcd = HasGcd.Yes)
        {
            if (ssd == null || onUnit == null)
                return;

            if (ssd(ctx, out sfr))
            {
                spell = sfr.Override ?? sfr.Original;
                name = spell.Name;
                context = ctx;
                unit = onUnit(ctx);
                    
                // health/dist change quickly, so grab these now where
                // .. we check requirements so the log message we output
                // .. later reflects what they were when we were testing
                // .. as opposed to what they may have changed to
                // .. (since spell lookup, move while casting check, and cancast take time)
                if (unit != null && unit.IsValid)
                {
                    health = unit.HealthPercent;
                    distance = unit.SpellDistance();
                }
            }
        }
コード例 #43
0
ファイル: Spell.cs プロジェクト: aash/Singular
 public static bool CastPrimative(WoWSpell spell)
 {
     LastSpellTarget = WoWGuid.Empty;
     return SpellManager.Cast(spell);
 }
コード例 #44
0
ファイル: Spell.cs プロジェクト: aash/Singular
 public static int GetCharges(WoWSpell spell)
 {
     int charges = Lua.GetReturnVal<int>("return GetSpellCharges(" + spell.Id.ToString() + ")", 0);
     return charges;
 }
コード例 #45
0
ファイル: Spell.cs プロジェクト: aash/Singular
 public static int GetBaseCooldown(WoWSpell spell)
 {
     int cd = Lua.GetReturnVal<int>("return GetSpellBaseCooldown(" + spell.Id.ToString() + ")", 0);
     return cd;
 }
コード例 #46
0
ファイル: Spell.cs プロジェクト: aash/Singular
        public static bool CanCastHackWillOurMovementInterrupt(WoWSpell spell, WoWUnit unit)
        {
            if ((spell.CastTime != 0u || spell.IsChanneled) && Me.IsMoving && !AllowMovingWhileCasting(spell))
            {
                if (SingularSettings.DebugSpellCasting)
                    Logger.WriteFile( "CanCast[{0}]: cannot cast while moving", spell.Name);
                return true;
            }

            return false;
        }
コード例 #47
0
ファイル: Spell.cs プロジェクト: aash/Singular
        public static bool CanCastHackInRange(WoWSpell spell, WoWUnit unit)
        {
            if (unit != null && !spell.IsSelfOnlySpell && !unit.IsMe)
            {
#if USE_LUA_RANGECHECK
                // will exercise the IsSpellInRange LUA if it can easily
                // .. derive a UnitID for the target

                string sTarget = null;

                if (unit.Guid == Me.CurrentTargetGuid)
                    sTarget = "target";
                else if (unit.IsPlayer && unit.ToPlayer().IsInMyPartyOrRaid())
                    sTarget = unit.Name;
                else if (unit.IsPet && unit.OwnedByUnit != null && unit.OwnedByUnit.IsPlayer && unit.OwnedByUnit.ToPlayer().IsInMyPartyOrRaid())
                    sTarget = unit.OwnedByUnit.Name + "-pet";
                else if (Me.GotAlivePet)
                {
                    if (unit.Guid == Me.Pet.Guid)
                        sTarget = "pet";
                    else if (unit.Guid == Me.Pet.CurrentTargetGuid)
                        sTarget = "pettarget";
                }

                if (sTarget != null)
                {
                    // 
                    string lua = string.Format("return IsSpellInRange(\"{0}\",\"{1}\")", spell.Name, sTarget);
                    string inRange = Lua.GetReturnVal<string>(lua, 0);
                    if (inRange != "1")
                    {
                        if (SingularSettings.DebugSpellCanCast)
                            Logger.WriteFile( "CanCast[{0}]: target @ {1:F1} yds failed IsSpellInRange() = {2}", spell.Name, unit.Distance, inRange);
                        return false;
                    }
                }
                else 
#endif
                {
                    if (spell.IsMeleeSpell && !unit.IsWithinMeleeRange)
                    {
                        if (SingularSettings.DebugSpellCasting)
                            Logger.WriteFile( "CanCast[{0}]: target @ {1:F1} yds not in melee range", spell.Name, unit.Distance);
                        return false;
                    }
                    else if (spell.HasRange)
                    {
                        if (unit.Distance > spell.ActualMaxRange(unit))
                        {
                            if (SingularSettings.DebugSpellCasting)
                                Logger.WriteFile( "CanCast[{0}]: out of range - further than {1:F1}", spell.Name, spell.ActualMaxRange(unit));
                            return false;
                        }
                        if (unit.Distance < spell.ActualMinRange(unit))
                        {
                            if (SingularSettings.DebugSpellCasting)
                                Logger.WriteFile( "CanCast[{0}]: out of range - closer than {1:F1}", spell.Name, spell.ActualMinRange(unit));
                            return false;
                        }
                    }
                }

                if (!unit.InLineOfSpellSight)
                {
                    if (SingularSettings.DebugSpellCasting)
                        Logger.WriteFile( "CanCast[{0}]: not in spell line of {1}", spell.Name, unit.SafeName());
                    return false;
                }
            }

            return true;
        }
コード例 #48
0
ファイル: Spell.cs プロジェクト: aash/Singular
        public static bool CanCastHackIsCastInProgress(WoWSpell spell, WoWUnit unit)
        {
            uint lat = SingularRoutine.Latency * 2u;

            if (Me.ChanneledCastingSpellId == 0)
            {
                if (StyxWoW.Me.IsCasting && Me.CurrentCastTimeLeft.TotalMilliseconds > lat)
                {
                    if (SingularSettings.DebugSpellCasting)
                        Logger.WriteFile("CanCast[{0}]: current cast of {1} has {2:F0} ms left", spell.Name, Me.CurrentCastId, Me.CurrentCastTimeLeft.TotalMilliseconds - lat);
                    return true;
                }

            }

            if (spell.CooldownTimeLeft.TotalMilliseconds > lat)
            {
                if (SingularSettings.DebugSpellCasting)
                    Logger.WriteFile("CanCast[{0}]: still on cooldown for {1:F0} ms", spell.Name, spell.CooldownTimeLeft.TotalMilliseconds - lat);
                return true;
            }

            return false;
        }
コード例 #49
0
 public SpellIsNotOnCooldownCondition(WoWSpell spell)
 {
     this.Spell = spell;
 }
コード例 #50
0
ファイル: Spell.cs プロジェクト: aash/Singular
        // always create passing the existing context so it is preserved for delegate usage
        internal CogContext(object ctx, SpellFindDelegate ssd, SimpleLocationRetriever locrtrv, SimpleStringDelegate descrtrv)
        {

            if (ssd(ctx, out sfr))
            {
                spell = sfr.Override ?? sfr.Original;
                name = spell.Name;
                context = ctx;

                loc = WoWPoint.Empty;
                targetDesc = "";
                if (locrtrv != null)
                {
                    loc = locrtrv(ctx);
                    if (descrtrv != null)
                    {
                        targetDesc = descrtrv(ctx) + " ";
                    }
                }
            }
        }
コード例 #51
0
ファイル: Spell.cs プロジェクト: aash/Singular
 public static bool CastPrimative(WoWSpell spell, WoWUnit unit)
 {
     LastSpellTarget = unit == null ? WoWGuid.Empty : unit.Guid;
     return SpellManager.Cast(spell, unit);
 }
コード例 #52
0
ファイル: Spell.cs プロジェクト: aash/Singular
 internal CogContext(CastContext cc, SimpleStringDelegate descrtrv)
 {
     if (cc.unit != null)
     {
         loc = cc.unit.Location;
         spell = cc.spell;
         context = cc.context;
         name = cc.name;
         sfr = cc.sfr;
         spell = cc.spell;
         if (descrtrv != null)
         {
             targetDesc = descrtrv(context) + " ";
         }
     }
 }
コード例 #53
0
ファイル: Common.cs プロジェクト: superkhung/SingularMod3
        private static bool SymbCanCast(WoWSpell spell, WoWUnit unit)
        {
            if (spell.Cooldown)
                return false;

            // check range
            if (unit != null && !spell.IsSelfOnlySpell)
            {
                if (spell.IsMeleeSpell && !unit.IsWithinMeleeRange)
                    return false;
                if (spell.HasRange && (unit.Distance > (spell.MaxRange + unit.CombatReach + 1) || unit.Distance < (spell.MinRange + unit.CombatReach + 1.66666675f)))
                    return false;
                if (!unit.InLineOfSpellSight)
                    return false;
            }

            if ((spell.CastTime != 0u || Spell.IsFunnel(spell)) && Me.IsMoving && !Spell.HaveAllowMovingWhileCastingAura(spell))
                return false;

            if (Me.ChanneledCastingSpellId == 0)
            {
                if (Spell.IsCasting())
                    return false;

                if (spell.Cooldown)
                    return false;
            }

            if (Me.CurrentPower < spell.PowerCost)
                return false;

            return true;
        }
コード例 #54
0
ファイル: Spell.cs プロジェクト: aash/Singular
        public static TimeSpan GetSpellCastTime(WoWSpell spell)
        {
            if (spell != null)
            {
                int time = (int)spell.CastTime;
                if (time == 0)
                    time = spell.BaseDuration;
                return TimeSpan.FromMilliseconds(time);
            }

            return TimeSpan.Zero;
        }
コード例 #55
0
 public AuraMaxRemaningTimeCondition(TimeSpan maxRemaingTime, WoWSpell aura, WoWUnit target)
 {
     _maxRemaingTime = maxRemaingTime;
     _aura = aura;
     _target = target;
 }
コード例 #56
0
ファイル: Spell.cs プロジェクト: aash/Singular
        public static bool IsSpellOnCooldown(WoWSpell spell)
        {           
            if (spell == null)
                return true;

            if (Me.ChanneledCastingSpellId != 0)
                return true;

            uint num = SingularRoutine.Latency * 2u;
            if (StyxWoW.Me.IsCasting && Me.CurrentCastTimeLeft.TotalMilliseconds > num)
                return true;

            if (spell.CooldownTimeLeft.TotalMilliseconds > num)
                return true;

            return false;
        }
コード例 #57
0
 public CoolDownLeftMinCondition(WoWSpell spell, TimeSpan minCooldown)
 {
     _spell = spell;
     _minCooldown = minCooldown;
 }
コード例 #58
0
ファイル: DisassembleMod.cs プロジェクト: Jokur/FuzzyMod
        private void btnStart_Click(object sender, EventArgs e)
        {
            if(isRunning) {
                isRunning = false;
                if( thread != null )
                    thread.Join();
                return;
            }

            if(cbActions.SelectedIndex < 0)
                return;

            if(ShadowBot.API.Bot.GetSettings.MouseHook_Enabled) {
                Mouse.Initialize();
            }

            Spells.CloseMountFrame();
            Spells.CloseSpellBookFrame();

            DisassembleItem item = (DisassembleItem)cbActions.Items[cbActions.SelectedIndex];

            int count = Inventory.GetItemCountById(item.ItemId);
            if(item.Profession == DisassembleProfession.JEWELCRAFTING || item.Profession == DisassembleProfession.INSCRIPTION) {
                count /= 5; // Requires atleast 5 to disassemble
            }

            int disassembleCount = 0;
            try {
                disassembleCount = int.Parse(txtItems.Text);
            } catch(Exception) {
                MessageBox.Show("Items to disassemble must be an integer number");
                return;
            }

            int spellId = 0;
            switch(item.Profession) {
                case DisassembleProfession.JEWELCRAFTING:
                    spellId = 31252;
                    break;
                case DisassembleProfession.INSCRIPTION:
                    spellId = 51005;
                    break;
                case DisassembleProfession.ENCHANTING:
                    spellId = 13262;
                    break;
            }

            disassembleSpell = Spells.GetWoWSpellById(spellId);

            if(!disassembleSpell.OnActionBar) {
                bool success = Spells.PlaceGatheringSpellOnBarById(spellId);

                if(!success) {
                    Log("Failed to place spell on bar");
                    return;
                } else {
                    Log("Placed on bar: " + success.ToString());
                }
            }

            itemsLeft = disassembleCount;

            disassembleItem = item;

            btnStart.Text = "Stop";
            isRunning = true;
            if(item.Profession == DisassembleProfession.JEWELCRAFTING || item.Profession == DisassembleProfession.INSCRIPTION) {
                thread = new Thread(new ThreadStart(ThreadSort));
                thread.Start();
            } else {
                thread = new Thread(new ThreadStart(ThreadDisassemble));
                thread.Start();
            }
        }
コード例 #59
0
 public TargetAuraUpCondition(WoWUnit target, WoWSpell aura , bool isMine = true)
 {
     _target = target;
     _aura = aura;
     _isMine = isMine;
 }
コード例 #60
0
ファイル: Spell.cs プロジェクト: aash/Singular
        /// <summary>
        /// check for aura which allows moving without interrupting spell casting
        /// </summary>
        /// <returns></returns>
        public static bool HaveAllowMovingWhileCastingAura(WoWSpell spell = null)
        {
            WoWAura found = Me.GetAllAuras().FirstOrDefault(a => a.ApplyAuraType == (WoWApplyAuraType)330 && (spell == null || Spell.GetSpellCastTime(spell) < a.TimeLeft));

            if (SingularSettings.DebugSpellCasting && found != null)
                Logger.WriteFile(
                    "MoveWhileCasting[{0}]: true, since we found move buff {1} #{2}", 
                    spell == null ? "(null)" : spell.Name, 
                    found.Name, 
                    found.SpellId
                    );

            return found != null;
        }