Merge branch 'development' into bugfix/npcids

This commit is contained in:
Emma Stone
2017-08-25 12:46:42 +01:00
committed by GitHub
9 changed files with 81 additions and 28 deletions
+4 -1
View File
@@ -2,11 +2,12 @@ package org.parabot.randoms;
import org.parabot.core.Context;
import org.parabot.environment.randoms.Random;
import org.parabot.randoms.dreamscape.MacAddressAvoider;
import org.parabot.randoms.dreamscape.SerialBanAvoider;
import org.parabot.randoms.elkoy.AntiDetector;
import org.parabot.randoms.elkoy.LogoutDisabler;
import org.parabot.randoms.elkoy.QuestionSolver;
import org.parabot.randoms.elkoy.MouseOnScreen;
import org.parabot.randoms.elkoy.QuestionSolver;
import org.parabot.randoms.pkhonor.*;
import java.util.ArrayList;
@@ -24,9 +25,11 @@ public class Core {
randoms.add(new SandwichLady());
randoms.add(new MysteriousOldMan());
randoms.add(new BobsIsland());
randoms.add(new BanFile());
// Dreamscape
randoms.add(new SerialBanAvoider());
randoms.add(new MacAddressAvoider());
// Elkoy
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.environment.randoms.Random;
import org.parabot.environment.randoms.RandomType;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import org.parabot.randoms.utils.Reflection;
/**
* @author JKetelaar
@@ -24,24 +22,10 @@ public class SerialBanAvoider implements Random {
@Override
public void execute() {
try {
workAroundStaticValues(Context.getInstance().getClient().getClass(), serialAddressField, serialAddressValue);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
Reflection.workAroundStaticValues(Context.getInstance().getClient().getClass(), serialAddressField, serialAddressValue);
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
public String getName() {
return "Serial ban avoider";
@@ -14,8 +14,8 @@ public class AntiDetector implements Random, Runnable {
private boolean activated;
private final String[] toBeNull = {"P", "Q", "N"};
private final String className = "cb";
private final String[] toBeNull = { "P", "Q", "N" };
private final String className = "cb";
@Override
public boolean activate() {
@@ -13,9 +13,9 @@ import java.util.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 long ms = System.currentTimeMillis();
private long ms = System.currentTimeMillis();
@Override
public boolean activate() {
@@ -24,7 +24,7 @@ public class LogoutDisabler implements org.parabot.environment.randoms.Random {
@Override
public void execute() {
int keyCode = KEYS[random.nextInt(KEYS.length)];
int keyCode = keys[random.nextInt(keys.length)];
Keyboard.getInstance().pressKey(keyCode);
Time.sleep(random.nextInt((20 - 5) + 1) + 5);
Keyboard.getInstance().releaseKey(keyCode);
@@ -10,8 +10,8 @@ import java.io.File;
*/
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 boolean checked = false;
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;
@Override
public boolean activate() {
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Tile;
*/
public class BobsIsland implements Random {
private static final Tile center = new Tile(2525, 4777);
private static final int portalId = 8987;
private static final Tile center = new Tile(2525, 4777);
private static final int portalId = 8987;
@Override
public boolean activate() {
@@ -17,6 +17,7 @@ import org.rev317.min.api.wrappers.SceneObject;
public class Jail implements Random {
private Npc jailer;
private final int[] rocks = {7456, 7455, 7488};
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();
}
}
}