Jump to content

Run Back to Corpse, Stop Bot


BusyAtSchool

Recommended Posts

Good afternoon,

I am trying to move through an area that is well over my level. Unfortunately, when I revive - I get attacked and die, so I am trying to revive to the furthest point to continue forward.

Is there a way that I can have a plug-in run me back to my body and then just stop?

I attempted to use this code below, but it halts the bot at the Spirit Healer. I want to stop the bot, at my dead corpse, before resurrecting. 

 

using System.Threading;
using wManager.Wow.Bot.States;

public class Main : wManager.Plugin.IPlugin
{
    public void Initialize()
    {
        robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
        {
            if (state is Resurrect || state is ResurrectBG)
            {
				robotManager.Products.Products.ProductStop();
            }
        };
    }

    public void Dispose()
    {
    }

    public void Settings()
    {
    }
}

 

Link to comment
Share on other sites

Hey, it is hardcoded but try code like that (not tested)

using System.Threading;
using System.Threading.Tasks;
using robotManager.Helpful;
using robotManager.Products;
using wManager.Wow.Bot.States;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    public void Initialize()
    {
        robotManager.Events.FiniteStateMachineEvents.OnRunState += (engine, state, cancelable) =>
        {
            if (state is Resurrect || state is ResurrectBG)
            {
                Task.Run(() =>
                {
                    while (Conditions.InGameAndConnectedAndProductStartedNotInPause && ObjectManager.Me.IsDeadMe)
                    {
                        if (ObjectManager.Me.IsValid &&
                            ObjectManager.Me.PositionCorpse.DistanceTo(ObjectManager.Me.Position) < 45)
                        {
                            Logging.Write("Stop product near corpse");
                            Products.ProductStop();
                        }
                        Thread.Sleep(500);
                    }
                });
            }
        };
    }

    public void Dispose()
    {
    }

    public void Settings()
    {
    }
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...