@TextCommand("manor_menu_select")
  public boolean manorMenu(BypassHandlerParams params) {
    L2PcInstance activeChar = params.getPlayer();
    L2Npc manager = activeChar.getLastFolkNPC();
    if (!activeChar.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, true, false)) {
      return false;
    }

    try {
      Castle castle = manager.getCastle();

      if (CastleManorManager.getInstance().isUnderMaintenance()) {
        activeChar.sendActionFailed();
        activeChar.sendPacket(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE);
        return true;
      }

      int ask = Integer.parseInt(params.getQueryArgs().get("ask"));
      int state = Integer.parseInt(params.getQueryArgs().get("state"));
      int time = Integer.parseInt(params.getQueryArgs().get("time"));

      int castleId;
      castleId = state < 0 ? castle.getCastleId() : state;

      switch (ask) {
        case 1: // Seed purchase
          if (castleId == castle.getCastleId()) {
            activeChar.sendPacket(
                new BuyListSeed(
                    activeChar.getAdenaCount(),
                    castleId,
                    castle.getSeedProduction(CastleManorManager.PERIOD_CURRENT)));
          } else {
            activeChar.sendPacket(
                SystemMessage.getSystemMessage(
                        SystemMessageId.HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR)
                    .addString(manager.getCastle().getName()));
          }
          break;
        case 2: // Crop sales
          activeChar.sendPacket(
              new ExShowSellCropList(
                  activeChar, castleId, castle.getCropProcure(CastleManorManager.PERIOD_CURRENT)));
          break;
        case 3: // Current seeds (Manor info)
          if (time == 1
              && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved()) {
            activeChar.sendPacket(new ExShowSeedInfo(castleId, null));
          } else {
            activeChar.sendPacket(
                new ExShowSeedInfo(
                    castleId,
                    CastleManager.getInstance().getCastleById(castleId).getSeedProduction(time)));
          }
          break;
        case 4: // Current crops (Manor info)
          if (time == 1
              && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved()) {
            activeChar.sendPacket(new ExShowCropInfo(castleId, null));
          } else {
            activeChar.sendPacket(
                new ExShowCropInfo(
                    castleId,
                    CastleManager.getInstance().getCastleById(castleId).getCropProcure(time)));
          }
          break;
        case 5: // Basic info (Manor info)
          activeChar.sendPacket(new ExShowManorDefaultInfo());
          break;
        case 6: // Buy harvester
          manager.showBuyList(activeChar, 0);
          break;
        case 7: // Edit seed setup
          if (castle.isNextPeriodApproved()) {
            activeChar.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM);
          } else {
            activeChar.sendPacket(new ExShowSeedSetting(castle.getCastleId()));
          }
          break;
        case 8: // Edit crop setup
          if (castle.isNextPeriodApproved()) {
            activeChar.sendPacket(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM);
          } else {
            activeChar.sendPacket(new ExShowCropSetting(castle.getCastleId()));
          }
          break;
        case 9: // Edit sales (Crop sales)
          activeChar.sendPacket(new ExShowProcureCropDetail(state));
          break;
        default:
          return false;
      }
      return true;
    } catch (Exception e) {
      log.log(Level.ERROR, e);
    }
    return false;
  }
 @TextCommand
 public boolean worldStatistic(BypassHandlerParams params) {
   params.getTarget().sendPacket(new ExShowStatPage(-2));
   return true;
 }