Dorkinator 64 Share Posted June 25, 2017 This code allows you to have random events that can easily be implemented into multiple scripts. Also the constructor for the AbstractAntiBan object does per player profiles so each player will automatically get a different and unique antiban profile. Credit to Dinh for telling me that using RandomEven.BANK_PIN to initialize the RandomSolver doesn't work and break does. package util; import node.Node; import org.dreambot.api.methods.MethodContext; import random.Random; import random.RandomConstant; /** * Created by Dorkinator on 6/22/2017. */ public abstract class AbstractAntiBan extends Node<MethodContext> { protected MethodContext c; private long nextActivation; private RandomConstant canActivate; private RandomConstant activate; private RandomConstant range; private int likelyhood; public AbstractAntiBan(MethodContext c, int mindelay, int maxDelay, int minRange, int maxRange, int likelyhood) { super(c); this.c = c; this.likelyhood = likelyhood; this.canActivate = new RandomConstant("canActivate"+status(), c.getClient().getUsername(),0, 100, 60*60*1000); this.activate = new RandomConstant("activate"+status(), c.getClient().getUsername(),mindelay, maxDelay, 60*60*1000); this.range = new RandomConstant("range"+status(), c.getClient().getUsername(),minRange, maxRange, 60*60*1000); nextActivation = getNextActivation(); } @Override public void execute() { nextActivation = getNextActivation(); onExecute(); } @Override public boolean activate() { return canActivate.get() > likelyhood && System.currentTimeMillis() > nextActivation; } public abstract void onExecute(); private long getNextActivation(){ return System.currentTimeMillis()+Random.nextInt(activate.get(), activate.get()+range.get()); } } package main; import antibans.*; import org.dreambot.api.methods.MethodContext; import org.dreambot.api.randoms.RandomEvent; import org.dreambot.api.randoms.RandomSolver; import org.dreambot.api.script.AbstractScript; import util.AbstractAntiBan; import java.awt.*; import java.util.ArrayList; /** * Created by Dorkinator on 6/22/2017. */ public class AntiBan extends RandomSolver{ private ArrayList<AbstractAntiBan> antibans; private AbstractAntiBan currentAnti; @Override public void onPaint(Graphics g) { } public AntiBan(MethodContext c) { super(RandomEvent.BREAK, c); antibans = new ArrayList<>(); antibans.add(new TurnCamera(c)); } @Override public boolean shouldExecute() { for(AbstractAntiBan i:antibans){ if(i.activate()){ currentAnti = i; System.out.println(i.status()); return true; } } return false; } @Override public int onLoop() { if(currentAnti != null){ currentAnti.execute(); System.out.println("executed"); }else{ System.out.println("Antiban failed to activate"); } return -1; } } Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted June 25, 2017 Nice one Link to comment Share on other sites More sharing options...
Hashtag 8670 Share Posted June 25, 2017 Great stuff indeed! Link to comment Share on other sites More sharing options...
Clock Work 31 Share Posted September 29, 2017 How would you implement this into a script? Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted October 8, 2017 How would you implement this into a script? Extend AbstractAntiBan which forces you to Overwrite onExecute, then add that class to the ArrayList in AntiBan? Link to comment Share on other sites More sharing options...
pash 14 Share Posted December 19, 2018 Yo, this was the resource I needed. Thank you man! That said, do you think bans can be avoided at the scripting level at this point, or is there no hope given Jagex's detection algorithms? I just had a couple of accounts banned while testing out scripts that I wrote, trying to understand whether or not I have false hope. What are your thoughts? -Pash PS : Find free bot scripts and source code in my repo! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.