Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help with plugin working 50% (easy)

Featured Replies

Hello, I created a plugin that when it's not in battleground it goes to the gem vendor and buy a gem if honor is enough, otherwise it goes into a "wait position".

The problem is when he moves, doesnt matter if to go to the vendor or to the wait position, it moves for like 10 yards, then stops, then moves again, then stops and so on.... It's bottish as hell and I don't understand why this behaviour, why doesnt he run all the way to the destination without stopping every 10 steps? I didn't add any sleep in the code.

This is the code

using System;
using robotManager.Products;
using wManager.Plugin;
using wManager.Wow.Enums;
using robotManager.Helpful;
using System.Threading;
using wManager.Wow;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    const int HONORREQUIRED = 10000;
    bool _running;
    public void Initialize()
    {
        _running = true;
        while (_running)
        {
		if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore && !Battleground.IsInBattleground())
                {
		   		    var zone = Lua.LuaDoString<string>("return GetZoneText()");
                    var h = Lua.LuaDoString<int>("local points = GetHonorCurrency(); return points;");
                    if (h >= HONORREQUIRED && zone == "Stormwind City")
                    {
                       	wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(new Vector3(-5768.91, 419.931, 103.921), 34081); 
			
			Lua.LuaDoString<int>("BuyMerchantItem(9,1)");
		    }
		    // Wait Position
		    if (h < HONORREQUIRED && zone == "Stormwind City")
		    {
			wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(-5814.899, 650.6406, 94.55161));

			
                    }
			
                }
        }
    }

    public void Dispose()
    {
        _running = false;
    }

    public void Settings()
    {
    }
}

Can anyone help me figuring how to fix this? Thanks

wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(-5814.899, 650.6406, 94.55161));

 

This code is blocking - but your loop should have a Thread.Sleep anyway to keep your CPU from exploding.
I'm guessing SOMETHING interrupts your code - so add some logging to see if the above quoted code actually returns anything. It probably breaks early, so maybe try an exitCondition for the function call that's basically just if you're getting attacked.
Or do MovementManager.Go(PathFinder.FindPath(vector3)), that will never terminate unless your movement is otherwise interruped (say by fightclass, plugin, etc). On the downside, you need to add a sleep until it reaches the final destination, because it's not blocking.

Edit:
You could also calculate the path ONCE and then just walk it in your loop. Pseudo code below, I don't have a PC right now, just doing this from the top of my head.

using System;
using robotManager.Products;
using wManager.Plugin;
using wManager.Wow.Enums;
using robotManager.Helpful;
using System.Threading;
using wManager.Wow;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    const int HONORREQUIRED = 10000;
    bool _running;
	List<Vector3> pathToFollow = new List<Vector3>();
	
    public void Initialize()
    {
        _running = true;
        while (_running)
        {
			if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore && !Battleground.IsInBattleground())
			{
				if(!pathToFollow.IsEmpty() && ObjectManager.Me.Position.DistanceTo(pathToFollow[pathToFollow.Count - 1]) > 5)
				{
					MovementManager.Go(pathToFollow);
					//wait until we reach last point or enter combat
					while(ObjectManager.Me.Position.DistanceTo(pathToFollow[pathToFollow.Count - 1]) > 5)
					{
						Thread.Sleep(500);
						if(Conditions.IsAttackedAndCannotIgnore || !Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
						{
							break;
						}
					}
				}
					
				var zone = Lua.LuaDoString<string>("return GetZoneText()");
				var h = Lua.LuaDoString<int>("local points = GetHonorCurrency(); return points;");
				if (h >= HONORREQUIRED && zone == "Stormwind City")
				{
					pathToFollow = PathFinder.FindPath(new Vector3(-5768.91, 419.931, 103.921));
					wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(new Vector3(-5768.91, 419.931, 103.921), 34081); 
					Lua.LuaDoString<int>("BuyMerchantItem(9,1)");
				}
				// Wait Position
				if (h < HONORREQUIRED && zone == "Stormwind City")
				{
					pathToFollow = PathFinder.FindPath(new Vector3(-5814.899, 650.6406, 94.55161));
					wManager.Wow.Bot.Tasks.GoToTask.ToPosition(new Vector3(-5814.899, 650.6406, 94.55161));
				}
				
			}
			Thread.Sleep(500);
        }
    }

    public void Dispose()
    {
        _running = false;
    }

    public void Settings()
    {
    }
}

 

Edited by Matenia

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.