mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-02 16:49:09 +00:00
Merge pull request #40 from Parabot/development
[MERGE] Development into master
This commit is contained in:
@@ -2,11 +2,11 @@ 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.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.locopk.MacAddressFix;
|
||||
import org.parabot.randoms.pkhonor.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -24,9 +24,8 @@ public class Core {
|
||||
randoms.add(new SandwichLady());
|
||||
randoms.add(new MysteriousOldMan());
|
||||
randoms.add(new BobsIsland());
|
||||
|
||||
// Dreamscape
|
||||
randoms.add(new SerialBanAvoider());
|
||||
randoms.add(new BanFile());
|
||||
randoms.add(new CombatStone());
|
||||
|
||||
// Elkoy
|
||||
randoms.add(new QuestionSolver());
|
||||
@@ -34,6 +33,9 @@ public class Core {
|
||||
randoms.add(new MouseOnScreen());
|
||||
randoms.add(new AntiDetector());
|
||||
|
||||
// LocoPK
|
||||
randoms.add(new MacAddressFix());
|
||||
|
||||
org.parabot.core.Core.verbose("Possible randoms:");
|
||||
for (Random random : randoms) {
|
||||
if (random.getServer().equalsIgnoreCase(server)) {
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author JKetelaar
|
||||
*/
|
||||
public class SerialBanAvoider implements Random {
|
||||
|
||||
private static final String serialAddressField = "SERIAL_ADDRESS";
|
||||
private static final String serialAddressValue = "empty_or_unknown";
|
||||
|
||||
private boolean done;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return !done;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
workAroundStaticValues(Context.getInstance().getClient().getClass(), serialAddressField, serialAddressValue);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "dreamscape";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.ON_SERVER_START;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.parabot.randoms.locopk;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.asm.ASMClassLoader;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @author EmmaStone
|
||||
*/
|
||||
public class MacAddressFix implements Random {
|
||||
|
||||
private boolean done;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return !done;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
final ASMClassLoader classLoader = Context.getInstance().getASMClassLoader();
|
||||
|
||||
Class<?> createUID = classLoader.loadClass("com.locopk.client.rs.CreateUID");
|
||||
|
||||
Field mac = createUID.getDeclaredField("mac");
|
||||
|
||||
String randomMac = randomMacAddress();
|
||||
|
||||
System.out.println(randomMac);
|
||||
|
||||
mac.set(null, randomMac);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
done = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Mac Address Fix";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "locopk";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.ON_SERVER_START;
|
||||
}
|
||||
|
||||
private String randomMacAddress(){
|
||||
java.util.Random rand = new java.util.Random();
|
||||
byte[] macAddr = new byte[6];
|
||||
rand.nextBytes(macAddr);
|
||||
|
||||
macAddr[0] = (byte)(macAddr[0] & (byte)254); //zeroing last 2 bytes to make it unicast and locally adminstrated
|
||||
|
||||
StringBuilder sb = new StringBuilder(18);
|
||||
for(byte b : macAddr){
|
||||
|
||||
if(sb.length() > 0)
|
||||
sb.append("");
|
||||
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
|
||||
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.parabot.randoms.pkhonor;
|
||||
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
|
||||
/**
|
||||
* @author Lord
|
||||
*/
|
||||
public class CombatStone implements Random {
|
||||
|
||||
private Npc combat;
|
||||
private final int id = 17025;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return (this.combat = getCombat()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (this.combat != null) {
|
||||
combat.interact(Npcs.Option.TALK_TO);
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return combat.distanceTo() > 0 || !combat.getInteractingCharacter().equals(Players.getMyPlayer());
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
private Npc getCombat() {
|
||||
for (Npc combat : Npcs.getNearest(id)) {
|
||||
if (combat != null && combat.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||
return combat;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "CombatStone Solver";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,8 @@ import org.rev317.min.api.wrappers.SceneObject;
|
||||
|
||||
public class Jail implements Random {
|
||||
private Npc jailer;
|
||||
private final int[] rocks = {2093, 2092};
|
||||
|
||||
private final int[] rocks = {7456, 7455, 7488};
|
||||
private final int[] pickAxes = {1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608};
|
||||
|
||||
@Override
|
||||
@@ -87,7 +88,7 @@ public class Jail implements Random {
|
||||
}
|
||||
|
||||
private Npc getJailer() {
|
||||
for (Npc jailer : Npcs.getNearest(201)) {
|
||||
for (Npc jailer : Npcs.getNearest(300)) {
|
||||
if (jailer != null && jailer.getDef() != null) {
|
||||
return jailer;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
public class MysteriousOldMan implements Random {
|
||||
|
||||
private Npc man;
|
||||
private final int id = 410;
|
||||
private final int id = 513;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
public class SandwichLady implements Random {
|
||||
|
||||
private Npc lady;
|
||||
private final int id = 3117;
|
||||
private final int id = 5510;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -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