Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. import impsoft.bots.ColorBot;
  2. import impsoft.scripting.ibot.builtin.itemrec.InventoryReflectionItemSlot;
  3. import impsoft.scripting.ibot.builtin.itemrec.ItemSlot;
  4. import impsoft.scripting.ibot.enums.Skill;
  5. import impsoft.scripting.ibot.interfaces.AutoPaint;
  6. import impsoft.scripting.ibot.interfaces.ChatListener;
  7. import impsoft.scripting.types.ColorScript;
  8. import impsoft.utils.general.Timer;
  9.  
  10. import java.awt.Color;
  11. import java.awt.Graphics;
  12. import java.text.NumberFormat;
  13.  
  14. import bergCoder.BergUtils;
  15. import bergCoder.Object3D;
  16.  
  17. public class OmnisBetaIronlearner extends ColorScript implements AutoPaint,ChatListener{
  18.  
  19. public OmnisBetaIronlearner(ColorBot arg0) {
  20. super(arg0);
  21. // TODO Auto-generated constructor stub
  22. }
  23. //*********************//
  24. /** Script Information */
  25. //********************//
  26. public static String name = "OmnisPowerIron";
  27. public static double version = 1.2;
  28. public static String author = "Omni";
  29. public static String description = "Powermines Iron" + version + ".";
  30. //******//
  31. //*Id's*//
  32. //******//
  33. public final static int[] IRON = {2092, 2093, 5773, 5774, 5775, 9717, 9718, 9719, 11557, 11954, 11955, 11956, 14913, 14914, 31071, 31072, 31073, 37307, 37308, 37309};
  34. public final static int[] IRON_DEAD = {33402};
  35. public int ironanim = 624;
  36. BergUtils util = new BergUtils(this);
  37.  
  38. String status = "";
  39. //***********//
  40. //Paint stuff//
  41. //***********//
  42. long scriptStartTIME = System.currentTimeMillis();
  43. public Timer Timer = new Timer(0);
  44. private int OresMined = 0;
  45. private int currentLvl = 0;
  46. private int startlvl = 0;
  47. private int currentxp = 0;
  48. private int startxp = 0;
  49. private int currentlvl = 0;
  50.  
  51. public void script() throws InterruptedException, Exception {
  52. if (theLoggedInTest.isLoggedIn()) {
  53. int currentxp = theTabs.Statistics.getStatExperience(Skill.MINING);
  54. startxp = currentxp;
  55. currentlvl = theTabs.Statistics.getStatBottom(Skill.MINING);
  56. log("Omni's Iron Powerminer Begun");
  57. log("Please post any bug reports on the forums.");
  58. while(hasPickaxe()){
  59. mine();
  60. sleep(10, 20); //Avoiding any stack overloading
  61. }
  62. shutDown();
  63. }
  64. }
  65.  
  66. public void mine() throws InterruptedException {
  67. status = "Mining";
  68. util.clickInteractiveObject(IRON, null, null, "ine rock",
  69. new Object3D(30,-48,36,-30,-47,50, false));
  70. util.waitForNoAnimation();
  71. if(theTabs.Inventory.isFull()) {
  72. int secondsTotal = (int) (Timer.getTimeElapsed()/1000);
  73. int seconds = secondsTotal%60;
  74. int minutes = (secondsTotal-seconds)/60;
  75. log("It took "+minutes+"mins "+seconds+"seconds to mine you a full inventory of Iron ore");
  76. int OresMined = theTabs.Inventory.count("Iron ore");
  77. drop(); }
  78.  
  79. }
  80. public void drop() throws InterruptedException
  81. {
  82. if(!theTabs.Inventory.isSelected())
  83. {
  84. theTabs.Inventory.setSelected();
  85. }
  86.  
  87. for(InventoryReflectionItemSlot s : theTabs.Inventory.SLOTS)
  88. {
  89. ItemSlot is = theTabs.Inventory.findItemSlot("ron ore");
  90. if(s.getItemName().equals("Iron ore"))
  91. {
  92. is.mouseClickRightOn();
  93. while(!theMenuFinder.isMenuUp())
  94. {
  95. sleep(10,20);
  96. }
  97. if(theMenuFinder.isMenuUp())
  98. {
  99. theMenuFinder.doMenu("drop");
  100. sleep(50,100);
  101. }
  102. }
  103. }
  104. log("Dropping Complete");
  105. }
  106.  
  107. public boolean hasPickaxe() throws InterruptedException {
  108. return theTabs.Inventory.count("ickaxe") > 0 || theTabs.Equipment.isWearing("ickaxe");
  109. }
  110.  
  111. public void paint(Graphics g) {
  112. long runTime = 0;
  113. long seconds = 0;
  114. long minutes = 0;
  115. long hours = 0;
  116. final NumberFormat nf = NumberFormat.getInstance();
  117. nf.setMinimumIntegerDigits(2);
  118. runTime = System.currentTimeMillis() - scriptStartTIME;
  119. seconds = runTime / 1000;
  120. if (seconds >= 60) {
  121. minutes = seconds / 60;
  122. seconds -= (minutes * 60);
  123. }
  124. if (minutes >= 60) {
  125. hours = minutes / 60;
  126. minutes -= (hours * 60);
  127. double averageCount = ((double) OresMined) * 3600 / (double) scriptStartTIME;
  128. double averageXP = ((double) (currentxp-startxp)) * 3600 / (double) scriptStartTIME;
  129. }
  130. g.setColor(Color.RED);
  131. g.drawString("Omnis Power Iron v " + version, 30, 14);
  132. g.drawString("Status: " + status, 30, 34);
  133. g.drawString("Run Time: " + hours + ":" + nf.format(minutes) + ":"
  134. + nf.format(seconds), 30, 54);
  135. g.drawString("Iron ores Mined:" + OresMined, 30, 74);
  136. g.drawString("Current level:" + currentLvl, 30, 94);
  137. g.drawString("Level: "+startlvl+"/"+currentlvl, 30, 114);
  138. g.drawString("Ore/hr "+nf.format(OresMined), 20, 100);
  139. g.drawString("XP "+(currentxp-startxp), 30, 115);
  140. g.drawString("XP/hr "+nf.format(currentxp), 30, 130);
  141. if (util.target != null && util.targetTimer.isNotUp()) {
  142. g.drawPolygon(util.target);
  143. }
  144. if (util.targetPoint != null && util.targetTimer.isNotUp()) {
  145. g.drawString("Mine This Bitch!", util.targetPoint.x,
  146. util.targetPoint.y);
  147. }
  148. }
  149.  
  150. public void chat(String arg0) throws InterruptedException {
  151. // TODO Auto-generated method stub
  152.  
  153. }
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement