Guest User

Untitled

a guest
Sep 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.33 KB | None | 0 0
  1. import org.rsbot.event.listeners.PaintListener;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import java.awt.event.MouseEvent;
  5. import java.awt.event.MouseListener;
  6. import org.rsbot.event.listeners.PaintListener;
  7. import org.rsbot.event.events.MessageEvent;
  8. import org.rsbot.event.listeners.MessageListener;
  9. import org.rsbot.event.listeners.PaintListener;
  10. import org.rsbot.script.Script;
  11. import org.rsbot.script.ScriptManifest;
  12. import org.rsbot.script.methods.Skills;
  13. import org.rsbot.script.util.Filter;
  14. import org.rsbot.script.methods.Game;
  15. import org.rsbot.script.wrappers.RSPath;
  16. import org.rsbot.script.wrappers.RSTile;
  17. import org.rsbot.script.wrappers.RSGroundItem;
  18. import org.rsbot.script.wrappers.RSItem;
  19. import org.rsbot.script.wrappers.RSNPC;
  20. import org.rsbot.script.wrappers.RSObject;
  21. import java.awt.*;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. @ScriptManifest(authors = { "powerlvlfish" }, keywords = { "goblin killer" }, name =
  29.  
  30. "goblin killer", description = "kill goblin at west lumby", version = 1)
  31. public class goblinkiller extends Script implements PaintListener,MouseListener {
  32.  
  33.  
  34. private int[] goblin = {12356,
  35.  
  36. 12357,12358,12359,12360,12350,12351,12352,12353,12354,12355};
  37. private int[] Rune = {556, 565, 562, 557, 558, 561, 555};
  38.  
  39. public int Charms[] = { 12159, 12158, 12160, 12163 };
  40.  
  41. int RunesCount = 0;
  42.  
  43. int CharmsCount = 0;
  44.  
  45. public long startTime = System.currentTimeMillis();
  46. private int attackStartExp = 0,
  47. attackExpGained = 0, attackExpHour = 0;
  48.  
  49. private int strenghtStartExp = 0,
  50. strenghtExpGained = 0, strenghtExpHour = 0;
  51.  
  52. private int defenceStartExp = 0,
  53. defenceExpGained = 0, defenceExpHour = 0;
  54.  
  55. private int rangedStartExp = 0,
  56. rangedExpGained = 0, RANGEDExpHour = 0;
  57.  
  58. private int hitpointStartExp = 0,
  59. hitpointExpGained = 0, hitpointExpHour = 0;
  60.  
  61. private int combatStartExp = 0, combatExpGained = 0, combatExpHour = 0;
  62. private int magicStartExp = 0, magicExpGained = 0, magicExpHour = 0;
  63. private static final Color MOUSE_COLOR = new Color(132, 198, 99),
  64. MOUSE_BORDER_COLOR = new Color(225, 200, 25),
  65. MOUSE_CENTER_COLOR = new Color(168, 9, 9);
  66. private boolean pressed = false;
  67. private int absoluteY;
  68.  
  69. private static final RSTile[] tilesdeathpath = {new RSTile(3226, 3219), new
  70.  
  71. RSTile(3234, 3226), new RSTile(3230, 3232), new RSTile(3222, 3241), new RSTile(3209,
  72.  
  73. 3247), new RSTile(3193, 3247), new RSTile(3181, 3252)};
  74. public boolean onStart() {
  75.  
  76.  
  77.  
  78. log("Welcome to powerlvlfish goblin killer.");
  79. attackStartExp = skills.getCurrentExp(Skills.ATTACK);
  80.  
  81.  
  82. strenghtStartExp = skills.getCurrentExp(Skills.STRENGTH);
  83.  
  84. defenceStartExp = skills.getCurrentExp(Skills.DEFENSE);
  85.  
  86.  
  87. rangedStartExp = skills.getCurrentExp(Skills.RANGE);
  88.  
  89.  
  90. hitpointStartExp = skills.getCurrentExp(Skills.CONSTITUTION);
  91. magicStartExp = skills.getCurrentExp(Skills.MAGIC);
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. return true;
  99. }
  100.  
  101. private void drawMouse(Graphics g) {
  102. ((Graphics2D) g).setRenderingHints(new RenderingHints(
  103. RenderingHints.KEY_ANTIALIASING,
  104. RenderingHints.VALUE_ANTIALIAS_ON));
  105. Point p = mouse.getLocation();
  106. Graphics2D spinG = (Graphics2D) g.create();
  107. Graphics2D spinGRev = (Graphics2D) g.create();
  108. Graphics2D spinG2 = (Graphics2D) g.create();
  109. spinG.setColor(MOUSE_BORDER_COLOR);
  110. spinGRev.setColor(MOUSE_COLOR);
  111. spinG.rotate(System.currentTimeMillis() % 2000d / 2000d * (360d) * 2
  112. * Math.PI / 180.0, p.x, p.y);
  113. spinGRev.rotate(System.currentTimeMillis() % 2000d / 2000d * (-360d)
  114. * 2 * Math.PI / 180.0, p.x, p.y);
  115. final int outerSize = 20;
  116. final int innerSize = 12;
  117. spinG.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  118. BasicStroke.JOIN_ROUND));
  119. spinGRev.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  120. BasicStroke.JOIN_ROUND));
  121. spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
  122. outerSize, 100, 75);
  123. spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
  124. outerSize, -100, 75);
  125. spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
  126. innerSize, innerSize, 100, 75);
  127. spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
  128. innerSize, innerSize, -100, 75);
  129. g.setColor(MOUSE_CENTER_COLOR);
  130. g.fillOval(p.x, p.y, 2, 2);
  131. spinG2.setColor(MOUSE_CENTER_COLOR);
  132. spinG2.rotate(System.currentTimeMillis() % 2000d / 2000d * 360d
  133. * Math.PI / 180.0, p.x, p.y);
  134. spinG2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
  135. BasicStroke.JOIN_ROUND));
  136. spinG2.drawLine(p.x - 5, p.y, p.x + 5, p.y);
  137. spinG2.drawLine(p.x, p.y - 5, p.x, p.y + 5);
  138. }
  139.  
  140.  
  141.  
  142. public void attack(){
  143.  
  144. RSNPC npc = npcs.getNearest(goblin);
  145. if(npc != null) {
  146. if(npc.isOnScreen()){
  147. if(!npc.isInCombat()){
  148. npc.interact("Attack");
  149.  
  150. while(getMyPlayer().isMoving()) {
  151.  
  152. }
  153.  
  154. while(getMyPlayer().isInCombat()){
  155.  
  156. }
  157. }
  158. } else {
  159. walking.walkTileMM(npc.getLocation());
  160. }
  161. }
  162. }
  163.  
  164. public int loop() {
  165. mouse.setSpeed(random(4, 7));
  166. attack();
  167. pickRunes();
  168. pickCharms();
  169. return random(500, 1500);
  170. }
  171.  
  172. private void deathpath() {
  173. RSPath pathdeathpath = walking.newTilePath(tilesdeathpath);
  174. pathdeathpath.traverse();
  175. }
  176.  
  177. private final void pickCharms() {
  178. RSGroundItem Charms1 = groundItems.getNearest(Charms);
  179.  
  180. if(Charms1 != null) {
  181. Charms1.interact("Take");
  182. sleep(1200,1500);
  183. }
  184. }
  185.  
  186. private final void pickRunes() {
  187. RSGroundItem Rune1 = groundItems.getNearest(Rune);
  188.  
  189. if(Rune1 != null) {
  190. Rune1.interact("Take");
  191. sleep(1200,1500);
  192.  
  193. }
  194. }
  195.  
  196.  
  197. public void onFinish() {
  198. env.saveScreenshot(true);
  199. }
  200. @Override
  201. public void mouseClicked(MouseEvent arg0) {
  202. }
  203.  
  204. @Override
  205. public void mouseEntered(MouseEvent arg0) {
  206. }
  207.  
  208. @Override
  209. public void mouseExited(MouseEvent arg0) {
  210. }
  211.  
  212. @Override
  213. public void mousePressed(MouseEvent arg0) {
  214. Point mp = arg0.getPoint();
  215. final Rectangle toggleRectangle = new Rectangle(493, absoluteY + 3, 16,
  216. 15);
  217. if (toggleRectangle.contains(mp)) {
  218. pressed = !pressed;
  219. }
  220. }
  221.  
  222. @Override
  223. public void mouseReleased(MouseEvent arg0) {
  224. }
  225.  
  226. private final Color color1 = new Color(0, 102, 0);
  227. private final Color color2 = new Color(0, 0, 0);
  228.  
  229. private final Font font1 = new Font("Baskerville Old Face", 1, 16);
  230.  
  231. public void onRepaint(Graphics g1) {
  232. Graphics2D g = (Graphics2D)g1;
  233. RunesCount = inventory.getCount(Rune);
  234.  
  235. CharmsCount = inventory.getCount(Charms);
  236. attackExpGained = skills.getCurrentExp(Skills.ATTACK) - attackStartExp;
  237. attackExpHour = (int) ((attackExpGained) * 3600000D / (System
  238. .currentTimeMillis() - startTime));
  239. strenghtExpGained = skills.getCurrentExp(Skills.STRENGTH) -
  240.  
  241. strenghtStartExp;
  242. strenghtExpHour = (int) ((strenghtExpGained) * 3600000D / (System
  243. .currentTimeMillis() - startTime));
  244. defenceExpGained = skills.getCurrentExp(Skills.DEFENSE) -
  245.  
  246. defenceStartExp;
  247. defenceExpHour = (int) ((defenceExpGained) * 3600000D / (System
  248. .currentTimeMillis() - startTime));
  249. rangedExpGained = skills.getCurrentExp(Skills.RANGE) - rangedStartExp;
  250. RANGEDExpHour = (int) ((rangedExpGained) * 3600000D / (System
  251. .currentTimeMillis() - startTime));
  252. magicExpGained = skills.getCurrentExp(Skills.MAGIC) - magicStartExp;
  253. magicExpHour = (int) ((magicExpGained) * 3600000D / (System
  254. .currentTimeMillis() - startTime));
  255. hitpointExpGained = skills.getCurrentExp(Skills.CONSTITUTION) -
  256.  
  257. hitpointStartExp;
  258. hitpointExpHour = (int) ((hitpointExpGained) * 3600000D / (System
  259. .currentTimeMillis() - startTime));
  260.  
  261. combatExpGained = (attackExpGained + strenghtExpGained + rangedExpGained
  262.  
  263. + defenceExpGained + magicExpGained);
  264. combatExpHour = (attackExpHour + strenghtExpHour + RANGEDExpHour +
  265.  
  266. defenceExpHour + magicExpHour);
  267. long millis = System.currentTimeMillis() - startTime;
  268. long hours = millis / (1000 * 60 * 60);
  269. millis -= hours * (1000 * 60 * 60);
  270. long minutes = millis / (1000 * 60);
  271. millis -= minutes * (1000 * 60);
  272. long seconds = millis / 1000;
  273. g.setColor(color1);
  274. g.fillRect(7, 345, 505, 128);
  275. g.setFont(font1);
  276. g.setColor(color2);
  277. g.drawString("time running:"+ hours + ":" + minutes + ":" + seconds, 8, 369);
  278. g.drawString("combat xp gained:"+ combatExpGained, 7, 402);
  279. g.drawString("combat xp per hour:"+ combatExpHour, 7, 434);
  280. g.drawString("hp xp gained:"+ hitpointExpGained, 275, 366);
  281. g.drawString("hp xp per hour:"+ hitpointExpHour, 271, 402);
  282. g.drawString("charms looted:"+ CharmsCount, 271, 432);
  283. g.drawString("runes looted:"+ RunesCount, 151, 463);
  284.  
  285. drawMouse(g);
  286. }
  287.  
  288. public void messageReceived(MessageEvent e) {
  289. String x = e.getMessage().toLowerCase();
  290. if (x.contains("oh dear")) {
  291. deathpath();
  292. }
  293. }
  294.  
  295. }
Advertisement
Add Comment
Please, Sign In to add comment