Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.event.listeners.PaintListener;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.wrappers.RSPath;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import java.awt.*;
- @ScriptManifest(authors = { "powerlvlfish" }, keywords = { "goblin killer" }, name =
- "goblin killer", description = "kill goblin at west lumby", version = 1)
- public class goblinkiller extends Script implements PaintListener,MouseListener {
- private int[] goblin = {12356,
- 12357,12358,12359,12360,12350,12351,12352,12353,12354,12355};
- private int[] Rune = {556, 565, 562, 557, 558, 561, 555};
- public int Charms[] = { 12159, 12158, 12160, 12163 };
- int RunesCount = 0;
- int CharmsCount = 0;
- public long startTime = System.currentTimeMillis();
- private int attackStartExp = 0,
- attackExpGained = 0, attackExpHour = 0;
- private int strenghtStartExp = 0,
- strenghtExpGained = 0, strenghtExpHour = 0;
- private int defenceStartExp = 0,
- defenceExpGained = 0, defenceExpHour = 0;
- private int rangedStartExp = 0,
- rangedExpGained = 0, RANGEDExpHour = 0;
- private int hitpointStartExp = 0,
- hitpointExpGained = 0, hitpointExpHour = 0;
- private int combatStartExp = 0, combatExpGained = 0, combatExpHour = 0;
- private int magicStartExp = 0, magicExpGained = 0, magicExpHour = 0;
- private static final Color MOUSE_COLOR = new Color(132, 198, 99),
- MOUSE_BORDER_COLOR = new Color(225, 200, 25),
- MOUSE_CENTER_COLOR = new Color(168, 9, 9);
- private boolean pressed = false;
- private int absoluteY;
- private static final RSTile[] tilesdeathpath = {new RSTile(3226, 3219), new
- RSTile(3234, 3226), new RSTile(3230, 3232), new RSTile(3222, 3241), new RSTile(3209,
- 3247), new RSTile(3193, 3247), new RSTile(3181, 3252)};
- public boolean onStart() {
- log("Welcome to powerlvlfish goblin killer.");
- attackStartExp = skills.getCurrentExp(Skills.ATTACK);
- strenghtStartExp = skills.getCurrentExp(Skills.STRENGTH);
- defenceStartExp = skills.getCurrentExp(Skills.DEFENSE);
- rangedStartExp = skills.getCurrentExp(Skills.RANGE);
- hitpointStartExp = skills.getCurrentExp(Skills.CONSTITUTION);
- magicStartExp = skills.getCurrentExp(Skills.MAGIC);
- return true;
- }
- private void drawMouse(Graphics g) {
- ((Graphics2D) g).setRenderingHints(new RenderingHints(
- RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON));
- Point p = mouse.getLocation();
- Graphics2D spinG = (Graphics2D) g.create();
- Graphics2D spinGRev = (Graphics2D) g.create();
- Graphics2D spinG2 = (Graphics2D) g.create();
- spinG.setColor(MOUSE_BORDER_COLOR);
- spinGRev.setColor(MOUSE_COLOR);
- spinG.rotate(System.currentTimeMillis() % 2000d / 2000d * (360d) * 2
- * Math.PI / 180.0, p.x, p.y);
- spinGRev.rotate(System.currentTimeMillis() % 2000d / 2000d * (-360d)
- * 2 * Math.PI / 180.0, p.x, p.y);
- final int outerSize = 20;
- final int innerSize = 12;
- spinG.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND));
- spinGRev.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND));
- spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
- outerSize, 100, 75);
- spinG.drawArc(p.x - (outerSize / 2), p.y - (outerSize / 2), outerSize,
- outerSize, -100, 75);
- spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
- innerSize, innerSize, 100, 75);
- spinGRev.drawArc(p.x - (innerSize / 2), p.y - (innerSize / 2),
- innerSize, innerSize, -100, 75);
- g.setColor(MOUSE_CENTER_COLOR);
- g.fillOval(p.x, p.y, 2, 2);
- spinG2.setColor(MOUSE_CENTER_COLOR);
- spinG2.rotate(System.currentTimeMillis() % 2000d / 2000d * 360d
- * Math.PI / 180.0, p.x, p.y);
- spinG2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND));
- spinG2.drawLine(p.x - 5, p.y, p.x + 5, p.y);
- spinG2.drawLine(p.x, p.y - 5, p.x, p.y + 5);
- }
- public void attack(){
- RSNPC npc = npcs.getNearest(goblin);
- if(npc != null) {
- if(npc.isOnScreen()){
- if(!npc.isInCombat()){
- npc.interact("Attack");
- while(getMyPlayer().isMoving()) {
- }
- while(getMyPlayer().isInCombat()){
- }
- }
- } else {
- walking.walkTileMM(npc.getLocation());
- }
- }
- }
- public int loop() {
- mouse.setSpeed(random(4, 7));
- attack();
- pickRunes();
- pickCharms();
- return random(500, 1500);
- }
- private void deathpath() {
- RSPath pathdeathpath = walking.newTilePath(tilesdeathpath);
- pathdeathpath.traverse();
- }
- private final void pickCharms() {
- RSGroundItem Charms1 = groundItems.getNearest(Charms);
- if(Charms1 != null) {
- Charms1.interact("Take");
- sleep(1200,1500);
- }
- }
- private final void pickRunes() {
- RSGroundItem Rune1 = groundItems.getNearest(Rune);
- if(Rune1 != null) {
- Rune1.interact("Take");
- sleep(1200,1500);
- }
- }
- public void onFinish() {
- env.saveScreenshot(true);
- }
- @Override
- public void mouseClicked(MouseEvent arg0) {
- }
- @Override
- public void mouseEntered(MouseEvent arg0) {
- }
- @Override
- public void mouseExited(MouseEvent arg0) {
- }
- @Override
- public void mousePressed(MouseEvent arg0) {
- Point mp = arg0.getPoint();
- final Rectangle toggleRectangle = new Rectangle(493, absoluteY + 3, 16,
- 15);
- if (toggleRectangle.contains(mp)) {
- pressed = !pressed;
- }
- }
- @Override
- public void mouseReleased(MouseEvent arg0) {
- }
- private final Color color1 = new Color(0, 102, 0);
- private final Color color2 = new Color(0, 0, 0);
- private final Font font1 = new Font("Baskerville Old Face", 1, 16);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- RunesCount = inventory.getCount(Rune);
- CharmsCount = inventory.getCount(Charms);
- attackExpGained = skills.getCurrentExp(Skills.ATTACK) - attackStartExp;
- attackExpHour = (int) ((attackExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- strenghtExpGained = skills.getCurrentExp(Skills.STRENGTH) -
- strenghtStartExp;
- strenghtExpHour = (int) ((strenghtExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- defenceExpGained = skills.getCurrentExp(Skills.DEFENSE) -
- defenceStartExp;
- defenceExpHour = (int) ((defenceExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- rangedExpGained = skills.getCurrentExp(Skills.RANGE) - rangedStartExp;
- RANGEDExpHour = (int) ((rangedExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- magicExpGained = skills.getCurrentExp(Skills.MAGIC) - magicStartExp;
- magicExpHour = (int) ((magicExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- hitpointExpGained = skills.getCurrentExp(Skills.CONSTITUTION) -
- hitpointStartExp;
- hitpointExpHour = (int) ((hitpointExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- combatExpGained = (attackExpGained + strenghtExpGained + rangedExpGained
- + defenceExpGained + magicExpGained);
- combatExpHour = (attackExpHour + strenghtExpHour + RANGEDExpHour +
- defenceExpHour + magicExpHour);
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- g.setColor(color1);
- g.fillRect(7, 345, 505, 128);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("time running:"+ hours + ":" + minutes + ":" + seconds, 8, 369);
- g.drawString("combat xp gained:"+ combatExpGained, 7, 402);
- g.drawString("combat xp per hour:"+ combatExpHour, 7, 434);
- g.drawString("hp xp gained:"+ hitpointExpGained, 275, 366);
- g.drawString("hp xp per hour:"+ hitpointExpHour, 271, 402);
- g.drawString("charms looted:"+ CharmsCount, 271, 432);
- g.drawString("runes looted:"+ RunesCount, 151, 463);
- drawMouse(g);
- }
- public void messageReceived(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("oh dear")) {
- deathpath();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement