Vous êtes sur la page 1sur 6

import import import import import import import import import import import

org.rsbot.script.Script; org.rsbot.script.ScriptManifest; org.rsbot.script.methods.Skills; org.rsbot.script.wrappers.RSWeb; org.rsbot.script.wrappers.RSTile; org.rsbot.event.listeners.*; java.awt.*; java.awt.event.*; java.text.DecimalFormat; java.text.NumberFormat; javax.swing.*;

@ScriptManifest(authors = "k0na", description = "All in one walker", version = 1 .01, keywords = "Walker", name = "AIO Walker") public class AIOWalker extends Script implements PaintListener { public long startTime = System.currentTimeMillis(); long seconds; long minutes; long hours; String distanceLeft; String location; RSWeb path; RSTile tile; boolean GUI_WAIT = true; GUI g = new GUI(); public boolean onStart() { g.setVisible(true); while(GUI_WAIT) sleep(500); return true; } public void walk() { path.step(); } public boolean rest() { log("Resting"); int energy = walking.getEnergy(); for (int d = 0; d < 5; d++) { interfaces.getComponent(750, 6).doAction("Rest"); sleep(random(1000, 1400)); if (getMyPlayer().getAnimation() == 12108 || getMyPlayer ().getAnimation() == 2033 || getMyPlayer().getAnimation() == 2716 || getMyPlayer ().getAnimation() == 11786 || getMyPlayer().getAnimation() == 5713) { break; } if (d == 4) { log("Rest failed!"); return false; } } energy = walking.getEnergy(); int maxWait = 0; int targetEnergy = random(80,95);

while (energy < targetEnergy && maxWait++ <= 111) { sleep(random(250, 300)); energy = walking.getEnergy(); } return true; } @Override public int loop() { if(getMyPlayer().isMoving()) { if(random(1,7) == 3) { switch(random(1,5)) { case 1: mouse.move(random(100,500), 300, 900); break; case 2: camera.setAngle(random(100,300)); break; case 3: camera.moveRandomly(100); break; case 4: mouse.moveSlightly(); break; case 5: mouse.moveSlightly(); sleep(1000); break; } } } if(walking.getEnergy() < 10 && !walking.isRunEnabled()) { rest(); } if(!walking.isRunEnabled() & walking.getEnergy() > 30) { log("Enabling run"); walking.setRun(true); } if(calc.distanceTo(tile) < 5) { log("Arrived at/to: " + location); stopScript(); } walk(); return 0; } public void onRepaint(Graphics g) { 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;

g.setColor(Color.GREEN); g.drawString("Run Time: " + hours + ":" + minutes + ":" + second s, 200, 35); g.drawString("Walking to: " + location, 200, 45); } public class GUI extends JFrame { public GUI() { initComponents(); } private void button1ActionPerformed(ActionEvent e) { location = cbLocation.getSelectedItem().toString(); if(location.equals("Al Kharid")) { tile = new RSTile(3286,3195); } else if(location.equals("Barbarian Outpost")) { tile = new RSTile(2542,3565); } else if(location.equals("Barbarian Village")) { tile = new RSTile(3087,3420); } else if(location.equals("Camelot")) { tile = new RSTile(2759,3475); } else if(location.equals("Canifis")) { tile = new RSTile(3497,3490); } else if(location.equals("Castle Wars")) { tile = new RSTile(2441,3091); } else if(location.equals("Crafting Guild")) { tile = new RSTile(2928,3297); } else if(location.equals("Draynor")) { tile = new RSTile(3080,3251); } else if(location.equals("Duel Arena")) { tile = new RSTile(3322,3237); } else if(location.equals("Dwarven Mine")) { tile = new RSTile(3017,3448); } else if(location.equals("Edgeville")) { tile = new RSTile(3087,3495); } else if(location.equals("East Ardougne")) { tile = new RSTile(2662,3303); } else if(location.equals("Falador East")) { tile = new RSTile(3013,3363); } else if(location.equals("Falador West")) { tile = new RSTile(2964,3382); } else if(location.equals("Goblin Village")) { tile = new RSTile(2955,3501); } else if(location.equals("Grand Exchange")) { tile = new RSTile(3165,3485); } else if(location.equals("Legends Guild")) { tile = new RSTile(2728,3346); } else if(location.equals("Lumbridge")) { tile = new RSTile(3222,3219); } else if(location.equals("Lumbridge Swamp")) { tile = new RSTile(3198,3164); } else if(location.equals("Mage Training Area")) { tile = new RSTile(3363,3298); } else if(location.equals("Port Sarim")) { tile = new RSTile(3040,3236); } else if(location.equals("Rimmington")) { tile = new RSTile(2958,3221); } else if(location.equals("Varrock East")) { tile = new RSTile(3254,3421); } else if(location.equals("Varrock Sawmill")) {

tile = new RSTile(3304,3489); } else if(location.equals("Varrock West")) { tile = new RSTile(3187,3436); } else if(location.equals("West Ardougne")) { tile = new RSTile(2533,3305); } else if(location.equals("Witchaven")) { tile = new RSTile(2723,3291); } else if(location.equals("Wizards Tower")) { tile = new RSTile(3110,3170); } else if(location.equals("Rellekka")) { tile = new RSTile(2661,3658); } else if(location.equals("Seers Village")) { tile = new RSTile(2692,3483); } else if(location.equals("Taverly")) { tile = new RSTile(2895,3447); } else if(location.equals("Tree Gnome Stronghold")) { tile = new RSTile(2461,3411); } else if(location.equals("ZMI Altar")) { tile = new RSTile(2454,3236); } else if(location.equals("Antipoison Stairs")) { tile = new RSTile(2458,3185); } path = web.getWeb(getMyPlayer().getLocation(), tile); GUI_WAIT = false; dispose(); } private void initComponents() { panel1 = new JPanel(); lLocation = new JLabel(); cbLocation = new JComboBox(); btnStart = new JButton(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(null); //======== panel1 ======== { panel1.setLayout(null); //---- lLocation ---lLocation.setText("Location:"); panel1.add(lLocation); lLocation.setBounds(new Rectangle(new Point(5, 1 0), lLocation.getPreferredSize())); //---- cbLocation ---cbLocation.setModel(new DefaultComboBoxModel(new String[] { "Al Kharid", "Antipoison Stairs", "Barbarian Outpost", "Barbarian Village", "Camelot", "Canifis", "Castle Wars", "Crafting Guild", "Draynor", "Duel Arena",

"Dwarven Mine", "Edgeville", "East Ardougne", "Falador East", "Falador West", "Goblin Village", "Grand Exchange", "Legends Guild", "Lumbridge", "Lumbridge Swamp", "Mage Training Area", "Port Sarim", "Rimmington", "Varrock East", "Varrock Sawmill", "Varrock West", "West Ardougne", "Witchaven", "Wizards Tower", "Rellekka", "Seers Village", "Taverly", "Tree Gnome Stronghold", "ZMI Altar" })); panel1.add(cbLocation); cbLocation.setBounds(new Rectangle(new Point(65, 5), cbLocation.getPreferredSize())); //---- btnStart ---btnStart.setText("WALK"); btnStart.setSelectedIcon(null); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); panel1.add(btnStart); btnStart.setBounds(65, 30, 163, btnStart.getPref erredSize().height); { // compute preferred size Dimension preferredSize = new Dimension( ); for(int i = 0; i < panel1.getComponentCo unt(); i++) { Rectangle bounds = panel1.getCom ponent(i).getBounds(); preferredSize.width = Math.max(b ounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max( bounds.y + bounds.height, preferredSize.height); } Insets insets = panel1.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel1.setMinimumSize(preferredSize); panel1.setPreferredSize(preferredSize);

} } contentPane.add(panel1); panel1.setBounds(0, 0, 240, 60); { // compute preferred size Dimension preferredSize = new Dimension(); for(int i = 0; i < contentPane.getComponentCount (); i++) { Rectangle bounds = contentPane.getCompon ent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } pack(); setLocationRelativeTo(getOwner()); } private JPanel panel1; private JLabel lLocation; private JComboBox cbLocation; private JButton btnStart; } }

Vous aimerez peut-être aussi