示例#1
0
  /**
   * Launching method for GameServer
   *
   * @param args arguments, not used
   */
  public static void main(String[] args) {
    long start = System.currentTimeMillis();

    initUtilityServicesAndConfig();

    GameServer gs = new GameServer();
    gs.spawnMonsters();

    // Loading quests
    QuestParser.getInstance();

    // Ininitialize skill engine
    SkillEngine.getInstance().registerAllSkills(gs.injector);

    // Drop list

    DropList.getInstance();

    Util.printMemoryUsage(log);
    log.info("###########################################################################");
    log.info(
        "AE Game Server started in " + (System.currentTimeMillis() - start) / 1000 + " seconds.");
    log.info("###########################################################################");

    gs.startServers();
    GameTimeManager.startClock();

    Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook()));

    // gs.injector.getInstance(com.aionemu.gameserver.utils.chathandlers.ChatHandlers.class);
  }
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_PRISON) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command!");
      return;
    }

    if (params.length == 0 || params.length > 2) {
      PacketSendUtility.sendMessage(admin, "syntax //rprison <player>");
      return;
    }

    try {
      Player playerFromPrison = World.getInstance().findPlayer(Util.convertName(params[0]));

      if (playerFromPrison != null) {
        PunishmentService.setIsInPrison(playerFromPrison, false, 0);
        PacketSendUtility.sendMessage(
            admin, "Player " + playerFromPrison.getName() + " removed from prison.");
      }
    } catch (NoSuchElementException nsee) {
      PacketSendUtility.sendMessage(admin, "Usage: //rprison <player>");
    } catch (Exception e) {
      PacketSendUtility.sendMessage(admin, "Usage: //rprison <player>");
    }
  }
 /** {@inheritDoc} */
 @Override
 protected void readImpl() {
   if (!(name = readS()).isEmpty()) {
     name = Util.convertName(name);
     readB(44 - (name.length() * 2 + 2));
   } else {
     readB(42);
   }
   region = readD();
   classMask = readD();
   minLevel = readC();
   maxLevel = readC();
   lfgOnly = readC();
   readC(); // 0x00 in search pane 0x30 in /who?
 }
示例#4
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_KINAH) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command.");
      return;
    }

    if (params == null || params.length < 1 || params.length > 2) {
      PacketSendUtility.sendMessage(admin, "syntax //kinah [player] <quantity>");
      return;
    }

    long kinahCount;
    Player receiver;

    if (params.length == 1) {
      receiver = admin;
      try {
        kinahCount = Integer.parseInt(params[0]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "Kinah value must be an integer.");
        return;
      }
    } else {
      receiver = World.getInstance().findPlayer(Util.convertName(params[0]));

      if (receiver == null) {
        PacketSendUtility.sendMessage(admin, "Could not find a player by that name.");
        return;
      }

      try {
        kinahCount = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "Kinah value must be an integer.");
        return;
      }
    }

    ItemService.increaseKinah(receiver, kinahCount);
    PacketSendUtility.sendMessage(admin, "Kinah given successfully.");
    PacketSendUtility.sendMessage(receiver, "An admin gives you some kinah.");
  }
示例#5
0
文件: UnGag.java 项目: soulxj/aion-cn
  @Override
  public void execute(Player admin, String... params) {
    if (params == null || params.length < 1) {
      PacketSendUtility.sendMessage(admin, "Syntax: //ungag <player>");
      return;
    }

    String name = Util.convertName(params[0]);
    Player player = World.getInstance().findPlayer(name);
    if (player == null) {
      PacketSendUtility.sendMessage(admin, "Player " + name + " was not found!");
      PacketSendUtility.sendMessage(admin, "Syntax: //ungag <player>");
      return;
    }

    player.setGagged(false);
    Future<?> task = player.getController().getTask(TaskId.GAG);
    if (task != null) player.getController().cancelTask(TaskId.GAG);
    PacketSendUtility.sendMessage(player, "You have been ungagged");

    PacketSendUtility.sendMessage(admin, "Player " + name + " ungagged");
  }
示例#6
0
文件: Add.java 项目: soulxj/aion-cn
  @Override
  public void execute(Player player, String... params) {
    if ((params.length < 0) || (params.length < 1)) {
      onFail(player, null);
      return;
    }
    int itemId = 0;
    long itemCount = 1;
    Player receiver;

    try {
      String item = params[0];
      // Some item links have space before Id
      if (item.equals("[item:")) {
        item = params[1];
        Pattern id = Pattern.compile("(\\d{9})");
        Matcher result = id.matcher(item);
        if (result.find()) itemId = Integer.parseInt(result.group(1));

        if (params.length == 3) itemCount = Long.parseLong(params[2]);
      } else {
        Pattern id = Pattern.compile("\\[item:(\\d{9})");
        Matcher result = id.matcher(item);

        if (result.find()) itemId = Integer.parseInt(result.group(1));
        else itemId = Integer.parseInt(params[0]);

        if (params.length == 2) itemCount = Long.parseLong(params[1]);
      }
      receiver = player;
    } catch (NumberFormatException e) {
      receiver = World.getInstance().findPlayer(Util.convertName(params[0]));
      if (receiver == null) {
        PacketSendUtility.sendMessage(player, "Could not find a player by that name.");
        return;
      }

      try {
        String item = params[1];
        // Some item links have space before Id
        if (item.equals("[item:")) {
          item = params[2];
          Pattern id = Pattern.compile("(\\d{9})");
          Matcher result = id.matcher(item);
          if (result.find()) itemId = Integer.parseInt(result.group(1));

          if (params.length == 4) itemCount = Long.parseLong(params[3]);
        } else {
          Pattern id = Pattern.compile("\\[item:(\\d{9})");
          Matcher result = id.matcher(item);

          if (result.find()) itemId = Integer.parseInt(result.group(1));
          else itemId = Integer.parseInt(params[1]);

          if (params.length == 3) itemCount = Long.parseLong(params[2]);
        }
      } catch (NumberFormatException ex) {
        PacketSendUtility.sendMessage(player, "You must give number to itemid.");
        return;
      } catch (Exception ex2) {
        PacketSendUtility.sendMessage(player, "Occurs an error.");
        return;
      }
    }

    if (DataManager.ITEM_DATA.getItemTemplate(itemId) == null) {
      PacketSendUtility.sendMessage(player, "Item id is incorrect: " + itemId);
      return;
    }

    if (!AdminService.getInstance().canOperate(player, receiver, itemId, "command //add")) return;

    long count = ItemService.addItem(receiver, itemId, itemCount);

    if (count == 0) {
      if (player != receiver) {
        PacketSendUtility.sendMessage(
            player,
            "You successfully gave "
                + itemCount
                + " x [item:"
                + itemId
                + "] to "
                + receiver.getName()
                + ".");
        PacketSendUtility.sendMessage(
            receiver,
            "You successfully received "
                + itemCount
                + " x [item:"
                + itemId
                + "] from "
                + player.getName()
                + ".");
      } else
        PacketSendUtility.sendMessage(
            player, "You successfully received " + itemCount + " x [item:" + itemId + "]");
    } else {
      PacketSendUtility.sendMessage(player, "Item couldn't be added");
    }
  }
