mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-07 16:49:11 +00:00
[FEATURE] Added Serial Ban Avoider for Dreamscape
This commit is contained in:
@@ -2,10 +2,7 @@ package org.parabot.randoms;
|
|||||||
|
|
||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.environment.scripts.randoms.Random;
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
import org.parabot.randoms.ikov.LogoutDisabler;
|
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
||||||
import org.parabot.randoms.ikov.PacketFail;
|
|
||||||
import org.parabot.randoms.ikov.Login;
|
|
||||||
import org.parabot.randoms.ikov.QuestionSolver;
|
|
||||||
import org.parabot.randoms.pkhonor.*;
|
import org.parabot.randoms.pkhonor.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -17,15 +14,15 @@ public class Core {
|
|||||||
private ArrayList<Random> randoms = new ArrayList<>();
|
private ArrayList<Random> randoms = new ArrayList<>();
|
||||||
|
|
||||||
public void init(String server) {
|
public void init(String server) {
|
||||||
|
// PkHonor
|
||||||
randoms.add(new Jail());
|
randoms.add(new Jail());
|
||||||
randoms.add(new TriangleSandwich());
|
randoms.add(new TriangleSandwich());
|
||||||
randoms.add(new SandwichLady());
|
randoms.add(new SandwichLady());
|
||||||
randoms.add(new MysteriousOldMan());
|
randoms.add(new MysteriousOldMan());
|
||||||
randoms.add(new QuestionSolver());
|
|
||||||
randoms.add(new BobsIsland());
|
randoms.add(new BobsIsland());
|
||||||
randoms.add(new LogoutDisabler());
|
|
||||||
randoms.add(new Login());
|
// Dreamscape
|
||||||
randoms.add(new PacketFail());
|
randoms.add(new SerialBanAvoider());
|
||||||
|
|
||||||
org.parabot.core.Core.verbose("Possible randoms:");
|
org.parabot.core.Core.verbose("Possible randoms:");
|
||||||
for (Random random : randoms) {
|
for (Random random : randoms) {
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package org.parabot.randoms.dreamscape;
|
||||||
|
|
||||||
|
import org.parabot.core.Context;
|
||||||
|
import org.parabot.core.Core;
|
||||||
|
import org.parabot.core.reflect.RefClass;
|
||||||
|
import org.parabot.core.reflect.RefField;
|
||||||
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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() {
|
||||||
|
RefClass client = new RefClass(Context.getInstance().getClient());
|
||||||
|
RefField serial = client.getField(serialAddressField);
|
||||||
|
if (serial != null) {
|
||||||
|
serial.set(serialAddressValue);
|
||||||
|
} else {
|
||||||
|
Core.verbose(String.format("Oh oh... Couldn't find field: %s", serialAddressField));
|
||||||
|
}
|
||||||
|
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Serial ban avoider";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "dreamscape";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user