Package org.rsbot.bot

Examples of org.rsbot.bot.Bot


  }

  private void checkData() {
    if (uidData != null) {
      if (client == null) {
        final Bot b = Application.getBot(this);
        if (b == null) {
          return;
        }
        client = b.getClient();
      }
      final String accountName = client != null ? client.getCurrentUsername() : "";

      if (!uidData.getLastUsed().equals(accountName) && data != null) {
        uidData.setUID(uidData.getLastUsed(), data);
View Full Code Here


            option, JOptionPane.QUESTION_MESSAGE, null, null, pretext);
        if (!(key == null || key.trim().isEmpty())) {
          ScriptDownloader.save(key);
        }
      } else if (option.equals(Messages.RUNSCRIPT)) {
        final Bot current = getCurrentBot();
        if (current != null) {
          showScriptSelector(current);
        }
      } else if (option.equals(Messages.STOPSCRIPT)) {
        final Bot current = getCurrentBot();
        if (current != null) {
          showStopScript(current);
        }
      } else if (option.equals(Messages.PAUSESCRIPT)) {
        final Bot current = getCurrentBot();
        if (current != null) {
          pauseScript(current);
        }
      } else if (option.equals(Messages.SAVESCREENSHOT)) {
        final Bot current = getCurrentBot();
        if (current != null && current.getMethodContext() != null) {
          ScreenshotUtil.saveScreenshot(current, current.getMethodContext().game.isLoggedIn());
        }
      } else if (option.equals(Messages.HIDE)) {
        setTray();
      } else if (option.equals(Messages.EXIT)) {
        cleanExit();
      }
    } else if (menu.equals(Messages.EDIT)) {
      if (option.equals(Messages.ACCOUNTS)) {
        AccountManager.getInstance().showGUI();
      } else {
        final Bot current = getCurrentBot();
        if (current != null) {
          if (option.equals(Messages.FORCEINPUT)) {
            current.overrideInput = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
            updateScriptControls();
          } else if (option.equals(Messages.LESSCPU)) {
            current.disableRendering = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
          } else if (option.equals(Messages.DISABLECANVAS)) {
            current.disableGraphics = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
          } else if (option.equals(Messages.EXTDVIEWS)) {
            menuBar.setExtendedView(((JCheckBoxMenuItem) evt.getSource()).isSelected());
          } else if (option.equals(Messages.DISABLEANTIRANDOMS)) {
            current.disableRandoms = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
          } else if (option.equals(Messages.DISABLEAUTOLOGIN)) {
            current.disableAutoLogin = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
          } else if (option.equals(Messages.DISABLETHEME)) {
            Preferences.getInstance().theme = !((JCheckBoxMenuItem) evt.getSource()).isSelected();
            log.info("Themes will be " + (Preferences.getInstance().theme ? "enabled" : "disabled") + " next time you run the application");
          } else if (option.equals(Messages.DISABLEADS)) {
            Preferences.getInstance().hideAds = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
          }
        }
      }
    } else if (menu.equals(Messages.VIEW)) {
      final Bot current = getCurrentBot();
      final boolean selected = ((JCheckBoxMenuItem) evt.getSource()).isSelected();
      if (option.equals(Messages.HIDETOOLBAR)) {
        toggleViewState(toolBar, selected);
      } else if (option.equals(Messages.HIDELOGPANE)) {
        toggleViewState(textScroll, selected);
      } else if (current != null) {
        if (option.equals(Messages.ALLDEBUGGING)) {
          for (final String key : BotMenuBar.DEBUG_MAP.keySet()) {
            final Class<?> el = BotMenuBar.DEBUG_MAP.get(key);
            if (menuBar.getCheckBox(key).isVisible()) {
              final boolean wasSelected = menuBar.getCheckBox(key).isSelected();
              menuBar.getCheckBox(key).setSelected(selected);
              if (selected) {
                if (!wasSelected) {
                  current.addListener(el);
                }
              } else {
                if (wasSelected) {
                  current.removeListener(el);
                }
              }
            }
          }
        } else {
          final Class<?> el = BotMenuBar.DEBUG_MAP.get(option);
          menuBar.getCheckBox(option).setSelected(selected);
          if (selected) {
            current.addListener(el);
          } else {
            menuBar.getCheckBox(Messages.ALLDEBUGGING).setSelected(false);
            current.removeListener(el);
          }
        }
      }
    } else if (menu.equals(Messages.TOOLS)) {
      if (option.equals(Messages.LICENSES)) {
        log.warning("License manager coming soon");
      }
    } else if (menu.equals(Messages.HELP)) {
      if (option.equals(Messages.SITE)) {
        openURL(Configuration.Paths.URLs.SITE);
      } else if (option.equals(Messages.PROJECT)) {
        openURL(Configuration.Paths.URLs.PROJECT);
      } else if (option.equals(Messages.LICENSE)) {
        openURL(Configuration.Paths.URLs.LICENSE);
      } else if (option.equals(Messages.ABOUT)) {
        JOptionPane.showMessageDialog(this, new String[]{
            "An open source bot developed by the community.",
            "",
            "RuneScape® is a trademark of Jagex © 1999 - 2011 Jagex, Ltd.",
            "RuneScape content and materials are trademarks and copyrights of Jagex or its licensees.",
            "This program is issued with no warranty and is not affiliated with Jagex Ltd., nor do they endorse usage of our software.",
            "",
            "Visit " + Configuration.Paths.URLs.SITE + "/ for more information."},
            option,
            JOptionPane.INFORMATION_MESSAGE);
      }
    } else if (menu.equals("Tab")) {
      final Bot curr = getCurrentBot();
      menuBar.setBot(curr);
      panel.setBot(curr);
      panel.repaint();
      toolBar.setHome(curr == null);
      setTitle(curr == null ? null : curr.getAccountName());
      updateScriptControls();
    }
  }
