Guest User

Untitled

a guest
Jul 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.util.Map;
  4.  
  5. import org.rsbot.event.events.ServerMessageEvent;
  6. import org.rsbot.event.listeners.PaintListener;
  7. import org.rsbot.event.listeners.ServerMessageListener;
  8. import org.rsbot.script.Constants;
  9. import org.rsbot.script.Script;
  10. import org.rsbot.script.ScriptManifest;
  11. import org.rsbot.script.Skills;
  12. import org.rsbot.script.wrappers.RSObject;
  13.  
  14. //import com.sun.org.apache.xerces.internal.impl.xpath.XPath.LocationPath;// wtf?
  15.  
  16. @ScriptManifest(authors = { "PScriptMaker" }, category = "Mining", name = "Iron Power Miner", version = 1.05, description = "<html><body>Start near any iron rock. Will drop every thing but Pickaxes. Version 1.05. Made by PScriptMaker. " +
  17. "<select name='location'>" +
  18. "<option>Bank" +
  19. "<option>PowerMine</body></html>")
  20. public class IronMiner extends Script implements PaintListener, ServerMessageListener {
  21.  
  22. int ironOre = 440;
  23. int[] ironRock = { 2093, 2092, 9719, 9717, 9718, 11956,11955, 11954, 37307, 37308, 37309, 31072, 31073, 31071 };
  24. public boolean paint;
  25. public int miningAnimation = 626;
  26. public int energy = random(11, 70);
  27. int levelsGained = 0;
  28. public int startexp;
  29. int gem = 0;
  30. int exp = 0;
  31. int rocksMined = 0;
  32. int[] gemID = { 1617, 1619, 1621, 1623 };
  33. int[] pickaxe = { 1265, 1267, 1269, 1271, 1273, 1275, 1296, 13661 };
  34. public static final int MINING_STAT = Skills.getStatIndex("Mining");
  35. public long startTime = System.currentTimeMillis();
  36. int startLVL = skills.getCurrentSkillLevel(Constants.STAT_MINING);
  37. int nextLVL = skills.getXPToNextLevel(Constants.STAT_MINING);
  38. public String Location;
  39.  
  40. public double getVersion() {
  41. return 1.05;
  42. }
  43.  
  44.  
  45.  
  46. public int loop() {
  47.  
  48. if (Location.equals("PowerMine")) {
  49. if (isInventoryFull()) {
  50.  
  51. if(isInventoryFull()) {
  52.  
  53. dropAllExcept(pickaxe);
  54.  
  55. return 500;
  56.  
  57. }
  58.  
  59.  
  60. RSObject iron = getNearestObjectByID(ironRock);
  61.  
  62. if(iron == null) {
  63.  
  64. return 500;
  65.  
  66. }
  67.  
  68. if (getMyPlayer().getAnimation() == -1) {atObject(iron, "Mine");} wait(random(500, 700));
  69.  
  70. return 0;
  71. // TODO Loop
  72. }
  73.  
  74.  
  75. public void onFinish() {
  76. log("Thank You for using PScriptMaker's Iron Power Miner");
  77. log("Levels Gained: " + levelsGained);
  78. log("Rocks Mined: " + rocksMined);
  79. }
  80.  
  81. public boolean onStart(Map<String, String> args) {
  82. Location=args.get("location");
  83. return true;
  84. }
  85.  
  86. public void onRepaint(Graphics g) {
  87. if (isLoggedIn()) {
  88. int xpGained = 0;
  89. if ( startexp == 0) {
  90. startexp = skills.getCurrentSkillExp(STAT_MINING);}
  91. long millis = System.currentTimeMillis() - startTime;
  92. long hours = millis / (1000 * 60 * 60);
  93. millis -= hours * (1000 * 60 * 60);
  94. long minutes = millis / (1000 * 60);
  95. millis -= minutes * (1000 * 60);
  96. long seconds = millis / 1000;
  97. long minutes2 = minutes + (hours * 60);
  98. g.setColor(Color.green);
  99. g.drawString("PScriptMaker's Iron Power Miner" , 9, 315);
  100. g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + "", 9, 299);
  101. g.drawString("Rocks Mined: " + rocksMined, 9, 283);
  102. g.drawString("Levels Gained: " + levelsGained, 9, 267);
  103. g.drawString("Gems Found: " + gem, 9, 251);
  104. g.drawString("XP Gained: " + exp, 9, 235);
  105. }
  106. }
  107.  
  108.  
  109.  
  110. @Override
  111. public void serverMessageRecieved(ServerMessageEvent e) {
  112. final String serverString = e.getMessage();
  113. if (serverString.contains("You've just advanced")) {
  114. levelsGained++;
  115. }
  116. if (serverString.contains("You manage to mine")) {
  117. rocksMined++;
  118. exp = exp + 35;
  119. }
  120. if (serverString.contains("you just found")) {
  121. gem++;
  122. exp = exp + 65;
  123. // TODO Server Messages
  124.  
  125. }
  126.  
  127. }
  128.  
  129. }
Add Comment
Please, Sign In to add comment