rendered paste bodyimport impsoft.bots.ColorBot;
import impsoft.scripting.ibot.interfaces.AutoPaint;
import impsoft.scripting.ibot.structs.AryanTile;
import impsoft.scripting.ibot.structs.AryanTileZone;
import impsoft.scripting.types.ColorScript;
import impsoft.scripting.ibot.itemrec.ItemNameExact;
import impsoft.utils.general.Timer;
import java.awt.Color;
import java.awt.Graphics;
import impsoft.scripting.ibot.interfaces.AutoPaint;
import impsoft.bots.reflection.NPC;
import impsoft.bots.reflection.NPCIterator;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.Random;
import java.awt.Graphics;
import bergCoder.BergUtils;
public class Decanter extends ColorScript implements AutoPaint {
// Script Info
public static String author = "TJ!";
public static String description = "Decants Pots";
public static double version = 0.1;
// Declare "util" to be an object type of BergUtils for use later.
BergUtils util = new BergUtils(this);
int itemsBanked = 0;
// Declaring the GUI.
DecantGUI myGUI = new DecantGUI();
// Public Variables
long startTime = System.currentTimeMillis();
private Timer timeRan = new Timer(0);
public String potionToDecant;
public Decanter(ColorBot c) {
super(c);
}
public void script() throws InterruptedException {
while(!isLoggedIn()){
log("|| Waiting for Login ||");
sleep(600,1600);
}
log(" || AutoDecanter is active ||");
myGUI.setVisible(true);
while (myGUI.isVisible())
{
sleep(1200);
}
// Walk to the decantNPC in case not starting at GE.
walk();
while(isLoggedIn()) {
bankItems();
sleep(300,500);
walk();
sleep(100,200);
decant();
}
}
public void walk() throws InterruptedException{
AryanTileZone decantNPCLocation = new AryanTileZone (new AryanTile(3157, 3480), (new AryanTile(3155, 3481)));
theWorldMap.walkTo(decantNPCLocation.random());
log("Walking to the decant NPC.");
}
public void decant() throws InterruptedException {
NPC decantNPC = util.getNPCByName("Bob Barter");
util.doNPC(decantNPC, "Decant");
sleep(1500,2000);
}
public void bankItems() throws InterruptedException {
theWorldMap.walkToBank();
log("Walking to bank.");
itemsBanked += theTabs.Inventory.getCount();
theBank.doDepositAll();
log("Depositing all items.");
theBank.doWithDrawAll(new ItemNameExact(potionToDecant), true);
log("Withdrawing all Extreme Attack (3)'s");
theBank.exit();
log("Exiting bank.");
}
public void paint(Graphics g) {
g.setColor(new Color(0, 0, 0, 200)); // Sets color for background (In RGBA)
g.drawRect(10, 10, 250, 50); // Draws a 250x250 Rectangle at (10,10);
g.fillRect(10, 10, 250, 50); // Fill the rectangle with the color.
g.setColor(Color.WHITE);
g.drawString("AutoDecanter - v0.1 - By: TJ!", 15, 25);
g.drawString("Time Ran: " + timeRan.toStringTimeElapsed(), 15, 40);
g.drawString("Items Banked: " + itemsBanked, 15, 55);
}
public class DecantGUI extends javax.swing.JFrame {
/** Creates new form DecantGUI */
public DecantGUI() {
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() {
jComboBox1 = new javax.swing.JComboBox();
label1 = new java.awt.Label();
button1 = new java.awt.Button();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Extreme attack (3)", "Extreme defense (3)", "Extreme strength (3)" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
label1.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N
label1.setText("Potion to decant:");
button1.setLabel("Start");
button1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button1ActionPerformed(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()
.addContainerGap()
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(button1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(21, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(button1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
// Actions performed when the start button is hit.
private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
potionToDecant = (String)jComboBox1.getSelectedItem();
// Debug
log("This is happening!");
// Hide the GUI
myGUI.dispose();
}
/**
* @param args the command line arguments
*/
public void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DecantGUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
private java.awt.Button button1;
private javax.swing.JComboBox jComboBox1;
private java.awt.Label label1;
// End of variables declaration
}
}