mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-07 16:49:11 +00:00
Merge branch 'development' into bugfix/npcids
This commit is contained in:
@@ -2,11 +2,12 @@ package org.parabot.randoms;
|
|||||||
|
|
||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.environment.randoms.Random;
|
import org.parabot.environment.randoms.Random;
|
||||||
|
import org.parabot.randoms.dreamscape.MacAddressAvoider;
|
||||||
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
||||||
import org.parabot.randoms.elkoy.AntiDetector;
|
import org.parabot.randoms.elkoy.AntiDetector;
|
||||||
import org.parabot.randoms.elkoy.LogoutDisabler;
|
import org.parabot.randoms.elkoy.LogoutDisabler;
|
||||||
import org.parabot.randoms.elkoy.QuestionSolver;
|
|
||||||
import org.parabot.randoms.elkoy.MouseOnScreen;
|
import org.parabot.randoms.elkoy.MouseOnScreen;
|
||||||
|
import org.parabot.randoms.elkoy.QuestionSolver;
|
||||||
import org.parabot.randoms.pkhonor.*;
|
import org.parabot.randoms.pkhonor.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -24,9 +25,11 @@ public class Core {
|
|||||||
randoms.add(new SandwichLady());
|
randoms.add(new SandwichLady());
|
||||||
randoms.add(new MysteriousOldMan());
|
randoms.add(new MysteriousOldMan());
|
||||||
randoms.add(new BobsIsland());
|
randoms.add(new BobsIsland());
|
||||||
|
randoms.add(new BanFile());
|
||||||
|
|
||||||
// Dreamscape
|
// Dreamscape
|
||||||
randoms.add(new SerialBanAvoider());
|
randoms.add(new SerialBanAvoider());
|
||||||
|
randoms.add(new MacAddressAvoider());
|
||||||
|
|
||||||
// Elkoy
|
// Elkoy
|
||||||
randoms.add(new QuestionSolver());
|
randoms.add(new QuestionSolver());
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package org.parabot.randoms.dreamscape;
|
||||||
|
|
||||||
|
import org.parabot.core.Context;
|
||||||
|
import org.parabot.core.network.NetworkInterface;
|
||||||
|
import org.parabot.environment.randoms.RandomType;
|
||||||
|
import org.parabot.randoms.utils.Reflection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author EmmaStone
|
||||||
|
*/
|
||||||
|
public class MacAddressAvoider implements org.parabot.environment.randoms.Random {
|
||||||
|
|
||||||
|
private boolean done;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
return !done;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
byte[] mac = new byte[6];
|
||||||
|
new java.util.Random().nextBytes(mac);
|
||||||
|
Reflection.workAroundStaticValues(Context.getInstance().getClient().getClass(), "MAC_ADDRESS", NetworkInterface.formatMac(mac));
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Mac address avoider";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "dreamscape";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RandomType getRandomType() {
|
||||||
|
return RandomType.ON_SERVER_START;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,7 @@ package org.parabot.randoms.dreamscape;
|
|||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.environment.randoms.Random;
|
import org.parabot.environment.randoms.Random;
|
||||||
import org.parabot.environment.randoms.RandomType;
|
import org.parabot.environment.randoms.RandomType;
|
||||||
|
import org.parabot.randoms.utils.Reflection;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author JKetelaar
|
* @author JKetelaar
|
||||||
@@ -24,24 +22,10 @@ public class SerialBanAvoider implements Random {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
Reflection.workAroundStaticValues(Context.getInstance().getClient().getClass(), serialAddressField, serialAddressValue);
|
||||||
workAroundStaticValues(Context.getInstance().getClient().getClass(), serialAddressField, serialAddressValue);
|
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void workAroundStaticValues(Class clazz, String fieldName, Object newValue) throws NoSuchFieldException, IllegalAccessException {
|
|
||||||
Field field = clazz.getDeclaredField(fieldName);
|
|
||||||
field.setAccessible(true);
|
|
||||||
Field modifiers = field.getClass().getDeclaredField("modifiers");
|
|
||||||
modifiers.setAccessible(true);
|
|
||||||
modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
|
||||||
field.set(null, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Serial ban avoider";
|
return "Serial ban avoider";
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ public class AntiDetector implements Random, Runnable {
|
|||||||
|
|
||||||
private boolean activated;
|
private boolean activated;
|
||||||
|
|
||||||
private final String[] toBeNull = {"P", "Q", "N"};
|
private final String[] toBeNull = { "P", "Q", "N" };
|
||||||
private final String className = "cb";
|
private final String className = "cb";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import java.util.Random;
|
|||||||
*/
|
*/
|
||||||
public class LogoutDisabler implements org.parabot.environment.randoms.Random {
|
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 int[] keys = { KeyEvent.VK_UP, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
|
||||||
private final Random random = new Random();
|
private final Random random = new Random();
|
||||||
private long ms = System.currentTimeMillis();
|
private long ms = System.currentTimeMillis();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
@@ -24,7 +24,7 @@ public class LogoutDisabler implements org.parabot.environment.randoms.Random {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
int keyCode = KEYS[random.nextInt(KEYS.length)];
|
int keyCode = keys[random.nextInt(keys.length)];
|
||||||
Keyboard.getInstance().pressKey(keyCode);
|
Keyboard.getInstance().pressKey(keyCode);
|
||||||
Time.sleep(random.nextInt((20 - 5) + 1) + 5);
|
Time.sleep(random.nextInt((20 - 5) + 1) + 5);
|
||||||
Keyboard.getInstance().releaseKey(keyCode);
|
Keyboard.getInstance().releaseKey(keyCode);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public class BanFile implements Random {
|
public class BanFile implements Random {
|
||||||
|
|
||||||
private static final File[] locations = {new File("C:/PkHonor/", ".jagex_cache_58993.dat"), new File(System.getProperty("user.home"), ".app_info_3541"), new File(System.getProperty("user.home"), "AppData/Applications")};
|
private static final File[] locations = { new File("C:/PkHonor/", ".jagex_cache_58993.dat"), new File(System.getProperty("user.home"), ".app_info_3541"), new File(System.getProperty("user.home"), "AppData/Applications") };
|
||||||
private boolean checked = false;
|
private boolean checked = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Tile;
|
|||||||
*/
|
*/
|
||||||
public class BobsIsland implements Random {
|
public class BobsIsland implements Random {
|
||||||
|
|
||||||
private static final Tile center = new Tile(2525, 4777);
|
private static final Tile center = new Tile(2525, 4777);
|
||||||
private static final int portalId = 8987;
|
private static final int portalId = 8987;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.rev317.min.api.wrappers.SceneObject;
|
|||||||
|
|
||||||
public class Jail implements Random {
|
public class Jail implements Random {
|
||||||
private Npc jailer;
|
private Npc jailer;
|
||||||
|
|
||||||
private final int[] rocks = {7456, 7455, 7488};
|
private final int[] rocks = {7456, 7455, 7488};
|
||||||
private final int[] pickAxes = {1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608};
|
private final int[] pickAxes = {1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.parabot.randoms.utils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author EmmaStone
|
||||||
|
*/
|
||||||
|
public class Reflection {
|
||||||
|
|
||||||
|
public static void workAroundStaticValues(Class clazz, String fieldName, Object newValue) {
|
||||||
|
try {
|
||||||
|
Field field = clazz.getDeclaredField(fieldName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
Field modifiers = field.getClass().getDeclaredField("modifiers");
|
||||||
|
modifiers.setAccessible(true);
|
||||||
|
modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||||
|
field.set(null, newValue);
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user