Esempio n. 1
0
  @Override
  public boolean useUserCommand(int id, Player player) {
    if (!player.isClanLeader()) {
      player.sendPacket(SystemMsg.ONLY_THE_CLAN_LEADER_MAY_ISSUE_COMMANDS);
      return false;
    }

    Castle castle = player.getCastle();
    if (castle == null) return false;

    if (castle.getSiegeEvent().isInProgress())
      if (!player.isNoble()) {
        player.sendPacket(
            SystemMsg
                .ONLY_A_CLAN_LEADER_THAT_IS_A_NOBLESSE_CAN_VIEW_THE_SIEGE_WAR_STATUS_WINDOW_DURING_A_SIEGE_WAR);
        return false;
      }

    NpcHtmlMessage msg = new NpcHtmlMessage(5);
    msg.setFile("siege_status.htm");
    msg.replace("%name%", player.getName());
    msg.replace("%kills%", String.valueOf(0));
    msg.replace("%deaths%", String.valueOf(0));
    msg.replace("%type%", String.valueOf(0));

    player.sendPacket(msg);
    return true;
  }
Esempio n. 2
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    if (player.getEnchantScroll() != null) {
      Log.add(
          "Player "
              + player.getName()
              + " trying to use enchant exploit[Warehouse], ban this player!",
          "illegal-actions");
      player.setEnchantScroll(null);
      return;
    }

    if (command.startsWith("WithdrawP")) {
      int val = Integer.parseInt(command.substring(10));
      if (val == 99) {
        NpcHtmlMessage html = new NpcHtmlMessage(player, this);
        html.setFile("warehouse/personal.htm");
        html.replace("%npcname%", getName());
        player.sendPacket(html);
      } else WarehouseFunctions.showRetrieveWindow(player, val);
    } else if (command.equals("DepositP")) WarehouseFunctions.showDepositWindow(player);
    else if (command.startsWith("WithdrawC")) {
      int val = Integer.parseInt(command.substring(10));
      if (val == 99) {
        NpcHtmlMessage html = new NpcHtmlMessage(player, this);
        html.setFile("warehouse/clan.htm");
        html.replace("%npcname%", getName());
        player.sendPacket(html);
      } else WarehouseFunctions.showWithdrawWindowClan(player, val);
    } else if (command.equals("DepositC")) WarehouseFunctions.showDepositWindowClan(player);
    else super.onBypassFeedback(player, command);
  }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    UndergroundColiseumEvent coliseumEvent =
        EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, _coliseumId);

    if (command.equals("register")) {
      Party party = player.getParty();
      if (party == null) showChatWindow(player, "events/kerthang_manager008.htm");
      else if (party.getPartyLeader() != player)
        showChatWindow(player, "events/kerthang_manager004.htm");
      else
        for (Player $player : party)
          if ($player.getLevel() < coliseumEvent.getMinLevel()
              || $player.getLevel() > coliseumEvent.getMaxLevel()) {
            showChatWindow(player, "events/kerthang_manager011.htm", "%name%", $player.getName());
            return;
          }
    } else if (command.equals("viewTeams")) {

      List<Player> reg = coliseumEvent.getRegisteredPlayers();

      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("events/kerthang_manager003.htm");
      for (int i = 0; i < 5; i++) {
        Player $player = CollectionUtils.safeGet(reg, i);

        msg.replace("%team" + i + "%", $player == null ? StringUtils.EMPTY : $player.getName());
      }

      player.sendPacket(msg);
    } else super.onBypassFeedback(player, command);
  }
 @Override
 public void showChatWindow(Player player, int val, Object... arg) {
   if (!validateCondition(player)) {
     NpcHtmlMessage html = new NpcHtmlMessage(player, this);
     html.setFile("wyvern/lord_only.htm");
     html.replace("%npcname%", "Wyvern Manager " + getName());
     player.sendPacket(html);
     player.sendActionFailed();
     return;
   }
   NpcHtmlMessage html = new NpcHtmlMessage(player, this);
   html.setFile("wyvern/lord_here.htm");
   html.replace("%Char_name%", String.valueOf(player.getName()));
   html.replace("%npcname%", "Wyvern Manager " + getName());
   player.sendPacket(html);
   player.sendActionFailed();
 }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    StringTokenizer st = new StringTokenizer(command, " ");
    String actualCommand = st.nextToken();
    boolean condition = validateCondition(player);

    if (actualCommand.equalsIgnoreCase("RideHelp")) {
      NpcHtmlMessage html = new NpcHtmlMessage(player, this);
      html.setFile("wyvern/help_ride.htm");
      html.replace("%npcname%", "Wyvern Manager " + getName());
      player.sendPacket(html);
      player.sendActionFailed();
    }
    if (condition) {
      if (actualCommand.equalsIgnoreCase("RideWyvern") && player.isClanLeader())
        if (!player.isRiding() || !PetDataTable.isStrider(player.getMountNpcId())) {
          NpcHtmlMessage html = new NpcHtmlMessage(player, this);
          html.setFile("wyvern/not_ready.htm");
          html.replace("%npcname%", "Wyvern Manager " + getName());
          player.sendPacket(html);
        } else if (player.getInventory().getItemByItemId(1460) == null
            || player.getInventory().getItemByItemId(1460).getCount() < 25) {
          NpcHtmlMessage html = new NpcHtmlMessage(player, this);
          html.setFile("wyvern/havenot_cry.htm");
          html.replace("%npcname%", "Wyvern Manager " + getName());
          player.sendPacket(html);
        } else if (player.getInventory().destroyItemByItemId(1460, 25L)) {
          player.setMount(PetDataTable.WYVERN_ID, player.getMountObjId(), player.getMountLevel());
          NpcHtmlMessage html = new NpcHtmlMessage(player, this);
          html.setFile("wyvern/after_ride.htm");
          html.replace("%npcname%", "Wyvern Manager " + getName());
          player.sendPacket(html);
        }
    } else super.onBypassFeedback(player, command);
  }