mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-03 16:49:09 +00:00
[FEATURE] New random system
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package org.parabot.randoms;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.environment.scripts.randoms.Random;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
||||
import org.parabot.randoms.pkhonor.*;
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
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;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
@@ -53,4 +51,9 @@ public class SerialBanAvoider implements Random {
|
||||
public String getServer() {
|
||||
return "dreamscape";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.ON_SERVER_START;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
package org.parabot.randoms.pkhonor;
|
||||
|
||||
import org.parabot.environment.scripts.randoms.Random;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by Fryslan.
|
||||
* @author Fryslan
|
||||
*/
|
||||
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 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() {
|
||||
checked = true;
|
||||
return !checked && filePresent();
|
||||
if (!checked) {
|
||||
if (filePresent()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
for(File banfile : locations){
|
||||
if(banfile.exists()){
|
||||
banfile.delete();
|
||||
for (File banfile : locations) {
|
||||
if (banfile.exists()) {
|
||||
banfile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +43,15 @@ public class BanFile implements Random {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.ON_SERVER_START;
|
||||
}
|
||||
|
||||
private boolean filePresent() {
|
||||
for(File banfile : locations){
|
||||
if(banfile.exists()){
|
||||
checked = true;
|
||||
for (File banfile : locations) {
|
||||
if (banfile.exists()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
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.parabot.environment.scripts.randoms.Random;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
import org.rev317.min.api.methods.SceneObjects;
|
||||
import org.rev317.min.api.wrappers.Area;
|
||||
import org.rev317.min.api.wrappers.SceneObject;
|
||||
import org.rev317.min.api.wrappers.Tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: Piet Jetse
|
||||
* Date: 2-1-2015
|
||||
* Time: 13:19
|
||||
* @author Fryslan
|
||||
*/
|
||||
public class BobsIsland implements Random {
|
||||
|
||||
private static final Tile center = new Tile(2525,4777);
|
||||
private static final Tile center = new Tile(2525, 4777);
|
||||
private static final int portalId = 8987;
|
||||
|
||||
public BobsIsland() {
|
||||
@@ -34,8 +28,8 @@ public class BobsIsland implements Random {
|
||||
public void execute() {
|
||||
SceneObject[] portals = SceneObjects.getNearest(portalId);
|
||||
|
||||
for(final SceneObject portal : portals){
|
||||
if(portal != null){
|
||||
for (final SceneObject portal : portals) {
|
||||
if (portal != null) {
|
||||
portal.interact(SceneObjects.Option.FIRST);
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
@@ -45,7 +39,7 @@ public class BobsIsland implements Random {
|
||||
}, 10000);
|
||||
Time.sleep(1000);
|
||||
|
||||
if(center.distanceTo() > 24){
|
||||
if (center.distanceTo() > 24) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -61,4 +55,9 @@ public class BobsIsland implements Random {
|
||||
public String getServer() {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
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.parabot.environment.scripts.randoms.Random;
|
||||
import org.rev317.min.api.methods.Inventory;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
@@ -11,7 +12,7 @@ import org.rev317.min.api.wrappers.Npc;
|
||||
import org.rev317.min.api.wrappers.SceneObject;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA. User: Piet Jetse Date: 11-9-2014 Time: 22:22
|
||||
* @author Fryslan
|
||||
*/
|
||||
|
||||
public class Jail implements Random {
|
||||
@@ -45,7 +46,7 @@ public class Jail implements Random {
|
||||
if (!Inventory.isFull()) {
|
||||
if (rock != null) {
|
||||
if (Players.getMyPlayer().getAnimation() == -1) {
|
||||
rock.interact(0);
|
||||
rock.interact(SceneObjects.Option.MINE);
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
@@ -57,7 +58,7 @@ public class Jail implements Random {
|
||||
|
||||
//Inventory is full depositting ores
|
||||
} else {
|
||||
jailer.interact(0);
|
||||
jailer.interact(Npcs.Option.TALK_TO);
|
||||
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
@@ -70,7 +71,7 @@ public class Jail implements Random {
|
||||
|
||||
//getting Pickaxe
|
||||
} else {
|
||||
jailer.interact(0);
|
||||
jailer.interact(Npcs.Option.TALK_TO);
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
@@ -84,18 +85,18 @@ public class Jail implements Random {
|
||||
}
|
||||
}
|
||||
|
||||
private Npc getJailer(){
|
||||
for(Npc jailer : Npcs.getNearest(201)){
|
||||
if(jailer != null && jailer.getDef() != null){
|
||||
private Npc getJailer() {
|
||||
for (Npc jailer : Npcs.getNearest(201)) {
|
||||
if (jailer != null && jailer.getDef() != null) {
|
||||
return jailer;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private SceneObject getRock(){
|
||||
for(SceneObject rock : SceneObjects.getNearest(rocks)){
|
||||
if(rock != null){
|
||||
private SceneObject getRock() {
|
||||
for (SceneObject rock : SceneObjects.getNearest(rocks)) {
|
||||
if (rock != null) {
|
||||
return rock;
|
||||
}
|
||||
}
|
||||
@@ -111,4 +112,9 @@ public class Jail implements Random {
|
||||
public String getServer() {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
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.parabot.environment.scripts.randoms.Random;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA. User: Piet Jetse Date: 12-9-2014 Time: 17:19
|
||||
* @author Fryslan
|
||||
*/
|
||||
public class MysteriousOldMan implements Random {
|
||||
|
||||
private Npc man;
|
||||
private final int id = 410;
|
||||
private final int ID = 410;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
@@ -35,7 +36,7 @@ public class MysteriousOldMan implements Random {
|
||||
}
|
||||
|
||||
private Npc getMan() {
|
||||
for (Npc man : Npcs.getNearest(id)) {
|
||||
for (Npc man : Npcs.getNearest(ID)) {
|
||||
if (man != null && man.getDef() != null && man.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||
return man;
|
||||
}
|
||||
@@ -52,4 +53,9 @@ public class MysteriousOldMan implements Random {
|
||||
public String getServer() {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
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.parabot.environment.scripts.randoms.Random;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA. User: Piet Jetse Date: 12-9-2014 Time: 16:13
|
||||
* @author Fryslan
|
||||
*/
|
||||
public class SandwichLady implements Random {
|
||||
|
||||
private Npc lady;
|
||||
private final int id = 3117;
|
||||
private final int ID = 3117;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
@@ -35,7 +36,7 @@ public class SandwichLady implements Random {
|
||||
}
|
||||
|
||||
private Npc getLady() {
|
||||
for (Npc lady : Npcs.getNearest(id)) {
|
||||
for (Npc lady : Npcs.getNearest(ID)) {
|
||||
if (lady != null && lady.getDef() != null && lady.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||
return lady;
|
||||
}
|
||||
@@ -52,4 +53,9 @@ public class SandwichLady implements Random {
|
||||
public String getServer() {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
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.parabot.environment.scripts.randoms.Random;
|
||||
import org.rev317.min.api.methods.Inventory;
|
||||
import org.rev317.min.api.wrappers.Item;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA. User: Piet Jetse Date: 11-9-2014 Time: 22:29
|
||||
* @author Fryslan
|
||||
*/
|
||||
public class TriangleSandwich implements Random {
|
||||
|
||||
Item item;
|
||||
private Item item;
|
||||
private final int ID = 6963;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
for (Item i : Inventory.getItems(6963)) {
|
||||
for (Item i : Inventory.getItems(ID)) {
|
||||
if (i != null) {
|
||||
this.item = i;
|
||||
return true;
|
||||
@@ -31,7 +33,7 @@ public class TriangleSandwich implements Random {
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return Inventory.getCount(6963) == 0;
|
||||
return Inventory.getCount(ID) == 0;
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
@@ -46,4 +48,9 @@ public class TriangleSandwich implements Random {
|
||||
public String getServer() {
|
||||
return "pkhonor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user