Guest User

Untitled

a guest
Jun 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. package com.scripts;
  2.  
  3. import com.kbot2.scriptable.Script;
  4. import com.kbot2.scriptable.*;
  5. import com.kbot2.scriptable.methods.*;
  6. import com.kbot2.scriptable.methods.data.*;
  7. import com.kbot2.scriptable.methods.wrappers.*;
  8. import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
  9. import com.kbot2.scriptable.methods.data.GameScreen;
  10. import com.kbot2.scriptable.methods.wrappers.Interface;
  11. import com.kbot2.scriptable.methods.data.Skills;
  12. import com.kbot2.scriptable.methods.wrappers.Obj;
  13. import com.kbot2.scriptable.methods.wrappers.Tile;
  14.  
  15. import java.awt.*;
  16.  
  17.  
  18. public class JnDYakPwner extends Script implements PaintListener {
  19. private long startTime;
  20. private int expOnStart;
  21. private int yaksAmount;
  22. private int curExp;
  23. private final static int[] yaks = new int[]{5529};
  24. NPC C;
  25. public String getName() {
  26. /**
  27. * Insert the name of your script here
  28. */
  29. return "JnD Yak Pwner";
  30. }
  31.  
  32. public String getAuthor() {
  33. /**
  34. * Your name here
  35. */
  36. return "J93 and Descrete";
  37. }
  38.  
  39. public String getDescription() {
  40. /**
  41. * A short description of your script
  42. */
  43. return "A yak killin' machine made by J93 and Descrete any questions or comments post on the thread :P";
  44. }
  45.  
  46.  
  47. public boolean onStart() {
  48. startTime = System.currentTimeMillis();
  49. expOnStart = -1;
  50. yaksAmount = 0;
  51. return true;
  52. }
  53.  
  54. public void onStop(){
  55. /*
  56. * Stops the script.
  57. */
  58. return;
  59. }
  60.  
  61. public int loop() {
  62.  
  63.  
  64. if(walking.getEnergy() > 30) {
  65. walking.setRunning(true);
  66. sleep(300, 500);
  67. }
  68.  
  69. if(getMyPlayer().isInCombat()) {
  70. return 300;
  71. }
  72. if(getMyPlayer().isMoving()) {
  73. return 300;
  74. }
  75.  
  76. C = npcs.getClosestFree(50, yaks);
  77. if (C != null) {
  78. C.doAction("Attack"); }
  79. return 300;
  80. }
  81.  
  82.  
  83. public void onRepaint(Graphics g) {
  84.  
  85. int trainedExp = curExp - expOnStart;
  86.  
  87. yaksAmount = trainedExp/200;
  88.  
  89. long runTime = System.currentTimeMillis() - startTime;
  90.  
  91. int secs = ((int) ((runTime / 1000) % 60));
  92. int mins = ((int) (((runTime / 1000) / 60) % 60));
  93. int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
  94.  
  95. g.setColor(new Color(0, 0, 0, 100));
  96.  
  97. int x = 13;
  98. int y = 210;
  99. g.fill3DRect(x, y, 230, 117, true);
  100.  
  101. x += 5;
  102. y += 15;
  103. g.setColor(Color.lightGray);
  104. g.drawString("Yak Pwner by J and D", x, y);
  105. g.setColor(Color.WHITE);
  106. y+=20;
  107. g.drawString("Runtime: "
  108. + (hours < 10 ? "0" : "") + hours
  109. + ":" + (mins < 10 ? "0" : "") + mins
  110. + ":" + (secs < 10 ? "0" : "") + secs, x, y);
  111. y+=15;
  112. g.drawString("Exp trained: " + trainedExp, x, y);
  113. y+=15;
  114. g.drawString("Yaks pwned: " + yaksAmount, x, y);
  115.  
  116. }
  117. }
Add Comment
Please, Sign In to add comment