mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-02 16:49:09 +00:00
Merge pull request #43 from Parabot/bugfix/windows
[BUGFIX] Generating random UUID
This commit is contained in:
@@ -12,10 +12,9 @@ import org.parabot.environment.randoms.RandomType;
|
||||
*/
|
||||
public class AntiDetector implements Random, Runnable {
|
||||
|
||||
private boolean activated;
|
||||
|
||||
private final String[] toBeNull = { "P", "Q", "N" };
|
||||
private final String className = "cb";
|
||||
private boolean activated;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -2,10 +2,12 @@ package org.parabot.randoms.locopk;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.asm.ASMClassLoader;
|
||||
import org.parabot.environment.OperatingSystem;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author EmmaStone
|
||||
@@ -26,13 +28,15 @@ public class MacAddressFix implements Random {
|
||||
|
||||
Class<?> createUID = classLoader.loadClass("com.locopk.client.rs.CreateUID");
|
||||
|
||||
Field mac = createUID.getDeclaredField("mac");
|
||||
if (OperatingSystem.getOS().equals(OperatingSystem.MAC)) {
|
||||
|
||||
String randomMac = randomMacAddress();
|
||||
Field mac = createUID.getDeclaredField("mac");
|
||||
mac.set(null, randomMacAddress());
|
||||
} else {
|
||||
Field firstID = createUID.getDeclaredField("firstId");
|
||||
|
||||
System.out.println(randomMac);
|
||||
|
||||
mac.set(null, randomMac);
|
||||
firstID.set(null, UUID.randomUUID().toString());
|
||||
}
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -55,23 +59,23 @@ public class MacAddressFix implements Random {
|
||||
return RandomType.ON_SERVER_START;
|
||||
}
|
||||
|
||||
private String randomMacAddress(){
|
||||
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
|
||||
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){
|
||||
for (byte b : macAddr) {
|
||||
|
||||
if(sb.length() > 0)
|
||||
if (sb.length() > 0) {
|
||||
sb.append("");
|
||||
}
|
||||
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
|
||||
|
||||
return sb.toString().toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
*/
|
||||
public class CombatStone implements Random {
|
||||
|
||||
private Npc combat;
|
||||
private final int id = 17025;
|
||||
private Npc combat;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -16,10 +16,9 @@ import org.rev317.min.api.wrappers.SceneObject;
|
||||
*/
|
||||
|
||||
public class Jail implements Random {
|
||||
private final int[] rocks = { 7456, 7455, 7488 };
|
||||
private final int[] pickAxes = { 1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608 };
|
||||
private Npc jailer;
|
||||
|
||||
private final int[] rocks = {7456, 7455, 7488};
|
||||
private final int[] pickAxes = {1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608};
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
*/
|
||||
public class MysteriousOldMan implements Random {
|
||||
|
||||
private Npc man;
|
||||
private final int id = 513;
|
||||
private Npc man;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
*/
|
||||
public class SandwichLady implements Random {
|
||||
|
||||
private Npc lady;
|
||||
private final int id = 5510;
|
||||
private Npc lady;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
@@ -12,8 +12,8 @@ import org.rev317.min.api.wrappers.Item;
|
||||
*/
|
||||
public class TriangleSandwich implements Random {
|
||||
|
||||
private Item item;
|
||||
private final int id = 6963;
|
||||
private Item item;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
|
||||
Reference in New Issue
Block a user