Jump to content

Recommended Posts

Hello, I'm writing a plugin for Blood of Sargeras exchange and I want to use it in pair with Gatherer, but if I try to pause Gatherer product and make plugin go on a custom routine GoTo tasks do not work, is there a proper way to supress main product or insert a custom function into main Engine with priority higher than Gatherer? Thanks in advance.

Link to comment
https://wrobot.eu/forums/topic/8602-how-to-supress-products-like-gatherer/
Share on other sites

Hello, you can subscribe to the movement events to block the movement. It could look like this(not tested):

    //call at initialize
    public void SubscribeEvents()
    {
        MovementEvents.OnMovementPulse += MovementEventsOnOnMovementPulse;
    }

    //call at dispose
    public void UnSubscribeEvents()
    {
        MovementEvents.OnMovementPulse -= MovementEventsOnOnMovementPulse;
    }


    private void MovementEventsOnOnMovementPulse(List<Vector3> path, CancelEventArgs cancelEventArgs)
    {
        if (DestinationTmp != Vector3.Empty
            && path.LastOrDefault()?.Action != "custom"
            )
        {
            cancelEventArgs.Cancel = true;
        }
    }





    public static Vector3 DestinationTmp = Vector3.Empty;
    public static void MoveTo(Vector3 destination)
    {
        List<Vector3> path = PathFinder.FindPath(ObjectManager.Me.Position, destination);
        var last = path.LastOrDefault();
        if (last != null)
            last.Action = "custom";
        DestinationTmp = MovementManager.CurrentPath.LastOrDefault() ?? ObjectManager.Me.Position;
        MovementManager.Go(path);
    }

    public static void GoBack()
    {
        List<Vector3> path = PathFinder.FindPath(ObjectManager.Me.Position, DestinationTmp);
        DestinationTmp = Vector3.Empty;
        MovementManager.Go(path);
    }

 

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...