Пример #1
0
  private static final void showWithdrawWindow(
      L2PcInstance player, WarehouseListType itemtype, byte sortorder) {
    player.sendPacket(ActionFailed.STATIC_PACKET);

    if (!player.hasClanPrivilege(ClanPrivilege.CL_VIEW_WAREHOUSE)) {
      player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_THE_CLAN_WAREHOUSE);
      return;
    }

    player.setActiveWarehouse(player.getClan().getWarehouse());

    if (player.getActiveWarehouse().getSize() == 0) {
      player.sendPacket(SystemMessageId.YOU_HAVE_NOT_DEPOSITED_ANY_ITEMS_IN_YOUR_WAREHOUSE);
      return;
    }

    for (L2ItemInstance i : player.getActiveWarehouse().getItems()) {
      if (i.isTimeLimitedItem() && (i.getRemainingTime() <= 0)) {
        player.getActiveWarehouse().destroyItem("L2ItemInstance", i, player, null);
      }
    }
    if (itemtype != null) {
      player.sendPacket(
          new SortedWareHouseWithdrawalList(
              player, WareHouseWithdrawalList.CLAN, itemtype, sortorder));
    } else {
      player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN));
    }

    if (Config.DEBUG) {
      _log.fine(
          "Source: L2WarehouseInstance.java; Player: "
              + player.getName()
              + "; Command: showRetrieveWindowClan; Message: Showing stored items.");
    }
  }
Пример #2
0
  @Override
  public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    if (!(target instanceof L2WarehouseInstance)
        && !(target instanceof L2ClanHallManagerInstance)) {
      return false;
    }

    if (activeChar.hasItemRequest()) {
      return false;
    }

    if (activeChar.getClan() == null) {
      activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_THE_CLAN_WAREHOUSE);
      return false;
    }

    if (activeChar.getClan().getLevel() == 0) {
      activeChar.sendPacket(
          SystemMessageId.ONLY_CLANS_OF_CLAN_LEVEL_1_OR_ABOVE_CAN_USE_A_CLAN_WAREHOUSE);
      return false;
    }

    try {
      if (command.toLowerCase().startsWith(COMMANDS[0])) // WithdrawC
      {
        if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_CLAN) {
          final NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc) target).getObjectId());
          msg.setFile(activeChar.getHtmlPrefix(), "html/mods/WhSortedC.htm");
          msg.replace("%objectId%", String.valueOf(((L2Npc) target).getObjectId()));
          activeChar.sendPacket(msg);
        } else {
          showWithdrawWindow(activeChar, null, (byte) 0);
        }
        return true;
      } else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedC
      {
        final String param[] = command.split(" ");

        if (param.length > 2) {
          showWithdrawWindow(
              activeChar,
              WarehouseListType.valueOf(param[1]),
              SortedWareHouseWithdrawalList.getOrder(param[2]));
        } else if (param.length > 1) {
          showWithdrawWindow(
              activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
        } else {
          showWithdrawWindow(activeChar, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
        }
        return true;
      } else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositC
      {
        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
        activeChar.setActiveWarehouse(activeChar.getClan().getWarehouse());
        activeChar.setInventoryBlockingStatus(true);

        if (Config.DEBUG) {
          _log.fine(
              "Source: L2WarehouseInstance.java; Player: "
                  + activeChar.getName()
                  + "; Command: showDepositWindowClan; Message: Showing items to deposit.");
        }

        activeChar.sendPacket(new WareHouseDepositList(activeChar, WareHouseDepositList.CLAN));
        return true;
      }

      return false;
    } catch (Exception e) {
      _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
    }
    return false;
  }