Tezlaz

Buying

Aug 6th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. package scripts.tasks;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api.Timing;
  5. import org.tribot.api.input.Mouse;
  6. import org.tribot.api2007.GrandExchange;
  7. import org.tribot.api2007.Inventory;
  8.  
  9. import scripts.data.Conditions;
  10. import scripts.data.Vars;
  11. import scripts.tools.Bank;
  12. import scripts.tools.Interaction;
  13. import scripts.tools.Prices;
  14. import scripts.tools.Walk;
  15.  
  16. public class Buying {
  17.  
  18. public static boolean NeedToReplacePick() {
  19. if (Mining.CurrentPickaxe() == null || Vars.currentPickaxe == 0) {
  20. return true;
  21. }
  22. if ((Mining.CurrentPickaxe().getID() == Vars.TOOLS[0] || Mining.CurrentPickaxe().getID() == Vars.TOOLS[1])
  23. && Vars.MiningLevel >= Vars.REQ_STEEL_PICK) {
  24. return true;
  25. }
  26. if (Mining.CurrentPickaxe().getID() == Vars.TOOLS[2] && Vars.MiningLevel >= Vars.REQ_MITHRIL_PICK) {
  27. return true;
  28. }
  29. if (Mining.CurrentPickaxe().getID() == Vars.TOOLS[3] && Vars.MiningLevel >= Vars.REQ_ADDY_PICK) {
  30. return true;
  31. }
  32. if (Mining.CurrentPickaxe().getID() == Vars.TOOLS[4] && Vars.MiningLevel >= Vars.REQ_RUNE_PICK) {
  33. return true;
  34. }
  35.  
  36. else {
  37. Vars.currentPickaxe = Mining.CurrentPickaxe().getID();
  38. return false;
  39. }
  40. }
  41.  
  42. public static void UpgradeTools() {
  43.  
  44. // if (Mining.CurrentPickaxe())
  45. if (NeedToReplacePick()) {
  46.  
  47. System.out.println(Vars.accountName + " needs a new pick. Going to GE now...");
  48.  
  49. int pickID = 10;
  50. String pickString = "undefined";
  51.  
  52.  
  53. if (Vars.MiningLevel < 6) {
  54. pickID = Vars.TOOLS[1];
  55. pickString = "Iron pickaxe";
  56. }
  57.  
  58. if (Vars.MiningLevel > 6 && Vars.MiningLevel < 21) {
  59. pickID = Vars.TOOLS[2];
  60. pickString = "Steel pickaxe";
  61. }
  62.  
  63. if (Vars.MiningLevel > 21 && Vars.MiningLevel < 31) {
  64. pickID = Vars.TOOLS[3];
  65. pickString = "Mithril pickaxe";
  66. }
  67.  
  68. if (Vars.MiningLevel > 31 && Vars.MiningLevel < 41) {
  69. pickID = Vars.TOOLS[4];
  70. pickString = "Adamant pickaxe";
  71. }
  72.  
  73. if (Vars.MiningLevel > 41) {
  74. pickID = Vars.TOOLS[5];
  75. pickString = "Rune pickaxe";
  76. }
  77.  
  78. Walk.GrandExchange(120000);
  79. General.sleep(4000);
  80.  
  81. int price = (int) (Prices.getGEPrice(pickID) * 1.25);
  82.  
  83. if (Inventory.find(995).length < 1) {
  84. Bank.Withdraw(price, 2000, "Coins");
  85. }
  86.  
  87. // This opens ge interface and sleeps just in case.
  88. Interaction.WithNPC(2148, 20, "Exchange Grand Exchange Clerk", 10000);
  89. Timing.waitCondition(Conditions.isGEInterfaceOpen, 20000);
  90. General.sleep(2000, 3000);
  91.  
  92. // Buys a pickaxe
  93. GrandExchange.offer(pickString, price, 1, false);
  94. Timing.waitCondition(Conditions.GETransaction0, 120000);
  95. General.sleep(2000, 2500);
  96.  
  97. // Equips pickaxe
  98. Mouse.click(General.random(450, 456), General.random(68, 73), 1);
  99. Timing.waitCondition(Conditions.gotPickAxe, 3000);
  100. GrandExchange.close(true);
  101. General.sleep(2000, 2500);
  102. Inventory.find(pickID)[0].click("Wield");
  103. General.sleep(400, 700);
  104.  
  105. Bank.DepositExcept(2000, Vars.TOOLS);
  106. Vars.currentPickaxe = Mining.CurrentPickaxe().getID();
  107. System.out.println(Vars.accountName + " just bought a new pick");
  108. }
  109. }
  110.  
  111. }
Add Comment
Please, Sign In to add comment