Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. package osbotOS;
  2.  
  3. import org.osbot.rs07.script.Script;
  4.  
  5. public abstract class Node {
  6. public Script script;
  7. public BankingMethods bankMethods = new BankingMethods();
  8. public PositionMethods positionMethods = new PositionMethods();
  9. public PouchMethods pouchMethods = new PouchMethods();
  10. public Core coreMethods = new Core();
  11.  
  12. public int BANK_ID = 11744;
  13. public int UNNOTE_ESS = 7937;
  14. public int NOTE_ESS = 7936;
  15. public String BANK_OPTION = "Bank";
  16.  
  17. public Node(Script script) {
  18. this.script = script;
  19. }
  20.  
  21. public abstract void execute();
  22.  
  23. public abstract boolean validate();
  24.  
  25. }
  26.  
  27. ^^^ node object
  28.  
  29. package osbotOS;
  30.  
  31. import java.util.ArrayList;
  32. import java.util.Collections;
  33.  
  34. import org.osbot.rs07.script.Script;
  35. import org.osbot.rs07.script.ScriptManifest;
  36.  
  37. //imports omitted
  38. @ScriptManifest(author = "Elliott", info = "Robust AIO Abyss crafter.", name = "Freaky Fast Abyss", version = 1.0, logo = "")
  39. public class MainCrafter extends Script {
  40.  
  41. public static ArrayList<Node> nodes = new ArrayList<>();
  42. public Core coreMethods = new Core();
  43. private ActivityInBank InBankNode = new ActivityInBank(this);
  44. private ActivityOutOfBank OutOfBankNode = new ActivityOutOfBank(this);
  45.  
  46. @Override
  47. public void onStart() {
  48. int eatAt = 60;
  49. boolean[] pouchesInUse = new boolean[] { true, true, true, false };
  50. int foodID = 7946; //monk
  51. int tabAmount = 10;
  52. int foodHeals = 16;
  53. boolean usingGlories = false;
  54. boolean usingPrayer = true;
  55. boolean usingStam = true;
  56. boolean usingTabs = true;
  57. this.setSettings(eatAt, pouchesInUse, usingTabs, usingGlories,
  58. tabAmount, usingPrayer, usingStam, foodID, foodHeals);
  59.  
  60. Collections.addAll(nodes, this.InBankNode, this.OutOfBankNode); //add all nodes to the ArrayList
  61. }
  62.  
  63. private void setSettings(int eatAt, boolean[] pouchesInUse,
  64. boolean usingGlories, boolean usingTabs, int tabAmount,
  65. boolean usingPrayer, boolean usingStam, int foodID, int foodHeals) {
  66.  
  67. this.InBankNode.eatAt = eatAt; //user defined from UI eventually;
  68. this.InBankNode.usingGlory = usingGlories;
  69. this.InBankNode.usingTabs = usingTabs;
  70. this.InBankNode.tabAmount = tabAmount;
  71. this.InBankNode.usingStam = usingStam;
  72. this.InBankNode.foodID = foodID;
  73. this.InBankNode.foodHeals = foodHeals;
  74.  
  75. this.OutOfBankNode.pouchesInUse[0] = pouchesInUse[0];
  76. this.OutOfBankNode.pouchesInUse[1] = pouchesInUse[1];
  77. this.OutOfBankNode.pouchesInUse[2] = pouchesInUse[2];
  78. this.OutOfBankNode.pouchesInUse[3] = pouchesInUse[3];
  79. }
  80.  
  81. @Override
  82. public int onLoop() throws InterruptedException {
  83. for (final Node node : nodes) { //loop through the nodes
  84. if (node.validate()) { //validate each node
  85. node.execute(); //execute
  86. this.coreMethods.waitTime(this.coreMethods.rand(10, 50)); //prevents us from going through the logic as fast as we possibly can
  87. }
  88. }
  89. return this.coreMethods.rand(50, 100);
  90. }
  91. }
  92.  
  93. ^^^^^ main script class
  94.  
  95.  
  96. package osbotOS;
  97.  
  98. import java.awt.Color;
  99. import java.util.ArrayList;
  100. import java.util.Collections;
  101.  
  102. import org.osbot.rs07.api.ui.EquipmentSlot;
  103. import org.osbot.rs07.api.ui.Skill;
  104. import org.osbot.rs07.script.Script;
  105.  
  106. public class ActivityInBank extends Node {
  107.  
  108. public boolean pouchesFull = false;
  109. public boolean bankingIsDone = false;
  110. public static ArrayList<Node> subnodes = new ArrayList<>();
  111.  
  112. public Integer eatAt;
  113. public int foodID;
  114. public int foodHeals;
  115. public boolean usingTabs;
  116. public boolean usingGlory;
  117. public boolean usingPrayer;
  118. public boolean usingStam;
  119. public int tabAmount;
  120.  
  121. public boolean needToWithdrawFood;
  122. public boolean needToWithdrawGlory;
  123. public boolean needToWithdrawPrayer;
  124. public boolean needToWithdrawRunes;
  125. public boolean needToWithdrawTabs;
  126. public boolean needToWithdrawStam;
  127.  
  128. public boolean nearBank = this.validateNearBank();
  129.  
  130. public ActivityInBank(Script script) {
  131. super(script);
  132.  
  133. this.needToWithdrawFood = this.validateFood();
  134. this.needToWithdrawGlory = this.validateGlory();
  135. this.needToWithdrawPrayer = this.validatePrayer();
  136. this.needToWithdrawRunes = this.validateRunes();
  137. this.needToWithdrawTabs = this.validateTabs();
  138. this.needToWithdrawStam = this.validateStam();
  139.  
  140. // TODO Auto-generated constructor stub
  141. }
  142. ^^ ActivityInBank showing constructor
  143. ...followed by other irrelevant methods to this problem
  144. activity out of bank is the same way.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement