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.

Plugin for robots/response to player attack

Featured Replies

@Droidz
Good afternoon. I encountered a problem that my bot does not respond to an attack from a renegade. I'm trying to create a plugin so that my character can respond to attacks from any players, but it's not working yet.
Here is my code, added it to the .cs, but the bot doesn’t even see my plugin.
Please help me with this, because my bot stands out very much when it just runs and absorbs all the player's attacks.
I would be very grateful for your help.


 

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

namespace YourNamespace
{
    public class Class1
    {
        private WoWUnit? attacker;

        public void Run()
        {
            var enemies = ObjectManager.GetWoWUnitAttackables().Where(u => u.IsTargetingMe && u.IsPlayer);
            if (enemies.Any())
            {
                foreach (var enemy in enemies)
                {
                    Logging.Write($"Attacking player {enemy.Name} in response to being attacked.");
                    Attack(enemy);
                }
            }
        }

        public void OnEvent(EventArgs args)
        {
            if (args is WRobotEventUnitBeingAttacked)
            {
                var eventArgs = (WRobotEventUnitBeingAttacked)args;
                attacker = eventArgs.Attacker;
            }
        }

        private void Attack(WoWUnit target)
        {
            target.Target;
            MovementManager.StopMove();
           
        }
    }
}

 

Hello,

Your code is wrong, the code would look more like this (not tested):

using System.Linq;
using System.Windows.Forms;
using robotManager.Helpful;
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.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) =>
        {
            if (state is IsAttacked &&
                Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
            {
                var enemies = ObjectManager
                    .GetObjectWoWPlayer()
                    .Where(u =>
                        u.IsValid &&
                        u.IsAlive &&
                        u.PlayerFaction != ObjectManager.Me.PlayerFaction &&
                        u.IsTargetingMe &&
                        u.InCombatFlagOnly
                    );
                if (enemies.Any())
                {
                    var enemy = enemies.First();
                    Logging.Write($"Attacking player {enemy.Name} in response to being attacked.");
                    Fight.StartFight(enemy.Guid);
                }
            }
        };
    }

    public void Dispose()
    {
        Logging.Write("Disposed.");
    }

    public void Settings()
    {
        MessageBox.Show("No settings for this plugin.");
    }
}

 

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.