Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import org.parabot.environment.api.utils.Time;
- import org.parabot.environment.scripts.Category;
- import org.parabot.environment.scripts.Script;
- import org.parabot.environment.scripts.ScriptManifest;
- import org.parabot.environment.scripts.framework.SleepCondition;
- import org.parabot.environment.scripts.framework.Strategy;
- import org.rev317.min.Loader;
- import org.rev317.min.api.methods.Game;
- import org.rev317.min.api.methods.Inventory;
- import org.rev317.min.api.methods.Menu;
- import org.rev317.min.api.wrappers.Item;
- @ScriptManifest(author = "Rah", category = Category.CRAFTING, description = "Makes Amulets of Glory for profit.", name = "rGloryHole", servers = {
- "Crandor" }, version = 1.1)
- public class rGloryHole extends Script {
- private final ArrayList<Strategy> strategies = new ArrayList<>();
- private static final int CHISEL_ID = 1756;
- private static final int CUT_ID = 1713;
- private static final int UNCUT_ID = 1632;
- public boolean onExecute() {
- strategies.add(new SolveRandom());
- strategies.add(new Cut());
- strategies.add(new Buy());
- strategies.add(new Sell());
- provide(strategies);
- return true;
- }
- private class Buy implements Strategy {
- public boolean activate() {
- return (Inventory.getCount(UNCUT_ID) < 26) && !(Inventory.containts(CUT_ID))
- && Game.getOpenInterfaceId() != 16135;
- }
- public void execute() {
- if (Game.getOpenInterfaceId() != 3824) {
- Menu.sendAction(20, 2495, 0, 0);
- Time.sleep(new SleepCondition() {
- public boolean isValid() {
- return Game.getOpenInterfaceId() != -1;
- }
- }, 2000);
- } else {
- Menu.sendAction(431, 1631, 14, 3900);
- Time.sleep(new SleepCondition() {
- public boolean isValid() {
- return Inventory.getCount(UNCUT_ID) >= 26;
- }
- }, 250);
- }
- }
- }
- private class Cut implements Strategy {
- public boolean activate() {
- return (Inventory.getCount(UNCUT_ID) >= 1) && (Inventory.isFull()) && Game.getOpenInterfaceId() != 16135;
- }
- public void execute() {
- Item chisel = Inventory.getItem(CHISEL_ID);
- if (Inventory.containts(UNCUT_ID)) {
- for (Item gem : Inventory.getItems(UNCUT_ID)) {
- chisel.interact(0);
- Time.sleep(50);
- Menu.sendAction(870, UNCUT_ID - 1, gem.getSlot(), 3214);
- }
- Time.sleep(new SleepCondition() {
- public boolean isValid() {
- return !Inventory.containts(UNCUT_ID);
- }
- }, 100);
- }
- }
- }
- private class Sell implements Strategy {
- public boolean activate() {
- return (Inventory.getCount(CUT_ID) >= 26) && (Inventory.isFull()) && Game.getOpenInterfaceId() != 16135;
- }
- public void execute() {
- if (Game.getOpenInterfaceId() == -1) {
- Menu.sendAction(20, 107, 0, 0);
- Time.sleep(new SleepCondition() {
- public boolean isValid() {
- return Game.getOpenInterfaceId() != -1;
- }
- }, 2000);
- } else {
- Menu.sendAction(434, 1712, 26, 3823);
- Time.sleep(100);
- Menu.sendAction(200, 946, 5, 3902);
- Time.sleep(new SleepCondition() {
- public boolean isValid() {
- return !Inventory.containts(CUT_ID);
- }
- }, 2000);
- }
- }
- }
- private class SolveRandom implements Strategy {
- @Override
- public boolean activate() {
- return Game.getOpenInterfaceId() == 16135;
- }
- @Override
- public void execute() {
- switch (getMessage()) {
- case "please select the bread.":
- sendAction(16140);
- break;
- case "please select the bagel.":
- sendAction(16137);
- break;
- case "please select the purple drink.":
- sendAction(16142);
- break;
- case "please select the triangle sandwich.":
- sendAction(16138);
- break;
- case "please select the square sandwich.":
- sendAction(16139);
- break;
- case "please select the chocolate.":
- sendAction(16143);
- break;
- case "please select the pie.":
- sendAction(16141);
- break;
- case "null":
- System.out.println("You done fucked up.");
- break;
- }
- }
- }
- private void sendAction(int action3) {
- Menu.sendAction(315, 1631, 25, action3);
- Time.sleep(new SleepCondition() {
- @Override
- public boolean isValid() {
- return Game.getOpenInterfaceId() != 16135;
- }
- }, 1500);
- }
- private String getMessage() {
- if (Loader.getClient().getInterfaceCache()[16145].getMessage() != null) {
- return Loader.getClient().getInterfaceCache()[16145].getMessage().toLowerCase();
- }
- return "null";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement