Jump to content

Recommended Posts

Hi, I have a need to stop all bots on separate servers, how can I do this using the reloger plugin?

I wrote a small plugin

using robotManager.Helpful;
using System;
using System.Threading;
using System.Windows.Forms;

namespace Killer
{
    public class MyPlugin : Relogger.ReloggerPlugin
    {
        public override string Name { get { return "Killer"; } }

        bool IsRunning { get; set; }

        public override void OnStart()
        {
        }
        public override void OnStop()
        {
            IsRunning = false;
        }

        public override void OnButtonPress()
        {
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
            Logging.WriteDebug("Kill all tasks started");
            for (int i = 15; i > 0; i--)
            {
                Logging.WriteDebug(i + " seconds until start end");
                Thread.Sleep(1000);
            }
            try
            {

                for (int i = 0; i < Relogger.Classes.ReloggerGeneralSettings.CurrentSetting.Profiles.Count; i++)
                {
                    var p = Relogger.Classes.ReloggerGeneralSettings.CurrentSetting.Profiles[i];

                    if (p.Status == Relogger.Classes.Status.Running)
                    {
                        if (p.ExistWowProcess())
                        {
                            p.KillWowProcess();
                            robotManager.Helpful.Logging.Write(Name + ": Kill wow for  " + p.Name);
                        }
                        if (p.ExistWRobotProcess())
                        {
                            p.ExistWRobotProcess();
                            robotManager.Helpful.Logging.Write(Name + ": Kill Bot for  " + p.Name);
                        }
                        p.Stop();
                        Thread.Sleep(Others.Random(5000, 10000));
                    }
                }
            }
            catch (Exception e)
            {
                robotManager.Helpful.Logging.WriteError(Name + " > " + e);
            }
            });
            //System.Threading.Thread.Sleep(500);

            base.OnButtonPress();
        }
    }
}

that turns off all running bots.
Is it possible to implement this through the ReloggerPlugin or some other way?

@Droidz would not want to add the ability to use multiple RelogerGeneralSettings.xml instead of copying the bot folder.But I would like to be able to stop bots on specific servers without stopping everyone.

Link to comment
https://wrobot.eu/forums/topic/13066-stop-group-of-bots-by-relogger/
Share on other sites

Hi, try

                for (int i = 0; i < Relogger.Classes.ReloggerGeneralSettings.CurrentSetting.Profiles.Count; i++)
                {
                    var p = Relogger.Classes.ReloggerGeneralSettings.CurrentSetting.Profiles[i];
                    if (p.CurrentWowAccount.Server == "Server Name")
                    {
                        if (p.Status == Relogger.Classes.Status.Running)
                        {
                            if (p.ExistWowProcess())
                            {
                                p.KillWowProcess();
                                robotManager.Helpful.Logging.Write(Name + ": Kill wow for  " + p.Name);
                            }
                            if (p.ExistWRobotProcess())
                            {
                                p.ExistWRobotProcess();
                                robotManager.Helpful.Logging.Write(Name + ": Kill Bot for  " + p.Name);
                            }
                            p.Stop();
                            Thread.Sleep(Others.Random(5000, 10000));
                        }
                    }
                }

I added 

if (p.CurrentWowAccount.Server == "Server Name")

Make one plugin by serveur

 

for (int i = 0; i < Relogger.Classes.ReloggerGeneralSettings.CurrentSetting.Profiles.Count; i++)
                    {
                        var p = Relogger.Classes.ReloggerGeneralSettings.CurrentSetting.Profiles[i];


                        if (p.Status == Relogger.Classes.Status.Running)
                        {
                            if (p.CurrentWowAccount.Server == "server name")
                            {
                                if (p.ExistWowProcess())
                                {
                                    p.KillWowProcess();
                                    robotManager.Helpful.Logging.Write(Name + ": Kill wow for  " + p.Name);
                                }
                                if (p.ExistWRobotProcess())
                                {
                                    p.ExistWRobotProcess();
                                    robotManager.Helpful.Logging.Write(Name + ": Kill Bot for  " + p.Name);
                                }
                                p.Stop();
                                Thread.Sleep(Others.Random(5000, 10000));
                            }
                        }

                    }

It works, thanks.

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