Jump to content

SoulPlay Neo's Miner Extended to Donator zone


av0ided
 Share

Recommended Posts

Credits to @Neo for base. I just changed/added bits to comply with donator zone.

 

Start in ::DZ mining area weilding pickaxe.

 

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
 
import xobot.client.callback.listeners.PaintListener;
import xobot.script.ActiveScript;
import xobot.script.Manifest;
import xobot.script.methods.Bank;
import xobot.script.methods.GameObjects;
import xobot.script.methods.Packets;
import xobot.script.methods.Players;
import xobot.script.methods.Walking;
import xobot.script.methods.tabs.Inventory;
import xobot.script.util.Filter;
import xobot.script.util.Time;
import xobot.script.util.Timer;
import xobot.script.wrappers.Tile;
import xobot.script.wrappers.interactive.GameObject;
 
@Manifest(authors = { "Neo" }, name = "NeoMiner Donator Version")
public class nMinerDonor extends ActiveScript implements PaintListener{
 
   
    public Timer t = null;
   
    int mined = 0;
    int id1 = 0;
    int id2 = 0;
    int ore;
   
    String oretype = "Loading..";
    String status = "Loading...";
   

    public boolean onStart() {
        t = new Timer(System.currentTimeMillis());
        JDialog frame = new JDialog();
        frame.setPreferredSize(new Dimension(250,90));
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        FlowLayout layout = new FlowLayout();
        layout.setHgap(5);
        layout.setVgap(5);
        frame.setLayout(layout);
       
        JComboBox<String> combo = new JComboBox<String>();
        combo.setPreferredSize(new Dimension(150,30));
        combo.setFocusable(false);
        combo.addItem("Iron");
        combo.addItem("Coal");
        combo.addItem("Mithril");
        combo.addItem("Adamant");
        combo.addItem("Rune");
       
        JButton button = new JButton("Start");
        button.setFocusable(false);
        button.setPreferredSize(new Dimension(60,32));
        button.addActionListener(new ActionListener() {
 
        	
        	 
        	   
            @Override
            public void actionPerformed(ActionEvent arg0) {
                oretype = (String)combo.getSelectedItem();
                switch(oretype) {
                case "Iron":
                    id1 = 2092;
                    id2 = 2092;
                    break;
                case "Coal":
                    id1 = 2096;
                    id2 = 2097;
                    break;
                case "Mithril":
                    id1 = 2102;
                    id2 = 2102;
                    break;
                case "Adamant":
                    id1 = 2105;
                    id2 = 2105;
                    break;
                case "Rune":
                    id1 = 2107;
                    id2 = 2107;
                    break;
                }
                frame.dispose();
            }
           
        });
       
        frame.add(combo);
        frame.add(button);
        frame.setTitle("XoBot - NeoMiner (Donor Version)");
 
       
        frame.pack();
        frame.setVisible(true);
        while(frame.isVisible()) {
            Time.sleep(500);
        }
        return id1 != 0 && id2 != 0;
    }
   
    public void interact() {
	   	Tile t = new Tile(2539, 3891);
        Walking.walkTo(t);
        Time.sleep(1000);
        Packets.sendAction(225, 211, 0, 0, 3044, 1);
        Time.sleep(2000);
        if (Bank.isOpen()) {
        Bank.depositAll();
        }
    }
    
    @Override
    public int loop() {
 
 
    	  
        GameObject o = GameObjects.getNearest(26972);
        if(Inventory.isFull()) {
            if(o != null) {
                status = "Banking..";
                if(Bank.isOpen()) {
                    Bank.depositAll();
                    mined+=28;
                    return 1000;
                }else {
                    o.interact(4);
                    return 2000;
                }
               
            }else {
                status = "Walking to bank.";

                interact();
                return 5000;
            }
        }else {
            if(Players.getMyPlayer().getAnimation() == 6746 || Players.getMyPlayer().getAnimation() == 12188) {
                status = "Mining..";
                return 1000;
            }
            GameObject oo = GameObjects.getNearest(new Filter<GameObject>() {
 
                @Override
                public boolean accept(GameObject o) {
                   
                    if(o.getId() == id1 || o.getId() == id2) {
                        return o.uid != ore;
                    }
                    return false;
                }
               
            });
            if(oo != null) {
                if(Players.getMyPlayer().getLocation().getY() > 3883) {
                    status = "Mining..";
                    ore = oo.uid;
                    oo.interact("mine");
                    return 2000;
                }
 
            }else {
                if(o != null) {

                    status = "Banking..";
                    interact();
                 
                }
            }
        }
       
        return 1000;
    }
   
    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);
 
    private final Font font1 = new Font("Arial", 0, 17);
    private final Font font2 = new Font("Arial", 2, 17);
 
    private final Image img1 = getImage("http://i.imgur.com/wPwcFdz.png");
 
 
   
    @Override
    public void repaint(Graphics render) {
        int ph = (int) ((mined) * 3600000D / (t.getElapsed()));
       
        Graphics2D g = (Graphics2D)render;
        g.drawImage(img1, 1, 224, null);
        g.setFont(font1);
        g.setColor(color1);
        g.drawString("Time: " + t.toElapsedString(), 16, 272);
        g.drawString("Ores: " + mined, 16, 297);
        g.drawString("Ores(h) " + ph, 135, 298);
        g.drawString("Mining: " + oretype, 135, 271);
        g.setFont(font2);
        g.drawString("Status: " + status, 50, 320);
 
    }
 
}

 

 

https://github.com/av0ided/XoBot-Scripts/tree/master/bin

Edited by av0ided
added pre compiled
Link to comment
Share on other sites

I've found a (tiny) issue when banking; first it opens the bank, then waits a few seconds or so, then closes and opens the bank again, then waits a few seconds again and then finally puts all the ores into the bank.

Other then that, great work!

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
2 hours ago, digdug1992 said:

it mines the ore but it keeps clicking the other ore and never gives it a chance to mine the ore fully and it never opens the bank it just keeps saying walking to bank

i got the banking part fixxed just trying to work on the mining part where when it banks then goes back to mining it like mines for few sec then thinks it mined a ore then clicks a diff ore. ANYONE got any tips on fixxing the ore 

 

trying to work on the mining part where when it banks then goes back to mining it like mines for few sec then thinks it mined a ore then clicks a diff ore. ANYONE got any tips on fixing the ore would setting this 

            if(Players.getMyPlayer().getAnimation() == 6746 || Players.getMyPlayer().getAnimation() == 12188) {
                status = "Mining..";
                return 2000;

to this 

            if(Players.getMyPlayer().getAnimation() == 6746 || Players.getMyPlayer().getAnimation() == 12188) {
                status = "Mining..";
                return 9500; 

would that idle the mining tell the ore runs out or is there another better way 
 

Edited by focus953
Link to comment
Share on other sites

  • 3 months later...
  • Neo locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...