Jump to content

Apexx

Elite user
  • Posts

    332
  • Joined

Posts posted by Apexx

  1. I am using Visual Studio 2013 with .Net Framework 4.5

    Before you guys supplied me with the Namespace System.Linq reference, I managed to get my rotation working using

    private int HostileUnitsInRange(int range)
        {
            var unitAttackPlayer = ObjectManager.GetUnitAttackPlayer();
    
            if (unitAttackPlayer.Count <= 0)
                return 0;
    
            var hostileUnitsAttacking = unitAttackPlayer.FindAll(u => u != null && u.IsValid && u.IsTargetingMe && u.GetDistance <= range);
            return hostileUnitsAttacking.Count;
        }

     

  2. Thanks @Matenia for the assist with the count issue!  I am going to try it out now.

    Error:

    'System.Collections.Generic.List<wManager.Wow.ObjectManager.WoWUnit>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.List<wManager.Wow.ObjectManager.WoWUnit>' could be found (are you missing a using directive or an assembly reference?)

     

  3. Hey, so I was running around in Orgrimmar when a Paladin I had passed by blessed me with Blessing of Might.
    I left Org to continue questing when I noticed my fight class kept trying to apply Battle Shout.

    In my Spell Conditions I have the following:
    Buff -> Battle Shout | Need = False
    Cooldown Time Left: Buff name: Battle Shout | Number: 10 | Type: SmallerOrEqual

    I was wondering what condition I could add to check that i don't have a buff like Blessing of Might?

    I was thinking something like:
     

    If (wManager.Wow.ObjectManager.ObjectManager.Me.HaveBuff(19835)) 
    {
    	// Not sure what to add here
    }

    *Edit* It may also be affected by Horn of Winter. Would need a check for multiple buffs.

  4. I consider myself an intermediate programmer, but I haven't even been able to tie Wrobot into Visual Studio.
    I read the forums and followed the instructions, but still have had no luck.

    I would like to share a piece of code from a rotation I wrote using another bot that no longer exists. The API was beautiful!
    Hooking into Visual Studio was easier than ever as well. I am new here, and I am sure after some more time playing around,
    I will be able to figure it out eventually. Have a look at this neat fight class approach:

    using System.Linq;
    using Newtonsoft.Json;
    using Botname.API;
    
    namespace Botname {
    	[Rotation("Apexx - PvP Beast Mastery [WiP]", "Apexx", WoWClass.Hunter, Specialization.HunterBeastMastery, 40)]
    	public class HunterPvPBeastMastery : CombatRotation {
    		[JsonProperty("UsePet")]
    		public bool UsePet = true;
    			
    		public HunterPvPBeastMastery() {
    			PullSpells = new string[] {
                    "Concussive Shot", 
                    "Steady Shot"
                };
    		}
    
            private void DebugWrite(string text) {
                API.Print(text);
            }
    
            // Store Player Focus
            public int myFocus {
                get { return Me.GetPower(WoWPowerType.Focus); }
            }
    
    
            // DPS Priority (From Noxxic.com)
            // ############################################################
    
            // Kill Command [on cooldown]
            private bool KillCommand() {
                string spellname = "Kill Command";
                if (SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname, () => Target.HpGreaterThanOrElite(0.4) && (!Target.HasAura("Hunter's Mark") || myFocus >= 60));
                DebugWrite(spellname);
                return true;
            }
            // Kill Shot [when target below 20% Health]
            private bool KillShot() {
                string spellname = "Kill Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname, () => Me.Target.HealthFraction < 0.2);
                DebugWrite(spellname);
                return true;
            }
            // Focus Fire [with 5 Frenzy stacks]
            private bool FocusFire() {
                string spellname = "Focus Fire";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                if(CastSelf(spellname, () => HasAura("Frenzy") && !HasAura("Focus Fire"))) {
                    DebugWrite(spellname);
                    return false;
                }
                return false;
            }
            // Arcane Shot [to dump excess Focus (> 60 Focus)]
            private bool ArcaneShot() {
                string spellname = "Arcane Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname, () => myFocus >= 60);
                DebugWrite(spellname);
                //DebugWrite("My Focus: " + myFocus.ToString());
                return true;
            }
            // Steady Shot [to build Focus (< 60 Focus)]
            private bool SteadyShot() {
                string spellname = "Steady Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                if(Cast(spellname, () => myFocus < 60)) {
                    DebugWrite(spellname);
                    return true;
                }
                return false;
            }
            // Cobra Shot [to build Focus (< 60 Focus)]
            private bool CobraShot() {
                string spellname = "Cobra Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname, () => myFocus < 60);
                DebugWrite(spellname);
                return true;
            }
    
    
            // AoE Abilities
            // ###########################################################
    
            // Multi-Shot [for Improved Beast Cleave]
            // Will perform Adds.Count check in combat (2+ enemy units)
            private bool MultiShot() {
                string spellname = "Multi-Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname, () => myFocus >= 40);
                DebugWrite(spellname);
                return true;
            }
            // Explosive Trap [on cooldown]
            // Will perform Adds.Count check in combat (2+ enemy units)
            private bool ExplosiveTrap() {
                string spellname = "Explosive Trap";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                CastOnTerrain(spellname, Me.Target.Position);
                DebugWrite(spellname);
                return true;
            }
            // Ice Trap [for evasive maneuvering]
            private bool IceTrap() {
                string spellname = "Ice Trap";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                CastOnTerrain(spellname, Me.Target.Position);
                DebugWrite(spellname);
                return true;
            }
    
    
            // Miscellaneous
            // ###########################################################
    
            // Dire Beast [should be used as frequently as possible]
            private bool DireBeast() {
                string spellname = "Dire Beast";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname);
                DebugWrite(spellname);
                return true;
            }
            // Bestial Wrath [Use on cooldown. Let your pet keep Frenzy.]
            private bool BestialWrath() {
                string spellname = "Bestial Wrath";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname);
                DebugWrite(spellname);
                return true;
            }
            // A Murder of Crows [when target HP < 20% and Focus >= 30]
            private bool MurderofCrows() {
                string spellname = "A Murder of Crows";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast("A Murder of Crows", () => Target.HealthFraction < 0.2 && myFocus >= 30);
                DebugWrite(spellname);
                return true;
            }
            // Concussive Shot [when target does not have debuff]
            private bool ConcussiveShot() {
                string spellname = "Concussive Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                if(Cast(spellname, () => (!Target.HasAura(spellname)))) {
                    DebugWrite(spellname);
                    return true;
                }
                return false;
            }
            // Last Stand
            private bool LastStand() {
                string spellname = "Last Stand";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                CastSelf(spellname, () => Me.HasAlivePet && Me.Pet.HealthFraction <= 0.5 && Me.Pet.HasAura("Mend Pet"));
                DebugWrite(spellname);
                return true;
            }
            // Disengage [Evasive maneuver used when target(s) are close!]
            private bool Disengage() {
                string spellname = "Disengage";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                if(CastSelfPreventDouble(spellname, () => (Target.DistanceSquared <= 5 * 5))) {
                    DebugWrite(spellname);
                    return true;
                }
                return false;
            }
            // Tranquilizing Shot [If target has magic aura]
            private bool TranquilizingShot() {
                string spellname = "Tranquilizing Shot";
                if(SpellCooldown(spellname) > 0) return false;
                if(!HasSpell(spellname)) return false;
                Cast(spellname, () => Target.Auras.Any(x => !x.IsDebuff && x.DebuffType == "Magic"));
                DebugWrite(spellname);
                return true;
            }
    
    
            // OUT OF COMBAT
            // ###############################################################################
    
    		public override bool OutOfCombat() {
                if (UsePet) {
    				if (!Me.HasAlivePet) {
    					if (CastSelfPreventDouble("Call Pet 1", null, 2000)) return true;
    					if (CastSelfPreventDouble("Revive Pet", null, 2000)) return true;
    					return true;
    				}
    			}
    			else if (Me.HasAlivePet) {
    				Me.PetDismiss();
    			}
    
                // Check Pet health here
                if(CastSelfPreventDouble("Mend Pet", () => Me.HasAlivePet && Me.Pet.HealthFraction <= 0.8, 9000)) return true;
    
    			if (CastSelf("Trap Launcher", () => !HasAura("Trap Launcher"))) return true;
    			return false;
    		}
    
    
            // IN COMBAT
            // ###############################################################################
    		public override void Combat() {
    			if (Me.HasAlivePet) {
    				UnitObject add = Adds.FirstOrDefault(x => x.Target == Me);
    				if (add != null)
    					Me.PetAttack(add);
    			}
    			else if (!Me.HasAlivePet) {
    				if (CastSelf("Heart of the Phoenix")) return;
    				if (CastSelfPreventDouble("Revive Pet", null, 10000)) return;
    			}
    
                int addsWithinMultiRange = 0;
                if(Adds.Count > 0) {
                    foreach(var aggro in Adds.Where(x => x.DistanceSquared < SpellMaxRangeSq("Arcane Shot"))) {
                        UnitObject add = aggro;
                        if(Cast("Serpent Sting", () => !add.HasAura("Serpent Sting", true), add)) {
                            DebugWrite("Serpent Sting");
                            return;
                        }
                    }
                    
                    //  Add.Count +1 to offset 0
                    addsWithinMultiRange = 1 + Adds.Count(x => x.DistanceSquaredTo(Target) < 40 * 40);
                    //DebugWrite("Adds in range: " + addsWithinMultiRange);
    
                    // Check Pet health here
                    if(CastSelfPreventDouble("Mend Pet", () => Me.HasAlivePet && Me.Pet.HealthFraction <= 0.8, 9000)) return;
    
                    // AoE if more than one enemy unit
                    if(addsWithinMultiRange >= 2) {
                        if(ExplosiveTrap()) return;
                        //if(IceTrap()) return;
                        //if(MultiShot()) return;
                    }
                }
    
    
                // Begin Rotation
    
                if(Target.HealthFraction < 0.2) {
                    API.ExecuteMacro("/stopcasting");
                    if(KillShot()) return;
                }
    
                //if(DireBeast()) return;
                //if(BestialWrath()) return;
                if(ConcussiveShot()) return;
                if(FocusFire()) return;
                if(ArcaneShot()) return;
                if(SteadyShot()) return;
                if(CobraShot()) return;
                if(LastStand()) return;
                if(MurderofCrows()) return;
                if(KillCommand()) return;
    
                if(Target.HealthFraction < 0.2) {
                    API.ExecuteMacro("/stopcasting");
                    if(KillShot()) return;
                }
    
                if(Target.IsCastingAndInterruptible() && SpellCooldown("Counter Shot") <= 0) {
                    API.ExecuteMacro("/stopcasting");
                    Cast("Counter Shot");
                    DebugWrite("Counter Shot");
                }
    
                if(Disengage()) return;
    
                if(TranquilizingShot()) return;
                if(Cast("Barrage")) return;
                if(Cast("Glaive Toss")) return;
    
                // Check Player health here
                // Feign Dealth when HP at 20%
                if(CastSelfPreventDouble("Feign Death", () => Me.HealthFraction <= 0.2)) return;
    
    			if (CastSelfPreventDouble("Feign Death", () => Me.HasAlivePet && Target.Target == Me.Pet && Adds.Any(x => x.Target == Me))) return;
    		}
    	}
    }

    I will keep searching the forums to better educate myself here. I like writing fight classes and grinder/questing profiles.
     

×
×
  • Create New...