//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); } }
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; }
//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; }
bool Melee(GUnit Target) { if (Target.Approach()) { Movement.TweakMelee(Target); return true; } return false; }
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; } }
//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; }