Jump to content

Recommended Posts

Hey Guys,

soo... I think many of you know already. Thoradins Wall is a big problem for the pathfinder.

Has anyone found a workaround to this? I could try to add many small blacklists along the wall and only leave the good gaps open? Not sure if that would work and it seems really dirty to me.

Offmesh connection doesnt really make sense here, or does it?

Thanks for any info.

 

Edited by Bambo
Link to comment
https://wrobot.eu/forums/topic/10104-thoradins-wall/
Share on other sites

New wRobot update should be able to take offmesh even if you can make a path - so you can give it a try.

Otherwise ask FNV for the little piece of code he used to and from Searing Gorge. Basically it intercepts movements and enters your own. 

Or do something similar to how I automate the Darnassus portal in HMP:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using robotManager.Events;
using robotManager.FiniteStateMachine;
using robotManager.Helpful;
using robotManager.Products;
using wManager;
using wManager.Events;
using wManager.Wow.Bot.States;
using wManager.Wow.Bot.Tasks;
using wManager.Wow.Forms;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Darnassus
{
    public static bool TakingPortal;
    
    private static WoWLocalPlayer Me = ObjectManager.Me;
    private static Vector3 _currentDestination = Vector3.Empty;

    private static List<Vector3> _darnassusPolygon = new List<Vector3>
    {
        new Vector3(10749.604f, 2412.323f, 0f),
        new Vector3(11296.502f, 2097.9175f, 0f),
        new Vector3(11259.335f, 936.64453f, 0f),
        new Vector3(10914.204f, 317.97504f, 0f),
        new Vector3(9990.316f, 104.99061f, 0f),
        new Vector3(9236.339f, 480.24902f, 0f),
        new Vector3(8944.306f, 1230.7659f, 0f),
        new Vector3(9045.189f, 2295.6887f, 0f),
        new Vector3(9512.443f, 2792.6523f, 0f),
        new Vector3(10292.969f, 2904.216f, 0f),
        new Vector3(10569.073f, 2655.7341f, 0f),
        new Vector3(10946.0625f, 2371.7546f, 0f),
    };
    
    
    public static void Start()
    {
        MovementEvents.OnMovementPulse += MovementEventsOnOnMovementPulse;
    }

    public static void Stop()
    {
        TakingPortal = false;
        _currentDestination = Vector3.Empty;
        MovementEvents.OnMovementPulse -= MovementEventsOnOnMovementPulse;
    }
    
    private static void MovementEventsOnOnMovementPulse(List<Vector3> points, CancelEventArgs cancelable)
    {
        //cancel all movement events that aren't our own
        /*if (_takingPortal && _currentDestination != Vector3.Empty && points.Last() != _currentDestination && !Logging.Status.ToLower().Contains("taxi"))
        {
            cancelable.Cancel = true;
        }*/
        
        if (!TakingPortal && points.Count > 0)
        {
            bool taken = TakePortalIfNecessary(points.Last());
            if (taken)
            {
                //GoToTask.ToPosition(points.Last());
                cancelable.Cancel = true;
            }
        }
    }

    private static bool TakePortalIfNecessary(Vector3 destination)
    {
        bool taken = false;
        if (Usefuls.ContinentId == 1)
        {
            if (VectorHelper.PointInPolygon2D(_darnassusPolygon, Me.Position) &&
                !VectorHelper.PointInPolygon2D(_darnassusPolygon, destination))
            {
                PluginLog.Log("Player in Darnassus, leaving through portal");
                GoThroughPortal(new Vector3(9947.029, 2618.881, 1316.962), new Vector3(9946.723, 2618.692, 1316.909));
                taken = true;
            }
            else if (!VectorHelper.PointInPolygon2D(_darnassusPolygon, Me.Position) &&
                      VectorHelper.PointInPolygon2D(_darnassusPolygon, destination))
            {
                PluginLog.Log("Player outside Darnassus, entering through portal");
                GoThroughPortal(new Vector3(8786.36, 967.445, 30.197), new Vector3(8788.761, 967.9706, 30.19558));
                taken = true;
            }
        }
        TakingPortal = false;
        _currentDestination = Vector3.Empty;
        return taken;
    }

    private static void GoThroughPortal(Vector3 destination, Vector3 direction)
    {
        TakingPortal = true;
        _currentDestination = destination;
        var tmp = wManagerSetting.CurrentSetting.CloseIfPlayerTeleported;
        wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = false;
        GoToTask.ToPosition(destination);
        //For some reason, GoToTask ends right away
        if (Me.IsDead && Me.HaveBuff("Ghost"))
        {
            MovementManager.Go(PathFinder.FindPath(destination));
            while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && Me.Position.DistanceTo(destination) >= 2)
            {
                Thread.Sleep(500);
            }
        }
        
        MovementManager.MoveTo(direction);
        Thread.Sleep(500);
        Move.Forward(Move.MoveAction.PressKey, 5000);
        //Reenable(tmp);
    }

    private static async void Reenable(bool close)
    {
        await Task.Run(() =>
        {
            Products.InPause = true;
            Thread.Sleep(5000);
            MovementManager.StopMove();
            MovementManager.CurrentPath.Clear();
            MovementManager.CurrentPathOrigine.Clear();
            wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = close;
            Products.InPause = false;
            TakingPortal = false;
            //Products.ProductRestart();
            PluginLog.Log("Resetting path after port");
        });
    } 
}

 

Link to comment
https://wrobot.eu/forums/topic/10104-thoradins-wall/#findComment-47630
Share on other sites

Today update add support of new offmeshconnections features:

I haven't added it to UI for now, but you can do it with code:

wManager.Wow.Helpers.PathFinder.OffMeshConnections.Add(new wManager.Wow.Helpers.PathFinder.OffMeshConnection(new List<Vector3> { new Vector3(-8857.249, 538.4138, 106.2859), new Vector3(-8842.317, 550.2717, 96.78889) { Action = "lua: print('gg')" } }, -1) { TryToUseEvenIfCanFindPathSuccess = true, Type = wManager.Wow.Helpers.PathFinder.OffMeshConnectionType.Unidirectional });

With this code, WRobot will jump instead to down the stairs when he exit the Flightmaster in Stormwind.

And WRobot support now the roads and waters, I need to complet list (for now only roads of Eastern kingdoms and Kalimdor are recorded (thank to Reaper)):

        wManager.Wow.Helpers.PathFinder.ReportArea(new Vector3(1, 2, 3), 3, RDManaged.RD.PolyArea.POLYAREA_ROAD);
        wManager.Wow.Helpers.PathFinder.ReportArea(new Vector3(1, 2, 3), 3, RDManaged.RD.PolyArea.POLYAREA_WATER);

 

Link to comment
https://wrobot.eu/forums/topic/10104-thoradins-wall/#findComment-47739
Share on other sites

1 minute ago, Matenia said:

Big thanks to both you for implementing this and providing road preference as well as water areas and Reapler for providing the data. It's a great day for wRobot pathfinding ?

I agree. My thanks go out to you guys as well.

Link to comment
https://wrobot.eu/forums/topic/10104-thoradins-wall/#findComment-47750
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...