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.

How can i make the bot attack the closest target in AV?

Featured Replies

The bot tends to target someone super far away and walk through a group of enemies before it gets to the target, making it look very obvious its a bot.
How can i make the bot attack the closest target to me while ignoring pets? Im want this mostly for bridge fights in AV

  • Author

I did some research and created my own pluging. It is kinda janky but seems to work well enough for what i want.
Any suggestions on how to improve it are appreciated.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using robotManager.Helpful;
using wManager.Plugin;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;


public class Main : IPlugin
{
    private bool __isRunning;

    private string __zone;

    private List<WoWPlayer> __hordePlayers;

    private System.Timers.Timer __bgTimer;
    private System.Timers.Timer __workTimer;
    private System.Timers.Timer __restTimer;
    public void Initialize()
    {
        __isRunning = true;
        Logging.Write("BG Assist plugin started");

        __hordePlayers = new List<WoWPlayer>();

        __bgTimer = new System.Timers.Timer();
        __bgTimer.Interval = 60 * 60 * 1000; //1h
        __bgTimer.Elapsed += LeaveBg;
        __bgTimer.AutoReset = false;

        __workTimer = new System.Timers.Timer();
        __workTimer.Interval = 3 * 60 * 1000; // 3 mins
        __workTimer.Elapsed += PauseBot;
        __workTimer.AutoReset = false;

        __restTimer = new System.Timers.Timer();
        __restTimer.Interval = 2 * 60 * 1000; // 2 mins
        __restTimer.Elapsed += ResumeBot;
        __restTimer.AutoReset = false;

        MainLoop();
    }

    public void Dispose()
    {
        __isRunning = false;

        __bgTimer.Stop();
        __workTimer.Stop();
        __restTimer.Stop();

        __bgTimer.Elapsed -= LeaveBg;
        __workTimer.Elapsed -= PauseBot;
        __restTimer.Elapsed -= ResumeBot;

        Logging.Write("BG Assist plugin stopped");

    }

    public void Settings()
    {
        
    }

    private void MainLoop()
    {
        while (__isRunning)
        {
            if (Conditions.InGameAndConnectedAndProductStarted)
            {
                __zone = Usefuls.MapZoneName;

                if (__zone == "Alterac Valley" && !__bgTimer.Enabled)
                {
                    // play for 1 hour max then leave the BG
                    Logging.Write("BG Assist - timer started");
                    __bgTimer.Start();

                    // play for 3 mins, rest for 2 mins
                    __workTimer.Start();
                }

                // Try to always fight the closest target
                if (__zone == "Alterac Valley" && !Conditions.ProductInPause && ObjectManager.Me.IsAlive && (!ObjectManager.Me.InCombat || !ObjectManager.Me.HasTarget))
                {
                    if (ObjectManager.GetObjectWoWPlayer().Any(x => x.IsHorde))
                    {
                        __hordePlayers = new List<WoWPlayer>();

                        // Grab a list of players and add all horde units to a list
                        foreach (WoWPlayer _unit in ObjectManager.GetObjectWoWPlayer())
                        {
                            if (_unit.IsHorde && _unit.IsAlive)
                            {
                                __hordePlayers.Add(_unit);
                            }
                        }

                        // Spammy but useful for now...
                        Logging.Write($"BG Assist - starting fight with...{__hordePlayers.OrderBy(x => x.Position.DistanceTo(ObjectManager.Me.Position)).FirstOrDefault().Name}");
                        Fight.StopFight();
                        Fight.StartFight(__hordePlayers.OrderBy(x => x.Position.DistanceTo(ObjectManager.Me.Position)).FirstOrDefault().Guid, false);
                    }
                }
            }

            Thread.Sleep(1000);
        }

    }

    private void LeaveBg(Object source, System.Timers.ElapsedEventArgs e)
    {
        Logging.Write($"BG Assist plugin - This bg has run for more than an hour. Taking a break...");
        Battleground.ExitBattleGround();
        __bgTimer.Stop();
        Thread.Sleep(10000);

    }

    private void PauseBot(Object source, System.Timers.ElapsedEventArgs e)
    {
        if (__zone == "Alterac Valley")
        {
            Logging.Write("BG Assist - resting...");
            robotManager.Products.Products.InPause = true;
            __restTimer.Start();
        }
    }

    private void ResumeBot(Object source, System.Timers.ElapsedEventArgs e)
    {
        Logging.Write("BG Assist - working again...");
        robotManager.Products.Products.InPause = false;
        __workTimer.Start();

    }
}

 

  • 1 month later...
On 4/5/2024 at 4:47 AM, joaocoros said:

I did some research and created my own pluging. It is kinda janky but seems to work well enough for what i want.
Any suggestions on how to improve it are appreciated.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using robotManager.Helpful;
using wManager.Plugin;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;


public class Main : IPlugin
{
    private bool __isRunning;

    private string __zone;

    private List<WoWPlayer> __hordePlayers;

    private System.Timers.Timer __bgTimer;
    private System.Timers.Timer __workTimer;
    private System.Timers.Timer __restTimer;
    public void Initialize()
    {
        __isRunning = true;
        Logging.Write("BG Assist plugin started");

        __hordePlayers = new List<WoWPlayer>();

        __bgTimer = new System.Timers.Timer();
        __bgTimer.Interval = 60 * 60 * 1000; //1h
        __bgTimer.Elapsed += LeaveBg;
        __bgTimer.AutoReset = false;

        __workTimer = new System.Timers.Timer();
        __workTimer.Interval = 3 * 60 * 1000; // 3 mins
        __workTimer.Elapsed += PauseBot;
        __workTimer.AutoReset = false;

        __restTimer = new System.Timers.Timer();
        __restTimer.Interval = 2 * 60 * 1000; // 2 mins
        __restTimer.Elapsed += ResumeBot;
        __restTimer.AutoReset = false;

        MainLoop();
    }

    public void Dispose()
    {
        __isRunning = false;

        __bgTimer.Stop();
        __workTimer.Stop();
        __restTimer.Stop();

        __bgTimer.Elapsed -= LeaveBg;
        __workTimer.Elapsed -= PauseBot;
        __restTimer.Elapsed -= ResumeBot;

        Logging.Write("BG Assist plugin stopped");

    }

    public void Settings()
    {
        
    }

    private void MainLoop()
    {
        while (__isRunning)
        {
            if (Conditions.InGameAndConnectedAndProductStarted)
            {
                __zone = Usefuls.MapZoneName;

                if (__zone == "Alterac Valley" && !__bgTimer.Enabled)
                {
                    // play for 1 hour max then leave the BG
                    Logging.Write("BG Assist - timer started");
                    __bgTimer.Start();

                    // play for 3 mins, rest for 2 mins
                    __workTimer.Start();
                }

                // Try to always fight the closest target
                if (__zone == "Alterac Valley" && !Conditions.ProductInPause && ObjectManager.Me.IsAlive && (!ObjectManager.Me.InCombat || !ObjectManager.Me.HasTarget))
                {
                    if (ObjectManager.GetObjectWoWPlayer().Any(x => x.IsHorde))
                    {
                        __hordePlayers = new List<WoWPlayer>();

                        // Grab a list of players and add all horde units to a list
                        foreach (WoWPlayer _unit in ObjectManager.GetObjectWoWPlayer())
                        {
                            if (_unit.IsHorde && _unit.IsAlive)
                            {
                                __hordePlayers.Add(_unit);
                            }
                        }

                        // Spammy but useful for now...
                        Logging.Write($"BG Assist - starting fight with...{__hordePlayers.OrderBy(x => x.Position.DistanceTo(ObjectManager.Me.Position)).FirstOrDefault().Name}");
                        Fight.StopFight();
                        Fight.StartFight(__hordePlayers.OrderBy(x => x.Position.DistanceTo(ObjectManager.Me.Position)).FirstOrDefault().Guid, false);
                    }
                }
            }

            Thread.Sleep(1000);
        }

    }

    private void LeaveBg(Object source, System.Timers.ElapsedEventArgs e)
    {
        Logging.Write($"BG Assist plugin - This bg has run for more than an hour. Taking a break...");
        Battleground.ExitBattleGround();
        __bgTimer.Stop();
        Thread.Sleep(10000);

    }

    private void PauseBot(Object source, System.Timers.ElapsedEventArgs e)
    {
        if (__zone == "Alterac Valley")
        {
            Logging.Write("BG Assist - resting...");
            robotManager.Products.Products.InPause = true;
            __restTimer.Start();
        }
    }

    private void ResumeBot(Object source, System.Timers.ElapsedEventArgs e)
    {
        Logging.Write("BG Assist - working again...");
        robotManager.Products.Products.InPause = false;
        __workTimer.Start();

    }
}

 



This will only work with actual players correct?

Is there a known method to grab all units? 

The server I play on shows them as Gossip-able NPC's that fight if attacked.

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.