Example #1
0
        // These buffs are OK to cast when you are IN COMBAT
        private void InCombatBuffs()
        {
            if (!Me.Combat)
            {
                return;
            }
            if (Me.IsFlying)
            {
                return;
            }
            if (Me.Mounted)
            {
                return;
            }

            if (Me.IsInParty && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
            {
                const string buffName = "Shadow Protection";
                WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                if (target != null)
                {
                    Spell.Cast(buffName, target);
                }
            }
            if (!Me.IsInParty && !Self.IsBuffOnMe("Shadow Protection") && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
            {
                Spell.Cast("Shadow Protection", Me);
            }


            // Fear Ward
            if (!Self.IsBuffOnMe("Fear Ward") && CLC.ResultOK(Settings.FearWard) && Spell.CanCast("Fear Ward"))
            {
                Spell.Cast("Fear Ward", Me);
            }


            // Class specific buffs
            //if (!Self.IsBuffOnMe(ClassHelpers.Druid.IDs.MarkOfTheWild, Self.AuraCheck.AllAuras) && Spell.CanCast("Mark of the Wild")) Spell.Cast("Mark of the Wild", Me);
            //if (!Self.IsBuffOnMe(IDs.MoltenCore, Self.AuraCheck.ActiveAuras) && Spell.CanCast("Power Word: Fortitude")) Spell.Cast("Power Word: Fortitude");
        }
Example #2
0
        // All buffs check here. Only cast when you are OUT OF COMBAT
        private void OutOfCombatBuffs()
        {
            if (Me.Combat)
            {
                return;
            }
            if (Me.IsFlying)
            {
                return;
            }
            if (Me.Mounted)
            {
                return;
            }
            if (Self.IsBuffOnMe("Drink"))
            {
                return;
            }
            if (Self.IsBuffOnMe("Food"))
            {
                return;
            }
            if (Me.IsCasting)
            {
                return;
            }

            // Resurrection
            if (Settings.ResurrectPlayers.Contains("always") && Spell.CanCast("Resurrection"))
            {
                foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.Dead && !p.IsGhost && p.InLineOfSight))
                {
                    if (Timers.Exists(p.Guid.ToString()) && !Timers.Expired(p.Guid.ToString(), 15000))
                    {
                        continue;
                    }

                    Spell.Cast("Resurrection", p);
                    Utils.LagSleep();
                    Timers.Add(p.Guid.ToString());  // Prevent spamming resurrection on th same target
                    System.Threading.Thread.Sleep(1500);
                    if (!Me.IsCasting)
                    {
                        Spell.StopCasting();
                    }
                    while (Me.IsCasting)
                    {
                        if (!p.Dead)
                        {
                            Utils.Log("-Emmm.... it appears our dead party member is now alive. So why are we still trying to rez them?");
                            Spell.StopCasting();
                        }
                    }
                    break;
                }
            }


            // Inner Fire or Inner Will
            if (!Self.IsBuffOnMe("Inner Fire") && Settings.InnerFireWill.Contains("Inner Fire") && Spell.CanCast("Inner Fire"))
            {
                Spell.Cast("Inner Fire", Me);
            }
            if (!Self.IsBuffOnMe("Inner Will") && Settings.InnerFireWill.Contains("Inner Will") && Spell.CanCast("Inner Will"))
            {
                Spell.Cast("Inner Will", Me);
            }

            // Power Word Fortitude
            if (Me.IsInParty && CLC.ResultOK(Settings.PowerWordFortitude) && Spell.CanCast("Power Word: Fortitude"))
            {
                const string buffName = "Power Word: Fortitude";
                WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                if (target != null && !target.Auras.ContainsKey("Blood Pact"))
                {
                    Spell.Cast(buffName, target);
                }
            }

            // Vampiric Embrace
            if (!Self.IsBuffOnMe("Vampiric Embrace") && Spell.CanCast("Vampiric Embrace"))
            {
                Spell.Cast("Vampiric Embrace");
            }


            // Class specific buffs
            //if (!Self.IsBuffOnMe(ClassHelpers.Druid.IDs.MarkOfTheWild, Self.AuraCheck.AllAuras) && Spell.CanCast("Mark of the Wild")) Spell.Cast("Mark of the Wild", Me);
        }
Example #3
0
        public override void Pulse()
        {
            // HB runs this as frequenty as possible. I don't know the exact frequency but its supposed to be 5-10 times per second
            // Anything you want checked on a regular basis you may want to add here.
            // For example buffing / healing random players

            base.Pulse();

            int lootableMobs = LootTargeting.Instance.LootingList.Count;

            // If Settings.DirtyData = true it will reload the settings from the XML file
            // This reads the XML file and re-populates the Settings class with any changed values
            if (!_isCCLoaded)
            {
                _isCCLoaded = true; Settings.DirtyData = true;
            }
            if (Settings.DirtyData)
            {
                LoadSettings(true);
            }

            // So we don't overload HB the below code is only run once per second
            if (!Timers.Expired("Pulse", 1000))
            {
                return;
            }
            Timers.Recycle("Pulse", 1000);

            // Environmental Settings
            if (Timers.Expired("EnvironmentSettings", 5000))
            {
                if (Settings.MultipleEnvironment.Contains("never"))
                {
                    ConfigSettings.CurrentEnvironment = "PVE";
                }
                else
                {
                    Timers.Reset("EnvironmentSettings");
                    string environment = Utils.IsBattleground ? "PVP" : "PVE";
                    environment = ObjectManager.Me.IsInInstance ? "Instance" : environment;
                    if (!ConfigSettings.UIActive && environment != ConfigSettings.CurrentEnvironment)
                    {
                        ConfigSettings.CurrentEnvironment = environment;
                        Utils.Log(string.Format("*** Environment has changed. Loading {0} settings.", environment), Utils.Colour("Red"));
                        LoadSettings(false);
                    }
                }
            }



            // Make sure we have a target - Instance only
            // Sometimes IB was not selecting a target when we were in combat. This f****d up things immensely!
            if (Me.IsInInstance && !Me.GotTarget)
            {
                WoWUnit tank = RAF.PartyTankRole;
                if (tank != null && tank.GotTarget && tank.Combat)
                {
                    RAF.PartyTankRole.CurrentTarget.Target();
                }
            }

            // Decurse / Remove Corruption
            if (CLC.ResultOK(Settings.RemoveCorruptionBalance) && Spell.CanCast("Remove Corruption"))
            {
                WoWUnit p = ClassHelpers.Druid.NeedToDecursePlayer;
                if (p != null && Spell.CanCast("Remove Corruption"))
                {
                    Spell.Cast("Remove Corruption", p);
                }
            }

            // Buff players with MotW);
            if (Settings.MarkOfTheWild.Contains("always") && Me.IsInParty && Me.ManaPercent > 40)
            {
                WoWUnit p = RAF.PartyMemberWithoutBuff("Mark of the Wild");
                if (p != null)
                {
                    if (Spell.CanCast("Mark of the Wild"))
                    {
                        Spell.Cast("Mark of the Wild", p);
                    }
                }
            }


            // Predator's Swiftness
            if (CLC.ResultOK(Settings.PredatorsSwiftnessFeralCat) && !Self.IsHealthPercentAbove(Settings.PredatorsSwiftnessFeralCatHealth))
            {
                if (Self.IsBuffOnMeLUA("Predator's Swiftness") && Spell.CanCast(Settings.PredatorsSwiftnessFeralCatSpell))
                {
                    Utils.Log("** Predator's Swiftness **");
                    Spell.Cast(Settings.PredatorsSwiftnessFeralCatSpell, Me);
                }
            }


            // Resurrection
            if (!Me.Combat && Spell.CanCast("Revive") && !Me.IsCasting)
            {
                foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.Dead && !p.IsGhost && p.InLineOfSight))
                {
                    if (Timers.Exists(p.Guid.ToString()) && !Timers.Expired(p.Guid.ToString(), 15000))
                    {
                        continue;
                    }

                    Spell.Cast("Revive", p);
                    Utils.LagSleep();
                    Timers.Add(p.Guid.ToString());  // Prevent spamming resurrection on th same target
                    System.Threading.Thread.Sleep(1500);
                    if (!Me.IsCasting)
                    {
                        Spell.StopCasting();
                    }
                    while (Me.IsCasting)
                    {
                        if (!p.Dead)
                        {
                            Utils.Log("-Emmm.... it appears our dead party member is now alive. So why are we still trying to rez them?");
                            Spell.StopCasting();
                        }
                    }
                    break;
                }
            }

            // Clean up timers
            foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.IsAlive && Timers.Exists(p.Guid.ToString())))
            {
                Timers.Remove(p.Guid.ToString());
            }

            // Make sure we have a target - Instance only
            // Sometimes IB was not selecting a target when we were in combat. This f****d up things immensely!
            if (Me.IsInInstance && !Me.GotTarget)
            {
                WoWUnit tank = RAF.PartyTankRole;
                if (tank != null && tank.GotTarget && tank.Combat)
                {
                    tank.CurrentTarget.Target();
                }
            }

            // Try and grab a target all the time, if we're sitting around doing nothing check if anyone in our party has a target and take it.
            if (!Me.Combat)
            {
                foreach (WoWPlayer player in Me.PartyMembers)
                {
                    if (!player.Combat)
                    {
                        continue;
                    }
                    if (player.Distance > 80)
                    {
                        continue;
                    }
                    if (!player.GotTarget)
                    {
                        continue;
                    }

                    player.CurrentTarget.Target();
                }
            }

            // Out of combat healing. Make sure everyone is topped up.
            if (!Me.Mounted && !Me.IsFlying && !Me.Combat && (Me.IsInParty || Me.IsInRaid) && Spell.CanCast("Regrowth"))
            {
                List <WoWPlayer> myPartyOrRaidGroup = Me.PartyMembers;
                List <WoWPlayer> healTarget         = (from o in myPartyOrRaidGroup let p = o.ToPlayer() where p.Distance < 40 && !p.Auras.ContainsKey("Regrowth") && !p.Dead && !p.IsGhost && p.InLineOfSight && p.HealthPercent < 80 select p).ToList();
                //List<WoWPlayer> healTarget = (from o in myPartyOrRaidGroup let p = o.ToPlayer() where p.Distance < 40 && !p.Auras.ContainsKey("Regrowth") && !p.Dead && !p.IsGhost && p.InLineOfSight && p.HealthPercent < 80 select p).ToList();

                if (healTarget.Count > 0)
                {
                    Spell.Cast("Regrowth", healTarget.FirstOrDefault());
                }
                else if (Me.HealthPercent < 80)
                {
                    Spell.Cast("Regrowth", Me);
                }
            }


            // Buffs and such
            if (!Me.IsFlying && !Me.Mounted)
            {
                if (!Self.IsBuffOnMe(Druid_ID.MarkOfTheWild) && Spell.CanCast("Mark of the Wild") && Settings.MarkOfTheWild.Contains("always"))
                {
                    Spell.Cast("Mark of the Wild", Me);
                }

                if (!Me.Combat)
                {
                    if (!Me.IsMoving)
                    {
                        Timers.Reset("TravelForm");
                    }
                    if (Timers.Expired("TravelForm", 4000) && ClassHelpers.Druid.Shapeshift.CanUseTravelForm)
                    {
                        ClassHelpers.Druid.Shapeshift.TravelForm();
                    }
                }

                /*
                 * if (Me.Combat)
                 * {
                 *
                 *  if (Me.GotTarget && Me.CurrentTarget.IsCasting)
                 *  {
                 *      Utils.Log("==============[TARGET IS CASTING A SPELL]==============");
                 *      Utils.Log("=== Spell name: " + CT.CastingSpell.Name);
                 *      Utils.Log("=== Spell ID: " + CT.CastingSpell.Id);
                 *      Utils.Log("=== Spell description: " + CT.CastingSpell.Description);
                 *      Utils.Log("=== Spell school: " + CT.CastingSpell.School);
                 *      Utils.Log("=== Spell mechanic: " + CT.CastingSpell.Mechanic.ToString());
                 *      Utils.Log("=== Spell cast time (ms): " + CT.CastingSpell.CastTime);
                 *      Utils.Log("=======================================================");
                 *  }
                 *
                 * }
                 */

                /*
                 * if (Me.Combat)
                 * {
                 *  if (Me.IsInInstance)
                 *  {
                 *      foreach (WoWUnit unit in ObjectManager.GetObjectsOfType<WoWUnit>())
                 *      {
                 *          //Utils.Log("=====================[Threat Info]============================");
                 *          if (!unit.Combat) continue;
                 *          if (unit.Distance > 80) continue;
                 *          Utils.Log(string.Format("-- {0}, TargetGuid {1}, ThreatStatus {2}, ThreatPercent {3}, RawPercent {4}", unit.Name, unit.ThreatInfo.TargetGuid,unit.ThreatInfo.ThreatStatus,unit.ThreatInfo.RawPercent,unit.ThreatInfo.RawPercent));
                 *          Utils.Log("-- Threat for ME " + unit.GetThreatInfoFor(Me));
                 *
                 *      }
                 *  }
                 * }
                 */
            }

            // If you are drinking/eating and the tank is in combat and low on health then get your ass up and heal
            if (Self.IsBuffOnMe("Food") || Self.IsBuffOnMe("Drink"))
            {
                WoWUnit tank = RAF.PartyTankRole;

                if (tank != null && Me.IsInInstance && tank.Combat)
                {
                    if (tank.HealthPercent < 70)
                    {
                        Utils.Log("-Oh shit! The tank has pulled while we were drinking");
                        Lua.DoString("CancelUnitBuff('player', 'Food')");
                        Lua.DoString("CancelUnitBuff('player', 'Drink')");
                    }
                }
            }
        }
Example #4
0
        public override void Pulse()
        {
            // HB runs this as frequenty as possible. I don't know the exact frequency but its supposed to be 5-10 times per second
            // Anything you want checked on a regular basis you may want to add here.
            // For example buffing / healing random players

            base.Pulse();

            int lootableMobs = LootTargeting.Instance.LootingList.Count;

            // If Settings.DirtyData = true it will reload the settings from the XML file
            // This reads the XML file and re-populates the Settings class with any changed values
            if (!_isCCLoaded)
            {
                _isCCLoaded = true; Settings.DirtyData = true;
            }
            if (Settings.DirtyData)
            {
                LoadSettings(true);
            }

            // So we don't overload HB the below code is only run once per second
            if (!Timers.Expired("Pulse", 1000))
            {
                return;
            }
            Timers.Recycle("Pulse", 1000);

            // Environmental Settings
            if (Timers.Expired("EnvironmentSettings", 5000))
            {
                if (Settings.MultipleEnvironment.Contains("never"))
                {
                    ConfigSettings.CurrentEnvironment = "PVE";
                }
                else
                {
                    Timers.Reset("EnvironmentSettings");
                    string environment = Utils.IsBattleground ? "PVP" : "PVE";
                    environment = ObjectManager.Me.IsInInstance ? "Instance" : environment;
                    if (!ConfigSettings.UIActive && environment != ConfigSettings.CurrentEnvironment)
                    {
                        ConfigSettings.CurrentEnvironment = environment;
                        Utils.Log(string.Format("*** Environment has changed. Loading {0} settings.", environment), Utils.Colour("Red"));
                        LoadSettings(false);
                    }
                }
            }

            // Evangelism / Archangel
            if (!Me.Combat)
            {
                Timers.Reset("ArcSmiteCombat");
            }

            // Make sure we have a target - Instance only
            // Sometimes IB was not selecting a target when we were in combat. This f****d up things immensely!
            if (Me.IsInInstance && !Me.GotTarget)
            {
                WoWUnit tank = RAF.PartyTankRole;
                if (tank != null && tank.GotTarget && tank.Combat)
                {
                    RAF.PartyTankRole.CurrentTarget.Target();
                }
            }


            // Dispel Magic - You and all party members);
            if ((!Settings.Cleanse.Contains("never") || !Settings.PartyCleanse.Contains("never")) && Spell.CanCast("Dispel Magic"))
            {
                List <int> urgentRemoval = new List <int> {
                    17173
                };
                bool urgentCleanse = (from aura in Me.ActiveAuras from procID in urgentRemoval where procID == aura.Value.SpellId select aura).Any();

                if (urgentCleanse || CLC.ResultOK(Settings.Cleanse) || CLC.ResultOK(Settings.PartyCleanse))
                {
                    List <WoWDispelType> cureableList = new List <WoWDispelType> {
                        WoWDispelType.Magic
                    };
                    //if (Settings.SacredCleansing.Contains("... talented") && !cureableList.Contains(WoWDispelType.Magic)) { cureableList.Add(WoWDispelType.Magic); }

                    var p = ClassHelpers.Common.DecursePlayer(cureableList, CLC.ResultOK(Settings.PartyCleanse));
                    if (p != null)
                    {
                        if (Spell.CanCast("Dispel Magic"))
                        {
                            Spell.Cast("Dispel Magic", p);
                        }
                    }
                }
            }

            // Cure Disease - You and all party members);
            if ((!Settings.Cleanse.Contains("never") || !Settings.PartyCleanse.Contains("never")) && Spell.CanCast("Cure Disease"))
            {
                List <int> urgentRemoval = new List <int> {
                    3427
                };
                bool urgentCleanse = (from aura in Me.ActiveAuras from procID in urgentRemoval where procID == aura.Value.SpellId select aura).Any();

                if (urgentCleanse || CLC.ResultOK(Settings.Cleanse))
                {
                    List <WoWDispelType> cureableList = new List <WoWDispelType> {
                        WoWDispelType.Disease
                    };
                    var p = ClassHelpers.Common.DecursePlayer(cureableList, CLC.ResultOK(Settings.PartyCleanse));
                    if (p != null)
                    {
                        if (Spell.CanCast("Cure Disease"))
                        {
                            Spell.Cast("Cure Disease", p);
                        }
                    }
                }
            }

            // Buffs and such
            if (!Me.IsFlying && !Me.Mounted && !Me.Auras.ContainsKey("Altered Form"))
            {
                // Inner Fire/Will
                if (!Self.IsBuffOnMe("Inner Fire") && Settings.InnerFireWill.Contains("Inner Fire") && Spell.CanCast("Inner Fire"))
                {
                    Spell.Cast("Inner Fire", Me);
                }
                if (!Self.IsBuffOnMe("Inner Will") && Settings.InnerFireWill.Contains("Inner Will") && Spell.CanCast("Inner Will"))
                {
                    Spell.Cast("Inner Will", Me);
                }

                // Power Word Fortitude
                if (Me.IsInParty && !Me.Combat && CLC.ResultOK(Settings.PowerWordFortitude) && Spell.CanCast("Power Word: Fortitude"))
                {
                    const string buffName = "Power Word: Fortitude";
                    WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                    if (target != null && !target.Auras.ContainsKey("Blood Pact"))
                    {
                        Spell.Cast(buffName, target);
                    }
                }
                if (!Me.IsInParty && !Me.Combat && !Self.IsBuffOnMe("Power Word: Fortitude") && CLC.ResultOK(Settings.PowerWordFortitude) && Spell.CanCast("Power Word: Fortitude"))
                {
                    Spell.Cast("Power Word: Fortitude", Me);
                }

                // Shadow Protection
                if (Me.IsInParty && !Me.Combat && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
                {
                    const string buffName = "Shadow Protection";
                    WoWUnit      target   = RAF.PartyMemberWithoutBuff(buffName);
                    if (target != null)
                    {
                        Spell.Cast(buffName, target);
                    }
                }
                if (!Me.IsInParty && !Me.Combat && !Self.IsBuffOnMe("Shadow Protection") && CLC.ResultOK(Settings.ShadowProtection) && Spell.CanCast("Shadow Protection"))
                {
                    Spell.Cast("Shadow Protection", Me);
                }

                // Vampiric Embrace
                if (!Self.IsBuffOnMe("Vampiric Embrace") && Spell.CanCast("Vampiric Embrace"))
                {
                    Spell.Cast("Vampiric Embrace");
                }

                // Fear Ward
                if (!Self.IsBuffOnMe("Fear Ward") && CLC.ResultOK(Settings.FearWard) && Spell.CanCast("Fear Ward"))
                {
                    Spell.Cast("Fear Ward", Me);
                }
            }

            // Shadowform - can be applied while flying and mounted
            //if (CLC.ResultOK(Settings.Shadowform) && !Self.IsBuffOnMe("Shadowform") && Self.IsHealthPercentAbove(Settings.RenewHealth) && Spell.CanCast("Shadowform")) Spell.Cast("Shadowform");
            if (CLC.ResultOK(Settings.Shadowform) && !Self.IsBuffOnMe(15473, Self.AuraCheck.AllAuras) && !Me.Mounted && Self.IsHealthPercentAbove(Settings.RenewHealth) && Spell.CanCast("Shadowform"))
            {
                Spell.Cast("Shadowform");
            }


            // Prayer of Healing
            if (!Me.Mounted && !Me.IsFlying && !Me.Combat && (Me.IsInParty || Me.IsInRaid))
            {
                int PoHCount = Convert.ToInt16(Settings.PrayerOfHealingCount);
                List <WoWPlayer> myPartyOrRaidGroup = Me.PartyMembers;
                List <WoWPlayer> PoH = (from o in myPartyOrRaidGroup let p = o.ToPlayer() where p.Distance < 30 && !p.Dead && !p.IsGhost && p.InLineOfSight && p.HealthPercent < Settings.PrayerOfHealingHealth select p).ToList();
                if (PoH.Count >= PoHCount && Spell.CanCast("Prayer of Healing"))
                {
                    Spell.Cast("Prayer of Healing");
                    Utils.LagSleep();
                    Utils.WaitWhileCasting();
                }

                // Everyone else in the party gets healed
                WoWUnit healTarget = RAF.HealPlayer(95, 40);
                if (healTarget != null && !healTarget.Dead)
                {
                    ClassHelpers.Priest.PartyHealer(healTarget);
                }
            }


            // Archangel - Use it or loose it
            if (!Me.Mounted && !Me.IsFlying && (!Me.Auras.ContainsKey("Drink") || !Me.Auras.ContainsKey("Food")) && Me.ActiveAuras.ContainsKey("Evangelism") && !Me.Combat)
            {
                const string spell            = "Evangelism";
                const string archangel        = "Archangel";
                double       getTime          = Convert.ToDouble(Self.GetTimeLUA());
                double       buffTime         = Convert.ToDouble(Self.BuffTimeLeftLUA(spell));
                double       secondsRemaining = buffTime - getTime;

                if (secondsRemaining < 4.5 && Spell.CanCastLUA(archangel))
                {
                    Utils.Log("-Evangelism buff about to expire. Casting Archangel buff to consume it", Utils.Colour("Red"));
                    Spell.Cast(archangel);
                }
            }


            // Resurrection
            if (Settings.ResurrectPlayers.Contains("always") && !Me.Combat && Spell.CanCast("Resurrection") && !Me.IsCasting)
            {
                foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.Dead && !p.IsGhost && p.InLineOfSight))
                {
                    if (Timers.Exists(p.Guid.ToString()) && !Timers.Expired(p.Guid.ToString(), 15000))
                    {
                        continue;
                    }

                    Spell.Cast("Resurrection", p);
                    Utils.LagSleep();
                    Timers.Add(p.Guid.ToString());  // Prevent spamming resurrection on th same target
                    System.Threading.Thread.Sleep(1500);
                    if (!Me.IsCasting)
                    {
                        Spell.StopCasting();
                    }
                    while (Me.IsCasting)
                    {
                        if (!p.Dead)
                        {
                            Utils.Log("-Emmm.... it appears our dead party member is now alive. So why are we still trying to rez them?");
                            Spell.StopCasting();
                        }
                    }
                    break;
                }
            }

            // Clean up timers
            foreach (WoWPlayer p in Me.PartyMembers.Where(p => p.IsAlive && Timers.Exists(p.Guid.ToString())))
            {
                Timers.Remove(p.Guid.ToString());
            }
        }