Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.event.MouseListener;
- import javax.swing.*;
- import java.awt.image.BufferedImage;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.util.Filter;
- @ScriptManifest( authors = { "Ministry" },
- keywords = { "Prayer" },
- name = "<html><b>GraveDigger</b></html>",
- description = "Picks up any bones from the ground & burys them.",
- version = 1.3 )
- public class GraveDigger extends Script implements PaintListener, MessageListener, MouseListener {
- private int startLevel, currLevel, startExp, currXP, lvlsGained, bonesburied = 0,
- expGained, expHour, expToLevel, percentTNL, boneID;
- private final static int bonesID = 526, bigBonesID = 532, babyDragonID = 534, dragonBonesID= 536;
- private final static int keep[] = { 526, 532, 534, 536 };
- private boolean Bury, showPaint = true, lootBones = true;
- private boolean guiWait = true;
- private long startTime = 0, millis = 0, hours = 0, minutes = 0, seconds = 0,
- STL = 0, MTL = 0, HTL = 0, last = 0;
- private float sXP = 0, mXP = 0, hXP = 0;
- private BufferedImage normal = null, clicked = null;
- private RSArea chickens = new RSArea(3226, 3288, 3236, 3301);
- private RSArea goblins = new RSArea(new RSTile (3262, 3252), new RSTile (3245, 3225));
- final ScriptManifest update = getClass().getAnnotation(ScriptManifest.class);
- gui g = new gui();
- @Override
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(Skills.PRAYER);
- currXP = startExp;
- expGained = skills.getCurrentExp(Skills.PRAYER) - startExp;
- startLevel = skills.getCurrentLevel(Skills.PRAYER);
- log("Welcome to GraveDigger v" + update.version() + " by Ministry");
- g.setVisible(true);
- while(guiWait) sleep(500);
- try {
- final URL cursorURL = new URL("http://sc2upload.sytes.net/rsbot/cursor2.png");
- final URL clickedURL = new URL("http://sc2upload.sytes.net/rsbot/cursor1.png");
- normal = ImageIO.read(cursorURL);
- clicked = ImageIO.read(clickedURL);
- } catch (Exception e) {
- log("Error obtaining custom cursor.");
- }
- return true;
- }
- public void messageReceived(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("bury the bones")) {
- bonesburied++;
- }
- }
- public void messageReceived2(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("can't reach that")) {
- RSTile Current = getMyPlayer().getLocation();
- walking.walkTileMM(Current, 6, 6);
- }
- }
- public final void antiban() {
- int b = random(0, 25);
- switch (b) {
- case 1:
- if (random(0, 10) == 5) {
- mouse.moveSlightly();
- sleep(200, 600);
- mouse.moveRandomly(150, 350);
- }
- break;
- case 2:
- if (random(0, 13) == 2) {
- camera.setAngle(random(30, 70));
- sleep(400, 1200);
- }
- break;
- case 3:
- if (random(0, 24) == 6) {
- mouse.moveOffScreen();
- sleep(1200, 2000);
- }
- break;
- case 4:
- if (random(0, 18) == 3) {
- game.openTab(1);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(2100, 3400);
- }
- break;
- case 5:
- if (random(0, 15) == 4) {
- mouse.moveRandomly(8);
- sleep(1400, 2400);
- }
- break;
- case 6:
- if (random(0, 19) == 5) {
- game.openTab(random(2, 7));
- mouse.sleep(1500);
- sleep(400, 500);
- }
- case 7:
- if(random(0,6) == 5){
- mouse.move(535, 60);
- mouse.click(true);
- sleep(1000, 2500);
- }
- break;
- default:
- break;
- }
- }
- private void FindBones() {
- RSGroundItem bone = groundItems.getNearest(boneID);
- if(bone !=null && players.getMyPlayer().isIdle()) {
- RSGroundItem bones = pickup();
- if (!inventory.isFull()) {
- if (bones.isOnScreen() && (bones != null)) {
- bones.interact("Take bones");
- }else
- if (!bones.isOnScreen()) {
- camera.turnTo(bones.getLocation(), 15);
- if (!bones.isOnScreen()) {
- walking.walkTileMM(walking.getClosestTileOnMap(bones.getLocation()));
- } else {
- if(bone == null) {
- sleep(random(400,450));
- }}
- }
- }}
- }
- private void BuryBones() {
- game.openTab(4);
- if (inventory.contains(boneID) && game.getCurrentTab() == 4) {
- while (inventory.getCount(boneID) > 0) {
- for(RSItem bone: inventory.getItems(boneID)) {
- if (bone != null) {
- bone.doClick(true);
- sleep(random(195, 210));
- }
- }
- }
- }
- sleep(500);
- }
- private void runEnable () {
- if(walking.isRunEnabled() == false && walking.getEnergy() >= random(55, 68)) {
- walking.setRun(true);
- }
- }
- private RSGroundItem pickup() {
- return groundItems.getNearest(new Filter<RSGroundItem>() {
- public boolean accept(RSGroundItem g) {
- return g.getItem().getID() == boneID;
- }
- });
- }
- public void dropAll() {
- sleep(random(150, 300));
- if (players.getMyPlayer().isIdle()) {
- inventory.dropAllExcept(keep);
- }
- }
- @Override
- public void onFinish() {
- env.saveScreenshot(false);
- log("GraveDigger v" + update.version() + " stopped.");
- log("Ran for: " +hours + ":" + minutes + ":" + seconds);
- log("Burried: " + bonesburied + " bones");
- log("Gained : " + expGained + " experience and " + lvlsGained + " levels");
- }
- public int loop() {
- sleep(random(400,650));
- mouse.setSpeed(random(7, 9));
- dropAll();
- runEnable();
- antiban();
- if (!inventory.isFull()) {
- FindBones();
- }
- if (inventory.isFull()) {
- BuryBones();
- }
- return random(350, 700);
- }
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(0, 0, 0, 135);
- private final Color color2 = new Color(35, 36, 135, 180);
- private final Color color4 = new Color(51, 153, 0);
- private final Color color5 = new Color(255, 255, 255);
- private final Color color7 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Rockwell", 1, 16);
- private final Font font2 = new Font("Rockwell", 0, 14);
- private final Font font3 = new Font("Rockwell", 0, 12);
- private final Font font4 = new Font("Rockwell", 1, 8);
- private final Image Zomzom = getImage("http://sc2upload.sytes.net/images//1303413346-zw.PNG");
- private final Image pBar = getImage("http://sc2upload.dyndns.org/images/re.png");
- private final Image Simg = getImage("http://sc2upload.dyndns.org/images/S.png");
- private final Image Himg = getImage("http://sc2upload.dyndns.org/images/H.png");
- Rectangle tab1 = new Rectangle(496, 345, 30, 30);
- //format is rectangle(xCORD, yCORD, WIDTH, HEIGHT)//
- public void mouseClicked(MouseEvent e){
- if(tab1.contains(e.getPoint())){
- showPaint = !showPaint;
- }
- }
- public void mouseEntered(MouseEvent e){
- }
- public void mouseExited(MouseEvent e){
- }
- public void mouseReleased(MouseEvent e){
- }
- public void mousePressed(MouseEvent e){
- }
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- if (game.isLoggedIn() && !game.isWelcomeScreen())
- {
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- currLevel = skills.getCurrentLevel(Skills.PRAYER);
- currXP = skills.getCurrentExp(Skills.PRAYER);
- lvlsGained = currLevel - startLevel;
- expGained = currXP - startExp;
- expToLevel = skills.getExpToNextLevel(Skills.PRAYER);
- percentTNL = skills.getPercentToNextLevel(skills.PRAYER);
- expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
- final int percentBar = (int) (skills.getPercentToNextLevel(Skills.PRAYER)*0.52);
- if ((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
- sXP = (float) expGained
- / (float) (seconds + minutes * 60 + hours * 60 * 60);
- }
- mXP = sXP * 60;
- hXP = mXP * 60;
- if (sXP > 0) {
- STL = (int) (expToLevel / sXP);
- }
- if (STL >= 60) {
- MTL = STL / 60;
- STL -= MTL * 60;
- } else {
- MTL = 0;
- }
- if (MTL >= 60) {
- HTL = MTL / 60;
- MTL -= HTL * 60;
- } else {
- HTL = 0;
- }
- if (clicked != null) {
- final int mx = (int)mouse.getLocation().getX();
- final int my = (int)mouse.getLocation().getY();
- final long mpt = System.currentTimeMillis() - mouse.getPressTime();
- if (mouse.getPressTime() == -1 || mpt >= 300)
- g.drawImage(normal, mx - 10, my - 6, null);
- if (mpt < 300)
- g.drawImage(clicked, mx - 10, my - 6, null);
- }
- if (showPaint == true) {
- //this is so you can see where the location is at, you can delete these once you get the correct size and cords//
- g.setRenderingHints(antialiasing);
- g.setColor(color1);
- g.fillRect(279, 351, 214, 104);
- g.setStroke(stroke1);
- g.drawRect(279, 351, 214, 104);
- g.setColor(color2);
- g.fillRect(276, 348, 214, 104);
- g.setColor(color7);
- g.drawRect(276, 348, 214, 104);
- g.setFont(font1);
- g.drawString("Grave Digger", 312, 364);
- g.setFont(font2);
- g.drawString("v"+ update.version(), 424, 366);
- g.setFont(font3);
- g.drawString("Bones Burried : " + bonesburied , 282, 382);
- g.drawString("Exp Gained : " + expGained, 282, 394);
- g.drawString("Current Level : " + currLevel, 280, 408);
- g.drawString("Runtime : " +hours + ":" + minutes + ":" + seconds, 282, 436);
- g.drawString("Time TNL : " + HTL + ":" + MTL + ":" + STL, 282, 422);
- g.drawImage(Zomzom, 444, 392, null);
- g.setFont(font4);
- g.setColor(color1);
- g.drawString("� Ministry", 446, 448);
- g.drawImage(pBar, 461, 480, null);
- g.setColor(color4);
- g.fillRoundRect(462, 480, percentBar, 22, 10, 10);
- g.setFont(font3);
- g.setColor(color5);
- g.drawString( percentTNL + " %", 468, 497);
- g.drawImage(Himg, 496, 345, null);
- }
- if (showPaint == false) {
- g.drawImage(Simg, 496, 345, null);
- }
- }
- }
- class gui extends JFrame {
- public gui() {
- initComponents();
- }
- private void startbuttonActionPerformed(ActionEvent e) {
- String chosen = boneSelected.getSelectedItem().toString();
- if (chosen.equals("Bones")) {
- boneID = bonesID;
- }else
- if (chosen.equals("Big Bones")) {
- boneID = bigBonesID;
- }else
- if (chosen.equals("Babydragon Bones")) {
- boneID = babyDragonID;
- } else
- if (chosen.equals("Dragon Bones")) {
- boneID = dragonBonesID;
- }
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- startbutton = new JButton();
- boneSelected = new JComboBox();
- label1 = new JLabel();
- label2 = new JLabel();
- comboBox1 = new JComboBox();
- //======== this ========
- setResizable(false);
- setTitle("GraveDigger");
- setIconImage(new ImageIcon("C:\\Users\\Ministry\\Desktop\\dragonb.gif").getImage());
- Container contentPane = getContentPane();
- //---- boneSelected ----
- boneSelected.setModel(new DefaultComboBoxModel(new String[] {
- "Bones",
- "Big Bones",
- "Babydragon Bones",
- "Dragon Bones"
- }));
- //---- label1 ----
- label1.setText("Type of Bones :");
- //---- startbutton ----
- startbutton.setText("Start");
- startbutton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- startbuttonActionPerformed(e);
- }
- });
- //---- label2 ----
- label2.setText("Location :");
- //---- comboBox1 ----
- comboBox1.setModel(new DefaultComboBoxModel(new String[] {
- "Anywhere",
- "Lumbridge Chickens",
- "Goblin Village"
- }));
- comboBox1.setSelectedIndex(0);
- comboBox1.setToolTipText("Sets an area where your player will remain.");
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(10, 10, 10)
- .addComponent(boneSelected, 0, 136, Short.MAX_VALUE))
- .addComponent(startbutton, GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(comboBox1, 0, 182, Short.MAX_VALUE)))
- .addContainerGap())
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(boneSelected, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(label1))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label2)
- .addComponent(comboBox1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
- .addComponent(startbutton)
- .addContainerGap())
- );
- setSize(250, 125);
- setLocationRelativeTo(null);
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JButton startbutton;
- private JComboBox boneSelected;
- private JLabel label1;
- private JLabel label2;
- private JComboBox comboBox1;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment