mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-03 08:39:09 +00:00
[FEATURE] Added the logout disabler random
Also removed the question solver random until it’s been fixed
This commit is contained in:
@@ -3,6 +3,7 @@ package org.parabot.randoms;
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
||||
import org.parabot.randoms.elkoy.LogoutDisabler;
|
||||
import org.parabot.randoms.elkoy.QuestionSolver;
|
||||
import org.parabot.randoms.pkhonor.*;
|
||||
|
||||
@@ -27,7 +28,8 @@ public class Core {
|
||||
randoms.add(new SerialBanAvoider());
|
||||
|
||||
//Elkoy
|
||||
randoms.add(new QuestionSolver());
|
||||
//randoms.add(new QuestionSolver());
|
||||
randoms.add(new LogoutDisabler());
|
||||
|
||||
org.parabot.core.Core.verbose("Possible randoms:");
|
||||
for (Random random : randoms) {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.parabot.randoms.elkoy;
|
||||
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.input.Keyboard;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
import org.rev317.min.api.methods.Game;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author EmmaStone
|
||||
*/
|
||||
public class LogoutDisabler implements org.parabot.environment.randoms.Random {
|
||||
|
||||
private final int[] KEYS = {KeyEvent.VK_UP, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT};
|
||||
private final Random random = new Random();
|
||||
private long ms = System.currentTimeMillis();
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return Game.isLoggedIn() && (System.currentTimeMillis() - ms) / 1000 > random.nextInt((50 - 30) + 1) + 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
int keyCode = KEYS[random.nextInt(KEYS.length)];
|
||||
Keyboard.getInstance().pressKey(keyCode);
|
||||
Time.sleep(random.nextInt((20 - 5) + 1) + 5);
|
||||
Keyboard.getInstance().releaseKey(keyCode);
|
||||
|
||||
ms = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Logout Disabler";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "Elkoy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,8 @@ public class QuestionSolver implements Random {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = Loader.getClient().getInterfaceCache()[372].getMessage();
|
||||
if (!message.contains("lose items on death, beware")) {
|
||||
String message = Loader.getClient().getInterfaceCache()[371].getMessage();
|
||||
if (!message.contains("otherwise you will be teleported")) {
|
||||
message = message.replace("@dre@ ", "");
|
||||
|
||||
Logger.addMessage("Contacting server to get an answer", false);
|
||||
|
||||
Reference in New Issue
Block a user