Jump to content

AntiBan Class


Deathimminent

Recommended Posts

I haven't been able to test anything, as I wrote this while the client is currently down. It works based on a weight system. Each action has a specific weight. The higher the weight, the more likely that action is to be performed. I only made 3 actions, but it's very simple to implement your own. Feedback is welcome. 

Adding your own action:

Say you want to add an action to...check your woodcutting exp. You would add to the Action enum constants the name of the action and the default weight, like such:

public enum Action {
    MOVE_MOUSE(3),
    ROTATE_CAMERA(7),
    RIGHT_CLICK_RANDOM_OBJECT(1),
    CHECK_WC_EXP(60); // <---------

    int weight;

    Action(int weight) {
        this.weight = weight;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }
}

Then you would add your method that performs the action to the switch statement in the execute() method, like so:

switch (action) {
    case MOVE_MOUSE:
        script.log("[ANTI BAN:] Moving mouse.");
        moveMouseRandomly();
        break;
    case ROTATE_CAMERA:
	    script.log("[ANTI BAN:] Rotating camera.");
	    rotateCameraRandomly();
	    break;
    case RIGHT_CLICK_RANDOM_OBJECT:
	    script.log("[ANTI BAN:] Right-clicking an object");
	    rightClickRandomObject();
	    break;
    case CHECK_WC_EXP:
	    script.log("[ANTI BAN:] Good luck JAGEX");
	    checkWcExp();
	    break;
}

 

Basic usage:

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0.1)
public class Test extends Script {
    
    AntiBan antiban = new AntiBan(this, 30000, 180000);

    @Override
    public int onLoop() throws InterruptedException {
        
        if (antiban.shouldExecute()) {
            antiban.execute();
        }
        
        return 500;
    }

}

Using a custom action list:

import java.util.ArrayList;
import java.util.List;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import test.AntiBan.Action;

@ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0.1)
public class Test extends Script {
    
    AntiBan antiban;

    @Override
    public void onStart() {

        List<Action> actionList = new ArrayList<>();
        
        // create an action with default weight
        Action action1 = Action.MOVE_MOUSE;
        
        // create an action and change its weight
        Action action2 = Action.ROTATE_CAMERA;
        action2.setWeight(20);
        
        // add actions to list
        actionList.add(action1);
        actionList.add(action2);
        
        // create antiban object with custom action list
        antiban = new AntiBan(this, 30000, 180000, actionList);
    }

    @Override
    public int onLoop() throws InterruptedException {

        if (antiban.shouldExecute()) {
            antiban.execute();
        }

        return 500;
    }

}

Source:

  Reveal hidden contents

 

Edited by Deathiminent
source code edits
Link to comment
Share on other sites

  On 10/5/2017 at 3:06 PM, Raccoon Hunter said:

well then tell them the truth, even alek said antiban is shit

 

good antiban is writing a good script

Expand  

Well, it's not "truth", as we don't have any proof that anti ban is useless. Everyone has their own beliefs about it. I personally don't think it matters, but if someone is paying me to write a script for them and anti ban implementation is one of their specifications, then I'll add it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...