Advertisement
Scriptr

nCooker

Jul 21st, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. import org.osbot.rs07.api.model.RS2Object;
  2. import org.osbot.rs07.api.ui.RS2Widget;
  3. import org.osbot.rs07.script.Script;
  4. import org.osbot.rs07.script.ScriptManifest;
  5. import org.osbot.rs07.utility.Area;
  6.  
  7. @ScriptManifest(author = "Charlie", info = "Cooks food in Nardah Duh", name = "Nardah Cooker", version = 0, logo = "")
  8. public class NCooker extends Script {
  9.  
  10. Area cookArea = new Area(3432, 2889, 3435, 2886);
  11. Area bankArea = new Area(3427, 2893, 3430, 2890);
  12.  
  13. private enum State {
  14. COOK, BANK, WALK2BANK, WALK2STOVE
  15. };
  16.  
  17.  
  18.  
  19. private NCooker.State getState()
  20. {
  21. if ((this.inventory.contains(new String[] { "Raw shrimps" })) && (cookArea.contains(myPlayer().getPosition()))) {
  22. return NCooker.State.COOK;
  23. }
  24. if ((!this.inventory.contains(new String[] { "Raw shrimps" })) && (!cookArea.contains(myPlayer().getPosition()))) {
  25. return NCooker.State.BANK;
  26. }
  27. if ((this.inventory.contains(new String[] { "Raw shrimps" })) && (!cookArea.contains(myPlayer().getPosition()))) {
  28. return NCooker.State.WALK2STOVE;
  29. }
  30. return NCooker.State.WALK2BANK;
  31. }
  32.  
  33.  
  34. @Override
  35. public int onLoop()
  36. throws InterruptedException
  37. {
  38. switch (getState())
  39. {
  40. case BANK:
  41. RS2Object bankBooth = (RS2Object)this.objects.closest(new String[] { "Bank booth" });
  42. if (bankBooth != null) {
  43. if (bankBooth.interact(new String[] { "Bank" }))
  44. {
  45. while (!this.bank.isOpen()) {
  46. sleep(250L);
  47. }
  48. this.bank.depositAll();
  49. if (this.bank.contains(new String[] { "Raw shrimps" })) {
  50. this.bank.withdraw("Raw shrimps", 27);
  51. } else {
  52. stop();
  53. }
  54. this.bank.close();
  55. }
  56. }
  57. break;
  58.  
  59. case COOK:
  60. if (!myPlayer().isAnimating())
  61. {
  62. if (this.inventory.contains(new String[] { "Raw shrimps" }))
  63. {
  64. getInventory().getItem("Raw shrimps").interact("Use");
  65. getObjects().closest("Clay Oven").interact("Use");
  66. sleep (500L);
  67. RS2Widget w = widgets.get(162,40);
  68. if (w != null)
  69. w.interact("Cook All");
  70. sleep (1000L);
  71.  
  72. break;
  73. }
  74. }
  75. break;
  76. case WALK2STOVE:
  77. this.localWalker.walk(this.cookArea, true);
  78. sleep(random(700, 900));
  79. break;
  80. case WALK2BANK:
  81. this.localWalker.walk(this.bankArea, true);
  82. sleep(random(700, 900));
  83. }
  84. return random(200, 300);
  85. }
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. @Override
  94. public void onStart() {
  95. log("Charlie's Nardah Cooker Started");
  96. log("If you experience any errors while using this scripts please talk to Charlie :)");
  97. log("Enjoy the Cooking Gains!");
  98. }
  99.  
  100. @Override
  101. public void onExit() {
  102. log("Thanks for using Nardah Cooker! Hope you made gains.");
  103. }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement