void ShadowCheck(GUnit Target)
 {
     //If use Nightfall, checks if have shadow trance and cast
             if (USE_NIGHTFALL && (Me.Mana > .30) && Me.HasBuff(ShadowTranceSpellID))
             {
                 Context.Log("SHADOWTRANCE! Casting now!");
                 CastShadowBolt(Target);
                 Thread.Sleep(250);
             }
 }
        void LastResort(GUnit Target)
        {
            switch (LAST_RESORT)
            {
                case "Wand":

                    if (!Interface.IsKeyFiring("PL.Wand"))
                    {
                        SendKey("PL.Wand");
                    }
                    break;
                case "Melee":
                    Target.Approach();
                    Movement.TweakMelee(Target);
                    break;
                default:
                    return;
            }
        }
 //Initiate primary attack
 bool PrimaryAttack(GUnit Target)
 {
     switch (PRIMARY_ATTACK)
     {
         case "Drain Life":
             return DrainLife(Target, true);
         case "Shadow Bolt":
             return CastShadowBolt(Target);
         case "Wand":
             Wand(Target);
             return true;
         case "Melee":
             return Melee(Target);
     }
     return false;
 }
 //Checks mana (Overloaded) - First check Drain Mana, Second check Life Tap
 bool CheckMana(GUnit Target)
 {
     if (USE_DRAINMANA && Target.Mana > .5 && Me.Mana > .1 && Me.Health > MIN_HEALTH_PCT && (Me.Mana < DRAINMANA_PCT || (USE_FEEDMANA && Me.HasLivePet && Me.Pet.Mana < FEEDMANA_PCT)))
     {
      //   Context.Log("CheckMana SS Check - My current SS count is " + SoulShardCount + " with a max of " + SOULSHARDS_MAX);
         if (SoulShardCount < SOULSHARDS_MAX)
         {
             if (SoulShardCount < 1)
             {
                 SoulShardCount = 0;
             }
             Target.Face();
             CastSwitchSpell("PL.DrainMana", "PL.DrainSoul", Target, DRAINSOUL_PCT);
         }
         else
         {
             Target.Face();
             CastSpell("PL.DrainMana");
         }
         return true;
     }
     else if (USE_DARKPACT && Me.HasLivePet && Me.Mana < MIN_MANA_PCT && Me.Pet.Mana > MaintainPetMana)
     {
         CastSpell("PL.DarkPact");
         return true;
     }
     else if (USE_LIFETAP && (Me.Health > MIN_HEALTH_PCT) && (Me.Mana < MIN_MANA_PCT || (USE_FEEDMANA && Me.HasLivePet && Me.Pet.Mana < FEEDMANA_PCT)))
     {
         CastSpell("PL.Lifetap");
         return true;
     }
     return false;
 }
        //Checks for and casts Drain Life
        bool DrainLife(GUnit Target, bool ForceUse)
        {
            //Added logging to Drainlife for testing  BEANS
            //Context.Log("DrainLife function check on ForceUse is " + ForceUse);
            //Context.Log("My health pct is "+Me.Health+" and my mana pct is " + Me.Mana);
            CheckHealth(Me.IsInCombat);
            if ((USE_DRAINLIFE && (Me.Health < DRAINLIFE_PCT) || ForceUse))
            {
                //Because its channeling it will often kill before we have a chance to drain soul so we do castspellwithinterrupt to fix it
                //Context.Log("DrainLife SS Check - My current SS count is " + SoulShardCount + " with a max of " + SOULSHARDS_MAX);
                if (SoulShardCount < SOULSHARDS_MAX && (Target.Health < MIN_MOB_HEALTH_PCT))
                {
                    ShadowCheck(Target);
                    if (USE_LIFETAP && (Me.Health > EMERGENCY_HEALTH))
                    {
                        //Context.Log("Casting Lifetap from within DrainLife function");
                        CastSpell("PL.Lifetap");
                        Thread.Sleep(250);
                    }
                    if (SoulShardCount < 1)
                    {
                        SoulShardCount = 0;
                    }
                    Target.Face();
                    if (!Target.IsDead)
                    {
                        CastSwitchSpell("PL.DrainLife", "PL.DrainSoul", Target, DRAINSOUL_PCT);
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {

                    ShadowCheck(Target);
                    //Context.Log("Use Lifetap is " + USE_LIFETAP);
                    if (USE_LIFETAP && (Me.Health > MIN_HEALTH_PCT) && (Me.Mana < MIN_MANA_PCT))
                    {
                        //Context.Log("Casting Lifetap from within DrainLife function");
                        CastSpell("PL.Lifetap");
                        Thread.Sleep(250);
                    }
                    try
                    {
                        Target.Face();
                        if (!Target.IsDead)
                        {
                            CastSpell("PL.DrainLife");
                            Thread.Sleep(250);
                        }
                        if ((Me.Health < MIN_HEALTH_PCT) && (Me.Mana > .3)&&(!Target.IsDead)) //If we are low on health and have at least 30% lets throw another Drain Life
                        {
                            Target.Face();
                            CastSpell("PL.DrainLife");
                            Thread.Sleep(250);
                        }
                    }
                    catch (Exception e)
                    {
                        if (Target == null)
                            Context.Log("You errored out during DrainLife - Notes Target = null so I tried to bomb out.");
                        else
                            Context.Log("You Errored out during DrainLife - \r\n " + e.ToString());
                    }
                    return true;
                }
            }
            return false;
        }
        protected bool IsMounted(GUnit Unit)
        {
            Unit.SetBuffsDirty();
            GBuff[] buffs = Unit.GetBuffSnapshot();
            for (int i = 0; i < buffs.Length; i++)
            {
                GBuff b = buffs[i];
                string s = b.SpellName;
                //OOberLog(" buff " + s);
                if (
                   (MOUNTNAME.Length>0 && s.Contains(MOUNTNAME)) ||
                   s.Contains("Horse") ||
                   s.Contains("Warhorse") ||
                   s.Contains("Raptor") ||
                   s.Contains("Kodo") ||
                   s.Contains("Wolf") ||
                   s.Contains("Saber") ||
                   s.Contains("Ram") ||
                   s.Contains("Mechanostrider") ||
                   s.Contains("Hawkstrider") ||
                   s.Contains("Elekk") ||
                   s.Contains("Steed") ||
                   s.Contains("Tiger") ||
                   s.Contains("Talbuk") ||
                   s.Contains("Frostsaber") ||
                   s.Contains("Nightsaber") ||
                   s.Contains("Battle Tank") ||
                   s.Contains("Charger") ||
                   s.Contains("Frostwolf") ||
                   s.Contains("Reins") || // yeah right
                   s.Contains("Turtle")  // lol
                    )
                {
                    //Context.Log("buff found : " + s);
                    if (s != "Ghost Wolf") return true;
                }

            }
            return false;
        }
 //Takes two spells. First MUST be channeling, second CAN be channeling.
 void CastSwitchSpell(string FirstSpell, string SecondSpell, GUnit Target, double TargetHealthToSwitch)
 {
     Context.Log(Format(Replace(Replace(FirstSpell, "PL.", "Casting: "), "Common.", "Casting: ")));
     if (Interface.IsKeyFiring("PL.Wand"))
     {
         SendKey("PL.Wand");
         GlobalCooldown.Reset();
     }
     if (Me.IsSitting)
     {
         SendKey("Common.Back");
         Thread.Sleep(200);
     }
     GlobalCooldown.Wait();
     Target.Face();
     //Context.CastSpell(FirstSpell, false, true);
     Context.SendKey(FirstSpell);
     GlobalCooldown.Reset();
     OneSecTimer.Reset();
     while (!OneSecTimer.IsReady)
     {
         Thread.Sleep(100);
         if (Me.IsCasting)
         {
             while (Me.IsCasting)
             {
                 if (Target.Health < TargetHealthToSwitch)
                 {
                     CastSpell(SecondSpell);
                     break;
                 }
                 Target.Face();
                 Thread.Sleep(100);
             }
             break;
         }
     }
 }
Example #8
0
 public override bool WantToDoSomething()
 {
     monster = ppather.FindAttacker();
     return(monster != null);
 }
Example #9
0
 public ActivityInteract(Task t, GUnit npc)
     : base(t, "Interact")
 {
     this.npc = npc;
 }
Example #10
0
 protected virtual void CombatRoutine(GUnit Cible)
 {
 }
Example #11
0
 public ActivityTaxi(Task t, GUnit npc, String destination)
     : base(t, "Taxi")
 {
     this.npc         = npc;
     this.destination = destination;
 }
Example #12
0
 private void DidLoot(GUnit u)
 {
     ppather.Blacklist(u.GUID, 5 * 60);
 }
Example #13
0
 public HealthPrioStruct(GUnit tar)
 {
     this.Target = tar;
 }
Example #14
0
 public SWarEnnemyAlgo(GUnit tar) : base(tar)
 {
 }
 bool WaitForEngage(GUnit Target, int Time)
 {
     GSpellTimer BreakLoop = new GSpellTimer(Time, false);
     BreakLoop.Reset();
     while (!BreakLoop.IsReady)
     {
         Thread.Sleep(100);
         if (Target.DistanceToSelf > PullDistance) Target.Approach(PullDistance - 5, false);
         if (Target.Target == Me || Target.Target == Me.Pet || Me.Pet.IsInCombat)
         {
             return true;
         }
         else if (Me.IsUnderAttack) return false;
     }
     return false;
 }
Example #16
0
 public ActivityLoot(Task t, GUnit monster, bool Skin)
     : base(t, "Loot " + monster.Name)
 {
     this.monster = monster;
     this.Skin    = Skin;
 }
 //Approaching opeartions
 public override void ApproachingTarget(GUnit Target)
 {
 }
Example #18
0
 public ActivityBuy(Task t, GUnit npc, List <BuySet> BuySets)
     : base(t, "Buy")
 {
     this.npc     = npc;
     this.BuySets = BuySets;
 }
Example #19
0
 public PrioStruct(GUnit tar)
 {
     this.Target = tar;
 }
Example #20
0
 public ActivityLearnFP(Task t, GUnit npc)
     : base(t, "LearnFP")
 {
     this.npc = npc;
 }
 void CheckAdds(GUnit Target)
 {
     bool temp = true;
     //Context.Log("CheckAdd code initialized");
     while (!Me.IsDead && temp)
     {
         try
         {
             //Find all adds
             //Context.Log("DBG - Finding all Adds");
             GUnit[] Attackers = GObjectList.GetAttackers();
             //Context.Log("DBG - Checking Adds - found " + Attackers.Length);
             if (Attackers.Length <= 1) return;
             foreach (GUnit Add in Attackers)
             {
                 if (Me.IsDead) return;
                 //Checks current Add - Makes sure its alive, not current target, checks fear
                 //Context.Log("DBG - Is Fear ready? " + Fear.IsReady);
                 if ((USE_FEAR && Fear.IsReady || CAST_ADDS) && Add.IsMonster && Add.Refresh(true) && !Add.IsDead && Add != Target && Add.DistanceToSelf < 40)
                 {
                     if (CAST_ADDS && !ArrayContains(CastedAdds, Add.GUID))
                     {
                         Context.Log("Dealing with add");
                         if (Add.DistanceToSelf < PullDistance) Add.Approach(PullDistance - 2, false);
                         Add.Face();
                         Context.ReleaseSpinRun();
                         TargetUnit(Add, false);
                         if (USE_FEAR && Fear.IsReady)
                         {
                             if (Add.DistanceToSelf > FearRange) Add.Approach(FearRange, false);
                             CastSpell("PL.Fear", Add);
                             Fear.Reset();
                         }
                         if (!Me.Pet.IsInCombat)
                         {
                             SendKey("Common.PetAttack");
                         }
                         CastSequence(Add, true);
                         CastedAdds[CastedAddsIndex++] = Add.GUID;
                     }
                     if (USE_FEAR && Fear.IsReady)
                     {
                         if (Add.DistanceToSelf > FearRange) Add.Approach(FearRange, false);
                         Add.Face();
                         Context.ReleaseSpinRun();
                         TargetUnit(Add, false);
                         CastSpell("PL.Fear", Add);
                         Fear.Reset();
                     }
                 }
             }
             Target.Refresh();
             TargetUnit(Target, false);
             SendKey("Common.PetAttack");
             temp = false;
         }
         catch (Exception e)
         {
             Context.Log("Exception caught in CheckAdds. This is probably due to dieing while in the inner loop.");
             Context.Log(e.ToString());
         }
     }
     return;
 }
Example #22
0
 public ActivityAttack(Task t, GUnit monster)
     : base(t, "Attack " + monster.Name)
 {
     this.monster = monster;
 }
 int CheckPlayers(GUnit Target)
 {
     //Find all nearby players
     GPlayer[] Players = GObjectList.GetPlayers();
     if (Players.Length < 1) return 0; //No players
     foreach (GPlayer Player in Players) //Check every player...
     {
         //Check if player is targeting me and if player is opposite faction
         if (Player != Me && Player.Refresh(true) && Player != Target && !Target.IsPlayer && Player.DistanceToSelf < (PullDistance + TARGET_DUMP_DISTANCE) && Player.IsTargetingMe && !Player.IsSameFaction)
         {
             if (Player.Level < Me.Level + LEVEL_DIFFERENCE && Player.Level > Me.Level - LEVEL_DIFFERENCE)
             {
                 TargetUnit(Player, false);
                 if (Me.Target == Player)
                 {
                     return 1; //Will return GCombatResult.SuccessWithAdd with Player as target
                 }
                 else return -1; //Failed to target player, will display a message that couldnt target
             }
         }
     }
     Target.Refresh();
     TargetUnit(Target, false);
     return 0;
 }
Example #24
0
        public override bool Do()
        {
            GPlayerSelf Me = GContext.Main.Me;

            Helpers.Mount.Dismount();
            ppather.Face(monster);

            if (monster.SetAsTarget(false))
            {
                GUnit         target = monster;
                GCombatResult res;
                do
                {
                    ppather.UnBlacklist(target);
                    ppather.TargetIs(target);
                    target.TouchHealthDrop();
                    ppather.StartCombat();
                    res = ppather.KillTarget(target, Me.IsInCombat);
                    PPather.WriteLine("Kill result is: " + res);
                    if (res == GCombatResult.Bugged || res == GCombatResult.OtherPlayerTag)
                    {
                        // TODO make sure to wait out evaders that are attackign us, they usually stop after a few seconds
                        if (res == GCombatResult.Bugged)
                        {
                            GSpellTimer t = new GSpellTimer(3000);
                            while (Me.IsInCombat && !t.IsReadySlow)
                            {
                                ;
                            }
                        }
                        ppather.Blacklist(target);
                    }
                    if (res == GCombatResult.Died)
                    {
                        return(true);                        // sigh
                    }
                    if (res == GCombatResult.Success ||
                        res == GCombatResult.SuccessWithAdd)
                    {
                        ppather.Killed(target);
                    }

                    if (res == GCombatResult.SuccessWithAdd)
                    {
                        target = Me.Target;
                    }
                    else
                    {
                        target.Refresh(true);
                        Thread.Sleep(100);

                        // wait for combat flag to expire unless we have attackers
                        {
                            GSpellTimer t = new GSpellTimer(2000);
                            while (Me.IsInCombat && GObjectList.GetNearestAttacker(0) == null && !t.IsReadySlow)
                            {
                                ;
                            }
                            //PPather.WriteLine("t: " + (2000 - t.TicksLeft));
                        }
                        if (ppather.IsItSafeAt(null, GContext.Main.Me) && !Me.IsInCombat)
                        {
                            if (GContext.Main.Me.Target != null)
                            {
                                GContext.Main.ClearTarget();
                            }
                            ppather.Rest();
                        }
                    }
                } while (res == GCombatResult.SuccessWithAdd && target != null);
            }
            else
            {
                PPather.WriteLine("!Warning:Can not target monster " + monster.Name);
                ppather.Blacklist(monster);
            }

            return(true);            // !?!?
        }
 //If not enough Soul Shards, Soul Drain
 bool DrainSoul(GUnit Target)
 {
     //if (Me.IsDead) return;
     //Context.Log("Drain Soul - Yes or No");
     //Context.Log("DrainSoul SS check - My current SS count is " + SoulShardCount + " with a max of " + SOULSHARDS_MAX);
     if (SoulShardCount < SOULSHARDS_MAX && Target.Health < DRAINSOUL_PCT && !Target.IsDead)
     {
         if (SoulShardCount < 1)
         {
             SoulShardCount = 0;
         }
         CastSpell("PL.DrainSoul");
         Thread.Sleep(100);
         return true;
     }
     return false;
 }
        public override bool Do()
        {
            bool  hide;
            int   minutes = 0;
            GUnit Player  = null;

            Player = GetClosestPlayer();

            if (Player != null && Player.DistanceToSelf < AvoidRange)
            {
                GSpellTimer WaitAfterLeave  = new GSpellTimer(10 * 1000);           // wait an exta 10 s
                GSpellTimer SpamTimer       = new GSpellTimer(60 * 1000);           // Spam every 1 min
                System.Media.SoundPlayer sp = new System.Media.SoundPlayer("PlayerNear.wav");
                WaitAfterLeave.Reset();
                SpamTimer.Reset();
                try
                {
                    if (PlaySound)
                    {
                        sp.Load();
                        sp.Play();
                    }
                }
                catch
                {
                }

                do
                {
                    if (Me.IsInCombat)
                    {
                        PPather.WriteLine("AvoidPlayers: I was attacked while hiding");
                        return(false);
                    }

                    if (Me.IsDead)
                    {
                        PPather.WriteLine("AvoidPlayers: I died while hiding");
                        return(false);
                    }

                    hide = false;
                    if (WaitUntilClear == true && GetClosestPlayer() != null)
                    {
                        hide = true;
                    }
                    else if (WaitUntilClear != true && GetClosestPlayer().DistanceToSelf < AvoidRange)
                    {
                        hide = true;
                    }
                    if (hide)
                    {
                        WaitAfterLeave.Reset();
                    }

                    if (Me.PlayerClass.ToString() == "Rogue" && StealthWhileHiding == true && !GPlayerSelf.Me.IsStealth)
                    {
                        GContext.Main.CastSpell(StealthKey);
                    }

                    if (Me.PlayerClass.ToString() == "Druid" && StealthWhileHiding == true && !GPlayerSelf.Me.IsStealth)
                    {
                        if (!Me.HasWellKnownBuff("CatForm"))
                        {
                            GContext.Main.CastSpell(CatFormKey, true, false);                             // if we aren't in cat form, then switch before trying to stealth
                        }
                        GContext.Main.CastSpell(StealthKey, true, false);
                    }

                    if (SpamTimer.IsReady)
                    {
                        SpamTimer.Reset();
                        minutes++;
                        PPather.WriteLine("AvoidPlayers: Waited " + minutes.ToString() + "minutes for players to leave.");
                        if (PlaySound)
                        {
                            sp.Play();
                        }
                        if (minutes >= TimeUntilExit)
                        {
                            PPather.WriteLine("AvoidPlayers: Time to log out");
                            GContext.Main.HearthAndExit();
                            return(false);
                        }
                    }
                    Thread.Sleep(1000);
                } while (!WaitAfterLeave.IsReady);
                return(true);
            }
            return(false);
        }
 bool Melee(GUnit Target)
 {
     if (Target.Approach())
     {
         Movement.TweakMelee(Target);
         return true;
     }
     return false;
 }
Example #28
0
 public ActivityTrain(Task t, GUnit unit, string trainType)
     : base(t, "Train")
 {
     this.unit      = unit;
     this.trainType = trainType;
 }
        //PVP combat function
        GCombatResult PVP(GUnit Target)
        {
            PVPTimer.Reset();
            //Reset timers
            Reset();
            //Sets an anchor to keep from getting too far away
            GLocation startLocation = Me.Location;
            //Send in pet and wait for predefined amount of time
            if (Me.HasLivePet && PET_ATTACK)
            {
                SendKey("Common.PetAttack");
            }

            if (Target.DistanceToSelf > FearRange) Target.Approach(FearRange - 3, false);
            CastSpell("PL.Fear", Target);

            //While less than PVPTimer seconds passed...
            while (!PVPTimer.IsReady)
            {
                Target.Refresh(true);

                //If target is dead, return to start point and report Success
                if (Target.IsDead)
                {
                    SoulShardCount = CountSoulShards();
                    Context.Log("Killed target, returning to start");
                    Movement.MoveToLocation(startLocation, 20, false);
                    return GCombatResult.Success;
                }
                //If further than 40 away from start, return to start point and report Success
                else if (startLocation.DistanceToSelf > (PullDistance + TARGET_DUMP_DISTANCE))
                {
                    SoulShardCount = CountSoulShards();
                    Context.Log("Straying too far, returning to start");
                    Movement.MoveToLocation(startLocation, 20, false);
                    return GCombatResult.Success;
                }

                Me.Refresh(true);
                if (Me.IsDead)
                {
                    return GCombatResult.Died;
                }

                //If target further than PullDistance and less than 60, approach to PullDistance
                if (Target.DistanceToSelf > PullDistance && Target.DistanceToSelf < (PullDistance + TARGET_DUMP_DISTANCE)) Target.Approach(PullDistance - 3, false);

                if (Target.DistanceToSelf > (PullDistance + TARGET_DUMP_DISTANCE)) //Added 2.15 dump target if too far
                {
                    Context.Log("We tried to fight " + Target.Name + " but we travelled > " + TARGET_DUMP_DISTANCE + " to fight him. Resetting!");
                    SendKey("Common.ClearTargetMacro");
                    if (Me.HasLivePet && RETURN_PET)
                    {
                        Context.Log("Recalling Pet.");
                        SendKey("Common.PetFollow");
                    }
                    return GCombatResult.Success;
                }

                //Stop Walking, Face
                Context.ReleaseSpinRun();
                Target.Face();

                TargetUnit(Target, false);

                //Check health
                CheckHealth(Me.IsInCombat);

                /* RecursiveBot 2.17.1 B
                 * Following check is to ensure that we don't resummon a pet needlessly. Quick fix
                 * to the summon new pet every time your mounted and have a target.
                 */
                if (!IsMounted(Me))
                {
                    CheckPet();
                }
                if (!Target.IsDead)
                {
                    //Cast Debuffs

                    CastSequence(Target, false);

                    //Cast Fear
                    if (Fear.IsReady)
                    {
                        if (Target.DistanceToSelf > FearRange) Target.Approach(FearRange - 3, false);
                        CastSpell("PL.Fear", Target);
                        Fear.Reset();
                    }
                    ShadowCheck(Target);
                    //Check various things
                    if (PetHealth())
                    {
                    }
                    /*else if (DrainSoul(Target))
                    {
                    }*/
                    else if (CheckMana(Target))
                    {
                    }
                    else if (DrainLife(Target, false))
                    {
                    }
                    else if (PrimaryAttack(Target))
                    {
                    }
                    else LastResort(Target);
                }
                Thread.Sleep(100);
            }
            //If timer runs out, return to start point and report Bugged
            Context.Log("PVP Timer expired, returning to start.");
            Movement.MoveToLocation(startLocation, 20, false);
            return GCombatResult.Success;
        }
Example #30
0
 public Follower(GUnit temp)
 {
     player = temp;
     firstseen = lastseen = DateTime.Now;
     alerted = false;
 }
 //Target a specified unit if not already targeted
 void TargetUnit(GUnit Target, bool FirstTarget)
 {
     Target.Refresh(true);
     if (Target.IsDead || (Me.TargetGUID == Target.GUID)) return;
     Target.Face();
     Target.SetAsTarget(FirstTarget);
 }
        //Debuff cast sequence
        void CastSequence(GUnit Target, bool ForceAll)
        {
            //Check if monster health is great enough to debuff
            SoulShardCount = CountSoulShards();
            if (Target.Health > MIN_MOB_HEALTH_PCT)
            {
                int i;
                //Loop for length of spell array
                for (i = 0; (i < SPELL_ORDER.Length && !Target.IsDead); i++)
                {
                    ShadowCheck(Target);
                    //Check for min mana
                    if (Me.Mana > MIN_MANA_PCT && Me.Health > EMERGENCY_HEALTH && Target.Health > MIN_MOB_HEALTH_PCT && Target.DistanceToSelf < (PullDistance + TARGET_DUMP_DISTANCE))
                    {
                        if (Target.IsDead)
                        {
                            break;
                        }

                        if (USE_BLOODFURY && BloodFury.IsReady)
                        {
                            CastSpell("PL.BloodFury");
                            BloodFury.Reset();
                            GlobalCooldown.ForceReady();
                            Thread.Sleep(MISCDELAY);
                        }
                        //Switch to select correct spell
                        //Context.Log("Casting spell '" + SPELL_ORDER[i] + "' which is spell " + (i+1) + " of " + SPELL_ORDER.Length + "!");
                        Thread.Sleep(250);
                        CheckHealth(Me.IsInCombat);
                        /* RecursiveBot 2.17.1 D
                         * The following is to ensure that we send in the pet after dismounting
                         * and starting to cast.
                         */
                        if (Me.HasLivePet && PET_ATTACK && !Me.Pet.IsInCombat)
                        {
                            //Context.Log("Your pet should being attacking now");
                            SendKey("Common.PetAttack");
                        }
                        switch (SPELL_ORDER[i])
                        {
                            case "UnstableAffliction":
                                //Context.Log("DBG - Unstable Affliction ready check is " + UnstableAffliction.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (UnstableAffliction.IsReady || ForceUnstableAffliction || ForceAll)
                                {
                                    if (ForceUnstableAffliction) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.UnstableAffliction");
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        UnstableAffliction.Reset();
                                        ForceUnstableAffliction = false;
                                    }
                                }
                                break;

                            case "SiphonLife":
                                //Context.Log("DBG - Siphon Life ready check is " + SiphonLife.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (SiphonLife.IsReady || ForceSiphonLife || ForceAll)
                                {
                                    if (ForceSiphonLife) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.SiphonLife");
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        SiphonLife.Reset();
                                        ForceSiphonLife = false;
                                    }
                                }
                                break;

                            case "CurseofAgony":
                                //Context.Log("DBG - Curse of Agony ready check 1 is " + CurseOfAgony.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (CurseOfAgony.IsReady || ForceCurseOfAgony || ForceAll)
                                {
                                    if (USE_AMPLIFYCURSE && AmplifyCurse.IsReady)
                                    {
                                        SendKey("PL.AmplifyCurse");
                                        AmplifyCurse.Reset();
                                        Thread.Sleep(MISCDELAY);
                                    }
                                    if (ForceCurseOfAgony) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.CurseofAgony");
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        CurseOfAgony.Reset();
                                        ForceCurseOfAgony = false;
                                    }
                                }
                                break;

                            case "Corruption":
                                //Context.Log("DBG - Corruption ready check 1 is " + Corruption.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (Corruption.IsReady || ForceCorruption || ForceAll)
                                {
                                    if (ForceCorruption) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.Corruption", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        Corruption.Reset();
                                        ForceCorruption = false;
                                    }
                                }
                                break;

                            case "CurseOfRecklessness":
                                //Context.Log("DBG - CurseOfRecklessness ready check is " + CurseOfRecklessness.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (CurseOfRecklessness.IsReady || ForceCurseOfRecklessness || ForceAll)
                                {
                                    if (ForceCurseOfRecklessness) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.CurseOfRecklessness", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        CurseOfRecklessness.Reset();
                                        ForceCurseOfRecklessness = false;
                                    }
                                }
                                break;

                            case "Immolate":
                               //Context.Log("DBG - Immolate ready check 1 is " + Immolate.IsReady);
                               while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (Immolate.IsReady || ForceImmolate || ForceAll)
                                {
                                    if (ForceImmolate) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.Immolate", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        Immolate.Reset();
                                        ForceImmolate = false;
                                    }
                                }
                                break;

                            case "Shadowburn":
                                //Context.Log("DBG - Shadowburn ready check is " + Shadowburn.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if ((Shadowburn.IsReady || ForceShadowburn || ForceAll) && SoulShardCount > 0 && Target.Health < 20)
                                {
                                    if (ForceShadowburn) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.Shadowburn", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        Shadowburn.Reset();
                                        ForceShadowburn = false;
                                    }
                                }
                                break;

                            case "ShadowBolt":
                                //Context.Log("DBG - ShadowBolt ready check is " + ShadowBolt.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if (ShadowBolt.IsReady || ForceShadowBolt || ForceAll)
                                {
                                    if (ForceShadowBolt) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.ShadowBolt", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        ShadowBolt.Reset();
                                        ForceShadowBolt = false;
                                    }
                                }
                                break;

                            case "Conflagurate":
                                //Context.Log("DBG - Conflagurate ready check is " + Conflagurate.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if ((Conflagurate.IsReady || ForceConflagurate || ForceAll) && (!Immolate.IsReady)) //We only want to cast if Immolate is on target
                                {
                                    if (ForceConflagurate) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.Conflagurate", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        Conflagurate.Reset();
                                        ForceConflagurate = false;
                                    }
                                }
                                break;

                            case "Incinerate":
                                //Context.Log("DBG - Incinerate ready check is " + Conflagurate.IsReady);
                                while (!Interface.IsKeyReady("PL."+SPELL_ORDER[i]))
                                {
                                    Thread.Sleep(150);
                                }
                                if ((Incinerate.IsReady || ForceIncinerate || ForceAll) && (!Immolate.IsReady)) //We only want to cast if Immolate is on target
                                {
                                    if (ForceIncinerate) Context.Log("Recast");
                                    Target.Face();
                                    CastSpell("PL.Incinerate", Target);
                                    Thread.Sleep(150);
                                    if (!ForceAll)
                                    {
                                        Incinerate.Reset();
                                        ForceIncinerate = false;
                                    }
                                }
                                break;
                        }

                    }
                }
            }
        }
 //Cast wand
 void Wand(GUnit Target)
 {
     Target.Face();
     if (!Interface.IsKeyFiring("PL.Wand"))
     {
         SendKey("PL.Wand");
         Thread.Sleep(MISCDELAY);
     }
 }
 //Checks for and casts ShadowBolt
 bool CastShadowBolt(GUnit Target)
 {
     if (Target.Health > MIN_MOB_HEALTH_PCT && Me.Mana > MIN_MANA_PCT)
     {
         //Context.Log("DBG - ShadowBolt code!");
         if (Target.DistanceToSelf > ShadowBoltRange) Target.Approach(ShadowBoltRange, false);
         Target.Face();
         CastSpell("PL.ShadowBolt", Target);
         Thread.Sleep(250);
         return true;
     }
     return false;
 }
        //Combat overrride
        public override GCombatResult KillTarget(GUnit Target, bool IsAmbush)
        {
            //Stop walking/turning
            Context.ReleaseSpinRun();
            /* RecursiveBot 2.17.1 A
             * the following is the logical switch to control if the spell
             * shuffle function is called. This removes the randomizing of spells
             * but does not give the ability to cast them in any order.
             */
            if (USE_SPELLSHUFFLE)
            {
                SpellShuffle(ref SPELL_ORDER);
            }
            SoulShardCount = CountSoulShards();
            Reset();

            //Call function to wait for player death
            if (Target.IsPlayer)
            {
                if (((GPlayer)Target).IsSameFaction)
                {
                    Context.ClearTarget();
                    return GCombatResult.Success;
                }
                else if (FIGHT_BACK)
                {
                    Context.Log("Attempting PVP...");
                    return PVP(Target);
                }
                else
                {
                    Context.Log("No PVP");
                    WaitForPlayerDeath();
                    return GCombatResult.Died;
                }
            }

            //Send in pet and wait for predefined amount of time
            /* RecursiveBot 2.17.1 G
             * The following change was to ensure that multiple Petattacks weren't sent
             * due to the logic flow.
             */
            if (Me.HasLivePet && PET_ATTACK && !Me.Pet.IsInCombat)
            {
                SendKey("Common.PetAttack");
              //Context.Log("DBG - KillTarget Send Pet routine started!");
                if (WAIT_FOR_PET_AGGRO)
                {
                    Context.Log("Waiting for pet to approach target");
                    bool temp;
                    temp = WaitForEngage(Target,(PET_AGGRO_DELAY * 1000));
                    if (temp)
                    {
                        Context.Log("Pet aggroed target");
                    }
                    else
                    {
                        Context.Log("Pet failed to aggro target");
                    }
                }
                Thread.Sleep(500);
            }

            while (true)
            {
                //Refresh the target
                Target.Refresh(true);

                //Check the current GCombatResult
                GCombatResult CommonResult = Context.CheckCommonCombatResult((GMonster)Target, IsAmbush);

                //Return the GCombatResult
                if (CommonResult != GCombatResult.Unknown)
                {
                    SoulShardCount = CountSoulShards();
                    if (USE_CONSUMESHADOWS)
                    {
                        TwoSecTimer.Reset();
                        while (!TwoSecTimer.IsReady)
                        {
                            Thread.Sleep(150);
                            if (!Me.IsInCombat)
                            {
                                TwoSecTimer.ForceReady();
                            }
                        }
                        PetHealth();
                    }
                    return CommonResult;
                }
                else if (Target.IsDead)
                {
                    SoulShardCount = CountSoulShards();
                    if (USE_CONSUMESHADOWS)
                    {
                        TwoSecTimer.Reset();
                        while (!TwoSecTimer.IsReady)
                        {
                            Thread.Sleep(100);
                            if (!Me.IsInCombat)
                            {
                                TwoSecTimer.ForceReady();
                            }
                        }
                        // PetHealth(); //Moved to outside of If statement to resolve pet deaths
                    }
                    return GCombatResult.Success;
                }

                PetHealth();
                Target.Face();

                if (Me.HasLivePet && PET_ATTACK && RETURN_PET && DoReturnPet && Target.Health < HealthToReturnPet && Target.DistanceToSelf > 10 && Target.Target == Me.Pet)
                {
                    Context.Log("Returning the pet to me! Come to papa!");
                    SendKey("Common.PetFollow");
                    DoReturnPet = false;
                }

                if (Target.DistanceToSelf > PullDistance && Target.DistanceToSelf < (PullDistance + TARGET_DUMP_DISTANCE))
                {
                    Target.Approach(PullDistance - 2, false);
                }

                if (Target.DistanceToSelf > (PullDistance + TARGET_DUMP_DISTANCE))
                {
                    Context.ClearTarget();
                    return GCombatResult.Success;
                }

                //Stop Walking, Face
                Context.ReleaseSpinRun();

                TargetUnit(Target, false);

                //Deal with players
                if (FIGHT_BACK)
                {
                    //Decide what to do depending on what is returned
                    switch (CheckPlayers(Target))
                    {
                        case 0:
                            break;
                        case 1:
                            Context.Log("Targeted by enemy faction, fighting back!");
                            return GCombatResult.SuccessWithAdd;
                        case -1:
                            Context.Log("Target by enemy faction but unable to target them");
                            break;
                    }
                }

                //Deal with adds
                //Context.Log("DBG - Are we set to deal with adds?" + DEAL_WITH_ADDS);
                if (DEAL_WITH_ADDS)
                {
                   // Context.Log("DBG - Starting Check Add's function call");
                    CheckAdds(Target);
                }

                //Check health
                //Context.Log("DBG - Me.IsInCombat is returning" + Me.IsInCombat);
                CheckHealth(Me.IsInCombat); //Changed Parameter from true to Me.IsInCombat
                //Check pet

                /* RecursiveBot 2.17.1 B
                 * The following was changed to check if the player is mounted before running
                 * CheckPet() due to the fact that checkpet would call for a resummon upon
                 * finding a target and not having a pet.
                 * This is a quick fix. Logic for checking a pet might need rework.
                 */
                if (!IsMounted(Me))
                {
                    CheckPet();
                }
                if (!Target.IsDead)
                {
                    //Cast Debuffs
                    //Context.Log("DBG - Test Target Not Dead code initiated");

                    CastSequence(Target, false);
                    ShadowCheck(Target);
                    //Check various things
                    if (PetHealth())
                    {
                    }
                    else if (DrainSoul(Target))
                    {
                    }
                    else if (DrainLife(Target, false))
                    {
                    }
                    else if (PrimaryAttack(Target))
                    {
                    }
                    else if (CheckMana(Target) && !IsMounted())
                    {
                    }
                    else LastResort(Target);
                }
                Thread.Sleep(150);
            }
        }
 //Modified Context.CastSpell() (Overloaded - directional casting) - turns off wand, waits for key, pause for specified delay, cast - keeps facing target while casting
 void CastSpell(string Spell, GUnit Target)
 {
     Context.Log(Format(Replace(Replace(Spell, "PL.", "Casting: "), "Common.", "Casting: ")));
     if (Interface.IsKeyFiring("PL.Wand"))
     {
         SendKey("PL.Wand");
         GlobalCooldown.Reset();
     }
     if (Me.IsSitting)
     {
         SendKey("Common.Back");
         Thread.Sleep(200);
     }
     GlobalCooldown.Wait();
     while (!Interface.IsKeyReady(Spell))
     {
         Thread.Sleep(200);
     }
     Target.Face();
     //Context.CastSpell(Spell, false, true);
     Context.SendKey(Spell);
     GlobalCooldown.Reset();
     OneSecTimer.Reset();
     while (!OneSecTimer.IsReady)
     {
         Thread.Sleep(100);
         if (Me.IsCasting)
         {
             while (Me.IsCasting)
             {
                 Target.Face();
                 Thread.Sleep(100);
             }
             break;
         }
     }
 }
Example #37
0
        public static bool IsMounted(GUnit Unit)
        {
            // Mount test based on spell ID - 5 June 2008
            int[] mountBuffsID = {
                48778, // Acherus Deathcharger
                35022, //	Black Hawkstrider
                6896, //	Black Ram
                17461, //	Black Ram
                22718, //	Black War Kodo
                22720, //	Black War Ram
                22721, //	Black War Raptor
                22717, //	Black War Steed
                22723, //	Black War Tiger
                22724, //	Black War Wolf
                578, //	Black Wolf
                35020, //	Blue Hawkstrider
                10969, //	Blue Mechanostrider
                33630, //	Blue Mechanostrider
                6897, //	Blue Ram
                17463, //	Blue Skeletal Horse
                43899, //	Brewfest Ram
                34406, //	Brown Elekk
                458, //	Brown Horse
                18990, //	Brown Kodo
                6899, //	Brown Ram
                17464, //	Brown Skeletal Horse
                6654, //	Brown Wolf
                39315, //	Cobalt Riding Talbuk
                34896, //	Cobalt War Talbuk
                39316, //	Dark Riding Talbuk
                34790, //	Dark War Talbuk
                17481, //	Deathcharger
                6653, //	Dire Wolf
                8395, //	Emerald Raptor
                36702, //	Fiery Warhorse
                23509, //	Frostwolf Howler
                16060, //	Golden Sabercat
                35710, //	Gray Elekk
                18989, //	Gray Kodo
                6777, //	Gray Ram
                459, //	Gray Wolf
                35713, //	Great Blue Elekk
                23249, //	Great Brown Kodo
                34407, //	Great Elite Elekk
                23248, //	Great Gray Kodo
                35712, //	Great Green Elekk
                35714, //	Great Purple Elekk
                23247, //	Great White Kodo
                18991, //	Green Kodo
                15780, //	Green Mechanostrider
                17453, //	Green Mechanostrider
                17465, //	Green Skeletal Warhorse
                824, //	Horse Riding
                6743, //	Horse Riding
                17459, //	Icy Blue Mechanostrider
                16262, //	Improved Ghost Wolf
                16287, //	Improved Ghost Wolf
                10795, //	Ivory Raptor
                17450, //	Ivory Raptor
                18995, //	Kodo Riding
                18996, //	Kodo Riding
                16084, //	Mottled Red Raptor
                16055, //	Nightsaber
                10798, //	Obsidian Raptor
                42936, //	Ornery Ram
                44370, //	Pink Elekk Call
                472, //	Pinto Horse
                35711, //	Purple Elekk
                35018, //	Purple Hawkstrider
                17455, //	Purple Mechanostrider
                23246, //	Purple Skeletal Warhorse
                17456, //	Red & Blue Mechanostrider
                34795, //	Red Hawkstrider
                10873, //	Red Mechanostrider
                17462, //	Red Skeletal Horse
                22722, //	Red Skeletal Warhorse
                43883, //	Rental Racing Ram
                18363, //	Riding Kodo
                30174, //	Riding Turtle
                39317, //	Silver Riding Talbuk
                34898, //	Silver War Talbuk
                8980, //	Skeletal Horse
                10921, //	Skeletal Horse Riding
                29059, //	Skeletal Steed
                42776, //	Spectral Tiger
                10789, //	Spotted Frostsaber
                15781, //	Steel Mechanostrider
                23510, //	Stormpike Battle Charger
                8394, //	Striped Frostsaber
                10793, //	Striped Nightsaber
                897, //	Summon Angry Programmer
                44369, //	Summon Baby Pink Elekk
                31700, //	Summon Black Qiraji Battle Tank
                26655, //	Summon Black Qiraji Battle Tank
                26656, //	Summon Black Qiraji Battle Tank
                25863, //	Summon Black Qiraji Battle Tank
                25953, //	Summon Blue Qiraji Battle Tank
                32723, //	Summon Bonechewer Riding Wolf
                34767, //	Summon Charger
                23214, //	Summon Charger
                23215, //	Summon Charger
                34766, //	Summon Charger
                23261, //	Summon Darkreaver's Fallen Charger
                31331, //	Summon Dire Wolf
                23161, //	Summon Dreadsteed
                38311, //	Summon Eclipsion Hawkstrider
                1710, //	Summon Felsteed
                5784, //	Summon Felsteed
                5968, //	Summon Ghost Saber
                6084, //	Summon Ghost Saber
                26056, //	Summon Green Qiraji Battle Tank
                30829, //	Summon Kessel's Elekk
                30837, //	Summon Kessel's Elekk
                30840, //	Summon Kessel's Elekk Trigger
                39782, //	Summon Lightsworn Elekk
                18166, //	Summon Magram Ravager
                26054, //	Summon Red Qiraji Battle Tank
                41543, //	Summon Reins (Jorus)
                41544, //	Summon Reins (Malfas)
                41546, //	Summon Reins (Onyxien)
                41547, //	Summon Reins (Suraku)
                41548, //	Summon Reins (Voranaku)
                41549, //	Summon Reins (Zoya)
                39783, //	Summon Scryer Hawkstrider
                7910, //	Summon Tamed Raptor
                7915, //	Summon Tamed Turtle
                4946, //	Summon Tamed Wolf
                13819, //	Summon Warhorse
                13820, //	Summon Warhorse
                34768, //	Summon Warhorse
                34769, //	Summon Warhorse
                23227, // Swift Palomino
                23241, //	Swift Blue Raptor
                43900, //	Swift Brewfest Ram
                23238, //	Swift Brown Ram
                23229, //	Swift Brown Steed
                23250, //	Swift Brown Wolf
                23220, //	Swift Dawnsaber
                23221, //	Swift Frostsaber
                23239, //	Swift Gray Ram
                23252, //	Swift Gray Wolf
                35025, //	Swift Green Hawkstrider
                23225, //	Swift Green Mechanostrider
                23219, //	Swift Mistsaber
                23242, //	Swift Olive Raptor
                23243, //	Swift Orange Raptor
                33660, //	Swift Pink Hawkstrider
                35027, //	Swift Purple Hawkstrider
                24242, //	Swift Razzashi Raptor
                42777, //	Swift Spectral Tiger
                23338, //	Swift Stormsaber
                23251, //	Swift Timber Wolf
                35028, //	Swift War Hawkstrider
                23223, //	Swift White Mechanostrider
                23240, //	Swift White Ram
                23228, //	Swift White Steed
                23222, //	Swift Yellow Mechanostrider
                24252, //	Swift Zulian Tiger
                39318, //	Tan Riding Talbuk
                34899, //	Tan War Talbuk
                16059, //	Tawny Sabercat
                18992, //	Teal Kodo
                22480, //	Tender Wolf Steak
                10790, //	Tiger
                10796, //	Turquoise Raptor
                17454, //	Unpainted Mechanostrider
                10799, //	Violet Raptor
                15779, //	White Mechanostrider
                6898, //	White Ram
                39319, //	White Riding Talbuk
                34897, //	White War Talbuk
                17229, //	Winterspring Frostsaber
                60114, //   Armored Brown Bear (Alliance)
                60116, //   Armored Brown Bear (Horde)
                 };

            GPlayerSelf.Me.Refresh(true);
            Unit.SetBuffsDirty();
            return Unit.HasBuff(mountBuffsID);
        }
Example #38
0
 public RezPrioStruct(GUnit tar, Bot b)
 {
     this.Target = tar;
     this.bot    = b;
 }