Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import java.util.ArrayList;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.util.Timer;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = "Iscream", name = "ISQuickFish", version = 1.00, keywords = "Fishing")
- public class ISQuickFish extends Script implements PaintListener {
- private long scriptStartTIME = -1,runTime = 0;
- private static final int Net = 303, FishSpot = 327;
- private int i = 0;
- private boolean inRandom = true;
- private ArrayList<String> AccountList = new ArrayList<String>();
- private ArrayList<String> RandomList = new ArrayList<String>();
- private String Password;
- private LBot Login = new LBot();
- private ISGUI ISGUI = new ISGUI();
- private Timer randomTime;
- private class ISGUI extends javax.swing.JFrame {
- private static final long serialVersionUID = -3358771461877565153L;
- public ISGUI() {
- initComponents();
- }
- private void initComponents() {
- Title = new javax.swing.JLabel();
- jScrollPane1 = new javax.swing.JScrollPane();
- TextArea = new javax.swing.JTextArea();
- StartButton = new javax.swing.JButton();
- CancelButton = new javax.swing.JButton();
- MessageField = new javax.swing.JTextField();
- jComboBox1 = new javax.swing.JComboBox();
- jLabel1 = new javax.swing.JLabel();
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- Title.setText("Randoms are Friends");
- TextArea.setColumns(20);
- TextArea.setRows(5);
- TextArea.setText("Erase All of This Text and Input the \n usernames you would like botted.\n\nPlace Commas between Usernames.\nExample : Username1@gmail.com,Username2@gmail.com");
- jScrollPane1.setViewportView(TextArea);
- StartButton.setText("Start");
- StartButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- StartButtonActionPerformed(evt);
- }
- });
- CancelButton.setText("Cancel");
- CancelButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- CancelButtonActionPerformed(evt);
- }
- });
- MessageField.setText("Input Universal Password for all Accounts");
- jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Fast", "Faster", "Fastest" }));
- jComboBox1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jComboBox1ActionPerformed(evt);
- }
- });
- jLabel1.setText("Mouse Speed");
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(128, 128, 128)
- .addComponent(Title))
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(StartButton)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 254, Short.MAX_VALUE)
- .addComponent(CancelButton))
- .addComponent(MessageField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jComboBox1, 0, 95, Short.MAX_VALUE)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addGap(11, 11, 11)))))))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(Title)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(27, 27, 27)
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(MessageField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(StartButton)
- .addComponent(CancelButton))
- .addContainerGap())
- );
- pack();
- }
- private void StartButtonActionPerformed(java.awt.event.ActionEvent evt) {
- for (String s : TextArea.getText().split(",")) {
- AccountList.add(s);
- }
- Password = MessageField.getText();
- ISGUI.dispose();
- }
- private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
- log.severe("Failed To Startup - User Cancelled");
- stopScript();
- ISGUI.dispose();
- }
- private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
- if (jComboBox1.getSelectedIndex() == 1) {
- mouse.setSpeed(6);
- }
- if (jComboBox1.getSelectedIndex() == 2) {
- mouse.setSpeed(4);
- }
- if (jComboBox1.getSelectedIndex() == 3) {
- mouse.setSpeed(2);
- }
- }
- private javax.swing.JButton CancelButton;
- private javax.swing.JTextField MessageField;
- private javax.swing.JButton StartButton;
- private javax.swing.JTextArea TextArea;
- private javax.swing.JLabel Title;
- private javax.swing.JComboBox jComboBox1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JScrollPane jScrollPane1;
- }
- private class LBot {
- private static final int INTERFACE_MAIN = 905;
- private static final int INTERFACE_MAIN_CHILD = 59;
- private static final int INTERFACE_MAIN_CHILD_COMPONENT_ID = 4;
- private static final int INTERFACE_LOGIN_SCREEN = 596;
- private static final int INTERFACE_USERNAME = 65;
- private static final int INTERFACE_USERNAME_WINDOW = 37;
- private static final int INTERFACE_PASSWORD = 71;
- private static final int INTERFACE_PASSWORD_WINDOW = 39;
- private static final int INTERFACE_BUTTON_LOGIN = 42;
- private static final int INTERFACE_TEXT_RETURN = 11;
- private static final int INTERFACE_BUTTON_BACK = 60;
- private static final int INTERFACE_WELCOME_SCREEN = 906;
- private static final int INTERFACE_WELCOME_SCREEN_BUTTON_PLAY_1 = 160;
- private static final int INTERFACE_WELCOME_SCREEN_BUTTON_PLAY_2 = 171;
- private static final int INTERFACE_WELCOME_SCREEN_TEXT_RETURN = 221;
- private static final int INTERFACE_WELCOME_SCREEN_BUTTON_BACK = 228;
- private static final int INTERFACE_WELCOME_SCREEN_HIGH_RISK_WORLD_TEXT = 86;
- private static final int INTERFACE_WELCOME_SCREEN_HIGH_RISK_WORLD_LOGIN_BUTTON = 93;
- private static final int INTERFACE_GRAPHICS_NOTICE = 976;
- private static final int INTERFACE_GRAPHICS_LEAVE_ALONE = 6;
- private static final int INDEX_LOGGED_OUT = 3;
- private static final int INDEX_LOBBY = 7;
- private int invalidCount, worldFullCount;
- public void login(String User, String pass) {
- String username = User.replaceAll("_", " ").toLowerCase().trim();
- String returnText = interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_TEXT_RETURN).getText().toLowerCase();
- int textlength;
- if (game.getClientState() != INDEX_LOGGED_OUT) {
- if (!game.isWelcomeScreen()) {
- sleep(random(1000, 2000));
- }
- if (game.getClientState() == INDEX_LOBBY) {
- RSInterface welcome_screen = interfaces
- .get(INTERFACE_WELCOME_SCREEN);
- RSComponent welcome_screen_button_play_1 = welcome_screen
- .getComponent(INTERFACE_WELCOME_SCREEN_BUTTON_PLAY_1);
- RSComponent welcome_screen_button_play_2 = welcome_screen
- .getComponent(INTERFACE_WELCOME_SCREEN_BUTTON_PLAY_2);
- mouse.click(welcome_screen_button_play_1.getAbsoluteX(),
- welcome_screen_button_play_1.getAbsoluteY(),
- welcome_screen_button_play_2.getAbsoluteX()
- + welcome_screen_button_play_2.getWidth()
- - welcome_screen_button_play_1.getAbsoluteX(),
- welcome_screen_button_play_1.getHeight(), true);
- for (int i = 0; i < 4 && game.getClientState() == 6; i++) {
- sleep(500);
- }
- returnText = interfaces.get(INTERFACE_WELCOME_SCREEN)
- .getComponent(INTERFACE_WELCOME_SCREEN_TEXT_RETURN)
- .getText().toLowerCase();
- if (returnText.contains("login limit exceeded")) {
- if(interfaces.getComponent(INTERFACE_WELCOME_SCREEN_BUTTON_BACK).isValid())
- interfaces.getComponent(INTERFACE_WELCOME_SCREEN_BUTTON_BACK).doClick();
- }
- if (returnText.contains("your account has not logged out")) {
- if (invalidCount > 10) {
- log.warning("Unable to login after 10 attempts. Stopping script.");
- log.severe("It seems you are actually already logged in?");
- stopScript(false);
- }
- invalidCount++;
- log.severe("Waiting for logout..");
- sleep(5000,15000);
- }
- if (returnText.contains("member")) {
- log("Unable to login to a members world. Stopping script.");
- RSComponent back_button1 = interfaces.get(
- INTERFACE_WELCOME_SCREEN).getComponent(228);
- RSComponent back_button2 = interfaces.get(
- INTERFACE_WELCOME_SCREEN).getComponent(231);
- mouse.click(
- back_button1.getAbsoluteX(),
- back_button1.getAbsoluteY(),
- back_button2.getAbsoluteX()
- + back_button2.getWidth()
- - back_button1.getAbsoluteX(),
- back_button1.getHeight(), true);
- interfaces.get(INTERFACE_WELCOME_SCREEN).getComponent(203)
- .doClick();
- stopScript(false);
- }
- if (interfaces
- .get(INTERFACE_WELCOME_SCREEN)
- .getComponent(
- INTERFACE_WELCOME_SCREEN_HIGH_RISK_WORLD_TEXT)
- .getText().toLowerCase().trim()
- .contains("high-risk wilderness world")) {
- interfaces
- .get(INTERFACE_WELCOME_SCREEN)
- .getComponent(
- INTERFACE_WELCOME_SCREEN_HIGH_RISK_WORLD_LOGIN_BUTTON)
- .doClick();
- }
- }
- }
- if (!game.isLoggedIn()) {
- if(interfaces.get(INTERFACE_LOGIN_SCREEN).getComponent(INTERFACE_BUTTON_BACK).isValid())
- interfaces.get(INTERFACE_LOGIN_SCREEN).getComponent(INTERFACE_BUTTON_BACK).doClick();
- if (returnText.contains("no reply from login server")) {
- if (invalidCount > 10) {
- log.warning("Unable to login after 10 attempts. Stopping script.");
- log.severe("It seems the login server is down.");
- stopScript(false);
- }
- invalidCount++;
- }
- if (returnText.contains("update")) {
- log("Runescape has been updated, please reload RSBot.");
- stopScript(false);
- }
- if (returnText.contains("disable")) {
- log.severe("Your account is banned/disabled.");
- stopScript(false);
- }
- if (returnText.contains("your account has not logged out")) {
- if (invalidCount > 10) {
- log.warning("Unable to login after 10 attempts. Stopping script.");
- log.severe("It seems you are actually already logged in?");
- stopScript(false);
- }
- invalidCount++;
- log.severe("Waiting for logout..");
- sleep(5000,15000);
- }
- if (returnText.contains("incorrect")) {
- log.warning("Failed to login five times in a row. Stopping script.");
- stopScript(false);
- }
- if (returnText.contains("invalid")) {
- if (invalidCount > 6) {
- log.warning("Unable to login after 6 attempts. Stopping script.");
- log("Please verify that your RSBot account profile is correct.");
- stopScript(false);
- }
- invalidCount++;
- }
- if (returnText.contains("error connecting")) {
- interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_BUTTON_BACK).doClick();
- stopScript(false);
- }
- if (returnText.contains("full")) {
- if (worldFullCount > 30) {
- log("World Is Full. Waiting for 15 seconds.");
- sleep(random(10000, 15000));
- worldFullCount = 0;
- }
- sleep(random(1000, 1200));
- worldFullCount++;
- }
- if (returnText.contains("login limit exceeded")) {
- if (invalidCount > 10) {
- log.warning("Unable to login after 10 attempts. Stopping script.");
- log.severe("It seems you are actually already logged in?");
- stopScript(false);
- }
- invalidCount++;
- sleep(5000,15000);
- }
- }
- if (game.getClientState() == INDEX_LOGGED_OUT) {
- if (interfaces.getComponent(INTERFACE_GRAPHICS_NOTICE,
- INTERFACE_GRAPHICS_LEAVE_ALONE).isValid()) {
- interfaces.getComponent(INTERFACE_GRAPHICS_NOTICE,
- INTERFACE_GRAPHICS_LEAVE_ALONE).doClick();
- if(interfaces.getComponent(INTERFACE_BUTTON_BACK).isValid())
- interfaces.getComponent(INTERFACE_BUTTON_BACK).doClick();
- }
- if (!atLoginScreen()) {
- if (interfaces.getComponent(INTERFACE_MAIN, INTERFACE_MAIN_CHILD)
- .getComponent(INTERFACE_MAIN_CHILD_COMPONENT_ID) != null) {
- interfaces.getComponent(INTERFACE_MAIN, INTERFACE_MAIN_CHILD)
- .getComponent(INTERFACE_MAIN_CHILD_COMPONENT_ID)
- .doAction("");
- }
- }
- if (isUsernameFilled(User) && isPasswordFilled(pass)) {
- if (random(0, 2) == 0)
- keyboard.pressKey((char) KeyEvent.VK_ENTER);
- else
- interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_BUTTON_LOGIN).doClick();
- }
- if (!isUsernameFilled(User)) {
- atLoginInterface(interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_USERNAME_WINDOW));
- sleep(random(500, 700));
- textlength = interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_USERNAME).getText().length()
- + random(3, 5);
- for (int i = 0; i <= textlength + random(1, 5); i++) {
- keyboard.sendText("\b", false);
- if (random(0, 2) == 1) {
- sleep(random(25, 100));
- }
- }
- keyboard.sendText(username, false);
- }
- if (isUsernameFilled(User) && !isPasswordFilled(pass)) {
- atLoginInterface(interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_PASSWORD_WINDOW));
- sleep(random(500, 700));
- textlength = interfaces.get(INTERFACE_LOGIN_SCREEN)
- .getComponent(INTERFACE_PASSWORD).getText().length()
- + random(3, 5);
- for (int i = 0; i <= textlength + random(1, 5); i++) {
- keyboard.sendText("\b", false);
- if (random(0, 2) == 1) {
- sleep(random(25, 100));
- }
- }
- keyboard.sendText(pass, false);
- }
- }
- }
- private boolean atLoginInterface(RSComponent i) {
- if (!i.isValid())
- return false;
- Rectangle pos = i.getArea();
- if (pos.x == -1 || pos.y == -1 || pos.width == -1 || pos.height == -1)
- return false;
- int dy = (int) (pos.getHeight() - 4) / 2;
- int maxRandomX = (int) (pos.getMaxX() - pos.getCenterX());
- int midx = (int) (pos.getCenterX());
- int midy = (int) (pos.getMinY() + pos.getHeight() / 2);
- if (i.getIndex() == INTERFACE_PASSWORD_WINDOW) {
- mouse.click(minX(i), midy + random(-dy, dy), true);
- } else {
- mouse.click(midx + random(1, maxRandomX), midy + random(-dy, dy), true);
- }
- return true;
- }
- private int minX(RSComponent a) {
- int x = 0;
- Rectangle pos = a.getArea();
- int dx = (int) (pos.getWidth() - 4) / 2;
- int midx = (int) (pos.getMinX() + pos.getWidth() / 2);
- if (pos.x == -1 || pos.y == -1 || pos.width == -1 || pos.height == -1)
- return 0;
- for (int i = 0; i < interfaces.get(INTERFACE_LOGIN_SCREEN).getComponent(INTERFACE_PASSWORD).getText().length(); i++) {
- x += 11;
- }
- if (x > 44) {
- return (int) (pos.getMinX() + x + 15);
- } else {
- return midx + random(-dx, dx);
- }
- }
- private boolean atLoginScreen() {
- return interfaces.get(596).isValid();
- }
- private boolean isUsernameFilled(String user) {
- String username = user.replaceAll("_", " ").toLowerCase().trim();
- return interfaces.get(INTERFACE_LOGIN_SCREEN).getComponent(INTERFACE_USERNAME).getText().toLowerCase().equalsIgnoreCase(username);
- }
- private boolean isPasswordFilled(String pass) {
- return interfaces.get(INTERFACE_LOGIN_SCREEN).getComponent(INTERFACE_PASSWORD).getText().toLowerCase().length() == pass.length();
- }
- }
- public boolean onStart() {
- ISGUI.setVisible(true);
- randomTime = new Timer(Long.MAX_VALUE);
- return true;
- }
- public int loop() {
- while (ISGUI.isVisible())
- return 500;
- if (game.isLoginScreen() || game.getClientState() == 7) {
- inRandom = true;
- randomTime.reset();
- for (int a = 0; a < AccountList.size(); a++ ) {
- if (RandomList.contains(AccountList.get(a))) {
- continue;
- }
- i = a;
- break;
- }
- Login.login(AccountList.get(i), Password);
- return 500;
- }
- if (game.inRandom()) {
- game.logout(false);
- RandomList.add(AccountList.get(i));
- if (inRandom) {
- log(AccountList.get(i) + " is in random");
- log("Spent : " + randomTime.toElapsedString());
- }
- inRandom = false;
- return 200;
- }
- if (inventory.getCount() == 28) {
- inventory.dropAllExcept(false, Net);
- return random(500,900);
- }
- if (game.isLoggedIn() && calc.distanceTo(new RSTile(3087,3229)) >= 9 && inventory.contains(Net)) {
- walking.walkTo(new RSTile(3087,3229));
- return 1000;
- }
- if (game.isLoggedIn() && calc.distanceTo(new RSTile(3197,3253)) >= 5 && !inventory.contains(Net)) {
- walking.walkTo(new RSTile(3197,3253));
- return 2000;
- }
- RSNPC Shop = npcs.getNearest(8864);
- if (game.isLoggedIn() && calc.distanceTo(new RSTile(3197,3253)) <= 5 && Shop != null && calc.tileOnScreen(Shop.getLocation()) && !inventory.contains(Net)) {
- if (Shop != null && !store.isOpen()) {
- Shop.doAction("Trade");
- return 1000;
- }
- if (store.isOpen() && !inventory.contains(Net)) {
- interfaces.getComponent(620,26).getComponent(0).doAction("Take 1");
- return 1000;
- }
- return 1000;
- }
- if (inventory.getCount() != 28 && getMyPlayer().getAnimation() != 621 && inventory.contains(Net)) {
- RSNPC Spot = npcs.getNearest(FishSpot);
- if (Spot != null && Spot.getLocation() != null) {
- if (calc.distanceTo(Spot) > 3 || !calc.tileOnScreen(Spot.getLocation())) {
- walking.walkTo(Spot.getLocation());
- return 100;
- }
- Spot.doAction("Net");
- return 3000;
- }
- return 50;
- }
- return 100;
- }
- public void onRepaint(final Graphics g) {
- if (!game.isLoggedIn()) {
- g.setColor(new Color(0, 0, 0, 175));
- g.fillRoundRect(1, 62, 125, 215, 10, 10);
- g.setColor(Color.WHITE);
- g.drawString("~ Paint Stopped ~", 8, 77);
- g.drawString("Please Log In", 18, 104);
- return;
- }
- if (scriptStartTIME == -1) {
- scriptStartTIME = System.currentTimeMillis();
- }
- long seconds;
- long minutes = 0;
- long hours = 0;
- if (game.isLoggedIn()) {
- runTime = System.currentTimeMillis() - scriptStartTIME;
- seconds = runTime / 1000;
- if (seconds >= 60) {
- minutes = seconds / 60;
- seconds -= (minutes * 60);
- }
- if (minutes >= 60) {
- hours = minutes / 60;
- minutes -= (hours * 60);
- }
- g.setColor(new Color(0, 0, 0, 175));
- g.fillRoundRect(5, 65, 162, 15, 10, 10);
- g.setColor(Color.WHITE);
- g.drawString("Time running: " + Long.toString(hours) + ":" + Long.toString(minutes) + ":" + Long.toString(seconds), 8, 77);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement