public static void Emergency(WowPlayer player) { if (!player.IsCasting("Holy Light") && !player.IsCasting("Flash of Light")) { if (!player.HasBuff("Forbearance")) { if (player.CanCast("Divine Protection")) { if (player.CanCast("Divine Shield") && divineShield) { player.SpellStopCasting(); player.CastSpellByName("Divine Shield"); } else { player.SpellStopCasting(); player.CastSpellByName("Divine Protection"); } HealSystem(player); } else if (player.CanCast("Blessing of Protection")) { player.SpellStopCasting(); player.CastSpellByName("Blessing of Protection"); HealSystem(player); } } if (!player.HasBuff(emBless) && player.CanCast(emBless) && emergBless) { player.CastSpellByName(emBless); } if (player.CanCast("Lay on Hands") && !player.HasBuff("Forbearance")) { player.SpellStopCasting(); player.CastSpellByName("Lay on Hands"); } if (player.HasBuff("Forbearance")) { if (player.CanCast("Lay on Hands") && player.HpPct < 24) { player.SpellStopCasting(); player.CastSpellByName("Lay on Hands"); } } if (player.HpPct < MinHPPct) { HealSystem(player); } } }
protected override void DoEnter(WowPlayer player) { // Check if it already accepted try { if (QuestHelper.CheckQuest(q, lfs)) Finish(player); } catch { SkipQuest(player); } req = QuestHelper.MakeAcceptQuestReq(); }
protected override void DoExecute(BabBot.Wow.WowPlayer Entity) { //for this basic test script... lets have a 1 in 5 chance of jumping every 5 seconds. //if it has been more then/equal to 5 seconds since the last jump attempt, then test if (DateTime.Now.Subtract(_LastJumpCheck).TotalSeconds >= 5) { _LastJumpCheck = DateTime.Now; //if two random numbers between 1 and 5 equal each other then jump if (MathFuncs.RandomNumber(1, 5) == MathFuncs.RandomNumber(1, 5)) { Entity.PlayerCM.SendKeys(" "); } } }
/// <summary> /// This routine gets called every time we end up fighting (because we pulled or /// because a mob aggroed) /// This should be implemented in the spcific class script /// </summary> protected override void DoExecute(WowPlayer player) { Output.Instance.Script("OnInCombat()", this); if (!player.HasTarget || player.IsTargetDead()) { Output.Instance.Script("We no longer have a target or our target is dead. We exit this state.", this); return; } // TODO: Before uncommenting this part we need to work out a FindBestTarget routine /* if (player.IsTargetTapped() && !player.IsTargetTappedByMe()) { player.SpellStopCasting(); player.ClearTarget(); player.FindBestTarget(); player.AttackTarget(); } */ // We turn to face the target if we're facing away for some reason float angleDifference = Math.Abs(player.FacingDegrees() - player.AngleToTargetDegrees()); Output.Instance.Script(string.Format("Degrees difference between player and target: {0}", angleDifference)); if (angleDifference > 20.0f) { Output.Instance.Script("Facing target", this); player.FaceTarget(); } if (player.DistanceFromTarget() > Core.MaxMeleeDistance) { Output.Instance.Script("Moving towards target", this); player.FaceTarget(); //player.MoveToTarget(Core.MinMeleeDistance); var mts = new MoveToState(player.CurTarget.Location, Core.MinMeleeDistance); CallChangeStateEvent(player, mts, true, false); return; } if (player.IsMoving() && player.DistanceFromTarget() < Core.MaxMeleeDistance && player.DistanceFromTarget() > Core.MinMeleeDistance) { Output.Instance.Script("We reached the correct distance to attack. Stopping all movement.", this); player.Stop(); } if (player.DistanceFromTarget() < Core.MinMeleeDistance) { Output.Instance.Script("We are too close to the mob, let's take a step back", this); player.MoveBackward(300); } if (!player.IsAttacking()) { Output.Instance.Script("We're not yet attacking but we should. Let's do this!", this); player.AttackTarget(); } if (player.HpPct <= Core.HpPctEmergency) { Output.Instance.Script("We're about to die. Time to perform the Emergency routine", this); Core.Emergency(player); } if (player.HpPct <= Core.HpPctPotion && Core.HasHealthPotion()) { Output.Instance.Script("We're still dying.. but we have a health potion to use! weee! :D", this); player.SpellStopCasting(); // TODO: implement a function to select the best health potion and drink it //player.TakePotion("HP"); } if (player.MpPct <= Core.MpPctPotion && Core.HasManaPotion()) { Output.Instance.Script("We're low on mana but we do have a mana potion, let's use it!", this); player.SpellStopCasting(); // TODO: implement a function to select the best mana potion and drink it //player.TakePotion("MP"); } if (player.HpPct <= Core.HpHammer && player.MpPct > 5 && player.HpPct >= Core.HpPctEmergency && player.CanCast("Hammer of Justice")) { Output.Instance.Script("We can use Hammer Of Justice, let's do it.", this); player.CastSpellByName("Hammer of Justice", true); if (player.TargetHpPct > 10) { Core.HealSystem(player); Output.Instance.Script("Hammer of Justice healing", this); return; } return; } // TODO: implement IsBeingAttackedByManyMobs by going through all the mobs who have aggro on us and are in range /* if (player.IsBeingAttackedByManyMobs()) { if (player.CanCast(multiAura)) { player.CastSpellByName(multiAura); } if (player.CanCast("Consecration")) { player.CastSpellByName("Consecration"); } } */ // TODO: implement TargetIsCasting() /* if (player.TargetIsCasting()) { CastInterruption(); } */ if (player.TargetHpPct <= 20) { FinalFight(); } else { NormalFight(); } // TODO: implement TargetCreatureType() /* if (useExorcism) { if (player.MpPct > 30 && player.TargetHpPct > exorcismHp && player.CanCast("Exorcism") && player.TargetCreatureType() == "Undead" || player.TargetCreatureType() == "Demon") { player.CastSpellByName("Exorcism"); } } */ if (Core.combatDebuff) { Output.Instance.Script("Debuffing.", this); Core.DebuffAll(); } // TODO: implement reading of the player race /* if (player.Race() == "Blood Elf") { if (player.Buff("Mana Tap").Application > 0 && player.MpPct <= 20) { player.SpellStopCasting(); player.CastSpellByName("Arcane Torrent"); } if (player.TargetMpPct > 0 && player.IsActionUsable("Mana Tap") && player.Buff("Mana Tap").Application < 3) { player.CastSpellByName("Mana Tap"); } } */ }
protected override void DoEnter(WowPlayer Entity) { }
protected override void DoFinish(WowPlayer Entity) { }
protected override void DoExit(WowPlayer Entity) { //on exit, if there is a previous state, go back to it if (PreviousState != null) { CallChangeStateEvent(Entity, PreviousState, false, false); } }
protected override void DoEnter(WowPlayer player) { req = QuestHelper.MakeDeliveryQuestReq(_choice); }
protected void SelfHeal(WowPlayer player) { Output.Instance.Script("SelfHeal()", this); foreach (var spell in HealingSpells) { if (!spell.IsOnCooldown() && (spell.Cost < player.Mp)) { Output.Instance.Script("SelfHeal() - Casting " + spell.Name, this); player.CastSpellByName(spell.Name, true); } } }
protected override void DoEnter(WowPlayer Entity) { base.DoEnter(Entity); Output.Instance.Script("Core.DoEnter() -- Begin", this); // We override the default states with our own inCombatState = new Paladin.InCombatState(); restState = new Paladin.RestState(); Output.Instance.Script("Core.DoEnter() -- End", this); }
public override bool NeedRest(WowPlayer player) { if (player.IsDead) { return false; } if (player.IsInCombat()) { return false; } if (player.HasBuff("Resurrection Sickness")) { return true; } if (player.MpPct < RestMana && !player.IsCasting() && !player.HasBuff("Drink")) { Output.Instance.Script("Resting for mana", this); return true; } if (player.MpPct < MinMPPct && player.HasBuff("Drink")) { Output.Instance.Script("Resting to continue drinking", this); return true; } if (player.HpPct < RestHp && !player.IsCasting() && !player.HasBuff("Drink")) { Output.Instance.Script("Resting for health", this); return true; } return false; }
public static void HealSystem(WowPlayer player) { if (player.CanCast("Flash of Light")) { player.CastSpellByName("Flash of Light", true); return; } if (player.CanCast("Holy Light")) { player.CastSpellByName("Holy Light", true); return; } }
/// <summary> /// This is the routine called when we need resting /// This should be implemented in the spcific class script /// </summary> protected override void DoExecute(WowPlayer player) { Output.Instance.Script("OnRest()", this); if (player.IsCasting() && player.HpPct > 90) { // we don't need to finish casting a healing spell, let's stop it player.SpellStopCasting(); } if (player.IsMoving()) { // If we're still moving, let's stop player.Stop(); } if (player.HasDebuff("Resurrection Sickness") && !player.IsSitting) { GlobalBaseBotState.Sit(player); Output.Instance.Script("OnRest() - We have resurrection sickness. We stay put.", this); return; } Core.DebuffAll(); if (Core.scrollSpam && GlobalBaseBotState.CanUseScroll(player)) { GlobalBaseBotState.UseScroll(player); } if (!Core.debuffStatus) { if (player.MpPct >= Core.RestMana && player.HpPct <= GlobalBaseBotState.MinHPPct && GlobalBaseBotState.Consumable.HasBandage() && Core.useBandage) { GlobalBaseBotState.Consumable.UseBandage(); } } if (player.HpPct >= GlobalBaseBotState.MinHPPct && player.MpPct >= GlobalBaseBotState.MinMPPct) { GlobalBaseBotState.Stand(player); return; } if (player.HpPct <= Core.RestHp && player.MpPct > 10 && !player.HasBuff("Drink") && !player.IsCasting()) { if (player.IsSitting) { GlobalBaseBotState.Stand(player); } if (!player.IsCasting()) { Core.HealSystem(player); return; } } if (!player.HasBuff("Drink") && player.MpPct <= Core.RestMana && !player.IsCasting()) { if (GlobalBaseBotState.Consumable.HasDrink()) { GlobalBaseBotState.Consumable.UseDrink(); } else { player.CastSpellByName("Blessing of Wisdom"); } } }
private static void InitializePlayer() { ObjectManager = new ObjectManager(); Player = new WowPlayer(ObjectManager.GetLocalPlayerObject()); Player.SetCurrentMapInfo(); Player.SetCharInfo(); if (WoWInGame != null) WoWInGame(); }
protected override void DoFinish(BabBot.Wow.WowPlayer Entity) { return; }
protected override void DoExit(BabBot.Wow.WowPlayer Entity) { return; }