mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-07 16:49:11 +00:00
[TASK] Init repository
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package org.parabot.randoms;
|
||||||
|
|
||||||
|
import org.parabot.core.Context;
|
||||||
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
|
import org.parabot.randoms.ikov.Login;
|
||||||
|
import org.parabot.randoms.ikov.LogoutDisabler;
|
||||||
|
import org.parabot.randoms.ikov.PacketFail;
|
||||||
|
import org.parabot.randoms.ikov.QuestionSolver;
|
||||||
|
import org.parabot.randoms.pkhonor.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JKetelaar
|
||||||
|
*/
|
||||||
|
public class Core {
|
||||||
|
private ArrayList<Random> randoms = new ArrayList<Random>();
|
||||||
|
|
||||||
|
public void init(String server) {
|
||||||
|
randoms.add(new Jail());
|
||||||
|
randoms.add(new TriangleSandwich());
|
||||||
|
randoms.add(new SandwichLady());
|
||||||
|
randoms.add(new MysteriousOldMan());
|
||||||
|
randoms.add(new QuestionSolver());
|
||||||
|
randoms.add(new BobsIsland());
|
||||||
|
randoms.add(new LogoutDisabler());
|
||||||
|
randoms.add(new Login());
|
||||||
|
randoms.add(new PacketFail());
|
||||||
|
|
||||||
|
org.parabot.core.Core.verbose("Possible randoms:");
|
||||||
|
for (Random random : randoms) {
|
||||||
|
if (random.getServer().toLowerCase().equalsIgnoreCase(server.toLowerCase())) {
|
||||||
|
org.parabot.core.Core.verbose("-> " + random.getName());
|
||||||
|
Context.getInstance().getRandomHandler().addRandom(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+62
@@ -0,0 +1,62 @@
|
|||||||
|
package org.parabot.randoms.ikov;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
import org.parabot.environment.input.Mouse;
|
||||||
|
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||||
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
|
import org.rev317.min.api.methods.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JKetelaar
|
||||||
|
*/
|
||||||
|
public class Login implements Random {
|
||||||
|
|
||||||
|
private static int timer = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
return System.currentTimeMillis() - timer > 0 && !Game.isLoggedIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
timer = 0;
|
||||||
|
|
||||||
|
// Move and click mouse on the login button
|
||||||
|
Mouse.getInstance().moveMouse(380, 320);
|
||||||
|
Mouse.getInstance().click(380, 320, true);
|
||||||
|
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return Game.isLoggedIn();
|
||||||
|
}
|
||||||
|
}, 4500);
|
||||||
|
if (Game.isLoggedIn()) {
|
||||||
|
/* Sleep to let the client load their objects and players */
|
||||||
|
Time.sleep(5000);
|
||||||
|
}else{
|
||||||
|
// Move and click mouse on the close button
|
||||||
|
Mouse.getInstance().moveMouse(515, 130);
|
||||||
|
Mouse.getInstance().click(515, 130, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Login";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "Ikov";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param timeOut seconds
|
||||||
|
*/
|
||||||
|
public static void setTimer(int timeOut){
|
||||||
|
timer = ((int) System.currentTimeMillis() + (timeOut * 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
package org.parabot.randoms.ikov;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
import org.parabot.environment.input.Keyboard;
|
||||||
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
|
import org.rev317.min.api.methods.Game;
|
||||||
|
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JKetelaar
|
||||||
|
*/
|
||||||
|
public class LogoutDisabler implements Random {
|
||||||
|
|
||||||
|
private final int[] keys = {KeyEvent.VK_UP, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT};
|
||||||
|
private final java.util.Random random = new java.util.Random();
|
||||||
|
|
||||||
|
private long ms = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
return Game.isLoggedIn() && (System.currentTimeMillis() - ms) / 1000 > random.nextInt((50 - 30) + 1) + 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
int keyCode = keys[random.nextInt(keys.length)];
|
||||||
|
Keyboard.getInstance().pressKey(keyCode);
|
||||||
|
Time.sleep(random.nextInt((20 - 5) + 1) + 5);
|
||||||
|
Keyboard.getInstance().releaseKey(keyCode);
|
||||||
|
|
||||||
|
ms = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Logout disabler";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "Ikov";
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+67
@@ -0,0 +1,67 @@
|
|||||||
|
package org.parabot.randoms.ikov;
|
||||||
|
|
||||||
|
import org.parabot.core.ui.Logger;
|
||||||
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
|
import org.rev317.min.api.events.MessageEvent;
|
||||||
|
import org.rev317.min.api.events.listeners.MessageListener;
|
||||||
|
import org.rev317.min.api.methods.Game;
|
||||||
|
import org.rev317.min.script.ScriptEngine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JKetelaar
|
||||||
|
*/
|
||||||
|
public class PacketFail implements Random, MessageListener {
|
||||||
|
|
||||||
|
private int fails = 0;
|
||||||
|
private long lastFail = 0;
|
||||||
|
|
||||||
|
public PacketFail(){
|
||||||
|
ScriptEngine.getInstance().addMessageListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
if (fails >= 3 && System.currentTimeMillis() - lastFail <= 25 * 1000){
|
||||||
|
return true;
|
||||||
|
}else if (System.currentTimeMillis() - lastFail > 25 * 1000){
|
||||||
|
lastFail = 0;
|
||||||
|
fails = 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
if (!Game.dropClient()){
|
||||||
|
Logger.addMessage("Couldn't drop the client, please restart if required", true);
|
||||||
|
}
|
||||||
|
fails = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Client restarter";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "Ikov";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void messageReceived(MessageEvent messageEvent) {
|
||||||
|
if (messageEvent.getType() == 0){
|
||||||
|
String message = messageEvent.getMessage().toLowerCase();
|
||||||
|
switch (message){
|
||||||
|
case "unable to receive input":
|
||||||
|
case "command does not exist":
|
||||||
|
case "too far away from this object":
|
||||||
|
case "that object does not exist":
|
||||||
|
case "party room is currently disabled":
|
||||||
|
fails++;
|
||||||
|
lastFail = System.currentTimeMillis();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+107
@@ -0,0 +1,107 @@
|
|||||||
|
package org.parabot.randoms.ikov;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
import org.parabot.core.Context;
|
||||||
|
import org.parabot.core.ui.Logger;
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
import org.parabot.environment.api.utils.WebUtil;
|
||||||
|
import org.parabot.environment.input.Keyboard;
|
||||||
|
import org.parabot.environment.scripts.Script;
|
||||||
|
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||||
|
import org.parabot.environment.scripts.randoms.Random;
|
||||||
|
import org.rev317.min.Loader;
|
||||||
|
import org.rev317.min.api.methods.Game;
|
||||||
|
import org.rev317.min.api.methods.Menu;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
public class QuestionSolver implements Random {
|
||||||
|
|
||||||
|
private final int backlogID = 368, cacheID = 372;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
return Game.isLoggedIn() && Game.getOpenBackDialogId() == backlogID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = Loader.getClient().getInterfaceCache()[cacheID].getMessage();
|
||||||
|
if (!message.contains("lose items on death, beware")) {
|
||||||
|
message = message.replace("@dre@ ", "");
|
||||||
|
|
||||||
|
Logger.addMessage("Contacting server to get an answer", false);
|
||||||
|
String answer = getAnswer(message);
|
||||||
|
|
||||||
|
if (answer == null) {
|
||||||
|
Logger.addMessage("Could not solve the question, please report this question (and the possible answer) on the forums", true);
|
||||||
|
Logger.addMessage("Question: " + message, true);
|
||||||
|
forceRelog();
|
||||||
|
Logger.addMessage("Logged account out for security measures", true);
|
||||||
|
Context.getInstance().getRunningScript().setState(Script.STATE_STOPPED);
|
||||||
|
} else {
|
||||||
|
Logger.addMessage("Answer found, now trying: " + answer, false);
|
||||||
|
Menu.sendAction(679, -1, -1, 373);
|
||||||
|
Time.sleep(1000);
|
||||||
|
Keyboard.getInstance().sendKeys(answer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Time.sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnswer(String question){
|
||||||
|
try {
|
||||||
|
JSONObject object = (JSONObject) WebUtil.getJsonParser().parse(WebUtil.getContents("http://bdn.parabot.org/api/v2/data/questions/get",
|
||||||
|
"server=ikov&question=" + URLEncoder.encode(question, "UTF-8")));
|
||||||
|
JSONObject result;
|
||||||
|
if ((result = (JSONObject) object.get("result")) != null){
|
||||||
|
Object answer;
|
||||||
|
if ((answer = result.get("answer")) != null){
|
||||||
|
return (String) answer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ParseException | MalformedURLException | UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}catch (Exception ignored){
|
||||||
|
// Catching for old bots
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void forceRelog() {
|
||||||
|
try {
|
||||||
|
Logger.addMessage("Logging out...", false);
|
||||||
|
Class<?> c = Loader.getClient().getClass();
|
||||||
|
|
||||||
|
Method m = c.getDeclaredMethod("am");
|
||||||
|
m.setAccessible(true);
|
||||||
|
|
||||||
|
m.invoke(Loader.getClient());
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return !Game.isLoggedIn();
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Login.setTimer(5 * 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Question solver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "Ikov";
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+67
@@ -0,0 +1,67 @@
|
|||||||
|
package org.parabot.randoms.pkhonor;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
public class BobsIsland implements Random {
|
||||||
|
|
||||||
|
private final int PORTAL = 8987;
|
||||||
|
private ArrayList<SceneObject> portals;
|
||||||
|
private final Area ISLAND = new Area(new Tile(2511, 4765), new Tile(2511, 4790), new Tile(2542, 4790), new Tile(2542, 4765));
|
||||||
|
|
||||||
|
public BobsIsland() {
|
||||||
|
portals = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
return ISLAND.contains(Players.getMyPlayer().getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
//Fill The ArrayList
|
||||||
|
for (SceneObject portal : SceneObjects.getNearest(PORTAL)) {
|
||||||
|
if (portal != null) {
|
||||||
|
portals.add(portal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Loop through the portals
|
||||||
|
for (final SceneObject portal : portals) {
|
||||||
|
if (portal != null) {
|
||||||
|
portal.interact(0);
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return portal.distanceTo() < 2;
|
||||||
|
}
|
||||||
|
}, 7500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Bobs Island Solver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "pkhonor";
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+114
@@ -0,0 +1,114 @@
|
|||||||
|
package org.parabot.randoms.pkhonor;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
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;
|
||||||
|
import org.rev317.min.api.methods.SceneObjects;
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Jail implements Random {
|
||||||
|
private Npc jailer;
|
||||||
|
private final int[] ROCKS = {2093, 2092};
|
||||||
|
private final int[] PICK_AXES = {1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
try {
|
||||||
|
if (jailer() != null) {
|
||||||
|
this.jailer = jailer();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
SceneObject rock = rock();
|
||||||
|
|
||||||
|
//Check if we got an Pickaxe
|
||||||
|
if (Inventory.getCount(PICK_AXES) > 0) {
|
||||||
|
|
||||||
|
//Check if we can min the ores
|
||||||
|
if (!Inventory.isFull()) {
|
||||||
|
if (rock != null) {
|
||||||
|
if (Players.getMyPlayer().getAnimation() == -1) {
|
||||||
|
rock.interact(0);
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return Players.getMyPlayer().getAnimation() != -1;
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Inventory is full depositting ores
|
||||||
|
} else {
|
||||||
|
jailer.interact(0);
|
||||||
|
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return !Inventory.isFull();
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
Time.sleep(2500);
|
||||||
|
}
|
||||||
|
|
||||||
|
//getting Pickaxe
|
||||||
|
} else {
|
||||||
|
jailer.interact(0);
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return Inventory.getCount(1266) > 0;
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Npc jailer(){
|
||||||
|
for(Npc jailer : Npcs.getNearest(201)){
|
||||||
|
if(jailer != null){
|
||||||
|
return jailer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SceneObject rock(){
|
||||||
|
for(SceneObject rock : SceneObjects.getNearest(ROCKS)){
|
||||||
|
if(rock != null){
|
||||||
|
return rock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Jail solver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "pkhonor";
|
||||||
|
}
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package org.parabot.randoms.pkhonor;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
public class MysteriousOldMan implements Random {
|
||||||
|
|
||||||
|
Npc man;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
for (Npc npc : Npcs.getNearest(410)) {
|
||||||
|
if (npc != null && npc.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||||
|
man = npc;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
if (man != null && man.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||||
|
man.interact(0);
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return !man.getInteractingCharacter().equals(Players.getMyPlayer());
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Mysterious Old Man Solver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "pkhonor";
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package org.parabot.randoms.pkhonor;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
public class SandwichLady implements Random {
|
||||||
|
|
||||||
|
Npc lady;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
for (Npc npc : Npcs.getNearest(3117)) {
|
||||||
|
if (npc != null && npc.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||||
|
lady = npc;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
if (lady != null && lady.getInteractingCharacter().equals(Players.getMyPlayer())) {
|
||||||
|
lady.interact(0);
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return !lady.getInteractingCharacter().equals(Players.getMyPlayer());
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Sandwich Lady Solver";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "pkhonor";
|
||||||
|
}
|
||||||
|
}
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
package org.parabot.randoms.pkhonor;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
public class TriangleSandwich implements Random {
|
||||||
|
|
||||||
|
Item item;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
for (Item i : Inventory.getItems(6963)) {
|
||||||
|
if (i != null) {
|
||||||
|
this.item = i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
if (this.item != null) {
|
||||||
|
item.drop();
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return Inventory.getCount(6963) == 0;
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Triangle Sandwich Handler";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServer() {
|
||||||
|
return "pkhonor";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user