Ejemplo n.º 1
0
        /// <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");
                }
            }
        }