Tezlaz

bank

Aug 6th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. package scripts.tools;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api.Timing;
  5. import org.tribot.api2007.Banking;
  6. import org.tribot.api2007.Interfaces;
  7. import org.tribot.api2007.Inventory;
  8.  
  9. import scripts.data.Conditions;
  10.  
  11. public class Bank {
  12.  
  13. public static boolean IsInterfaceUp() {
  14. if (Interfaces.get(12) != null) {
  15. return true;
  16. } else {
  17. return false;
  18. }
  19. }
  20.  
  21. public static boolean HasCoins() {
  22. if (Inventory.find("Coins").length > 1) {
  23. return true;
  24. } else {
  25. return false;
  26. }
  27. }
  28.  
  29. // Opens bank, banks and closes. Used for ids
  30. public static void DepositExcept(int timeToWait, String... itemNames) {
  31. long t = Timer.Tic();
  32. while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
  33. Banking.openBank();
  34. if (timeToWait < 1) {
  35. break;
  36. }
  37. }
  38. General.sleep(450, 600);
  39. Banking.depositAllExcept(itemNames);
  40. General.sleep(450, 600);
  41. Banking.close();
  42. Timing.waitCondition(Conditions.bankClosed, 1000);
  43. }
  44.  
  45. // Opens bank, banks and closes. Used for strings
  46. public static void DepositExcept(int timeToWait, int... itemIDs) {
  47. long t = Timer.Tic();
  48. while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
  49. Banking.openBank();
  50. if (timeToWait < 1) {
  51. break;
  52. }
  53. }
  54. General.sleep(450, 600);
  55. Banking.depositAllExcept(itemIDs);
  56. General.sleep(450, 600);
  57. Banking.close();
  58. Timing.waitCondition(Conditions.bankClosed, 1000);
  59. }
  60.  
  61. // Opens bank, withdraws and closes. Used for strings
  62. public static void Withdraw(int amount, int timeToWait, String... itemNames) {
  63. long t = Timer.Tic();
  64. while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
  65. Banking.openBank();
  66. if (timeToWait < 1) {
  67. break;
  68. }
  69. }
  70. General.sleep(450, 600);
  71. Banking.withdraw(amount, itemNames);
  72. General.sleep(1450, 1600);
  73. Banking.close();
  74. Timing.waitCondition(Conditions.bankClosed, 1000);
  75. }
  76.  
  77. // Opens bank, withdraws and closes. Used for ids
  78. public static void Withdraw(int amount, int timeToWait, int... itemIDs) {
  79. long t = Timer.Tic();
  80. while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
  81. Banking.openBank();
  82. if (timeToWait < 1) {
  83. break;
  84. }
  85. }
  86. General.sleep(450, 600);
  87. for (int b = 0; b < itemIDs.length; b++) {
  88. Banking.withdraw(amount, itemIDs[b]);
  89. }
  90. General.sleep(1450, 1600);
  91. Banking.close();
  92. Timing.waitCondition(Conditions.bankClosed, 1000);
  93. }
  94.  
  95. }
Add Comment
Please, Sign In to add comment