Guest User

Untitled

a guest
Jul 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.util.Map;
  5.  
  6. import org.rsbot.script.Script;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.Constants;
  9. import org.rsbot.event.listeners.PaintListener;
  10. import org.rsbot.script.wrappers.RSObject;
  11.  
  12. @ScriptManifest(authors = "Spyropt" , category = "Mining", name = "PowerCopper", version = 1.0, description = "Start On Varrock Eastern Mine with Pickaxe on Inventory." + "This will mine copper and drop it.")
  13. public class PowerCopper extends Script implements PaintListener {
  14.  
  15. ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  16. String name = properties.name(); // Gets the name of the script
  17. double version = properties.version(); // Gets the version of the script.
  18.  
  19.  
  20.  
  21. //Stuff for script
  22. public long startTime = System.currentTimeMillis();
  23. private String status = "";
  24. public int startexp;
  25. public int[] AllPickaxes = { 1275, 1271, 1273, 1269, 1267, 1265, 15269 };
  26. public int[] IronRocksID = new int[] {11960, 11962, 11961};
  27.  
  28. @Override
  29. public boolean onStart(Map<String, String> args) {
  30. log(name + " has started!");
  31. status = "Initializing";
  32. startTime = System.currentTimeMillis();
  33. return true;
  34. }
  35. @Override
  36. public void onFinish() {
  37. log(name + " has finished!");
  38. }
  39. public boolean needToDrop() {
  40. status = "Dropping";
  41. return isInventoryFull();
  42. }
  43. public boolean atRocks() {
  44. RSObject rockObject = getNearestObjectByID(IronRocksID);
  45. if (rockObject == null) {
  46. return false;
  47. }
  48. return tileOnScreen(rockObject.getLocation());
  49. }
  50. public void onRepaint(Graphics g) {
  51. if (isLoggedIn()) {
  52. int xpGained = 0;
  53. if ( startexp == 0) {
  54. startexp = skills.getCurrentSkillExp(Constants.STAT_MINING);
  55. }
  56. // ty to speedwing
  57. xpGained = skills.getCurrentSkillExp(Constants.STAT_MINING) - startexp;
  58. // ty to speedwing
  59. long millis = System.currentTimeMillis() - startTime;
  60. long hours = millis / (1000 * 60 * 60);
  61. millis -= hours * (1000 * 60 * 60);
  62. long minutes = millis / (1000 * 60);
  63. millis -= minutes * (1000 * 60);
  64. long seconds = millis / 1000;
  65. long minutes2 = minutes + (hours * 60);
  66. g.setColor(Color.red);
  67. g.setFont(new Font("Cooper Black", Font.BOLD, 12));
  68. g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + "." , 9, 315);
  69. g.drawString("Status: " + status, 9, 299);
  70. g.drawString("XP Gained: " + xpGained, 9, 327);
  71. }
  72. }
  73. @Override
  74. public int loop() {
  75. if (getMyPlayer().isMoving()) {
  76. return random(400, 900);
  77. }
  78. if (getMyPlayer().getAnimation() != -1) {
  79. return random(400, 900);
  80. }
  81. if (needToDrop()) {
  82. dropAllExcept(AllPickaxes);
  83. return random(400, 900);
  84. }
  85. RSObject rockObject = getNearestObjectByID(IronRocksID);
  86.  
  87.  
  88. if (atRocks()) {
  89. if (getMyPlayer().getAnimation() == -1) {
  90. atObject(rockObject, "Mine");
  91. status = "Mining";
  92.  
  93. }
  94. } else {
  95. walkTileMM(rockObject.getLocation(), 2, 2);
  96. } return random(400, 600);
  97. }
  98. }
Add Comment
Please, Sign In to add comment