What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

[Plugin] Simple Anti AFK

2face

New Member
Joined
Feb 1, 2014
Messages
27
Reaction score
3
Hi,

made some quick anti afk plugin for those who are too lazy to read how to write a simple plugin ;)
https://www.thebuddyforum.com/archebuddy-forum/178351-request-relogger-anti-afk.html

Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace AntiAFK{
    public class AntiAFK : Core
    {
        public static string GetPluginAuthor()
        {
            return "2face";
        }

        public static string GetPluginVersion()
        {
            return "1.0.0.0";
        }

        public static string GetPluginDescription()
        {
            return "Anti AFK Plugin";
        } 

        public void PluginRun()
        {    
 			System.Random RandNum = new System.Random();
			int waitTime;
                        while (true){
				waitTime = RandNum.Next((1000 * 60) * 2, (1000 * 60) * 10);
                                Thread.Sleep(waitTime);
				UpdateNoAfkState();
				Turn(0.5);
			}
        } 
        //Call on plugin stop
        public void PluginStop()
        {
        }
    }
}
 
Last edited:
Nice plugin, exactly what I needed. Is there a way (or could you implement one) to see, that it succefully ran the "UpdateNoAfkState()" ?
 
UpdateNoAfkState
This function only resets bot internal counter (that notyfy server, if you 5 mins dont do nothing), and use emotion.
 
This function only resets bot internal counter (that notyfy server, if you 5 mins dont do nothing), and use emotion.
Thanks for explaining the function.

@2Face
Maybe add this:
Code:
Log("Waiting for " + waitTime / 1000 + " seconds");

In the line between your random number generation and the Thread.Sleep. At least for me, its nice to see the current waiting time of plugin (and also see how often it has already pulsed)
 
Archebuddy already has a function to avoid afk, this plugin is useless imo, unless you need the code for some other plugin .
 
Archebuddy already has a function to avoid afk, this plugin is useless imo, unless you need the code for some other plugin .


i dont seem to think it works.. :\ got kicked to outside of the game. where it was which server i get to
 
got kicked to outside of the game. where it was which server i get to
Then try UpdateNoAfkState + UseSkill (some buff\etc) each X minutes
 
you got kicked because if you read the forum , they wrote a post saying that they are now doing daily restart to kick undetectable anti-afk
 
Archebuddy already has a function to avoid afk, this plugin is useless imo, unless you need the code for some other plugin .

Why would you call someone else's work useless? And no, no one asked for your opinion. Ugh, get some respect.
 
can you give quick guild how to add this code to bot?
 
Just a small update becouse they now kick you out in 5min and less.
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace AntiAFK{
    public class AntiAFK : Core
    {
        public static string GetPluginAuthor()
        {
            return "2face";
        }

        public static string GetPluginVersion()
        {
            return "1.0.0.1";
        }

        public static string GetPluginDescription()
        {
            return "Anti AFK Plugin";
        } 

        public void PluginRun()
        {    
            System.Random RandNum = new System.Random();
            int waitTime;
			while (true){
                waitTime = RandNum.Next((1000 * 60) * 2, (1000 * 60) * 4);
				Log("Waiting for " + waitTime / 1000 + " seconds");
				Thread.Sleep(waitTime);
                UpdateNoAfkState();
                Turn(0.5);
            }
        } 
        //Call on plugin stop
        public void PluginStop()
        {
        }
    }
}
 
where is the antiafk that comes standard with archebuddy
 
Just gona share my version of afking here:
Wht it does is check if char is afk and if so wait between 0-2mins longer (random) before doing something <- YOU have to specify wht + u choose how long he does it before stopping the plugin ie set LaborGoal to whatever amount of laborp u wish to have

Code:
       public void PluginRun()
        int LaborGoal = 200
       {
           Random rnd = new Random();
           while(me.laborPoints<LaborGoal)
           {
               Thread.Sleep(30000); // ie wait 30 seconds
               if(me.isAfk)
               {
                   int dice = rnd.Next(1, 120);
                   Thread.Sleep(dice*1000);

                   //DO SOMETING TO SIMUALTE AKTIVITY HERE like
                   //UseSkill(string name, bool autoCome, bool selfTarget)

                   Log("waiting " + dice + " secs longer");
               }               
           }
       }
 
this might be a noob question, but how do i add this 2 my plug ins ?
tryed dumping the code in a file called antiafk.cs inside a folder in my plugin folder called antiafk.

did i do something wrong here ?
 
this might be a noob question, but how do i add this 2 my plug ins ?
tryed dumping the code in a file called antiafk.cs inside a folder in my plugin folder called antiafk.

did i do something wrong here ?

After you put the .cs file in then tell your editor where the plugin folder is at. Then hit the Compile button on the Editor. It will create a .dll file inside that folder. Then you can run the plugin from your manager.
 
I modified the code to be able to call up and specify how long you want to be AFK for based on Labor Points.
Easy way of calling it up from different points in your script for different durations, or pausing a longer script until you have enough Labor to continue.

Code:
    public void AntiAFK(int dur)   //- duration = labor point gain. 1 hr = 60 (non patron)
    {    
        sLP = me.laborPoints;
        Log("~~~ Starting AFK Mode ~~~");
       Log("Current Labor = " + sLP + " | " + "Ending Labor: " + (sLP + dur));
            while (true)
              { 
                  //- Check current Labor Points
                  eLP = me.laborPoints;
                  
                  if(eLP >= (sLP + dur))
                  {
                      //- All done
                      return;
                      } else {
                          //- Stay AFK
                  //Jump once  
                Jump(true);
                Thread.Sleep(500);
                Jump(false);


                //Generate random time between 4-5 minutes       
                Random random = new Random();
                var mseconds = random.Next(240, 300) * 1000;
                var seconds = mseconds / 1000;
                Log("Labor = " + eLP + " | Waiting for " + seconds.ToString() + " seconds");


                //sleep for random time
                Thread.Sleep(mseconds);
            } 
            }
    }
 
Back
Top