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.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.0)
- public class rGloryHole extends Script {
- private final ArrayList<Strategy> strategies = new ArrayList<>();
- public static final int CHISEL_ID = 1756;
- public static final int CUT_ID = 1713;
- public static final int UNCUT_ID = 1632;
- public boolean onExecute() {
- strategies.add(new Cut());
- strategies.add(new Buy());
- strategies.add(new Sell());
- provide(strategies);
- return true;
- }
- public class Buy implements Strategy {
- public boolean activate() {
- return (Inventory.getCount(UNCUT_ID) < 26) && !(Inventory.containts(CUT_ID));
- }
- 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);
- }
- }
- }
- public class Cut implements Strategy {
- public boolean activate() {
- return (Inventory.getCount(UNCUT_ID) >= 1) && (Inventory.isFull());
- }
- 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);
- }
- }
- }
- public class Sell implements Strategy {
- public boolean activate() {
- return (Inventory.getCount(CUT_ID) >= 26) && (Inventory.isFull());
- }
- 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);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement