- import java.awt.Container;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.GroupLayout;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.LayoutStyle;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSItem;
- @ScriptManifest(authors = { "Vitera" }, name = "BuryAIO", description = "Bury's bones at any bank.", version = 1.1)
- public class BuryAIO extends Script implements PaintListener {
- public int bones;
- public String Status;
- public String TypeBonez;
- public boolean GuiWait;
- public long start_time = System.currentTimeMillis();
- public int bonesBuried;
- public int buryBonesAnimation = 827;
- public double BonesEXP;
- GUIBuryAIO gui;
- private enum State {
- OPENBANK, WITHDRAW, CLOSEBANK, BURY
- }
- private State GetState() {
- if (bank.isOpen() && inventory.getCount() == 0) {
- return State.WITHDRAW;
- } else if (!bank.isOpen() && inventory.getCount() == 0) {
- return State.OPENBANK;
- } else if (bank.isOpen() && inventory.contains(bones)) {
- return State.CLOSEBANK;
- } else if (!bank.isOpen() && inventory.contains(bones)) {
- return State.BURY;
- }
- return GetState();
- }
- @Override
- public int loop() {
- switch (GetState()) {
- case OPENBANK:
- Status = ("Opening Bank");
- inventory.getCount(bones);
- bank.open();
- if(bank.getCount(bones) == 0 && inventory.getCount(bones) == 0){
- stopScript();
- }
- sleep(1000, 1100);
- break;
- case WITHDRAW:
- Status = ("Withdrawing Bones");
- bank.withdraw(bones, 0);
- sleep(700, 900);
- break;
- case CLOSEBANK:
- Status = ("Closing Bank");
- if (bank.isOpen() && inventory.contains(bones))
- ;
- bank.close();
- break;
- case BURY:
- Status = ("Burying bones");
- RSItem a = inventory.getItem(bones);
- a.doAction("Bury");
- break;
- }
- return 0;
- }
- @Override
- public boolean onStart() {
- gui = new GUIBuryAIO();
- gui.setVisible(true);
- do sleep(5000);
- while (GuiWait);
- start_time = System.currentTimeMillis();
- inventory.getCount(bones);
- log("We're going to bury some bones.");
- return true;
- }
- public class GUIBuryAIO extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = -345766679047743782L;
- public GUIBuryAIO() {
- initComponents();
- }
- private void StartActionPerformed(ActionEvent e) {
- }
- private void initComponents() {
- // GEN-BEGIN:initComponents
- Titel = new JLabel();
- MadeBy = new JLabel();
- TypeBone = new JLabel();
- BonesChoose = new JComboBox();
- Start = new JButton();
- // ======== this ========
- setResizable(false);
- setTitle("BuryAIO");
- Container contentPane = getContentPane();
- // ---- Titel ----
- Titel.setText("BuryAIO");
- Titel.setFont(new Font("Franklin Gothic Medium", Font.BOLD, 28));
- // ---- MadeBy ----
- MadeBy.setText("Made by Vitera");
- // ---- TypeBone ----
- TypeBone.setText("Type bone:");
- TypeBone.setFont(new Font("Dialog", Font.BOLD, 18));
- // ---- BonesChoose ----
- BonesChoose.setModel(new DefaultComboBoxModel(new String[] {
- "Bones", "Big Bones", "Burnt Bones", "Monkey Bones",
- "Dragon Bones" }));
- // ---- Start ----
- Start.setText("Start");
- Start.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- if ((BonesChoose.getSelectedItem()).equals("Bones")) {
- bones = 526;
- TypeBonez = "Bones";
- BonesEXP = 4.5;
- } else if ((BonesChoose.getSelectedItem())
- .equals("Big Bones")) {
- bones = 532;
- TypeBonez = "Big Bones";
- BonesEXP = 15;
- } else if ((BonesChoose.getSelectedItem())
- .equals("Burnt Bones")) {
- bones = 528;
- TypeBonez = "Burnt Bones";
- BonesEXP = 4.5;
- } else if ((BonesChoose.getSelectedItem())
- .equals("Monkey Bones")) {
- bones = 3183;
- TypeBonez = "Monkey Bones";
- BonesEXP = 5;
- } else if ((BonesChoose.getSelectedItem())
- .equals("Dragon Bones")) {
- bones = 536;
- TypeBonez = "Dragon Bones";
- BonesEXP = 72;
- }
- dispose();
- StartActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout
- .setHorizontalGroup(contentPaneLayout
- .createParallelGroup()
- .addGroup(
- contentPaneLayout
- .createSequentialGroup()
- .addGroup(
- contentPaneLayout
- .createParallelGroup()
- .addComponent(
- MadeBy,
- GroupLayout.PREFERRED_SIZE,
- 91,
- GroupLayout.PREFERRED_SIZE)
- .addGroup(
- contentPaneLayout
- .createSequentialGroup()
- .addGap(32,
- 32,
- 32)
- .addComponent(
- Titel))
- .addComponent(
- TypeBone))
- .addGap(31, 31, 31))
- .addGroup(
- GroupLayout.Alignment.TRAILING,
- contentPaneLayout
- .createSequentialGroup()
- .addContainerGap()
- .addComponent(BonesChoose, 0, 152,
- Short.MAX_VALUE)
- .addContainerGap())
- .addGroup(
- contentPaneLayout
- .createSequentialGroup()
- .addGap(33, 33, 33)
- .addComponent(Start,
- GroupLayout.PREFERRED_SIZE,
- 106,
- GroupLayout.PREFERRED_SIZE)
- .addContainerGap(33,
- Short.MAX_VALUE)));
- contentPaneLayout
- .setVerticalGroup(contentPaneLayout
- .createParallelGroup()
- .addGroup(
- contentPaneLayout
- .createSequentialGroup()
- .addComponent(Titel,
- GroupLayout.PREFERRED_SIZE,
- 27,
- GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(MadeBy,
- GroupLayout.PREFERRED_SIZE,
- 16,
- GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(TypeBone)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(BonesChoose,
- GroupLayout.PREFERRED_SIZE,
- GroupLayout.DEFAULT_SIZE,
- GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(Start)
- .addContainerGap(
- GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE)));
- pack();
- setLocationRelativeTo(getOwner());
- // GEN-END:initComponents
- }
- // GEN-BEGIN:variables
- private JLabel Titel;
- private JLabel MadeBy;
- private JLabel TypeBone;
- private JComboBox BonesChoose;
- private JButton Start;
- // GEN-END:variables
- }
- @Override
- public void onRepaint(Graphics g) {
- if (game.getCurrentTab() == 4) {
- long millis = System.currentTimeMillis() - start_time;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- @SuppressWarnings("unused")
- long minutes2 = minutes + (hours * 60);
- g.setFont(new Font("Times New Roman", 0, 12));
- g.drawString("BuryAIO", 580, 240);
- g.drawString("Status: " + Status, 580, 260);
- g.drawString("Run Time: " + hours + ":" + minutes + ":"
- + seconds , 580, 280);
- g.drawString("Type Bones: " + TypeBonez, 580, 300);
- }
- }
- }