Exemplo n.º 1
0
        static WoWUnit unitToSaveHeal = null;       // key unit in trouble that needs immediate heal (ignore normal heal priority)

        private bool HealRaid()
        {
            bool wasSpellCast = false;
            int  healPct      = hsm.NeedHeal;

            // following line is here solely to make sure we wait on the GCD since
            // ... prior checks may pause only if we were casting.  This prevents
            // ... misleading results from WoWSpell.Cooldown later in .CastHeal
            WaitForCurrentSpell(null);

            WoWPlayer p = ChooseHealTarget(healPct, SpellRange.NoCheck);

            if (p != null)
            {
                wasSpellCast = hsm.CastHeal(p);
            }

            // check and earth shield tank if needed
            if (IsRAFandTANK() && GroupTank.IsAlive && typeShaman == ShamanType.Resto)
            {
                bool inCombat = _me.Combat || GroupTank.Combat;
                if (GetAuraStackCount(GroupTank, "Earth Shield") < (inCombat ? 1 : 3))
                {
                    MoveToHealTarget(GroupTank, 35);
                    if (IsUnitInRange(GroupTank, 39))
                    {
                        wasSpellCast = wasSpellCast || Safe_CastSpell(GroupTank, "Earth Shield", SpellRange.Check, SpellWait.NoWait);
                    }
                }
            }

            return(wasSpellCast);
        }
Exemplo n.º 2
0
 public static int PetIsMissing(this WoWPlayer p)
 {
     if ((p.GotAlivePet || p.Mounted) && p.Pet != null)
     {
         _petstate = 0;
         return(0);
     }
     if (_petstate == 0)
     {
         _pettimer = DateTime.Now.AddSeconds(3);
         _petstate = 1;
         return(0);
     }
     else if (_petstate == 1)
     {
         if (DateTime.Now < _pettimer)
         {
             return(0);
         }
         _petstate = 2;
         return(0);
     }
     else if (_petstate == 2)
     {
         _petstate = 3;
         return(0);
     }
     else
     {
         // petstate == 3 - let revive pet kick in
         return(1);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Does minimal testing to see if a WoWUnit should be treated as an enemy.  Avoids
        /// searching lists (such as TargetList)
        /// </summary>
        /// <param name="u"></param>
        /// <returns></returns>
        public static bool IsEnemy(WoWUnit u)
        {
            if (u == null || !u.CanSelect || !u.Attackable || !u.IsAlive || u.IsNonCombatPet)
            {
                return(false);
            }

            if (BotPoi.Current.Guid == u.Guid && BotPoi.Current.Type == PoiType.Kill)
            {
                return(true);
            }

            if (u.IsCritter && u.ThreatInfo.ThreatValue == 0)
            {
                return(true);
            }

            if (!u.IsPlayer)
            {
                return(u.IsHostile || u.Aggro || u.PetAggro);
            }

            WoWPlayer p = u.ToPlayer();

            /* // not supported currently
             *          if (Battlegrounds.IsInsideBattleground)
             *              return p.BattlefieldArenaFaction != Me.BattlefieldArenaFaction;
             */
            return(p.IsHostile); // || p.IsHorde != Me.IsHorde;
        }
        private void btnSetLeader_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count == 0)
            {
                MessageBox.Show("Choose a Player before clicking Set Leader");
                listView.Focus();
            }
            else
            {
                WoWPlayer chosenPlayer = (WoWPlayer)listView.SelectedItems[0].Tag;
                try
                {
                    if (chosenPlayer != null)
                    {
                        RaFHelper.SetLeader(chosenPlayer);
                        LazyRaider.IamTheTank = false;
                        Logging.Write(Color.Blue, "[LazyRaider] Tank set to {0}, max health {1}", LazyRaider.Safe_UnitName(RaFHelper.Leader), RaFHelper.Leader.MaxHealth);
                    }
                    else // == null
                    {
                        RaFHelper.ClearLeader();
                        LazyRaider.IamTheTank = true;
                        Logging.Write(Color.Blue, "[LazyRaider] selected -ME-, leader cleared");
                    }
                }
                catch
                {
                    listView.SelectedItems[0].Remove();
                }

                this.Hide();
            }
        }
Exemplo n.º 5
0
    public static bool GroupBuffSpell(Spell spell, int playercount = 0)
    {
        if (!spell.KnownSpell || !spell.IsSpellUsable || !spell.IsDistanceGood)
        {
            return(false);
        }
        var members = Partystuff.getPartymembers().Where(o => o.IsValid &&
                                                         o.IsAlive &&
                                                         !o.HaveBuff(spell.Id) &&
                                                         !TraceLine.TraceLineGo(o.Position)).OrderBy(o => o.HealthPercent);

        if (members.Count() > playercount)
        {
            var       u          = members.First();
            WoWPlayer bufftarget = new WoWPlayer(u.GetBaseAddress);
            if (!TraceLine.TraceLineGo(bufftarget.Position) && bufftarget.IsAlive)
            {
                ObjectManager.Me.FocusGuid = bufftarget.Guid;
                Extension.HealSpell(spell, false, false, true);
                Logging.Write("Cast" + spell + "on " + bufftarget);
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 6
0
        protected override void DefaultTargetWeight(List <TargetPriority> units)
        {
            ulong tanks = GetMainTankGuids();

            foreach (TargetPriority prio in units)
            {
                prio.Score = 500f;
                WoWPlayer p = prio.Object.ToPlayer();

                // The more health they have, the lower the score.
                // This should give -500 for units at 100%
                // And -50 for units at 10%
                prio.Score -= p.HealthPercent * 5;

                // If they're out of range, give them a bit lower score.
                if (p.DistanceSqr > 40 * 40)
                {
                    prio.Score -= 50f;
                }

                // If they're out of LOS, again, lower score!
                if (!p.InLineOfSight)
                {
                    prio.Score -= 100f;
                }

                // Give tanks more weight. If the tank dies, we all die. KEEP HIM UP.
                if (tanks.Equals(p.Guid) && p.HealthPercent != 100)
                {
                    //Logger.Write(p.Name + " is a tank!");
                    prio.Score += 100f;
                }
            }
        }
Exemplo n.º 7
0
        public override void Update()
        {
            if ((Profile == null) || (DataModel == null) || (_process == null))
            {
                return;
            }

            var dataModel = (WoWDataModel)DataModel;

            var objectManager = new WoWObjectManager(_process,
                                                     _pointer.GameAddresses.First(a => a.Description == "ObjectManager").BasePointer);
            var nameCache = new WoWNameCache(_process,
                                             _pointer.GameAddresses.First(a => a.Description == "NameCache").BasePointer);
            var player = new WoWPlayer(_process,
                                       _pointer.GameAddresses.First(a => a.Description == "LocalPlayer").BasePointer,
                                       _pointer.GameAddresses.First(a => a.Description == "TargetGuid").BasePointer, true);

            dataModel.Player = player;
            if (dataModel.Player != null && dataModel.Player.Guid != Guid.Empty)
            {
                dataModel.Player.UpdateDetails(nameCache);
                var target = player.GetTarget(objectManager);
                if (target == null)
                {
                    return;
                }

                dataModel.Target = new WoWUnit(target.Process, target.BaseAddress);
                dataModel.Target.UpdateDetails(nameCache);
            }
            else
            {
                dataModel.Target = null;
            }
        }
Exemplo n.º 8
0
    public static bool TankHealSpell(Spell spell, int setting, int playercount = 0)
    {
        if (!spell.KnownSpell || !spell.IsSpellUsable || !spell.IsDistanceGood)
        {
            return(false);
        }
        var members = Partystuff.getTanks().Where(o => o.IsValid &&
                                                  o.IsAlive &&
                                                  o.HealthPercent <= setting &&
                                                  !TraceLine.TraceLineGo(o.Position)).OrderBy(o => o.HealthPercent);

        if (members.Count() > playercount)
        {
            var       u    = members.First();
            WoWPlayer tank = new WoWPlayer(u.GetBaseAddress);
            if (!TraceLine.TraceLineGo(tank.Position) && tank.IsAlive)
            {
                ObjectManager.Me.FocusGuid = tank.Guid;
                Extension.HealSpell(spell, false, false, true);
                Logging.Write("Cast" + spell + "on " + tank);
                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 9
0
        public static double Calculateangle(WoWPlayer Target, WoWPlayer Player)
        {
            float vx = Target.Position.X - Player.Position.X;
            float vy = Target.Position.Y - Player.Position.Y;

            return(Math.Sign(vy) * Math.Acos((vx * 1 + vy * 0) / (Math.Sqrt(vx * vx + vy * vy))));
        }
Exemplo n.º 10
0
        protected virtual void BuffRotation()
        {
            _foodManager.CheckIfEnoughFoodAndDrinks();
            _foodManager.CheckIfThrowFoodAndDrinks();
            _foodManager.CheckIfHaveManaStone();

            if (specialization.RotationType == Enums.RotationType.Party)
            {
                // PARTY Arcane Intellect
                WoWPlayer noAI = AIOParty.GroupAndRaid
                                 .Find(m => m.Mana > 0 && !m.HaveBuff(ArcaneIntellect.Name));
                if (noAI != null && cast.OnFocusUnit(ArcaneIntellect, noAI))
                {
                    return;
                }
            }

            // Dampen Magic
            if (!Me.HaveBuff("Dampen Magic") &&
                settings.UseDampenMagic &&
                DampenMagic.KnownSpell &&
                DampenMagic.IsSpellUsable &&
                cast.OnSelf(DampenMagic))
            {
                return;
            }
        }
Exemplo n.º 11
0
        public WoWPlayer GetFocus()
        {
            string sUnitNameInfo = Lua.GetReturnVal <string>("return GetUnitName(\"focus\", 0)", 0);

            if (String.IsNullOrEmpty(sUnitNameInfo))
            {
                return(null);
            }

            string[] parts     = sUnitNameInfo.Split(' ');
            string   sUnitName = parts[0];

            WoWPlayer player =
                (from p in GroupList
                 where !p.IsMe && p.Name.ToUpper() == sUnitName.ToUpper()
                 select p
                ).FirstOrDefault();

            if (player == null)
            {
                dlog("GetFocus:  no focus set by user");
            }

            return(player);
        }
        private void LoadListView()
        {
            listView.Items.Clear();

            AddRow(null, "-ME-", LazyRaider.Me.Class.ToString(), LazyRaider.GetGroupRoleAssigned(LazyRaider.Me).ToString(), LazyRaider.Me.MaxHealth.ToString());

            if (ObjectManager.IsInGame && ObjectManager.Me != null)
            {
                ObjectManager.Update();

                Logging.WriteDebug(Color.Chocolate, "-- Group Count: {0}", LazyRaider.GroupMembers.Count);

                foreach (WoWPartyMember pm in LazyRaider.GroupMemberInfos)
                {
                    WoWPlayer p = pm.ToPlayer();
                    if (pm == null || p == null || p.IsMe)
                    {
                        continue;
                    }

                    string sRole = LazyRaider.GetGroupRoleAssigned(pm).ToString().ToUpper();
                    Logging.WriteDebug(Color.Chocolate, "-- Group Member: {0} hp={1} is {2}", p.Class.ToString(), p.MaxHealth, sRole);

                    AddRow(p, p.Name, p.Class.ToString(), sRole, p.MaxHealth.ToString());
                }
            }

            btnSetLeader.Enabled = true;
        }
Exemplo n.º 13
0
 public Grinder(WoWConnection mainWow, WoWPlayer mainPlayer, List <Vector3> cs)
 {
     this.wowConnection = mainWow;
     this.player        = mainPlayer;
     this.checkpoints   = cs;
     this.atCP          = 0;
 }
Exemplo n.º 14
0
            private void MoveToHealTarget(WoWUnit unit, double distRange)
            {
                if (!IsUnitInRange(unit, distRange))
                {
                    Slog("MoveToHealTarget:  moving to Heal Target {0} who is {1:F1} yds away", Safe_UnitName(unit), unit.Distance);
                    if (_me.IsCasting)
                    {
                        WaitForCurrentSpell(null);
                    }

                    MoveToUnit(unit);
                    while (!IsGameUnstable() && _me.IsAlive && _me.IsMoving && unit.IsAlive && !IsUnitInRange(unit, distRange) && unit.Distance < 100)
                    {
                        // while running, if someone else needs a heal throw a riptide on them
                        if (SpellManager.HasSpell("Riptide") && SpellManager.CanCast("Riptide"))
                        {
                            WoWPlayer otherTarget = ChooseNextHealTarget(unit, (double)hsm.NeedHeal);
                            if (otherTarget != null)
                            {
                                Slog("MoveToHealTarget:  healing {0} while moving to heal target {1}", Safe_UnitName(otherTarget), Safe_UnitName(unit));
                                Safe_CastSpell(otherTarget, "Riptide", SpellRange.Check, SpellWait.NoWait);
                                StyxWoW.SleepForLagDuration();
                            }
                        }
                    }

                    if (_me.IsMoving)
                    {
                        Safe_StopMoving();
                    }

                    Dlog("MoveToHealTarget: stopping now that Heal Target is {0} yds away", unit.Distance);
                }
            }
Exemplo n.º 15
0
        private bool Tranquility()
        {
            WoWPlayer tar = GetHealTarget();

            if (tar != null)
            {
                if (!HazzDruidSettings.Instance.SpecRestoration)
                {
                    return(false);
                }
                else
                {
                    if (FriendlyCount(40) >= 3 && HazzDruidSettings.Instance.UseTranquility && CC("Tranquility"))
                    {
                        Logging.Write("Tranquility");
                        C("Tranquility", Me);;
                        return(true);
                    }
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 16
0
        private bool SelfBuff()
        {
            WoWPlayer tar = Threat();

            if (tar != null)
            {
                if (HazzDruidSettings.Instance.UseBarkskin && CC("Barkskin") && !Me.HasAura("Barkskin"))
                {
                    Logging.Write("Barkskin");
                    C("Barkskin", Me);
                    return(true);
                }
                if (!HazzDruidSettings.Instance.SpecFeral && HazzDruidSettings.Instance.UseThorns && CC("Thorns") && !Me.HasAura("Thorns"))
                {
                    Logging.Write("Thorns");
                    C("Thorns", Me);
                    return(true);
                }
                if (HazzDruidSettings.Instance.UseThorns && CC("Typhoon"))
                {
                    Logging.Write("Typhoon");
                    C("Typhoon", tar);
                    return(true);
                }
                if (HazzDruidSettings.Instance.UseGrasp && CC("Nature's Grasp") && !Me.HasAura("Nature's Grasp"))
                {
                    Logging.Write("Nature's Grasp");
                    C("Nature's Grasp", Me);
                    return(true);
                }
                return(false);
            }
            return(false);
        }
Exemplo n.º 17
0
 private bool Cleansing()
 {
     if (HazzDruidSettings.Instance.UseRemoveCurse)
     {
         WoWPlayer p = GetCleanseTarget();
         if (p != null)
         {
             if (p.Distance2D > 40 || !p.InLineOfSight)
             {
                 return(true);
             }
             else if (HazzDruidSettings.Instance.SpecRestoration && CC("Remove Corruption", p))
             {
                 Logging.Write("Remove Corruption");
                 C("Remove Corruption", p);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     return(false);
 }
Exemplo n.º 18
0
        public override void Pulse()
        {
            if (!Me.IsInParty && !Me.IsInRaid)
            {
                Combat();
            }
            else if (Battlegrounds.IsInsideBattleground)
            {
                Combat();
            }
            else if (!CheckUnit(tank) || (CheckUnit(tank) && (tank.IsMe || !tank.InLineOfSight || tank.Distance2D > 40)))
            {
                tank = GetTank();

                if (tank == null)
                {
                    tank = Me;
                }

                if (lastTank == null || lastTank.Guid != tank.Guid)
                {
                    lastTank = tank;
                }
                if (CheckUnit(tank) && tank.Combat)
                {
                    Combat();
                }
            }
        }
        protected override void BuffRotation()
        {
            base.BuffRotation();

            if (!Me.HaveBuff("Ghost Wolf") && (!Me.HaveBuff("Drink") || Me.ManaPercentage > 95))
            {
                // Ghost Wolf
                if (settings.GhostWolfMount &&
                    wManager.wManagerSetting.CurrentSetting.GroundMountName == "" &&
                    GhostWolf.KnownSpell)
                {
                    ToolBox.SetGroundMount(GhostWolf.Name);
                }

                // Lesser Healing Wave OOC
                if (Me.HealthPercent < settings.OOCHealThreshold &&
                    cast.OnSelf(LesserHealingWave))
                {
                    return;
                }

                // Healing Wave OOC
                if (Me.HealthPercent < settings.OOCHealThreshold &&
                    cast.OnSelf(HealingWave))
                {
                    return;
                }

                // Water Shield
                if (!Me.HaveBuff("Water Shield") &&
                    !Me.HaveBuff("Lightning Shield") &&
                    (settings.UseWaterShield || !settings.UseLightningShield || Me.ManaPercentage < 20) &&
                    cast.OnSelf(WaterShield))
                {
                    return;
                }

                // PARTY Cure poison
                WoWPlayer needCurePoison = AIOParty.GroupAndRaid
                                           .Find(m => ToolBox.HasPoisonDebuff(m.Name));
                if (needCurePoison != null && cast.OnFocusUnit(CurePoison, needCurePoison))
                {
                    return;
                }

                // PARTY Cure Disease
                WoWPlayer needCureDisease = AIOParty.GroupAndRaid
                                            .Find(m => ToolBox.HasDiseaseDebuff(m.Name));
                if (needCureDisease != null && cast.OnFocusUnit(CureDisease, needCureDisease))
                {
                    return;
                }

                // PARTY Drink
                if (AIOParty.PartyDrink(settings.PartyDrinkName, settings.PartyDrinkThreshold))
                {
                    return;
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// This will create the list
        /// </summary>
        public BGHealers()
        {
            // Frame lock it as we are gunna be calling a loop of lua
            using (new FrameLock())
            {
                int BGPlayerCount = Lua.GetReturnVal <int>("return GetNumBattlefieldScores()", 0);

                // Loop threw all the players in the BG
                for (int i = 1; i < BGPlayerCount; i++)
                {
                    List <string> GetLua    = Lua.GetReturnValues(string.Format("return GetBattlefieldScore({0})", i));
                    string[]      NameSplit = GetLua[0].ToString().Split('-');
                    string        Name      = NameSplit[0].Trim();
                    string        Spec      = GetLua[15].ToString();

                    if (!HealingSpecs.Contains(Spec))
                    {
                        continue;
                    }

                    // Convert a "name" into a WoWPlayer
                    WoWPlayer PlayerHealer = (from CurPlayer in ObjectManager.GetObjectsOfType <WoWPlayer>()
                                              where CurPlayer.Name == Name
                                              select CurPlayer).FirstOrDefault();

                    // If we actually have a player that we can see in our object manager
                    // Add him to our list!
                    if (PlayerHealer != null)
                    {
                        lHealers.Add(PlayerHealer);
                    }
                }
            }
        }
Exemplo n.º 21
0
    public static List <WoWPlayer> getTanks()
    {
        List <WoWPlayer> ret = new List <WoWPlayer>();
        var u = Party.GetPartyHomeAndInstance().Where(p => p.GetDistance < 80 && p.IsValid && !TraceLine.TraceLineGo(p.Position));

        if (u.Count() > 0)
        {
            foreach (var unit in u)
            {
                //Logging.WriteDebug("Unit name: " + unit.Name.ToString().Trim());
                if (IsTank(unit.Name.ToString()))
                {
                    WoWPlayer p = new WoWPlayer(unit.GetBaseAddress);
                    ret.Add(p);
                }
            }
        }

        /*          if (ret.Count() == 0)
         *              {
         *                  Logging.WriteDebug("Could not find a tank!");
         *                  WoWPlayer v = new WoWPlayer(ObjectManager.Me.GetBaseAddress);
         *                  ret.Add(v);
         *              }
         */
        return(ret);
    }
Exemplo n.º 22
0
        private bool Cleansing()
        {
            WoWPlayer p = GetCleanseTarget();

            //slog(Color.Violet, "Cleansing {0}", p.Name);
            return(Cast("Cleanse", p, 40, "Cleanse", "Noone to heal, dispelling"));
        }
Exemplo n.º 23
0
        public static bool IsMeOrMyGroup(WoWUnit unit)
        {
            if (unit != null)
            {
                // find topmost unit in CreatedByUnit chain
                while (unit.CreatedByUnit != null)
                {
                    unit = unit.CreatedByUnit;
                }

                if (unit.IsMe)
                {
                    return(true);
                }

                if (unit.IsPlayer)
                {
                    WoWPlayer p = unit.ToPlayer();
                    if (p.IsHorde == Me.IsHorde && PartyManager.GroupMembers.Contains(unit.ToPlayer()))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 24
0
        private void LoadListView()
        {
            listView.Items.Clear();

            AddRow(LazyRaider.Me.Guid, "-ME-", LazyRaider.Me.Class.ToString(), LazyRaider.GetGroupRoleAssigned(LazyRaider.Me).ToString(), LazyRaider.Me.MaxHealth.ToString());

            if (StyxWoW.IsInGame && StyxWoW.Me != null)
            {
                ObjectManager.Update();

                LazyRaider.Dlog("-- Group Count: {0}", LazyRaider.GroupMemberInfos.Count());

                foreach (WoWPartyMember pm in LazyRaider.GroupMemberInfos)
                {
                    if (pm == null || pm.Guid == LazyRaider.Me.Guid)
                    {
                        continue;
                    }

                    WoWPlayer p      = pm.ToPlayer();
                    string    sName  = p == null ? "-out of range-" : p.Name;
                    string    sRole  = LazyRaider.GetGroupRoleAssigned(pm).ToString();
                    string    sClass = p == null ? "-n/a-" : p.Class.ToString();
                    LazyRaider.Dlog("-- Group Member: {0}.{1:X3} hp={2} is {3}", sClass, pm.Guid, pm.HealthMax, sRole);

                    AddRow(pm.Guid, sName, sClass, sRole, pm.HealthMax.ToString());
                }
            }

            this.listView.ListViewItemSorter = new ListViewItemComparer(2);
            listView.Sort();
            btnSetLeader.Enabled = true;
        }
Exemplo n.º 25
0
    public bool needBurst(float percent)
    {
        WoWPlayer p;
        WoWObject obj;
        uint      count = 0;
        List <MemoryRobot.Int128> party = Party.GetPartyGUID();

        party.Add(ObjectManager.Me.Guid);
        foreach (var playerGuid in party)
        {
            if (playerGuid.IsNotZero())
            {
                obj = ObjectManager.GetObjectByGuid(playerGuid);
                if (obj.IsValid)
                {
                    p = new WoWPlayer(obj.GetBaseAddress);

                    if (p.Health < p.MaxHealth * percent)
                    {
                        count += 1;
                    }
                }
            }
        }
        return(count > 1);
    }
Exemplo n.º 26
0
        public static bool RotateTowards(WoWPlayer PlayerUnit, Vector2 TargetUnitPos, double RotationThreshhold, bool DisableForward)
        {
            double mydiff = Angles.AngleDiff(Angles.Calculateangle(TargetUnitPos, PlayerUnit.Position), PlayerUnit.Rotation);

            if ((Math.Abs(mydiff) < RotationThreshhold))
            {
                SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle);
                SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle);
                return(true);
            }
            else if (mydiff < 0)
            {
                if (DisableForward)
                {
                    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle);
                }
                SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_LEFT, !PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle);
                SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle);
            }
            else if (mydiff > 0)
            {
                if (DisableForward)
                {
                    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, PlayerUnit.MovingInfo.IsMovingForward, ref PlayerUnit.MovingInfo.myforward, PlayerUnit.WindowTitle);
                }
                SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_RIGHT, !PlayerUnit.MovingInfo.IsTurningRight, ref PlayerUnit.MovingInfo.myright, PlayerUnit.WindowTitle);
                SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, PlayerUnit.MovingInfo.IsTurningLeft, ref PlayerUnit.MovingInfo.myleft, PlayerUnit.WindowTitle);
            }
            return(false);
        }
Exemplo n.º 27
0
        protected override void OnBeforeAction(ActionBase action)
        {
            if (Leader == null || !Leader.IsValid)
            {
                Leader = WoWParty.Members.FirstOrDefault() ?? WoWPlayer.Invalid;
            }

            if (action is CatSpellAction && Manager.LocalPlayer.Shapeshift != ShapeshiftForm.Cat)
            {
                WoWSpell.GetSpell("Cat Form").Cast();
                Sleep(Globals.SpellWait);
            }

            if (action is BearSpellAction && Manager.LocalPlayer.Shapeshift != ShapeshiftForm.Bear)
            {
                WoWSpell.GetSpell("Bear Form").Cast();
                Sleep(Globals.SpellWait);
            }

            var cd = WoWSpell.GetSpell("Tiger's Fury");

            if (action is CatSpellAction && cd.IsValid && cd.IsReady)
            {
                Log.WriteLine("Popping {0}", cd.Name);
                cd.Cast();
                Sleep(Globals.SpellWait);
            }
        }
Exemplo n.º 28
0
        private bool Harmony()
        {
            WoWPlayer tar = GetHealTarget();

            if (tar != null)
            {
                if (!HazzDruidSettings.Instance.SpecRestoration)
                {
                    return(false);
                }
                else
                {
                    if (!CheckUnit(Me))
                    {
                        return(false);
                    }
                    if (Battlegrounds.IsInsideBattleground && Me.ActiveAuras.ContainsKey("Harmony") && Me.ActiveAuras["Harmony"].TimeLeft.TotalSeconds < 2)
                    {
                        Logging.Write("Regrowth");
                        C("Regrowth", tar);
                        Thread.Sleep(1000);
                        return(true);
                    }
                    else if (Me.ActiveAuras.ContainsKey("Harmony") && Me.ActiveAuras["Harmony"].TimeLeft.TotalSeconds < 3)
                    {
                        Logging.Write("Harmony Nourish");
                        C("Nourish", tar);
                        return(true);
                    }
                }
                return(false);
            }
            return(false);
        }
Exemplo n.º 29
0
    public static List <WoWUnit> GetPartyTargets()
    {
        List <WoWPlayer> party        = Party.GetPartyHomeAndInstance();
        List <WoWPlayer> partyMembers = new List <WoWPlayer>();
        var ret = new List <WoWUnit>();

        partyMembers.AddRange(party.Where(p => p.GetDistance < 40 && p.IsValid && p.HealthPercent > 0));
        WoWPlayer Me = new WoWPlayer(ObjectManager.Me.GetBaseAddress);

        partyMembers.Add(Me);
        foreach (var m in partyMembers)
        {
            var targetUnit = new WoWUnit(ObjectManager.GetObjectByGuid(m.Target).GetBaseAddress);
            if (m.IsValid && (m.HealthPercent > 0) && (m.InCombat || targetUnit.InCombat) && m.Target.IsNotZero())
            {
                if (ret.All(u => u.Guid != m.Target))     // prevent double list entrys
                {
                    if (targetUnit.IsValid && targetUnit.IsAlive)
                    {
                        ret.Add(targetUnit);
                    }
                }
            }
        }
        return(ret);
    }
Exemplo n.º 30
0
        public static bool IsAttackingHealer(this WoWUnit unit)
        {
            string fnname = "FTWExtensionMethods.IsAttackingHealer";

            MyTimer.Start(fnname);
            bool retval = false;

            if (!(unit.IsAlive && unit.IsHostile && unit.CurrentTarget != null))
            {
                retval = false;
            }
            else if (!unit.CurrentTarget.IsPlayer)
            {
                retval = false;
            }
            else if (!unit.IsTargetingMyPartyMember)
            {
                retval = false;
            }
            else if (!unit.IsTargetingMyRaidMember)
            {
                retval = false;
            }
            else
            {
                WoWPlayer target = (WoWPlayer)unit.CurrentTarget;
                if (target.Role().Contains("Healer"))
                {
                    retval = true;
                }
            }
            MyTimer.Stop(fnname);
            return(retval);
        }
Exemplo n.º 31
0
    public void Pulse()
    {
        if (Products.InPause != _lastNeedPause)
            return;

        bool needPause = false;
        if (Party.IsInGroup() && !Conditions.IsAttackedAndCannotIgnore && Conditions.InGameAndConnectedAndAlive)
        {
            var members = Party.GetPartyGUIDHomeAndInstance();
            foreach (var guid in members)
            {
                if (guid.IsZero() || ObjectManager.Me.Guid == guid)
                    continue;

                WoWPlayer player = null;
                var obj = ObjectManager.GetObjectByGuid(guid);
                if (obj.IsValid && obj.Type == WoWObjectType.Player)
                {
                    player = new WoWPlayer(obj.GetBaseAddress);
                }

                if (WaitPartySettings.CurrentSetting.WaitIfDead)
                {
                    if (player == null || !player.IsValid || player.IsDead)
                    {
                        needPause = true;
                        if (!_lastNeedPause)
                            Logging.Write("[WaitParty] Pause because an player of group are dead or not found.");
                        break;
                    }
                }
                if (WaitPartySettings.CurrentSetting.MaxDistance > 0)
                {
                    if (player != null && player.IsValid && player.GetDistance > WaitPartySettings.CurrentSetting.MaxDistance)
                    {
                        needPause = true;
                        if (!_lastNeedPause)
                            Logging.Write("[WaitParty] Pause because " + player.Name + " is too far.");
                        break;
                    }
                }
            }
        }
        if (!needPause && _lastNeedPause)
            Logging.Write("[WaitParty] Pause stopped.");
        Products.InPause = needPause;
        if (needPause)
        {
            Fight.StopFight();
            MovementManager.StopMove();
            LongMove.StopLongMove();
        }
        _lastNeedPause = needPause;
    }
 public bool needExit(Int64 time)
 {
     foreach (KeyValuePair<WoWPlayer, double> pt in players)
     {
         if (pt.Value > time)
         {
             FollowingPlayer = pt.Key;
             return true;
         }
     }
     return false;
 }
Exemplo n.º 33
0
        private static WoWPlayer GetBestRiptideTarget(WoWPlayer originalTarget)
        {
            if (!originalTarget.HasMyAura("Riptide") && originalTarget.InLineOfSpellSight)
                return originalTarget;

            // Target already has RT. So lets find someone else to throw it on. Lowest health first preferably.
            WoWPlayer ripTarget = Unit.GroupMembers.Where(u => u.DistanceSqr < 40 * 40 && !u.HasMyAura("Riptide") && u.InLineOfSpellSight).OrderBy(u => u.GetPredictedHealthPercent()).FirstOrDefault();
            if (ripTarget != null && ripTarget.GetPredictedHealthPercent() > SingularSettings.Instance.IgnoreHealTargetsAboveHealth)
                ripTarget = null;

            return ripTarget;
        }
Exemplo n.º 34
0
 private bool PVENeedsUrgentCleanse(WoWPlayer p, bool can_dispel_disease, bool can_dispel_magic, bool can_dispel_poison)
 {
     foreach (WoWAura a in p.Debuffs.Values)
     {
         foreach (string q in _dispell_ASAP)
         {
             if (a.Name == q)
             {
                 WoWDispelType t = a.Spell.DispelType;
                 if ((can_dispel_disease && t == WoWDispelType.Disease) || (can_dispel_magic && t == WoWDispelType.Magic) || (can_dispel_poison && t == WoWDispelType.Poison))
                 {
                     urgentdebuff = a.Name;
                     return true;
                 }
             }
         }
     }
     return false;
 }
Exemplo n.º 35
0
        public static WoWPartyMember.GroupRole GetGroupRoleAssigned(WoWPlayer p)
        {
            WoWPartyMember.GroupRole role = WoWPartyMember.GroupRole.None;
            if (p != null && IsInGroup)
            {
                // GroupMemberInfos.FirstOrDefault(t => t.Guid == p.Guid);
                WoWPartyMember pm = new WoWPartyMember( p.Guid, true );
                if (pm != null)
                    role = GetGroupRoleAssigned(pm);
            }

            return role;
        }
Exemplo n.º 36
0
        private WoWPlayer FindLeader()
        {
            WoWPlayer leader = null;

            if (SquireSettings.Instance.Method == SquireSettings.FollowMethod.Focus)
            {
                leader = GetFocus();
                if ( leader != null )
                    slog(">>> following current focus [{0}]", Safe_UnitName(leader));
            }
            else if ( SquireSettings.Instance.Method == SquireSettings.FollowMethod.Health )
            {
                leader = (from p in GroupList
                    where p.Distance <= SquireSettings.Instance.LeaderScanRange
                        && p.CurrentHealth > 1
                        && !p.IsMe
                        && !p.OnTaxi
                        && !p.IsStealthed
                        && !Blacklist.Contains(p)
                        && p.Class != WoWClass.Rogue
                        && p.Class != WoWClass.Druid
                    orderby
                        p.MaxHealth descending
                    select p
                    ).FirstOrDefault();

                if ( leader != null )
                    slog(">>> following {0} with max health {1}", Safe_UnitName(leader), leader.MaxHealth);
            }
            else
            {
                var t =(from o in ObjectManager.ObjectList
                        where o is WoWPlayer && o.Distance <= SquireSettings.Instance.LeaderScanRange
                        let p = o.ToPlayer()
                        where p.IsHorde == Me.IsHorde
                            && p.CurrentHealth > 1
                            && !p.IsMe
                            && p.Class != WoWClass.Rogue
                            && p.Class != WoWClass.Druid
                            && !Blacklist.Contains(p)
                        let c = (from oo in ObjectManager.ObjectList
                                    where oo is WoWPlayer
                                        let pp = oo.ToPlayer()
                                    where pp.Location.Distance( p.Location ) < 40
                                        && pp.IsHorde == p.IsHorde
                                        && pp.CurrentHealth > 1
                                    select pp).Count()
                        orderby c descending, p.Distance ascending
                        select new {Player = p, Count = c}).FirstOrDefault();

                if ( t != null && t.Count >= SquireSettings.Instance.FollowMinDensity)
                {
                    leader = t.Player;
                    slog(">>> following {0} with player density {1}", Safe_UnitName(leader), t.Count );
                }
            }

            if (leader == null)
                slog(">>> no leader found, running profile till we find one...");

            return leader;
        }
Exemplo n.º 37
0
        private int unitcheck(WoWPlayer unit)
        {
            if (unit == null)
            {
                return -1;
            }
            else if (!unit.IsValid)
            {
                return -2;
            }
            else if (unit.Dead)
            {
                return -3;
            }
            else if (unit.IsGhost)
            {
                return -4;
            }
            else if (!unit.IsInMyPartyOrRaid && !unit.IsMe)
            {
                return -5;
            }
            return 1;

        }
        private bool PVENeedsUrgentCleanse(WoWPlayer p)
        {

            foreach (WoWAura a in p.Debuffs.Values)//p.ActiveAuras.Values)
            {

                /*if (
                    (p.ActiveAuras.ContainsKey("Static Cling")) ||
                    (p.ActiveAuras.ContainsKey("Flame Shock")) ||
                    (p.ActiveAuras.ContainsKey("Static Discharge")) ||
                    (p.ActiveAuras.ContainsKey("Consuming Darkness")) ||
                    (p.ActiveAuras.ContainsKey("Lash of Anguish")) ||
                    (p.ActiveAuras.ContainsKey("Static Disruption")) ||
                    (p.ActiveAuras.ContainsKey("Accelerated Corruption")) ||
                    (p.ActiveAuras.ContainsKey("Mangle")) ||
                    (p.ActiveAuras.ContainsKey("Corruption")) ||
                    (p.ActiveAuras.ContainsKey("Fear")
                    )
                   )*/
                if(a.Name=="Fear"||a.Name=="Static Cling"||a.Name=="Flame Shock"||a.Name=="Static Discharge"||a.Name=="Consuming Darkness"||a.Name=="Lash of Anguish"||a.Name=="Static Disruption"
                    ||a.Name=="Accelerated Corruption")
                {
                    
                    //slog(Color.Orange, "There is a urgent buff to dispell!");
                    WoWDispelType t = a.Spell.DispelType;
                    if (t == WoWDispelType.Disease || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
                    {
                    //    slog(Color.Orange, "And is dispellable {0} harmfull {1} name {2} applyauratype {3}, flags {4} category {5} dispelltype {6}", t.ToString(), a.IsHarmful.ToString(), a.Name, a.ApplyAuraType.ToString(), a.Flags.ToString(), a.Spell.Category.ToString(), a.Spell.DispelType.ToString());
                        return true;
                    }
                    else
                    {
                    //    slog(Color.Orange, "But is not dispellable {0} harmfull {1} name {2} applyauratype {3}, flags {4} category {5} dispelltype {6}", t.ToString(), a.IsHarmful.ToString(), a.Name, a.ApplyAuraType.ToString(), a.Flags.ToString(), a.Spell.Category.ToString(), a.Spell.DispelType.ToString());
                    }
                    //return true;
                }
            }
            return false;
        }
Exemplo n.º 39
0
 private bool NeedsCleanse(WoWPlayer p)
 {
     foreach (WoWAura a in p.ActiveAuras.Values)
     {
         if (a.IsHarmful && Me.ManaPercent > 50)
         {
             WoWDispelType t = a.Spell.DispelType;
             if (t == WoWDispelType.Curse || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
             {
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 40
0
 public bool IsTank(WoWPlayer p)
 {
     if (p != null)
     {
         return Lua.GetReturnValues("return UnitGroupRolesAssigned('" + DeUnicodify(p.Name) + "')").First() == "TANK";
     }
     else return false;
 }
        public PVPPlayerState(WoWPlayer player)
        {
            if (player == null)
                return;

            // Cycle trough target auras
            foreach (KeyValuePair<string, WoWAura> aura in player.Auras)
            {
                if (aura.Key.Equals("Sap") ||
                    aura.Key.Equals("Polymorph") ||
                    aura.Key.Equals("Ring of Frost") ||
                    aura.Key.Equals("Repentance") ||
                    aura.Key.Equals("Hungering Cold") ||
                    aura.Key.Equals("Blind"))
                {
                    Incapacitated = true;
                    Logger.Write("Target is Incapacitated: " + aura.Key);
                }
                else if (aura.Key.Equals("Ice Block") ||
                    aura.Key.Equals("Divine Shield") || 
                    aura.Key.Equals("Cyclone"))
                {
                    Invulnerable = true;
                    Logger.Write("Target is Invulnerable: " + aura.Key);
                }
                else if (aura.Value.Spell.Mechanic == WoWSpellMechanic.Stunned ||
                    aura.Key.Equals("Deep Freeze") || 
                    aura.Key.Equals("Hammer of Justice") ||
                    aura.Key.Equals("Pounce") ||
                    aura.Key.Equals("Maim"))
                {
                    Stunned = true;
                    Logger.Write("Target is stunned: " + aura.Key);
                }
                else if (aura.Value.Spell.Mechanic == WoWSpellMechanic.Slowed ||
                    aura.Value.Spell.Mechanic == WoWSpellMechanic.Snared ||
                    aura.Key.Equals("Frostfire Bolt") ||
                    aura.Key.Equals("Chains of Ice") ||
                    aura.Key.Equals("Aftermath") ||
                    aura.Key.Equals("Permafrost") || 
                    aura.Key.Equals("Piercing Chill") ||
                    aura.Key.Equals("Hamstring") ||
                    aura.Key.Equals("Typhoon") ||
                    aura.Key.Equals("Frost Shock") ||
                    aura.Key.Equals("Frozen Power"))
                {
                    Slowed = true;
                    Logger.Write("Target is slowed: " + aura.Key);
                }
                else if (aura.Value.Spell.Mechanic == WoWSpellMechanic.Rooted)
                {
                    rooted = true;
                    Logger.Write("Target is rooted: " + aura.Key);
                }
                else if (aura.Key.Equals("Fear") ||
                    aura.Key.Equals("Psychic Scream") ||
                    aura.Key.Equals("Howl of Terror") ||
                    aura.Key.Equals("Intimidating Shout"))
                {
                    Feared = true;
                    Logger.Write("Target is feared: " + aura.Key);
                }
                else if (aura.Key.Equals("Anti-Magic Shell") ||
                    aura.Key.Equals("Cloak of Shadows"))
                {
                    ResistsBinarySpells = true;
                    Logger.Write("Target resists binary spell: " + aura.Key);
                }
                else if (aura.Key.Equals("Icebound Fortitude"))
                {
                    ResistsStun = true;
                    Logger.Write("Target resists stun!");
                }
                else if (aura.Key.Equals("Spell Reflect"))
                {
                    ReflectMagic = true;
                    Logger.Write("Target has spell reflect");
                }

                if (aura.Key.Equals("Frost Nova") ||
                    aura.Key.Equals("Deep Freeze") ||
                    aura.Key.Equals("Improved Cone of Cold"))
                {
                    Freezed = true;
                }
            }
        }
Exemplo n.º 42
0
        private bool IsBeingTargeted(WoWPlayer Player)
        {
            foreach (WoWPlayer LoopUnit in ObjectManager.GetObjectsOfType<WoWPlayer>())
            {
                if (Player.IsAlliance == LoopUnit.IsAlliance) continue;

                if ((LoopUnit.CurrentTarget == Player)
                    && (Utils.Misc.GetDistance2D(LoopUnit.X, LoopUnit.Y, Player.X, Player.Y) < 35)) return true;
            }

            return false;
        }
Exemplo n.º 43
0
        private bool Hastobehealed(WoWPlayer unit)
        {
            for (i = 0; i < Me.RaidMembers.Count; i++)
            {
                if (healornot[i] && unit.Name==WoWnames[i])
                {
                    return true;
                }

            }
            return false;
        }
        // Credit to Apoc for the below CastSpell code
        // Used for calling CastSpell in the Combat Rotation


        //Credit to Wulf!
        public bool CastSpell(string spellName, WoWPlayer target)
        {
            if (SpellManager.CanCast(spellName, target) && !SpellManager.GlobalCooldown && !Me.IsCasting)
            {
                if (target == Me)
                {
                    //SpellManager.Cast(spellName, Me);
                    return false;
                }
                else
                {
                    SpellManager.Cast(spellName, target);
                    return true;
                }
            }
            return false;
        }
Exemplo n.º 45
0
 private bool NeddHoF(WoWPlayer p)
 {
     foreach (WoWAura a in p.Debuffs.Values)
         if (a.Name == "Entangling Roots" || a.Name == "Frost Nova" || a.Name == "Chains of Ice")
         {
             return true;
         }
     return false;
 }
Exemplo n.º 46
0
 private bool PVPNeedsUrgentCleanse(WoWPlayer p, bool can_dispel_disease, bool can_dispel_magic, bool can_dispel_poison)
 {
     foreach (WoWAura b in p.Debuffs.Values)
     {
         foreach (string s in _do_not_touch)
         {
             if (b.Name == s)
             {
                 return false;
             }
         }
     }
     foreach (WoWAura a in p.Debuffs.Values)
     {
         foreach (string q in _dispell_ASAP)
         {
             if (a.Name == q)
             {
                 WoWDispelType t = a.Spell.DispelType;
                 //slog(Color.Orange, "There is a urgent buff to dispell!");
                 if ((can_dispel_disease && t == WoWDispelType.Disease) || (can_dispel_magic && t == WoWDispelType.Magic) || (can_dispel_poison && t == WoWDispelType.Poison))
                 {
                     urgentdebuff = a.Name;
                     return true;
                 }
                 //return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 47
0
 private bool Should_AOE(WoWPlayer center, string spell, int how_many, int distance, int how_much_health)
 {
     if (!IsSpellReady(spell))
     {
         return false;
     }
     if (How_Many_Inside_AOE(center, distance, how_much_health) >= how_many)
     {
         return true;
     }
     else 
     { 
         return false; 
     }
 }
Exemplo n.º 48
0
        public static bool IsValidSymbiosisTarget(WoWPlayer p)
        {
            if (p.IsHorde != Me.IsHorde)
                return false;

            if (Blacklist.Contains(p.Guid, BlacklistFlags.Combat))
                return false;

            if (!p.IsAlive)
                return false;

            if (p.Level < 87)
                return false;

            if (p.Combat)
                return false;

            if (p.Distance > 28)
                return false;

            if (p.HasAura("Symbiosis"))
                return false;

            if (!p.InLineOfSpellSight)
                return false;

            return true;
        }
Exemplo n.º 49
0
        public static int HealingWeight(WoWPlayer unit)
        {
            WoWPlayer tank = RAF.PartyTankRole.ToPlayer();
            bool isCaster = (unit.Class == WoWClass.Mage || unit.Class == WoWClass.Priest || unit.Class == WoWClass.Warlock || unit.Class == WoWClass.Shaman || unit.Class == WoWClass.Druid && unit.Shapeshift == ShapeshiftForm.Normal);
            bool isHealer = (unit.Class == WoWClass.Priest && !unit.Auras.ContainsKey("Shadow Form") || unit.Class == WoWClass.Shaman || unit.Class == WoWClass.Paladin || unit.Class == WoWClass.Druid && (unit.Shapeshift != ShapeshiftForm.Cat || unit.Shapeshift != ShapeshiftForm.Bear));
            int weight = 0;                                   
            const int healthMultiplier = 11;
            const int debuffMultiplier = -5;
            const int tankMultiplier = -50;
            const int addMultiplier = -75;
            const int casterMultiplier = -155;
            const int healerMultiplier = -200;
            const int rejuvenationMultiplier = 44;
            const int regrowthMultiplier = 10;

            weight += (tank != null && tank.Guid == unit.Guid) ? tankMultiplier : 0;
            weight += (int)unit.HealthPercent * healthMultiplier;

            int countOfAdds = 0;
            foreach (WoWUnit u in ObjectManager.GetObjectsOfType<WoWUnit>())
            {
                if (u.IsPlayer) continue;
                if (!u.Combat) continue;
                if (u.Distance > 80) continue;
                if (u.CurrentTargetGuid != unit.Guid) continue;
                countOfAdds += 1;
            }
            weight += isCaster ? (countOfAdds * casterMultiplier) : countOfAdds * addMultiplier;
            weight += (Utils.IsBattleground && isHealer) ? healerMultiplier : 0;
            //weight += countOfAdds * addMultiplier;

            int countOfDoTs = 0;
            foreach (KeyValuePair<string, WoWAura> aura in unit.Auras)
            {
                if (aura.Key == "Rejuvenation") weight += rejuvenationMultiplier;
                if (aura.Key == "Regrowth") weight += regrowthMultiplier;

                if (!aura.Value.IsHarmful) continue;
                if (aura.Value.Spell.DispelType == WoWDispelType.None) continue;
                //countOfDoTs += 1;
                weight += debuffMultiplier;
            }
            weight += countOfDoTs * debuffMultiplier;


            return weight;
        }
Exemplo n.º 50
0
 private int How_Many_Inside_AOE(WoWPlayer center, int distance, int how_much_health, int subgroup)
 {
     return (from unit in NearbyFarFriendlyPlayers
             where unitcheck(unit)
             where (unit.IsInMyPartyOrRaid || unit.IsMe)
             where unit.Location.Distance(center.Location) < distance
             where unit.HealthPercent < how_much_health
             where SameSubgroup(unit.Name,subgroup)
             select unit).Count();
 }
Exemplo n.º 51
0
 private bool IsTank(WoWPlayer p)
 {
     return Lua.GetReturnValues("return UnitGroupRolesAssigned('" + DeUnicodify(p.Name) + "')").First() == "TANK";
 }
Exemplo n.º 52
0
 private bool Should_AOE(int how_many, int distance, int how_much_health, out WoWPlayer target)
 {
     i = 0;
     foreach (WoWPlayer p in NearbyFriendlyPlayers)
     {
         if (i < 41 && unitcheck(p) && p.Distance < _max_healing_distance && p.InLineOfSight)
         {
             check_aoe[i] = How_Many_Inside_AOE(p, distance, how_much_health);
             i++;
         }
     }
     if (check_aoe.Max() < how_many)
     {
         target = null;
         return false;
     }
     else
     {
         for (i = 0; i < check_aoe.Length; i++)
         {
             if (check_aoe.Max() == check_aoe[i])
             {
                 slog("Found a center! {0} units will be healied!", check_aoe.Max());
                 target = NearbyFriendlyPlayers[i];
                 return true;
             }
         }
         target = null;
         return false;
     }
 }
Exemplo n.º 53
0
        public override void Pulse()
        {
            try
            {
                while (IsGameStable() && Styx.Logic.BehaviorTree.TreeRoot.IsRunning && Battlegrounds.IsInsideBattleground)
                {
                    if (Me.CurrentHealth <= 1 || Me.Combat || Me.IsCasting || Battlegrounds.Finished)
                        return;

                    if (!haveInitialized)
                    {
                        Initialize();
                    }

                    if (Battlegrounds.Current == BattlegroundType.IoC || Battlegrounds.Current == BattlegroundType.SotA)
                    {
                        slog("battleground '{0}' not supported, running profile only", Battlegrounds.Current.ToString());
                        return;
                    }

                    // during prep period of bg let bot handle buffs, timing, etc
                    if (Me.Auras.ContainsKey("Preparation"))
                    {
                        while (IsGameStable() && Me.CurrentHealth > 1 && RoutineManager.Current.NeedPullBuffs)
                        {
                            slog("Applying Pull Buffs");
                            RoutineManager.Current.PullBuff();
                            StyxWoW.SleepForLagDuration();
                        }

                        while (IsGameStable() && Me.CurrentHealth > 1 && RoutineManager.Current.NeedPreCombatBuffs)
                        {
                            slog("Applying Pre-Combat Buffs");
                            RoutineManager.Current.PreCombatBuff();
                            StyxWoW.SleepForLagDuration();
                        }

                        return;
                    }

                    // battleground is running, so validate our leader
                    if (leader != null)
                    {
                        if (!ObjectManager.ObjectList.Contains(leader) || !leader.IsValid)
                        {
                            slog("leader is no longer in group");
                            leader = null;
                        }
                        else if (leader.CurrentHealth <= 1)
                        {
                            slog("leader died");
                            leader = null;
                        }
                        else if (leader.OnTaxi)
                        {
                            slog("leader is hitching a ride");
                            leader = null;
                        }
                        else if (leader.IsStealthed)
                        {
                            slog("leader is stealthed");
                            leader = null;
                        }
                        else if (leader.Distance > (SquireSettings.Instance.LeaderScanRange + SquireSettings.Instance.LeaderOutOfRange))
                        {
                            slog("leader out of range at {0:F1} yds", leader.Distance);
                            leader = null;
                        }
                    }

                    // no leader? then find one
                    if (leader == null)
                    {
                        if (lastLeadCheck.IsRunning && lastLeadCheck.ElapsedMilliseconds < 2000)
                            return;

                        lastLeadCheck.Reset();
                        lastLeadCheck.Start();

                        leader = FindLeader();
                        SetFocus(leader);       // null clears focus
                        if (leader == null)
                        {
                            slog(">>> no leader found, running profile till we find one...");
                            return;
                        }

                        lastLeadMovement = System.Environment.TickCount + (SquireSettings.Instance.StillTimeout * 1000);
                    }

                    // update movement timeout if they are doing something
                    if (leader.IsMoving || leader.IsCasting)
                        lastLeadMovement = System.Environment.TickCount + (SquireSettings.Instance.StillTimeout * 1000);

                    // TODO:  check if near an objective, since its okay to wait there in a group
                    // if they havent done anything, bail on the current leader
                    if (lastLeadMovement < System.Environment.TickCount)
                    {
                        slog("leader still for {0} seconds, blacklisting for {1} seconds", SquireSettings.Instance.StillTimeout, SquireSettings.Instance.BlacklistTime);
                        Blacklist.Add(leader, TimeSpan.FromSeconds(SquireSettings.Instance.BlacklistTime));
                        leader = null;
                        continue;
                    }

                    if ((leader.Mounted || leader.Distance > 50) && Me.IsOutdoors && !Me.Mounted && Mount.CanMount())
                    {
                        WaitForMount();
                    }

                    WoWUnit target = null;

                    if (!IsUnitInRange(leader, Me.IsIndoors ? 10 : followDistance ))
                    {
                        // slog("leader out of range, moving towards now...");
                        if (movePointDelay.ElapsedMilliseconds > SquireSettings.Instance.MoveDelayMS || (!Me.IsMoving && leader.IsMoving))
                        {
                            movePointDelay.Reset();
                            movePointDelay.Start();
                            if (!MoveToUnit(leader, 5))
                            {
                                slog("Unable to move to leader {0}, resetting...", Safe_UnitName(leader));
                                Blacklist.Add(leader, TimeSpan.FromSeconds(10));
                                leader = null;
                            }
                        }

                        if (!Me.Mounted)
                            target = FindTarget();

                        if (target == null)
                            continue;   // moving now, so just loop and check again in awhile
                    }

                    if (!leader.Mounted && Me.Mounted)
                    {
                        slog("leader not mounted, dismounting...");
                        WaitForDismount();
                    }

                    if (!leader.Combat && !leader.IsMoving && Me.IsMoving)
                    {
                        slog("leader not moving, stopping...");
                        WaitForStop();
                    }

                    CallPulse();
                    CallRest();
                    CallHeal();
                    // if (GetActualStrategy() == SquireSettings.CombatStrategy.DPS)
                    {
                        // if (!Me.Combat && leader.Combat)
                        {

                            // have a target? Then PULLL!!!!!!!!
                            if (target != null )
                            {
                                CallPull(target);
                            }
                        }
                    }
                }
            }
            catch (InvalidOperationException )
            {
                slog("Leader is no longer valid, resetting...");
                leader = null;
            }
            catch (Exception e)
            {
                slog( "An Exception occured. Check debug log for details.");
                Logging.WriteDebug(">>> EXCEPTION");
                Logging.WriteException(e);
            }

            // at this point, they either stopped the bot or we are in Combat

            // now fall through and let default behavior take place
        }
Exemplo n.º 54
0
 private bool Should_PoH(WoWPlayer center, int how_many, int distance, int how_much_health, int subgroup)
 {
     if (How_Many_Inside_AOE(center, distance, how_much_health,subgroup) >= how_many)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemplo n.º 55
0
 /*
 private bool NeedsCleanse(WoWPlayer p)
 {
     int dispelme;
     bool touchme;
     dispelme = 0;
     touchme = true;
     foreach (WoWAura a in p.ActiveAuras.Values)
     {
         if ((a.IsHarmful) && (!p.ActiveAuras.ContainsKey("Blackout")) && (!p.ActiveAuras.ContainsKey("Toxic Torment")) && (!p.ActiveAuras.ContainsKey("Frostburn Formula")) && (!p.ActiveAuras.ContainsKey("Burning Blood")) && (!p.ActiveAuras.ContainsKey("Unstable Affliction")))
         {
             WoWDispelType t = a.Spell.DispelType;
             if (t == WoWDispelType.Disease || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
             {
                 dispelme += 1;
                 // return true;
             }
         }
         else if ((p.ActiveAuras.ContainsKey("Blackout")) || (p.ActiveAuras.ContainsKey("Toxic Torment")) || (p.ActiveAuras.ContainsKey("Frostburn Formula")) | (p.ActiveAuras.ContainsKey("Burning Blood")) || (p.ActiveAuras.ContainsKey("Unstable Affliction")))
         {
             touchme = false;
         }
     }
     if ((dispelme > 0) && (touchme)) { return true; } else { return false; }
 }
 */
 private bool NeedsCleanse(WoWPlayer p)
 {
     //int dispelme;
     //dispelme = 0;
     if ((p.ActiveAuras.ContainsKey("Blackout")) || (p.ActiveAuras.ContainsKey("Toxic Torment")) || (p.ActiveAuras.ContainsKey("Frostburn Formula")) || (p.ActiveAuras.ContainsKey("Burning Blood")) || (p.ActiveAuras.ContainsKey("Unstable Affliction")))
     {
         return false;
     }
     foreach (WoWAura a in p.Debuffs.Values)
     {
             WoWDispelType t = a.Spell.DispelType;
             if (t == WoWDispelType.Disease || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
             {
                 //dispelme += 1;
                 return true;
             }
     }
     //if (dispelme > 0) { return true; } else { return false; }
     return false;
 }
Exemplo n.º 56
0
        public static string GetGroupRoleAssigned(WoWPlayer p)
        {
            string sRole = "NONE";
            if (ObjectManager.Me.IsInParty || ObjectManager.Me.IsInRaid)
            {
                try
                {                   
                    string luaCmd = "return UnitGroupRolesAssigned(\"" + p.Name + "\")";
                    sRole = Lua.GetReturnVal<string>(luaCmd, 0);
                }
                catch
                {
                    sRole = "NONE";
                }
            }

            return sRole;
        }
 /*
 private bool NeedHoFNow(WoWPlayer p)
 {
     foreach (WoWAura a in p.ActiveAuras.Values)
     {
         if ((a.IsHarmful) &&
             (!p.ActiveAuras.ContainsKey("Unstable Affliction")) &&
             ((p.ActiveAuras.ContainsKey("Entangling Roots")) ||
             (p.ActiveAuras.ContainsKey("Frost Nova")) ||
             (p.ActiveAuras.ContainsKey("Chains of Ice"))
         ))
         {
             WoWDispelType t = a.Spell.DispelType;
             if (t == WoWDispelType.Disease || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
             {
                 return true;
             }
         }
     }
     return false;
 }
 */
 /*
 private bool PVPNeedsUrgentCleanse(WoWPlayer p)
 {
     foreach (WoWAura a in p.ActiveAuras.Values)
     {
         if (
             (!p.ActiveAuras.ContainsKey("Unstable Affliction")) &&
             ((p.ActiveAuras.ContainsKey("Fear")) ||
             (p.ActiveAuras.ContainsKey("Polymorph")) ||
             (p.ActiveAuras.ContainsKey("Freezing Trap")) ||
             (p.ActiveAuras.ContainsKey("Wyvern Sting")) ||
             (p.ActiveAuras.ContainsKey("Seduction")) ||
             (p.ActiveAuras.ContainsKey("Mind Control")) ||
             //(p.ActiveAuras.ContainsKey("Entangling Roots")) ||
             //(p.ActiveAuras.ContainsKey("Frost Nova")) ||
             //(p.ActiveAuras.ContainsKey("Chains of Ice")) ||
             (p.ActiveAuras.ContainsKey("Repentance")) ||
             (p.ActiveAuras.ContainsKey("Hex")) ||
             (p.ActiveAuras.ContainsKey("Psychic Scream")) ||
             (p.ActiveAuras.ContainsKey("Hammer of Justice")) ||
             (p.ActiveAuras.ContainsKey("Intimidating Shout")) ||
             (p.ActiveAuras.ContainsKey("Howl of Terror"))
         )){
             WoWDispelType t = a.Spell.DispelType;
             slog(Color.Orange, "There is a urgent buff to dispell!");
             if (t == WoWDispelType.Disease || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
             {
 //                slog(Color.Orange, "And is dispellable");
                 return true;
             }
             else
             {
   //              slog(Color.Orange, "But is not dispellable");
             }
         }
     }
     return false;
 }*/
 private bool PVPNeedsUrgentCleanse(WoWPlayer p)
 {
     if (p.ActiveAuras.ContainsKey("Unstable Affliction"))
     {
         return false;
     }
     foreach (WoWAura a in p.Debuffs.Values)
     {
         if (a.Name == "Fear" || a.Name == "Polymorph" || a.Name == "Freezing Trap" || a.Name == "Wyvern Sting" || a.Name == "Seduction" || a.Name == "Mind Control" || a.Name == "Repetance" || a.Name == "Psychic Scream"
             || a.Name == "Hammer of Justice" || a.Name == "Intimidating Shout" || a.Name == "Howl of Terror")
         {
             WoWDispelType t = a.Spell.DispelType;
             //slog(Color.Orange, "There is a urgent buff to dispell!");
             if (t == WoWDispelType.Disease || t == WoWDispelType.Magic || t == WoWDispelType.Poison)
             {
                 //                slog(Color.Orange, "And is dispellable");
                 return true;
             }
             //return true;
         }
     }
     return false;
 }
Exemplo n.º 58
0
 private bool PVPNeedsCleanse(WoWPlayer p, bool can_dispel_disease, bool can_dispel_magic, bool can_dispel_poison)
 {
     foreach (WoWAura b in p.Debuffs.Values)
     {
         foreach (string s in _do_not_touch)
         {
             if (b.Name == s)
             {
                 return false;
             }
         }
     }
     foreach (WoWAura a in p.Debuffs.Values)
     {
         WoWDispelType t = a.Spell.DispelType;
         if ((can_dispel_disease && t == WoWDispelType.Disease) || (can_dispel_magic && t == WoWDispelType.Magic) || (can_dispel_poison && t == WoWDispelType.Poison))
         {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 59
0
        private static WoWPlayer GetBestRiptideTarget(WoWPlayer originalTarget)
        {
            if (!originalTarget.HasMyAura("Riptide"))
                return originalTarget;

            // Target already has RT. So lets find someone else to throw it on. Lowest health first preferably.
            return Unit.NearbyFriendlyPlayers.OrderBy(u => u.HealthPercent).Where(u => !u.HasMyAura("Riptide")).FirstOrDefault();
        }
Exemplo n.º 60
0
 public Composite cbac(string name, WoWPlayer onUnit)
 {
     return new Decorator(ret => SpellManager.CanBuff(name, onUnit),
                          new Action(delegate
                              {
                                  SpellManager.Buff(name, onUnit);
                                 Logging.Write(Color.Lime, "--> " + name + " <-- on " + onUnit + "!");
                              }
                              ));
 }