mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-08 00:38:51 +00:00
Merge pull request #39 from Parabot/feature/locopk
[FEATURE] Added LocoPK Random
This commit is contained in:
@@ -2,12 +2,11 @@ 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.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.MouseOnScreen;
|
import org.parabot.randoms.elkoy.MouseOnScreen;
|
||||||
import org.parabot.randoms.elkoy.QuestionSolver;
|
import org.parabot.randoms.elkoy.QuestionSolver;
|
||||||
|
import org.parabot.randoms.locopk.MacAddressFix;
|
||||||
import org.parabot.randoms.pkhonor.*;
|
import org.parabot.randoms.pkhonor.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -26,10 +25,7 @@ public class Core {
|
|||||||
randoms.add(new MysteriousOldMan());
|
randoms.add(new MysteriousOldMan());
|
||||||
randoms.add(new BobsIsland());
|
randoms.add(new BobsIsland());
|
||||||
randoms.add(new BanFile());
|
randoms.add(new BanFile());
|
||||||
|
randoms.add(new CombatStone());
|
||||||
// Dreamscape
|
|
||||||
randoms.add(new SerialBanAvoider());
|
|
||||||
randoms.add(new MacAddressAvoider());
|
|
||||||
|
|
||||||
// Elkoy
|
// Elkoy
|
||||||
randoms.add(new QuestionSolver());
|
randoms.add(new QuestionSolver());
|
||||||
@@ -37,6 +33,9 @@ public class Core {
|
|||||||
randoms.add(new MouseOnScreen());
|
randoms.add(new MouseOnScreen());
|
||||||
randoms.add(new AntiDetector());
|
randoms.add(new AntiDetector());
|
||||||
|
|
||||||
|
// LocoPK
|
||||||
|
randoms.add(new MacAddressFix());
|
||||||
|
|
||||||
org.parabot.core.Core.verbose("Possible randoms:");
|
org.parabot.core.Core.verbose("Possible randoms:");
|
||||||
for (Random random : randoms) {
|
for (Random random : randoms) {
|
||||||
if (random.getServer().equalsIgnoreCase(server)) {
|
if (random.getServer().equalsIgnoreCase(server)) {
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +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 org.parabot.randoms.utils.Reflection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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() {
|
|
||||||
Reflection.workAroundStaticValues(Context.getInstance().getClient().getClass(), serialAddressField, serialAddressValue);
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Serial ban avoider";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getServer() {
|
|
||||||
return "dreamscape";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RandomType getRandomType() {
|
|
||||||
return RandomType.ON_SERVER_START;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -18,12 +18,11 @@ public class CombatStone implements Random {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
return (this.combat = getCombat) != null;
|
return (this.combat = getCombat()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Logger.addMessage("CombatStone Random Running",true);
|
|
||||||
if (this.combat != null) {
|
if (this.combat != null) {
|
||||||
combat.interact(Npcs.Option.TALK_TO);
|
combat.interact(Npcs.Option.TALK_TO);
|
||||||
Time.sleep(new SleepCondition() {
|
Time.sleep(new SleepCondition() {
|
||||||
Reference in New Issue
Block a user