@Override
  public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    try {
      final L2Npc olymanager = activeChar.getLastFolkNPC();

      if (command.startsWith(COMMANDS[0])) // list
      {
        if (!Olympiad.getInstance().inCompPeriod()) {
          activeChar.sendPacket(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS);
          return false;
        }

        activeChar.sendPacket(new ExOlympiadMatchList());
      } else {
        if ((olymanager == null) || !(olymanager instanceof L2OlympiadManagerInstance)) {
          return false;
        }

        if (!activeChar.inObserverMode()
            && !activeChar.isInsideRadius(olymanager, 300, false, false)) {
          return false;
        }

        if (OlympiadManager.getInstance().isRegisteredInComp(activeChar)) {
          activeChar.sendPacket(
              SystemMessageId
                  .WHILE_YOU_ARE_ON_THE_WAITING_LIST_YOU_ARE_NOT_ALLOWED_TO_WATCH_THE_GAME);
          return false;
        }

        if (!Olympiad.getInstance().inCompPeriod()) {
          activeChar.sendPacket(SystemMessageId.THE_OLYMPIAD_GAME_IS_NOT_CURRENTLY_IN_PROGRESS);
          return false;
        }

        if (activeChar.isOnEvent()) {
          activeChar.sendMessage("You can not observe games while registered on an event");
          return false;
        }

        final int arenaId = Integer.parseInt(command.substring(12).trim());
        final OlympiadGameTask nextArena =
            OlympiadGameManager.getInstance().getOlympiadTask(arenaId);
        if (nextArena != null) {
          activeChar.enterOlympiadObserverMode(
              nextArena.getZone().getSpectatorSpawns().get(0), arenaId);
          activeChar.setInstanceId(
              OlympiadGameManager.getInstance().getOlympiadTask(arenaId).getZone().getInstanceId());
        }
      }
      return true;

    } catch (Exception e) {
      _log.log(Level.WARNING, "Exception in " + getClass().getSimpleName(), e);
    }
    return false;
  }
Exemple #2
0
 @Override
 public void onExit(BuffInfo info) {
   if (info.getEffected().isPlayer()) {
     L2PcInstance activeChar = info.getEffected().getActingPlayer();
     if (!activeChar.inObserverMode()) {
       activeChar.setInvisible(false);
     }
   }
 }
  @Override
  public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item) {
    final L2PcInstance player = effector.getActingPlayer();
    if (player == null) {
      return false;
    }

    boolean canSummon = true;

    if (Config.RESTORE_PET_ON_RECONNECT
        && CharSummonTable.getInstance().getPets().containsKey(player.getObjectId())) {
      player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME);
      canSummon = false;
    } else if (player.hasPet()) {
      player.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_MULTIPLE_PETS_AT_THE_SAME_TIME);
      canSummon = false;
    } else if (player.isFlyingMounted()
        || player.isMounted()
        || player.inObserverMode()
        || player.isTeleporting()) {
      canSummon = false;
    }
    return (_val == canSummon);
  }