Advertisement
Guest User

Untitled

a guest
Apr 20th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. import java.util.ArrayList;
  2.  
  3. import org.parabot.environment.api.utils.Time;
  4. import org.parabot.environment.scripts.Category;
  5. import org.parabot.environment.scripts.Script;
  6. import org.parabot.environment.scripts.ScriptManifest;
  7. import org.parabot.environment.scripts.framework.SleepCondition;
  8. import org.parabot.environment.scripts.framework.Strategy;
  9. import org.rev317.min.api.methods.Game;
  10. import org.rev317.min.api.methods.Inventory;
  11. import org.rev317.min.api.methods.Menu;
  12. import org.rev317.min.api.wrappers.Item;
  13.  
  14. @ScriptManifest(author = "Rah", category = Category.CRAFTING, description = "Makes Amulets of Glory for profit.", name = "rGloryHole", servers = {
  15. "Crandor" }, version = 1.0)
  16. public class rGloryHole extends Script {
  17.  
  18. private final ArrayList<Strategy> strategies = new ArrayList<>();
  19.  
  20. public static final int CHISEL_ID = 1756;
  21. public static final int CUT_ID = 1713;
  22. public static final int UNCUT_ID = 1632;
  23.  
  24. public boolean onExecute() {
  25. strategies.add(new Cut());
  26. strategies.add(new Buy());
  27. strategies.add(new Sell());
  28. provide(strategies);
  29. return true;
  30. }
  31.  
  32. public class Buy implements Strategy {
  33.  
  34. public boolean activate() {
  35. return (Inventory.getCount(UNCUT_ID) < 26) && !(Inventory.containts(CUT_ID));
  36. }
  37.  
  38. public void execute() {
  39. if (Game.getOpenInterfaceId() != 3824) {
  40. Menu.sendAction(20, 2495, 0, 0);
  41. Time.sleep(new SleepCondition() {
  42. public boolean isValid() {
  43. return Game.getOpenInterfaceId() != -1;
  44. }
  45. }, 2000);
  46. } else {
  47. Menu.sendAction(431, 1631, 14, 3900);
  48. Time.sleep(new SleepCondition() {
  49. public boolean isValid() {
  50. return Inventory.getCount(UNCUT_ID) >= 26;
  51. }
  52. }, 250);
  53. }
  54. }
  55.  
  56. }
  57.  
  58. public class Cut implements Strategy {
  59.  
  60. public boolean activate() {
  61. return (Inventory.getCount(UNCUT_ID) >= 1) && (Inventory.isFull());
  62. }
  63.  
  64. public void execute() {
  65. Item chisel = Inventory.getItem(CHISEL_ID);
  66. if (Inventory.containts(UNCUT_ID)) {
  67. for (Item gem : Inventory.getItems(UNCUT_ID)) {
  68. chisel.interact(0);
  69. Time.sleep(50);
  70. Menu.sendAction(870, UNCUT_ID - 1, gem.getSlot(), 3214);
  71. }
  72. Time.sleep(new SleepCondition() {
  73. public boolean isValid() {
  74. return !Inventory.containts(UNCUT_ID);
  75. }
  76. }, 100);
  77. }
  78. }
  79.  
  80. }
  81.  
  82. public class Sell implements Strategy {
  83.  
  84. public boolean activate() {
  85. return (Inventory.getCount(CUT_ID) >= 26) && (Inventory.isFull());
  86. }
  87.  
  88. public void execute() {
  89. if (Game.getOpenInterfaceId() == -1) {
  90. Menu.sendAction(20, 107, 0, 0);
  91. Time.sleep(new SleepCondition() {
  92. public boolean isValid() {
  93. return Game.getOpenInterfaceId() != -1;
  94. }
  95. }, 2000);
  96. } else {
  97. Menu.sendAction(434, 1712, 26, 3823);
  98. Time.sleep(100);
  99. Menu.sendAction(200, 946, 5, 3902);
  100. Time.sleep(new SleepCondition() {
  101. public boolean isValid() {
  102. return !Inventory.containts(CUT_ID);
  103. }
  104. }, 2000);
  105. }
  106. }
  107.  
  108. }
  109.  
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement