Guest User

Untitled

a guest
Oct 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.97 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.Map;
  3. import org.rsbot.script.Script;
  4. import org.rsbot.script.ScriptManifest;
  5. import org.rsbot.event.listeners.PaintListener;
  6. import org.rsbot.script.wrappers.RSObject;
  7. import org.rsbot.script.wrappers.RSTile;
  8. import org.rsbot.script.wrappers.RSArea;
  9. import org.rsbot.script.wrappers.RSNPC;
  10. import org.rsbot.script.wrappers.RSWeb;
  11. import org.rsbot.script.web.*;
  12.  
  13. @ScriptManifest(authors = "NEXBot", name = "BananaOwner", version = 1.4, description = "Start by the deposit box in Port Sarim. Banks Bananas, and picks them.")
  14. public class BananaOwner extends Script implements PaintListener {
  15. long Time = System.currentTimeMillis();
  16. int officerID = 380;
  17. int[] TreesId = { 2073, 2074, 2075, 2076, 2077 };
  18. int Bannana = 1963;
  19. int TheDude = 378;
  20. int GangPlank = 2084;
  21. int GangPlankMofo = 2082;
  22. int Deposit = 36788;
  23. int BananasOwned = 0;
  24. int BananasOwned2 = 0;
  25. int Profit = 0;
  26. int Price = 81;
  27. String ActionString="NULL";
  28. RSTile randomplaces = new RSTile(2920, 3060, 0);
  29. RSTile bann2 = new RSTile(3048, 3236, 0);
  30. RSTile TheBox = new RSTile(3048, 3236, 0);
  31. RSTile DudeKaramj = new RSTile(2954, 3147, 0);
  32. RSTile DudeToKaramj = new RSTile(2954, 3147, 0);
  33. RSTile DropOff = new RSTile(3046, 3236, 0);
  34. RSTile TheKaramjThing = new RSTile(2925, 3157, 0);
  35. RSTile SeaMan = new RSTile(3028, 3218, 0);
  36. RSTile TheNext = new RSTile(3027, 3215, 0);
  37. RSTile TheNexter = new RSTile(3038, 3231, 0);
  38. RSTile Retrace = new RSTile(2920, 3163, 0);
  39. public boolean onStart(){
  40. ActionString = "Starting...";
  41. log("Hello Nelson.");
  42. return true;
  43. }
  44. //private/publics:
  45. private void PickBan() {
  46. RSObject ban = objects.getNearest(TreesId);
  47. if (ban.isOnScreen()) {
  48. BananasOwned2 = inventory.getCount(Bannana);
  49. ActionString = "Picking bananas";
  50. ban.doAction("Pic");
  51. sleep(300);
  52. }
  53. if (ActionString.equals("Looking for bananas")) {
  54. RSObject bann = objects.getNearest(TreesId);
  55. camera.turnTo(bann);
  56. }
  57. if (!ban.isOnScreen()) {
  58. ActionString = "Looking for bananas";
  59. }
  60. }
  61. private void CameraTurn() {
  62. ActionString = "Turning camera";
  63. RSNPC Thresnorr = npcs.getNearest(TheDude);
  64. camera.turnTo(Thresnorr);
  65. }
  66. private void CameraTurn2() {
  67. ActionString = "Turning camera";
  68. RSNPC ZE = npcs.getNearest(officerID);
  69. camera.turnTo(ZE);
  70. }
  71. private boolean KarmDudePlaceAREA(){
  72. RSArea area = new RSArea(new RSTile(2917, 3142), new RSTile(2958, 3155));
  73. return area.contains(getMyPlayer().getLocation());
  74. }
  75. private boolean KarmDudePlaceAccuAREA(){
  76. RSArea area = new RSArea(new RSTile(2949, 3146), new RSTile(2959, 3151));
  77. return area.contains(getMyPlayer().getLocation());
  78. }
  79. private boolean ShipAREA(){
  80. RSArea area = new RSArea(new RSTile(3032, 3212, 1), new RSTile(3036, 3224, 1));
  81. return area.contains(getMyPlayer().getLocation());
  82. }
  83. private boolean SeaGuyArea(){
  84. RSArea area = new RSArea(new RSTile(3026, 3212), new RSTile(3029, 3225));
  85. return area.contains(getMyPlayer().getLocation());
  86. }
  87. private boolean Dock(){
  88. RSArea area = new RSArea(new RSTile(3026, 3217), new RSTile(3044, 3236));
  89. return area.contains(getMyPlayer().getLocation());
  90. }
  91. private boolean DepositBox(){
  92. RSArea area = new RSArea(new RSTile(3043, 3234), new RSTile(3051, 3237));
  93. return area.contains(getMyPlayer().getLocation());
  94. }
  95. private boolean TREESAREA(){
  96. RSArea area = new RSArea(new RSTile(2891, 3144), new RSTile(2936, 3175));
  97. return area.contains(getMyPlayer().getLocation());
  98. }
  99. private boolean BANKAREA() {
  100. RSArea area = new RSArea(new RSTile(3154,3479), new RSTile (3176,3497));
  101. return area.contains(getMyPlayer().getLocation());
  102. }
  103.  
  104. //on finish
  105. public void onFinish(){
  106. ActionString = "Bye!";
  107. log("Goodbye.");
  108. }
  109. @Override
  110. public int loop() {
  111. mouse.setSpeed(5);
  112. if (Dock() && inventory.isFull()){
  113. ActionString = "Going to bank yo";
  114. RSWeb ToDeposit = web.getWeb(getMyPlayer().getLocation(), TheBox);
  115. ToDeposit.step();
  116. }
  117. if (SeaGuyArea() && !inventory.isFull()){
  118. sleep(3000);
  119. CameraTurn();
  120. RSNPC Thresnor = npcs.getNearest(TheDude);
  121. if (Thresnor.isOnScreen()) {
  122. ActionString = "Paying a fare to Karamja";
  123. Thresnor.interact("pay-fare");
  124. ActionString = "Making sure you paid";
  125. Thresnor.interact("pay-fare");
  126. Profit = BananasOwned * Price - 30;
  127. ActionString = "Looking for a gangplank";
  128. sleep(random(10000,15000));
  129. }
  130. else if (!Thresnor.isOnScreen()) {
  131. ActionString = "Dude, I can't find Thresnor, waiting..";
  132. sleep(4000);
  133. }
  134. }
  135. if (Dock() && !inventory.isFull()){
  136. ActionString = "Walking to the sea dude";
  137. RSWeb ToSeaGuy = web.getWeb(getMyPlayer().getLocation(), SeaMan);
  138. ToSeaGuy.step();
  139. }
  140. if (TREESAREA() && inventory.isFull()) {
  141. BananasOwned = BananasOwned + BananasOwned2;
  142. BananasOwned2 = 0;
  143. ActionString = "Walking to sea dude";
  144. RSWeb ToDude1 = web.getWeb(getMyPlayer().getLocation(), DudeKaramj);
  145. ToDude1.step();
  146. }
  147. if (KarmDudePlaceAREA() && !inventory.isFull()){
  148. ActionString = "To the trees";
  149. RSWeb ToTheTrees = web.getWeb(getMyPlayer().getLocation(), TheKaramjThing);
  150. ToTheTrees.step();
  151. sleep(4000);
  152. }
  153. if (KarmDudePlaceAREA() && inventory.isFull()){
  154. ActionString = "Going to the dude";
  155. RSWeb ToDude5 = web.getWeb(getMyPlayer().getLocation(), DudeKaramj);
  156. ToDude5.step();
  157. }
  158. if (KarmDudePlaceAccuAREA() && inventory.isFull()){
  159. sleep(random(2000,3000));
  160. ActionString = "Turning camera";
  161. CameraTurn2();
  162. RSNPC TheDudtre = npcs.getNearest(officerID);
  163. if (TheDudtre.isOnScreen()) {
  164. ActionString = "Paying";
  165. TheDudtre.doAction("pay-fare");
  166. ActionString = "Making sure you paid";
  167. TheDudtre.doAction("pay-fare");
  168. ActionString = "Looking for a gangplank";
  169. sleep(random(10000,15000));
  170. }
  171. else if (!TheDudtre.isOnScreen()) {
  172. ActionString = "Looking for the officer..";
  173. sleep(2000);
  174. }
  175. else {
  176. ActionString = "Re-routing";
  177. CameraTurn2();
  178. RSWeb ToNext22 = web.getWeb(getMyPlayer().getLocation(), TheNexter);
  179. ToNext22.step();
  180. CameraTurn2();
  181. if (TheDudtre.isOnScreen()) {
  182. ActionString = "Paying";
  183. TheDudtre.doAction("pay-fare");
  184. ActionString = "Making sure you paid";
  185. TheDudtre.doAction("pay-fare");
  186. Profit = BananasOwned * Price - 30;
  187. ActionString = "Looking for a gangplank";
  188. sleep(random(10000,15000));
  189. }
  190. }
  191. }
  192. if (DepositBox() && inventory.isFull()){
  193. sleep(random(4000,5000));
  194. RSObject Box = objects.getNearest(Deposit);
  195. ActionString = "Depositing";
  196. Box.interact("deposit");
  197. sleep(random(2000,3000));
  198. bank.deposit(Bannana, 27);
  199. sleep(1000);
  200. //sleep(random(1000, 2000));
  201. //ActionString = "Closing bank";
  202. //bank.close();
  203. //sleep(random(1000,2000));
  204. ActionString = "Going to the dude";
  205. RSWeb ToNext = web.getWeb(getMyPlayer().getLocation(), TheNext);
  206. ToNext.step();
  207. }
  208. if (DepositBox() && !inventory.isFull()){
  209. ActionString = "Going to the dude";
  210. RSWeb ToNext = web.getWeb(getMyPlayer().getLocation(), TheNext);
  211. ToNext.step();
  212. }
  213. if (TREESAREA() && !inventory.isFull()) {
  214. ActionString = "Picking bananas";
  215. RSWeb ToTheRandoms = web.getWeb(getMyPlayer().getLocation(), randomplaces);
  216. RSWeb Retracer = web.getWeb(getMyPlayer().getLocation(), Retrace);
  217. PickBan();
  218. if (ActionString.equals("Looking for bananas")) {
  219. if (Retracer != null && !Retracer.finished()) {
  220. if (!getMyPlayer().isMoving()
  221. || calc.distanceTo(walking.getDestination()) < 4) {
  222. try {
  223. Retracer.step();
  224. sleep(7000);
  225. } catch (Exception ignored) {
  226. }
  227. }
  228. }
  229. }
  230. }
  231. else {
  232. try {
  233. RSObject Gangplank8 = objects.getNearest(GangPlankMofo);
  234. if (Gangplank8.isOnScreen()) {
  235. Gangplank8.interact("cross");
  236. sleep(random(2000,3000));
  237. }
  238. } catch (Exception ignored) {
  239. }
  240. try {
  241. RSObject Gangplank9 = objects.getNearest(GangPlank);
  242. if (Gangplank9.isOnScreen()) {
  243. Gangplank9.interact("cross");
  244. sleep(random(2000,3000));
  245. }
  246. } catch (Exception ignored) {
  247. }
  248. }
  249. return (random(50, 200));
  250. }
  251. //START: Code generated using Enfilade's Easel
  252. private final Color color1 = new Color(255, 255, 255);
  253. private final Color color2 = new Color(0, 0, 0);
  254. private final Color color3 = new Color(230, 227, 179);
  255. private final Color color4 = new Color(224, 8, 0);
  256. private final Color color5 = new Color(51, 51, 255);
  257. private final Color color6 = new Color(1, 1, 1);
  258.  
  259. private final BasicStroke stroke1 = new BasicStroke(1);
  260.  
  261. private final Font font1 = new Font("Arial", 0, 15);
  262.  
  263. public void onRepaint(Graphics g1) {
  264. if (game.isLoggedIn()) {
  265. long Mill = System.currentTimeMillis() - Time;
  266. long Hrs = Mill / (1000 * 60 * 60);
  267. Mill -= Hrs * (1000 * 60 * 60);
  268. long Min = Mill / (1000 * 60);
  269. Mill -= Min * (1000 * 60);
  270. long Sec = Mill / 1000;
  271. Graphics2D g = (Graphics2D)g1;
  272. g.setColor(color1);
  273. g.fillRect(10, 458, 139, 15);
  274. g.setColor(color2);
  275. g.setStroke(stroke1);
  276. g.drawRect(10, 458, 139, 15);
  277. g.setColor(color3);
  278. g.fillRect(9, 346, 489, 108);
  279. g.setColor(color2);
  280. g.drawLine(500, 458, 515, 471);
  281. g.setColor(color4);
  282. g.fillRect(152, 459, 346, 14);
  283. g.setColor(color2);
  284. g.drawRect(152, 459, 346, 14);
  285. g.setFont(font1);
  286. g.setColor(color5);
  287. g.drawString("NEXBots Banana Owner V1.4", 305, 453);
  288. g.drawString("Current action:", 306, 410);
  289. g.setColor(color6);
  290. g.drawString("Run time:", 14, 364);
  291. g.drawString(Hrs+":"+Min+":"+Sec, 83, 365);
  292. g.setColor(color4);
  293. g.drawString(ActionString, 307, 426);
  294. g.setColor(color5);
  295. g.drawString("Bananas Owned since first full inventory: " + BananasOwned, 13, 389);
  296. g.drawString("Profit: " + Profit, 13, 420);
  297. }
  298. }
  299. }
Add Comment
Please, Sign In to add comment