Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 24th, 2012  |  syntax: None  |  size: 7.99 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.awt.Container;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6.  
  7. import javax.swing.DefaultComboBoxModel;
  8. import javax.swing.GroupLayout;
  9. import javax.swing.JButton;
  10. import javax.swing.JComboBox;
  11. import javax.swing.JFrame;
  12. import javax.swing.JLabel;
  13. import javax.swing.LayoutStyle;
  14.  
  15. import org.rsbot.event.listeners.PaintListener;
  16. import org.rsbot.script.Script;
  17. import org.rsbot.script.ScriptManifest;
  18. import org.rsbot.script.wrappers.RSItem;
  19.  
  20. @ScriptManifest(authors = { "Vitera" }, name = "BuryAIO", description = "Bury's bones at any bank.", version = 1.1)
  21. public class BuryAIO extends Script implements PaintListener {
  22.  
  23.         public int bones;
  24.         public String Status;
  25.         public String TypeBonez;
  26.         public boolean GuiWait;
  27.         public long start_time = System.currentTimeMillis();
  28.         public int bonesBuried;
  29.         public int buryBonesAnimation = 827;
  30.         public double BonesEXP;
  31.  
  32.         GUIBuryAIO gui;
  33.  
  34.         private enum State {
  35.                 OPENBANK, WITHDRAW, CLOSEBANK, BURY
  36.         }
  37.  
  38.         private State GetState() {
  39.                 if (bank.isOpen() && inventory.getCount() == 0) {
  40.                         return State.WITHDRAW;
  41.                 } else if (!bank.isOpen() && inventory.getCount() == 0) {
  42.                         return State.OPENBANK;
  43.                 } else if (bank.isOpen() && inventory.contains(bones)) {
  44.                         return State.CLOSEBANK;
  45.                 } else if (!bank.isOpen() && inventory.contains(bones)) {
  46.                         return State.BURY;
  47.                 }      
  48.                 return GetState();
  49.         }
  50.  
  51.         @Override
  52.         public int loop() {
  53.                 switch (GetState()) {
  54.                 case OPENBANK:
  55.                         Status = ("Opening Bank");
  56.                         inventory.getCount(bones);
  57.                         bank.open();
  58.                         if(bank.getCount(bones) == 0 && inventory.getCount(bones) == 0){
  59.                                 stopScript();
  60.                         }
  61.                         sleep(1000, 1100);
  62.                         break;
  63.                 case WITHDRAW:
  64.                         Status = ("Withdrawing Bones");
  65.                         bank.withdraw(bones, 0);
  66.                         sleep(700, 900);
  67.                         break;
  68.                 case CLOSEBANK:
  69.                         Status = ("Closing Bank");
  70.                         if (bank.isOpen() && inventory.contains(bones))
  71.                                 ;
  72.                         bank.close();
  73.                         break;
  74.                 case BURY:
  75.                         Status = ("Burying bones");
  76.                         RSItem a = inventory.getItem(bones);
  77.                         a.doAction("Bury");
  78.                          break;
  79.                 }
  80.                 return 0;
  81.         }
  82.  
  83.         @Override
  84.         public boolean onStart() {
  85.                 gui = new GUIBuryAIO();
  86.                 gui.setVisible(true);
  87.                 do sleep(5000);
  88.                 while (GuiWait);
  89.                 start_time = System.currentTimeMillis();
  90.                 inventory.getCount(bones);
  91.                 log("We're going to bury some bones.");
  92.                 return true;
  93.         }
  94.         public class GUIBuryAIO extends JFrame {
  95.                 /**
  96.                  *
  97.                  */
  98.                 private static final long serialVersionUID = -345766679047743782L;
  99.                 public GUIBuryAIO() {
  100.                         initComponents();
  101.                 }
  102.  
  103.                 private void StartActionPerformed(ActionEvent e) {
  104.  
  105.                 }
  106.  
  107.                 private void initComponents() {
  108.                         // GEN-BEGIN:initComponents
  109.                         Titel = new JLabel();
  110.                         MadeBy = new JLabel();
  111.                         TypeBone = new JLabel();
  112.                         BonesChoose = new JComboBox();
  113.                         Start = new JButton();
  114.  
  115.                         // ======== this ========
  116.                         setResizable(false);
  117.                         setTitle("BuryAIO");
  118.                         Container contentPane = getContentPane();
  119.  
  120.                         // ---- Titel ----
  121.                         Titel.setText("BuryAIO");
  122.                         Titel.setFont(new Font("Franklin Gothic Medium", Font.BOLD, 28));
  123.  
  124.                         // ---- MadeBy ----
  125.                         MadeBy.setText("Made by Vitera");
  126.  
  127.                         // ---- TypeBone ----
  128.                         TypeBone.setText("Type bone:");
  129.                         TypeBone.setFont(new Font("Dialog", Font.BOLD, 18));
  130.  
  131.                         // ---- BonesChoose ----
  132.                         BonesChoose.setModel(new DefaultComboBoxModel(new String[] {
  133.                                         "Bones", "Big Bones", "Burnt Bones", "Monkey Bones",
  134.                                         "Dragon Bones" }));
  135.  
  136.                         // ---- Start ----
  137.                         Start.setText("Start");
  138.                         Start.addActionListener(new ActionListener() {
  139.                                 @Override
  140.                                 public void actionPerformed(ActionEvent e) {
  141.                                         if ((BonesChoose.getSelectedItem()).equals("Bones")) {
  142.                                                 bones = 526;
  143.                                                 TypeBonez = "Bones";
  144.                                                 BonesEXP = 4.5;
  145.                                         } else if ((BonesChoose.getSelectedItem())
  146.                                                         .equals("Big Bones")) {
  147.                                                 bones = 532;
  148.                                                 TypeBonez = "Big Bones";
  149.                                                 BonesEXP = 15;
  150.                                         } else if ((BonesChoose.getSelectedItem())
  151.                                                         .equals("Burnt Bones")) {
  152.                                                 bones = 528;
  153.                                                 TypeBonez = "Burnt Bones";
  154.                                                 BonesEXP = 4.5;
  155.                                         } else if ((BonesChoose.getSelectedItem())
  156.                                                         .equals("Monkey Bones")) {
  157.                                                 bones = 3183;
  158.                                                 TypeBonez = "Monkey Bones";
  159.                                                 BonesEXP = 5;
  160.                                         } else if ((BonesChoose.getSelectedItem())
  161.                                                         .equals("Dragon Bones")) {
  162.                                                 bones = 536;
  163.                                                 TypeBonez = "Dragon Bones";
  164.                                                 BonesEXP = 72;
  165.                                         }
  166.                                         dispose();
  167.                                         StartActionPerformed(e);
  168.                                 }
  169.                         });
  170.  
  171.                         GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  172.                         contentPane.setLayout(contentPaneLayout);
  173.                         contentPaneLayout
  174.                                         .setHorizontalGroup(contentPaneLayout
  175.                                                         .createParallelGroup()
  176.                                                         .addGroup(
  177.                                                                         contentPaneLayout
  178.                                                                                         .createSequentialGroup()
  179.                                                                                         .addGroup(
  180.                                                                                                         contentPaneLayout
  181.                                                                                                                         .createParallelGroup()
  182.                                                                                                                         .addComponent(
  183.                                                                                                                                         MadeBy,
  184.                                                                                                                                         GroupLayout.PREFERRED_SIZE,
  185.                                                                                                                                         91,
  186.                                                                                                                                         GroupLayout.PREFERRED_SIZE)
  187.                                                                                                                         .addGroup(
  188.                                                                                                                                         contentPaneLayout
  189.                                                                                                                                                         .createSequentialGroup()
  190.                                                                                                                                                         .addGap(32,
  191.                                                                                                                                                                         32,
  192.                                                                                                                                                                         32)
  193.                                                                                                                                                         .addComponent(
  194.                                                                                                                                                                         Titel))
  195.                                                                                                                         .addComponent(
  196.                                                                                                                                         TypeBone))
  197.                                                                                         .addGap(31, 31, 31))
  198.                                                         .addGroup(
  199.                                                                         GroupLayout.Alignment.TRAILING,
  200.                                                                         contentPaneLayout
  201.                                                                                         .createSequentialGroup()
  202.                                                                                         .addContainerGap()
  203.                                                                                         .addComponent(BonesChoose, 0, 152,
  204.                                                                                                         Short.MAX_VALUE)
  205.                                                                                         .addContainerGap())
  206.                                                         .addGroup(
  207.                                                                         contentPaneLayout
  208.                                                                                         .createSequentialGroup()
  209.                                                                                         .addGap(33, 33, 33)
  210.                                                                                         .addComponent(Start,
  211.                                                                                                         GroupLayout.PREFERRED_SIZE,
  212.                                                                                                         106,
  213.                                                                                                         GroupLayout.PREFERRED_SIZE)
  214.                                                                                         .addContainerGap(33,
  215.                                                                                                         Short.MAX_VALUE)));
  216.                         contentPaneLayout
  217.                                         .setVerticalGroup(contentPaneLayout
  218.                                                         .createParallelGroup()
  219.                                                         .addGroup(
  220.                                                                         contentPaneLayout
  221.                                                                                         .createSequentialGroup()
  222.                                                                                         .addComponent(Titel,
  223.                                                                                                         GroupLayout.PREFERRED_SIZE,
  224.                                                                                                         27,
  225.                                                                                                         GroupLayout.PREFERRED_SIZE)
  226.                                                                                         .addPreferredGap(
  227.                                                                                                         LayoutStyle.ComponentPlacement.RELATED)
  228.                                                                                         .addComponent(MadeBy,
  229.                                                                                                         GroupLayout.PREFERRED_SIZE,
  230.                                                                                                         16,
  231.                                                                                                         GroupLayout.PREFERRED_SIZE)
  232.                                                                                         .addPreferredGap(
  233.                                                                                                         LayoutStyle.ComponentPlacement.RELATED)
  234.                                                                                         .addComponent(TypeBone)
  235.                                                                                         .addPreferredGap(
  236.                                                                                                         LayoutStyle.ComponentPlacement.RELATED)
  237.                                                                                         .addComponent(BonesChoose,
  238.                                                                                                         GroupLayout.PREFERRED_SIZE,
  239.                                                                                                         GroupLayout.DEFAULT_SIZE,
  240.                                                                                                         GroupLayout.PREFERRED_SIZE)
  241.                                                                                         .addPreferredGap(
  242.                                                                                                         LayoutStyle.ComponentPlacement.RELATED)
  243.                                                                                         .addComponent(Start)
  244.                                                                                         .addContainerGap(
  245.                                                                                                         GroupLayout.DEFAULT_SIZE,
  246.                                                                                                         Short.MAX_VALUE)));
  247.                         pack();
  248.                         setLocationRelativeTo(getOwner());
  249.                         // GEN-END:initComponents
  250.                 }
  251.  
  252.                 // GEN-BEGIN:variables
  253.                 private JLabel Titel;
  254.                 private JLabel MadeBy;
  255.                 private JLabel TypeBone;
  256.                 private JComboBox BonesChoose;
  257.                 private JButton Start;
  258.                 // GEN-END:variables
  259.         }
  260.  
  261.         @Override
  262.         public void onRepaint(Graphics g) {
  263.                 if (game.getCurrentTab() == 4) {
  264.             long millis = System.currentTimeMillis() - start_time;
  265.             long hours = millis / (1000 * 60 * 60);
  266.             millis -= hours * (1000 * 60 * 60);
  267.             long minutes = millis / (1000 * 60);
  268.             millis -= minutes * (1000 * 60);
  269.             long seconds = millis / 1000;
  270.             @SuppressWarnings("unused")
  271.                         long minutes2 = minutes + (hours * 60);
  272.                         g.setFont(new Font("Times New Roman", 0, 12));
  273.                         g.drawString("BuryAIO", 580, 240);
  274.                         g.drawString("Status: " + Status, 580, 260);
  275.                         g.drawString("Run Time: " + hours + ":" + minutes + ":"
  276.                                         + seconds , 580, 280);
  277.                         g.drawString("Type Bones: " + TypeBonez, 580, 300);
  278.                 }
  279.         }
  280. }