View Full Code Here

    }
  }

  public void updateScriptControls() {
    boolean idle = true, paused = false;
    final Bot bot = getCurrentBot();

    if (bot != null) {
      final Map<Integer, LoopTask> scriptMap = bot.getScriptHandler().getRunningScripts();
      if (scriptMap.size() > 0) {
        idle = false;
        paused = scriptMap.values().iterator().next().isPaused();
      } else {
        idle = true;
View Full Code Here

  public void addBot() {
    if (bots.size() > MAX_BOTS) {
      return;
    }
    final Bot bot = new Bot();
    bots.add(bot);
    toolBar.addTab();
    toolBar.setAddTabVisible(bots.size() < MAX_BOTS);
    bot.getScriptHandler().addScriptListener(this);
    new Thread(new Runnable() {
      public void run() {
        bot.start();
      }
    }).start();
  }
View Full Code Here

      pack();
    }
  }

  private void lessCpu(boolean on) {
    final Bot bot = getCurrentBot();
    if (bot != null) {
      disableRendering(on || menuBar.isTicked(Messages.LESSCPU));
      disableGraphics(on || menuBar.isTicked(Messages.DISABLECANVAS));
    }
  }
View Full Code Here

  }

  public void scriptStarted(final ScriptHandler handler) {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        final Bot bot = handler.getBot();
        bot.inputFlags = Environment.INPUT_KEYBOARD;
        bot.overrideInput = false;
        final String acct = bot.getAccountName();
        toolBar.setTabLabel(bots.indexOf(bot), acct == null ? Messages.TABDEFAULTTEXT : acct);
        if (bot == getCurrentBot()) {
          updateScriptControls();
          setTitle(acct);
        }
View Full Code Here

  }

  public void scriptStopped(final ScriptHandler handler) {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        final Bot bot = handler.getBot();
        bot.inputFlags = Environment.INPUT_KEYBOARD | Environment.INPUT_MOUSE;
        bot.overrideInput = false;
        toolBar.setTabLabel(bots.indexOf(bot), Messages.TABDEFAULTTEXT);
        if (bot == getCurrentBot()) {
          updateScriptControls();
View Full Code Here

TOP

Related Classes of org.rsbot.bot.Bot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.