public ExInzoneWaitingInfo(Player player) {
    collapseInstanceTime = new FastMap<>();

    if (player.getActiveReflection() != null) {
      instanceZoneId = player.getActiveReflection().getInstancedZoneId();
    }

    for (int i : player.getInstanceReuses().keySet()) {
      int timeToCollapse = InstantZoneHolder.getInstance().getMinutesToNextEntrance(i, player);

      if (timeToCollapse > 0) {
        collapseInstanceTime.put(i, timeToCollapse * 60);
      }
    }
  }
Esempio n. 2
0
  /**
   * Method useUserCommand.
   *
   * @param id int
   * @param activeChar Player
   * @return boolean
   * @see lineage2.gameserver.handlers.IUserCommandHandler#useUserCommand(int, Player)
   */
  @Override
  public boolean useUserCommand(int id, Player activeChar) {
    if (COMMAND_IDS[0] != id) {
      return false;
    }

    if (activeChar.getActiveReflection() != null) {
      activeChar.sendPacket(
          new SystemMessage2(SystemMsg.INSTANT_ZONE_CURRENTLY_IN_USE_S1)
              .addInstanceName(activeChar.getActiveReflection().getInstancedZoneId()));
    }

    int limit;
    boolean noLimit = true;
    boolean showMsg = false;

    for (int i : activeChar.getInstanceReuses().keySet()) {
      limit = InstantZoneHolder.getInstance().getMinutesToNextEntrance(i, activeChar);

      if (limit > 0) {
        noLimit = false;

        if (!showMsg) {
          activeChar.sendPacket(SystemMsg.INSTANCE_ZONE_TIME_LIMIT);
          showMsg = true;
        }

        activeChar.sendPacket(
            new SystemMessage2(SystemMsg.S1_WILL_BE_AVAILABLE_FOR_REUSE_AFTER_S2_HOURS_S3_MINUTES)
                .addInstanceName(i)
                .addInteger(limit / 60)
                .addInteger(limit % 60));
      }
    }

    if (noLimit) {
      activeChar.sendPacket(SystemMsg.THERE_IS_NO_INSTANCE_ZONE_UNDER_A_TIME_LIMIT);
    }

    return true;
  }