Esempio n. 1
0
  /** Handle Messages. */
  public void handleEvent(Message event) {
    if (event.getMessageType() != Message.PRIVATE_MESSAGE
        && event.getMessageType() != Message.REMOTE_PRIVATE_MESSAGE) return;

    Player p = m_botAction.getPlayer(event.getPlayerID());

    if (p == null) return;

    String name = p.getPlayerName();
    String msg = event.getMessage();

    if (m_opList.isER(name)) {
      if (msg.startsWith("!autoon")) {
        cmdOn(name);
      } else if (msg.startsWith("!autooff")) {
        cmdOff(name);
      } else if (msg.startsWith("!listtasks")) {
        cmdList(name);
      } else if (msg.startsWith("!addtask ")) {
        cmdAdd(name, msg.substring(9));
      } else if (msg.startsWith("!removetask ")) {
        cmdRemove(name, msg.substring(12));
      } else if (msg.startsWith("!modinfo")) {
        cmdModInfo(name);
      }
    }

    if (msg.startsWith("!info")) {
      cmdInfo(name);
    } else {
      cmdDefault(name, msg);
    }
  }
Esempio n. 2
0
  public DuelPlayer(Player p, duel2bot bot) {
    staffer = null;
    name = p.getPlayerName();
    this.bot = bot;
    team = null;
    teams = new int[6];
    ba = bot.ba;
    rules = null;
    freq = p.getFrequency();
    ship = p.getShipType();
    rating = 1000;

    if (ship > 0) status = IN;
    else status = SPEC;

    create = false;
    registered = false;
    banned = false;
    enabled = false;
    userMID = -1;
    userIP = "";
    bot.lagChecks.add(name.toLowerCase());
    user = new UserData(ba, db, name, true);
    getRules();
    sql_setupUser();
  }
Esempio n. 3
0
 /**
  * Warps the player after the player just warped
  *
  * @param x int
  * @param y int
  */
 public void warpWarper(int x, int y) {
   setStatus(WARPING);
   Player p1 = ba.getPlayer(name);
   ba.warpTo(name, x, y);
   p1.updatePlayerPositionManuallyAfterWarp(x, y);
   setStatus(PLAYING);
 }
Esempio n. 4
0
  /**
   * Sets the player as part of a team.
   *
   * @param team DuelTeam
   */
  public void setTeam(DuelTeam team) {
    this.team = team;
    rules = team.rules;
    freq = team.freq;

    if (team.div != 5) ship = team.ship;
    else {
      Player p = ba.getPlayer(name);
      ship = p.getShipType();
    }
  }
Esempio n. 5
0
  /**
   * Warps the player to the specified coordinates (in tiles)
   *
   * @param x int
   * @param y int
   */
  public void warp(int x, int y) {
    setStatus(WARPING);
    Player p1 = ba.getPlayer(name);

    if (p1 == null) return;

    ba.shipReset(name);
    ba.warpTo(name, x, y);
    p1.updatePlayerPositionManuallyAfterWarp(x, y);
    setStatus(PLAYING);
    ba.specificPrize(name, 15);
  }
Esempio n. 6
0
  /** Removes votes of players who have left. */
  public void handleEvent(PlayerLeft event) {
    if (!isEnabled) return;

    if (tasks.size() == 0) return;

    Player p = m_botAction.getPlayer(event.getPlayerID());

    if (p == null) return;

    for (int i = 0; i < tasks.size(); i++) {
      AutoTask c = tasks.get(i);

      if (c != null) c.removeVote(p.getPlayerName());
    }
  }