Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.Dimension;
- import java.awt.Toolkit;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.WebWalking;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- @ScriptManifest(authors = { "Tsuyoshi" }, name = "TsuMiner", category = "Mining")
- public class TsuMiner extends Script {
- private boolean shouldBank;
- private final int[] ORE_ID = { 7484, 7453 };
- private final int MINING_ANIM = 625;
- private final int ORE_INV_ID = 436;
- private RSObject[] ores;
- private RSObject nearestOre;
- private RSTile START_TILE;
- private boolean GUI_COMPLETE = false;
- private int PICKAXE_ID[] = {1265, 1267, 1271, 1273, 1275, 11929, 12297};
- @Override
- public void run() {
- GUI GUI = new GUI();
- Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
- int screenW = (screensize.width) / 2;
- int screenH = (screensize.height) / 2;
- Dimension dim = GUI.getSize();
- GUI.setVisible(true);
- GUI.setLocation((screenW / 2), (screenH / 2));
- while (!GUI_COMPLETE){
- sleep(300);
- }
- GUI.setVisible(false);
- startScript();
- while (loop()) {
- }
- }
- private boolean loop() {
- if (Inventory.isFull() && shouldBank) {
- bank(START_TILE);
- } else if (Inventory.isFull() && !shouldBank) {
- dropOre();
- } else {
- mineOre();
- }
- return true;
- }
- private void startScript() {
- Mouse.setSpeed(170);
- START_TILE = Player.getPosition();
- }
- private void mineOre() {
- ores = Objects.findNearest(20, ORE_ID);
- nearestOre = ores[0];
- if (Player.getAnimation() != MINING_ANIM && !Player.isMoving()) {
- if (nearestOre.isOnScreen()) {
- nearestOre.click();
- sleep(1800, 2900);
- } else {
- Camera.turnToTile(nearestOre.getPosition());
- Walking.walkTo(nearestOre.getPosition());
- }
- }
- }
- private void dropOre() {
- Inventory.drop(ORE_INV_ID);
- }
- private void bank(RSTile startTile) {
- if (WebWalking.walkToBank()) {
- if (Banking.openBank()) {
- Banking.depositAllExcept(PICKAXE_ID);
- Banking.close();
- WebWalking.walkTo(startTile);
- }
- }
- }
- /**
- *
- * @author Jordan
- */
- public class GUI extends javax.swing.JFrame {
- /**
- * Creates new form UI
- */
- public GUI() {
- initComponents();
- }
- /**
- * This method is called from within the constructor to initialize the
- * form. WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- buttonGroup1 = new javax.swing.ButtonGroup();
- jLabel1 = new javax.swing.JLabel();
- start = new javax.swing.JButton();
- bank = new javax.swing.JRadioButton();
- drop = new javax.swing.JRadioButton();
- jLabel1.setFont(new java.awt.Font("Segoe UI Light", 1, 36)); // NOI18N
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel1.setText("TsuMiner");
- start.setText("Start");
- start.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- startActionPerformed(evt);
- }
- });
- buttonGroup1.add(bank);
- bank.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
- bank.setSelected(true);
- bank.setText("Bank");
- bank.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- buttonGroup1.add(drop);
- drop.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
- drop.setText("Drop");
- drop.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- }
- });
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup().addGap(60, 60, 60)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(drop).addComponent(bank))
- .addGap(0, 0, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup().addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
- .addComponent(start, javax.swing.GroupLayout.Alignment.TRAILING,
- javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE))
- .addContainerGap()));
- layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup().addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(bank)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(drop)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(start)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
- pack();
- }// </editor-fold>
- private void startActionPerformed(java.awt.event.ActionEvent evt) {
- if (bank.isSelected()){
- shouldBank = true;
- } else {
- shouldBank = false;
- }
- GUI_COMPLETE = true;
- }
- /**
- * @param args
- * the command line arguments
- */
- // Variables declaration - do not modify
- private javax.swing.JRadioButton bank;
- private javax.swing.ButtonGroup buttonGroup1;
- private javax.swing.JRadioButton drop;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JButton start;
- // End of variables declaration
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement