Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //AIOWcer V0.1
- import java.awt.*;
- import java.util.Map;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @org.rsbot.script.ScriptManifest(authors = { "Indaface" }, category = "Woodcutting", name = "aio Wcer", version = 0.1, description = "<html><head></head><body bgcolor='#222222'><center><table><tr><td width='350' valign='top'><center><div style='font-family:Calibri, Arial;color:#FF3300; font-size:36px'>aioWcer</div><div style='font-family:Calibri, Arial;color:#FFFFFF; font-size:16px'>v0.1 by Indaface <br /></a></div><div style='font-family:Calibri, Arial;color:#FF3300; font-size:16px'>Quick Select</div><div><table bordercolor='#FF3300' border='1' cellpadding='0' cellspacing='0' ><tr><td align='center' style='font-family:Calibri, Arial;color:#FFFFFF; font-size:12px'><b>Tree Locations</b> <br /><select name='trees'><option>WestVarrock RegularLogs<option>EastVarrock Oaks<option>Draynor Willows</select>")
- public class AIOWcer extends Script implements PaintListener, ServerMessageListener {
- public enum actions {
- WALKING_TO_TREES, CHOPPING, BANKING, WALKING_TO_BANK, WAIT //add pickup nests and dropping in future update
- }
- private static final actions WAIT = null;
- public String bankAt = "";
- public String chopAt = "";
- public long startTime = System.currentTimeMillis();
- public int[] axes = { 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
- public int[] treeID;
- public int[] logsID = { 1511, 1521, 1519 };
- public int StartingExp;
- public int ExpGained;
- public int[] bankBooths = {2213};
- public int[] nestIDs = { 5070, 5071, 5072, 5073, 5074, 5075, 7413 };
- public RSTile[] toBank, toTrees;
- public int price;
- public int profit;
- public int nestzFound;
- public int cut;
- public int startExp;
- public int[] NormalTree = { 5004, 5005, 5045, 3879, 3881, 3882, 3883,
- 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3928, 3967,
- 3968, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 3033, 3034, 3035,
- 3036, 2409, 2447, 2448, 1330, 1331, 1332, 1310, 1305, 1304, 1303,
- 1301, 1276, 1277, 1278, 1279, 1280, 8742, 8743, 8973, 8974, 1315,
- 1316 };
- public int[] OakTree = { 1281, 3037, 8462, 8463, 8464, 8465, 8466, 8467 };
- public int[] WillowTree = { 1308, 5551, 5552, 5553, 8481, 8482, 8483,
- 8484, 8485, 8486, 8487, 8488 };
- public int[] YewTree = { 1309, 8503, 8504, 8505, 8506, 8507, 8508, 8509,
- 8510, 8511, 8512, 8513 };
- // /////////LOCATIONS///////////////
- public boolean onStart(Map<String, String> args) {
- log("aioWcer Initialized!");
- log("I hope you Enjoy the script");
- log("Check my thread to make sure that your version of this script is up to date..");
- if (args.get("trees").equals("WestVarrock RegularLogs")) {
- bankAt = "WestVarrock Bank";
- chopAt = "WestVarrock RegularLogs";
- price = 36;
- logsID = new int[] { 1511 };
- treeID = new int[] { 1278 };
- toTrees = new RSTile[] { new RSTile(3184, 3444),
- new RSTile(3173, 3456), new RSTile(3157, 3459) };
- toBank = reversePath(toTrees);
- }
- if (args.get("trees").equals("EastVarrock Oaks")) {
- //bankAt = ""
- //chopAT = ""
- price = 48;
- logsID = new int[] { 1521 };
- treeID = new int[] { 1281 };
- toTrees = new RSTile[] { new RSTile(3175, 3451),
- new RSTile(3160, 3455)};
- toBank = new RSTile[] { new RSTile(3160, 3455),
- new RSTile(3175, 3450), new RSTile(3185, 3443)};
- }
- if (args.get("trees").equals("Draynor Willows")) {
- bankAt = "Draynor Bank";
- chopAt = "Draynor Willows";
- price = 8;
- logsID = new int[] { 1519 };
- treeID = new int[] { 5553, 5551, 5552 };
- toTrees = new RSTile[] { new RSTile(3087, 3243), new RSTile(3087, 3235)};
- toBank = new RSTile[] { new RSTile(3087, 3242), new RSTile(3094, 3243)};
- }
- return true;
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- String message = e.getMessage();
- if (message.contains("YOU GET SOME LOGS")) {
- cut += 1;
- }
- }
- public actions getAction() {
- if(inArea(bankAt) && !inventoryContains(logsID) && !bank.isOpen()) {
- return actions.WALKING_TO_TREES;
- }
- if(inArea(bankAt) && isInventoryFull()) {
- return actions.BANKING;
- }
- if(inArea(chopAt) && isInventoryFull() && !inArea(bankAt)) {
- return actions.WALKING_TO_BANK;
- }
- if(inArea(chopAt) && !getMyPlayer().isMoving() && !isInventoryFull()) {
- return actions.CHOPPING;
- }
- return WAIT;
- }
- ///////LOOP/////////
- public int loop() {
- if(!isRunning() && getEnergy() > random(60,80)) {
- setRun(true);
- }
- actions act = getAction();
- switch (act) {
- case WALKING_TO_TREES:
- walkPathMM(toTrees);
- break;
- case WALKING_TO_BANK:
- walkPathMM(toBank);
- break;
- case BANKING:
- walkPathMM(toBank);
- if(!bank.isOpen()) {
- RSObject bankBooth = getNearestObjectByID(bankBooths);
- if(bankBooth != null) {
- atObject(bankBooth, "se-Quickly");
- return random(500, 1000);
- }
- }
- if(bank.isOpen()) {
- bank.depositAllExcept(axes);
- bank.close();
- return random(400, 600);
- }
- break;
- case CHOPPING:
- if (getMyPlayer().getAnimation() != 867) {
- RSObject tree = getNearestObjectByID(treeID);
- if(tree != null) {
- atTree(tree, "chop");
- if(treeID == null){
- log("Cannot find tree to chop. Hold on gimme a second");
- return (random(500,1000));
- }
- if (treeID == null) {
- log("Tree is null");
- return 500;
- }
- }
- }
- }
- return(random(500, 1000));
- }
- public boolean CHOPPING() {
- if(treeID == null);
- return (false);
- }
- public void continueWalk(RSTile[] path) {
- if(!getMyPlayer().isMoving() && distanceTo(getDestination()) <= random(3, 6)) {
- walkPathMM(randomizePath(path, 2, 2));
- }
- }
- public boolean inArea(String area) {
- int x = getMyPlayer().getLocation().getX();
- int y = getMyPlayer().getLocation().getY();
- if(area.equals("Draynor Bank")) {
- return x >= 3092 && x <= 3097 && y >= 3240 && y <= 3245;
- }
- if(area.equals("Draynor Willows")) {
- return x >= 3081 && x <= 3091 && y >= 3226 && y <= 3238;
- }
- if(area.equals("WestVarrock Bank")) {
- return x >= 3182 && x <= 3188 && y >= 3436 && y <= 3445;
- }
- if(area.equals("WestVarrock RegularLogs")) {
- return x >= 3149 && x <= 3159 && y >= 3150 && y <= 3461;
- }
- return x >= 1 && x <= 1 && y >= 1 && y <= 1;
- }
- public void onFinish(){
- log("Thank you for choosing AIOWcer. I hope you enjoyed it.");
- }
- public void onRepaint(Graphics render) {
- if (isLoggedIn()) {
- render.setColor(new Color(128, 0, 128));
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- render.drawString("Time Running: " + hours + ":" + minutes + ":"
- + seconds, 240, 356);
- if (StartingExp == 0) {
- StartingExp = skills.getCurrentSkillExp(STAT_WOODCUTTING);
- ExpGained = skills.getCurrentSkillExp(STAT_WOODCUTTING);
- }
- render.setColor(new Color(255, 0, 0));
- render.drawString("Exp Gained: ", ExpGained, ExpGained);
- }
- }
- }
- //GUI
- /****************************************************************/
- /* GUI */
- /* */
- /****************************************************************/
- import java.awt.*;
- import java.awt.event.*;
- import java.util.*;
- import javax.swing.*;
- import javax.swing.event.*;
- /**
- * Summary description for GUI
- *
- */
- public class GUI extends JFrame
- {
- // Variables declaration
- private JLabel jLabel1;
- private JTextArea jTextArea1;
- private JList jList1;
- private JScrollPane jScrollPane1;
- private JButton Start;
- private JPanel contentPane;
- // End of variables declaration
- public GUI()
- {
- super();
- initializeComponent();
- //
- // TODO: Add any constructor code after initializeComponent call
- //
- this.setVisible(true);
- }
- /**
- * 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 Windows Form Designer. Otherwise, retrieving design might not work properly.
- * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder
- * to retrieve your design properly in future, before revising this method.
- */
- @SuppressWarnings("unchecked")
- private void initializeComponent()
- {
- ArrayList arr;
- jLabel1 = new JLabel();
- jTextArea1 = new JTextArea();
- jList1 = new JList();
- jScrollPane1 = new JScrollPane();
- Start = new JButton();
- contentPane = (JPanel)this.getContentPane();
- //
- // jLabel1
- //
- jLabel1.setText(" Place and TreeType");
- //
- // jTextArea1
- //
- jTextArea1.setText(" -Thank you for using AIOWcer!\n -Please post any problems that you have with this script\n on my thread.\n -Please choose Place and TreeType below in which you want\n to cut below");
- //
- // jList1
- //
- arr = new ArrayList();
- arr.add("WestVarrock RegularLogs");
- arr.add("EastVarrock Oaks");
- arr.add("Draynor Willows");
- jList1.setListData(arr.toArray());
- jList1.addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e)
- {
- jList1_valueChanged(e);
- }
- });
- //
- // jScrollPane1
- //
- jScrollPane1.setViewportView(jList1);
- //
- // Start
- //
- Start.setText("Start");
- Start.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- Start_actionPerformed(e);
- }
- });
- //
- // contentPane
- //
- contentPane.setLayout(null);
- addComponent(contentPane, jLabel1, 152,108,139,18);
- addComponent(contentPane, jTextArea1, 8,5,433,91);
- addComponent(contentPane, jScrollPane1, 153,130,139,60);
- addComponent(contentPane, Start, 354,238,83,28);
- //
- // AIOWcer
- //
- this.setTitle("AIOWcer - extends JFrame");
- this.setLocation(new Point(0, 0));
- this.setSize(new Dimension(465, 311));
- }
- /** Add Component Without a Layout Manager (Absolute Positioning) */
- private void addComponent(Container container,Component c,int x,int y,int width,int height)
- {
- c.setBounds(x,y,width,height);
- container.add(c);
- }
- //
- // TODO: Add any appropriate code in the following Event Handling Methods
- //
- private void jList1_valueChanged(ListSelectionEvent e)
- {
- System.out.println("\njList1_valueChanged(ListSelectionEvent e) called.");
- if(!e.getValueIsAdjusting())
- {
- Object o = jList1.getSelectedValue();
- System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
- // TODO: Add any handling code here for the particular object being selected
- }
- }
- private void Start_actionPerformed(ActionEvent e)
- {
- System.out.println("\nStart_actionPerformed(ActionEvent e) called.");
- // TODO: Add any handling code here
- }
- //============================= Testing ================================//
- //= =//
- //= The following main method is just for testing this class you built.=//
- //= After testing,you may simply delete it. =//
- //======================================================================//
- public static void main(String[] args)
- {
- JFrame.setDefaultLookAndFeelDecorated(true);
- JDialog.setDefaultLookAndFeelDecorated(true);
- try
- {
- UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
- }
- catch (Exception ex)
- {
- System.out.println("Failed loading L&F: ");
- System.out.println(ex);
- }
- new AIOWcer();
- }
- //= End of Testing =
- }
Add Comment
Please, Sign In to add comment