示例#7
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_POWERUP) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
      return;
    }
    int index = 2;
    int i = 0;
    Player player = null;
    if (params.length != 0) {
      if ("help".startsWith(params[i])) {
        PacketSendUtility.sendMessage(admin, "0 to return to normal state");
        PacketSendUtility.sendMessage(admin, "//powerup <Multiplier = 2>");
        PacketSendUtility.sendMessage(
            admin,
            "Syntax:  //powerup [playerName] [Multiplier = 2]\n"
                + "  This command multiplies your actual power to the number given.\n"
                + "  Using 0 as the Multiplier resets the power to normal.\n"
                + "  Notice: You can ommit parameters between [], especially playerName.\n"
                + "  Target: Named player, then targeted player, only then self.\n"
                + "  Default Value: Multiplier is 2.");
        return;
      }
      player = World.getInstance().findPlayer(Util.convertName(params[i]));
      if (player == null) {
        VisibleObject target = admin.getTarget();
        if (target instanceof Player) player = (Player) target;
        else player = admin;
      } else i++;
      try {
        index = Integer.parseInt(params[i]);
      } catch (NumberFormatException ex) {
        PacketSendUtility.sendMessage(admin, "Wrong input use //powerup help");
        return;
      } catch (Exception ex2) {
        PacketSendUtility.sendMessage(admin, "Occurs an error.");
        return;
      }
    }
    if (index == 0) {
      player.getGameStats().recomputeStats();
      player.getLifeStats().increaseHp(TYPE.HP, admin.getLifeStats().getMaxHp() + 1);
      player.getLifeStats().increaseMp(TYPE.MP, admin.getLifeStats().getMaxMp() + 1);
      PacketSendUtility.sendPacket(player, new SM_STATS_INFO(admin));
      if (player == admin) PacketSendUtility.sendMessage(player, "You are now normal again.");
      else {
        PacketSendUtility.sendMessage(
            admin, "Player " + player.getName() + " is now normal again.");
        PacketSendUtility.sendMessage(
            player, "Admin " + admin.getName() + " made you normal again.");
      }
      return;
    }
    player.getGameStats().setStat(StatEnum.MAXMP, admin.getLifeStats().getMaxHp() * index);
    player.getGameStats().setStat(StatEnum.MAXHP, admin.getLifeStats().getMaxMp() * index);

    player
        .getGameStats()
        .setStat(StatEnum.BLOCK, admin.getGameStats().getStatBonus(StatEnum.BLOCK) * index);
    player
        .getGameStats()
        .setStat(StatEnum.EVASION, admin.getGameStats().getStatBonus(StatEnum.EVASION) * index);
    player
        .getGameStats()
        .setStat(StatEnum.HEALTH, admin.getGameStats().getStatBonus(StatEnum.HEALTH) * index);
    player
        .getGameStats()
        .setStat(StatEnum.ACCURACY, admin.getGameStats().getStatBonus(StatEnum.ACCURACY) * index);
    player
        .getGameStats()
        .setStat(StatEnum.PARRY, admin.getGameStats().getStatBonus(StatEnum.PARRY) * index);

    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_ACCURACY,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_ACCURACY) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_CRITICAL,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_CRITICAL) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_POWER,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_POWER) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_ATTACK_SPEED,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_POWER) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_ACCURACY,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_ACCURACY) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_CRITICAL,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_CRITICAL) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_POWER,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_POWER) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_ATTACK_SPEED,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_ATTACK_SPEED) * index);

    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_ATTACK,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_ATTACK) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_ACCURACY,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_ACCURACY) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_CRITICAL,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_CRITICAL) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_RESIST,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_RESIST) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.BOOST_MAGICAL_SKILL,
            admin.getGameStats().getStatBonus(StatEnum.BOOST_MAGICAL_SKILL) * index * 15);

    player
        .getGameStats()
        .setStat(StatEnum.REGEN_MP, admin.getGameStats().getStatBonus(StatEnum.REGEN_MP) * index);
    player
        .getGameStats()
        .setStat(StatEnum.REGEN_HP, admin.getGameStats().getStatBonus(StatEnum.REGEN_HP) * index);

    player.getLifeStats().increaseHp(TYPE.HP, admin.getLifeStats().getMaxHp() + 1);
    player.getLifeStats().increaseMp(TYPE.MP, admin.getLifeStats().getMaxMp() + 1);
    PacketSendUtility.sendPacket(player, new SM_STATS_INFO(admin));
    if (player == admin)
      PacketSendUtility.sendMessage(
          player, "You are now " + index + " times more powerfull than before.");
    else {
      PacketSendUtility.sendMessage(
          admin,
          "Player " + player.getName() + " is now " + index + " times more powerfull than before.");
      PacketSendUtility.sendMessage(
          player,
          "Admin " + admin.getName() + " made you " + index + " times more powerfull than before.");
    }
  }