Advertisement
Guest User

Variables

a guest
Oct 4th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.62 KB | None | 0 0
  1. package scripts.Liam;
  2.  
  3. import org.tribot.api.DynamicClicking;
  4. import org.tribot.api.General;
  5. import org.tribot.api.Timing;
  6. import org.tribot.api.input.Mouse;
  7. import org.tribot.api.types.generic.Condition;
  8. import org.tribot.api.util.ABCUtil;
  9. import org.tribot.api2007.Banking;
  10. import org.tribot.api2007.Camera;
  11. import org.tribot.api2007.Inventory;
  12. import org.tribot.api2007.Objects;
  13. import org.tribot.api2007.Player;
  14. import org.tribot.api2007.Players;
  15. import org.tribot.api2007.Trading;
  16. import org.tribot.api2007.WebWalking;
  17. import org.tribot.api2007.Skills.SKILLS;
  18. import org.tribot.api2007.WorldHopper;
  19. import org.tribot.api2007.ext.Filters;
  20. import org.tribot.api2007.types.RSArea;
  21. import org.tribot.api2007.types.RSItem;
  22. import org.tribot.api2007.types.RSObject;
  23. import org.tribot.api2007.types.RSPlayer;
  24. import org.tribot.api2007.types.RSTile;
  25.  
  26. public class Variables {
  27. public static boolean RunScript = true;
  28. public static int RockIDs[] = {14864,14883,14863};
  29. public static int CoalRockIDs[] = {14861,14860};
  30. static RSTile coal1 = new RSTile(3149,3151,0);
  31. static RSTile coal2 = new RSTile(3147,3148,0);
  32. static RSTile CoalCorner1 = new RSTile(3143,3144,0);
  33. static RSTile CoalCorner2 = new RSTile(3150,3154,0);
  34. static RSTile TinCorner1 = new RSTile(3223,3145,0);
  35. static RSTile TinCorner2 = new RSTile(3230,3150,0);
  36. static RSArea TinMine = new RSArea(TinCorner1,TinCorner2);
  37. static RSArea WholeMine = new RSArea(CoalCorner1,CoalCorner2);
  38. static RSArea CoalMine = new RSArea(coal1,coal2);
  39. public static int OresMined = 0;
  40. public static boolean GUI_COMPLETE = false;
  41. public static String MuleName = "";
  42. public static int MuleWorld;
  43. public static boolean NeedTrade = false;
  44. public static int PickIDs[] = {1265,1267,1267,1273,1271,1275};
  45. public static final int BotWorld = WorldHopper.getWorld();
  46. static ABCUtil abc = new ABCUtil();
  47.  
  48. public static void StartBank(){
  49. if(!Banking.isInBank()){
  50. WebWalking.walkToBank();
  51. }
  52. General.sleep(200,2000);
  53. Banking.openBank();
  54. General.sleep(500,1000);
  55. if(Inventory.getAll().length > 0){
  56. Banking.depositAll();
  57. }
  58. General.sleep(1000,3000);
  59. RSItem[] pick = Banking.find(PickIDs);
  60. if(pick.length > 0){
  61. Banking.withdrawItem(pick[0], 1);
  62. }else
  63. {
  64. General.println("Could not find pickaxe....");
  65. }
  66. General.sleep(200,500);
  67. Banking.close();
  68. General.sleep(2000,4000);
  69. }
  70.  
  71. public static void WalkToRocks(){
  72. WebWalking.walkTo(TinMine.getRandomTile());
  73. General.sleep(100,500);
  74. }
  75.  
  76. public static boolean IsAtRocks(){
  77. return TinMine.contains(Player.getPosition());
  78. }
  79.  
  80. public static boolean randomPercent(int min, int max){
  81. return General.random(1, 100) <= General.random(min, max);
  82. }
  83.  
  84. public static boolean isMining(){
  85. return true;
  86. }
  87.  
  88. public static boolean MineTin(){
  89. if(abc.TIME_TRACKER.ROTATE_CAMERA.next() > System.currentTimeMillis()){
  90. abc.performRotateCamera();
  91. abc.TIME_TRACKER.ROTATE_CAMERA.reset();
  92. }
  93. abc.performTimedActions(SKILLS.MINING);
  94. if(!Player.isMoving() && Player.getAnimation() == -1 && !Inventory.isFull()){
  95. final RSObject rocks[]= Objects.findNearest(15, RockIDs);
  96. if(rocks.length > 0){
  97. RSObject rock = rocks[randomPercent(40,90) ? 0:General.random(0, rocks.length - 1)];
  98. if(rock != null){
  99. if(rock.isOnScreen()){
  100. if(DynamicClicking.clickRSObject(rock,"Mine")){
  101. Timing.waitCondition(new Condition()
  102. {
  103. @Override
  104. public boolean active()
  105. {
  106. General.sleep(100);
  107. abc.performTimedActions(SKILLS.MINING);
  108. return Player.getAnimation() != -1;
  109. }
  110. }, General.random(4000, 6000));
  111. }
  112. }else {
  113. Camera.turnToTile(rock);
  114. }
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120.  
  121. public static void DropTin(){
  122. Inventory.dropAllExcept(PickIDs);
  123. }
  124.  
  125. public static void WalkToCoalMine(){
  126. WebWalking.walkTo(CoalMine.getRandomTile());
  127. }
  128.  
  129. public static boolean MineCoal(){
  130. if(abc.TIME_TRACKER.ROTATE_CAMERA.next() > System.currentTimeMillis()){
  131. abc.performRotateCamera();
  132. abc.TIME_TRACKER.ROTATE_CAMERA.reset();
  133. }
  134. abc.performTimedActions(SKILLS.MINING);
  135. if(Player.getAnimation() == -1 && !Inventory.isFull()){
  136. final RSObject rocks[]= Objects.findNearest(15, CoalRockIDs);
  137. if(rocks.length != 0){
  138. RSObject rock = rocks[randomPercent(40,90) ? 0:General.random(0, rocks.length - 1)];
  139. if(rock != null){
  140. if(rock.isOnScreen()){
  141. if(DynamicClicking.clickRSObject(rock,"Mine")){
  142. Timing.waitCondition(new Condition()
  143. {
  144. @Override
  145. public boolean active()
  146. {
  147. General.sleep(100);
  148. abc.performTimedActions(SKILLS.MINING);
  149. return Player.getAnimation() != -1;
  150. }
  151. }, General.random(4000, 6000));
  152. }
  153. }
  154. }
  155. }
  156. }
  157. return false;
  158. }
  159.  
  160. public static boolean AtCoalMine(){
  161. return WholeMine.contains(Player.getPosition());
  162. }
  163.  
  164. public static void WalkToBank(){
  165. WebWalking.walkToBank();
  166. Timing.waitCondition(new Condition()
  167. {
  168. @Override
  169. public boolean active()
  170. {
  171. General.sleep(100);
  172. return !Player.isMoving();
  173. }
  174. }, General.random(10000, 20000));
  175. }
  176.  
  177. public static void BankCoal(){
  178. if(Banking.isInBank()){
  179. if(!Banking.isBankScreenOpen()){
  180. Banking.openBank();
  181. }
  182. General.sleep(1000,3000);
  183. Banking.depositAllExcept(PickIDs);
  184. if(Inventory.find("Adamant pickaxe").length == 0){
  185. Banking.deposit(1, "Bronze pickaxe");
  186. General.sleep(200,500);
  187. RSItem[] AddyPick = Banking.find("Adamant pickaxe");
  188. if(AddyPick.length > 0){
  189. Banking.withdraw(1,"Adamant pickaxe");
  190. General.sleep(200,500);
  191. }else{
  192. General.println("Could find find addy pick!");
  193. }
  194. }
  195. General.sleep(1000,2000);
  196. if(Banking.find("Coal")[0].getStack() >= 2000){
  197. NeedTrade = true;
  198. }
  199. General.sleep(100,500);
  200. if(!NeedTrade){
  201. Banking.close();
  202. }
  203. }
  204. }
  205.  
  206. public static void WithdrawCoal(){
  207. General.sleep(1500,2500);
  208. RSItem[] coal = Banking.find("Coal");
  209. if(coal[0] != null){
  210. Mouse.clickBox(292, 316, 362, 325,1);
  211. General.sleep(200,900);
  212. Banking.withdraw(0,"Coal");
  213. General.sleep(1000,3000);
  214. Banking.close();
  215. }
  216. }
  217.  
  218. static RSPlayer getMuleRSPlayer(String muleName) {
  219. RSPlayer[] players = Players.find(Filters.Players.nameEquals(muleName));
  220. if (players.length > 0) return players[0];
  221. return null;
  222. }
  223.  
  224. public static void TradeMule(){
  225. WorldSwitcher.scrollToWorld(MuleWorld);
  226. General.sleep(1000,1500);
  227. while(WorldHopper.getWorld() != MuleWorld){
  228. WorldSwitcher.switchWorld(MuleWorld);
  229. }
  230. General.sleep(6000,9000);
  231. getMuleRSPlayer(MuleName).click("Trade");
  232. Timing.waitCondition(new Condition()
  233. {
  234. @Override
  235. public boolean active()
  236. {
  237. General.sleep(100);
  238. return Trading.getWindowState() == Trading.WINDOW_STATE.FIRST_WINDOW;
  239. }
  240. }, General.random(10000, 20000));
  241. if(Trading.offer(0, "Coal")){
  242. Trading.accept();
  243. General.sleep(1000,2000);
  244. if(Trading.getWindowState() == Trading.WINDOW_STATE.SECOND_WINDOW){
  245. Trading.accept();
  246. NeedTrade = false;
  247. General.sleep(2000,4000);
  248. WorldSwitcher.scrollToWorld(BotWorld);
  249. General.sleep(1000,2000);
  250. if(WorldHopper.getWorld() != BotWorld){
  251. WorldSwitcher.switchWorld(BotWorld);
  252. }
  253. }
  254. }
  255. }
  256. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement