Guest User

Untitled

a guest
Jun 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. package com.scripts;
  2.  
  3.  
  4. import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
  5. import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
  6. import com.kbot2.scriptable.Script;
  7. import com.kbot2.scriptable.methods.Calculations;
  8. import com.kbot2.scriptable.methods.data.Skills;
  9. import com.kbot2.scriptable.methods.wrappers.Obj;
  10.  
  11. import java.awt.*;
  12.  
  13.  
  14. /**
  15. * Created by IntelliJ IDEA.
  16. * User: Koh-Koh
  17. * Date: 08/06/2009
  18. * Time: 11:37:54 AM
  19. * To change this template use File | Settings | File Templates.
  20. */
  21. public class KohtaGraniteMiner extends Script implements PaintListener, ServerMessageListener {
  22.  
  23.  
  24. int NUMMINED = 0;
  25. int MN_SXP = 0;
  26. long startTime = System.currentTimeMillis();
  27.  
  28. public int loop() {
  29. if (getMyPlayer().getAnimation() != -1) return 100;
  30. if (!inventory.contains(1823, 1825, 1827, 1829, 1831))
  31. stopAllScripts();
  32. {
  33. if (inventory.getCount() == 28) {
  34. inventory.dropAllExcept(1823, 1825, 1827, 1829, 1831);
  35. }
  36. Obj rock = objects.getClosestObject(15, 10947);
  37. if (rock != null) {
  38. if (Calculations.onScreen(rock.getScreenPos())) {
  39. rock.doAction("mine");
  40. } else
  41. walking.walkToMM(rock.getLocation());
  42. }
  43. }
  44. return random(1000, 1500);
  45. }
  46.  
  47. public boolean onStart() {
  48. MN_SXP = skills.getExperience(Skills.SKILL_MINING);
  49.  
  50. return true;
  51. }
  52.  
  53. public String getName() {
  54. return "Granite Smasher";
  55. }
  56.  
  57. public String getAuthor() {
  58. return "Kohta";
  59. }
  60.  
  61. public String getDescription() {
  62. return "Mines Granite in the desert.";
  63. }
  64.  
  65. public double getVersion() { return 1.0; }
  66.  
  67.  
  68. public void onServerMessage(String e) {
  69. if (e.contains("mined Granite")) {
  70. NUMMINED++;
  71. }
  72. }
  73.  
  74.  
  75. public void onRepaint(Graphics g) {
  76. long runTime = System.currentTimeMillis() - startTime;
  77.  
  78. int secs = ((int) ((runTime / 1000) % 60));
  79. int mins = ((int) (((runTime / 1000) / 60) % 60));
  80. int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
  81.  
  82.  
  83. g.setColor(new Color(0, 0, 0, 100));
  84.  
  85. int MN_NXP = skills.getExperience(Skills.SKILL_MINING);
  86. int CUR_LVL = skills.getLevel(Skills.SKILL_MINING);
  87. int XP_TO_LVL = skills.getExperienceToNextLevel(Skills.SKILL_MINING);
  88. int GAINED_XP = MN_SXP - MN_NXP;
  89.  
  90.  
  91. int x = 13;
  92. int y = 210;
  93. g.setColor(Color.red);
  94. g.fill3DRect(x, y, 246, 102, true);
  95. x += 5;
  96. y += 15;
  97. g.setColor(Color.white);
  98. y += 15;
  99. g.drawString("Granite Smasher by Kohta", x, y);
  100. g.setColor(Color.black);
  101. g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":" + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "") + secs, x , y);
  102. y += 15;
  103. g.drawString("Granite mined: " + NUMMINED, x, y);
  104. y += 15;
  105. g.drawString("Current lvl: " + CUR_LVL, x, y);
  106. y += 15;
  107. g.drawString("Number of granite till next level: " + XP_TO_LVL, x, y);
  108. y += 15;
  109. g.drawString("Experience gained: " + GAINED_XP, x, y);
  110.  
  111.  
  112. }
  113. }
Add Comment
Please, Sign In to add comment