@Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (command.startsWith("start1")) {
      // тут пропускам т.к. это первый этаж, и перемещение на него == вход в инстанс
    } else if (command.startsWith("start2")) {

      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar1");
        party.setVar("Altar2", "true", -1);
        party.teleToLocation(FLOOR2, player.getReflection());
      }
    } else if (command.startsWith("start3")) {
      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar2");
        party.setVar("Altar3", "true", -1);
        party.teleToLocation(FLOOR3, player.getReflection());
      }

    } else if (command.startsWith("exit")) {
      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar3");
        party.teleToLocation(OFF, 0);
      }
    } else {
      super.onBypassFeedback(player, command);
    }
  }
    @Override
    public void runImpl() throws Exception {
      if (isNowNight()) getInstance().getListenerEngine().onNight();
      else getInstance().getListenerEngine().onDay();

      for (Player player : GameObjectsStorage.getAllPlayersForIterate()) {
        player.checkDayNightMessages();
        player.sendPacket(new ClientSetTime());
      }
    }
示例#3
0
  @Override
  protected void runImpl() {
    Player activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    if (activeChar.isOutOfControl()) {
      activeChar.sendActionFailed();
      return;
    }

    if (activeChar.isProcessingRequest()) {
      activeChar.sendPacket(SystemMsg.WAITING_FOR_ANOTHER_REPLY);
      return;
    }

    if (activeChar.isChaosFestivalParticipant()) {
      activeChar.sendPacket(
          SystemMsg
              .YOU_CANNOT_INVITE_A_FRIEND_OR_PARTY_WHILE_PARTICIPATING_IN_THE_CEREMONY_OF_CHAOS);
      return;
    }

    Player target = World.getPlayer(_name);
    if (target == null) {
      FakePlayerInstance fakePlayer = GameObjectsStorage.getFakePlayerByName(_name);
      if (fakePlayer != null) {
        new Request(L2RequestType.PARTY, activeChar, null)
            .setTimeout(10000L)
            .set("itemDistribution", _itemDistribution);
        activeChar.sendPacket(
            new SystemMessage2(SystemMsg.C1_HAS_BEEN_INVITED_TO_THE_PARTY).addName(fakePlayer));
        return;
      }
      activeChar.sendPacket(SystemMsg.THAT_PLAYER_IS_NOT_ONLINE);
      return;
    }

    if (target == activeChar) {
      activeChar.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      activeChar.sendActionFailed();
      return;
    }

    if (Config.DISABLE_PARTY_ON_EVENT && target.isInPvPEvent()) {
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addName(target));
      return;
    }

    if (Config.DISABLE_PARTY_ON_EVENT && activeChar.isInPvPEvent()) {
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addName(target));
      return;
    }

    if (target.isChaosFestivalParticipant()) {
      activeChar.sendActionFailed();
      return;
    }

    if (target.isBusy()) {
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addName(target));
      return;
    }

    IStaticPacket problem = target.canJoinParty(activeChar);
    if (problem != null) {
      activeChar.sendPacket(problem);
      return;
    }

    if (activeChar.isInParty()) {
      if (activeChar.getParty().getMemberCount() >= Party.MAX_SIZE) {
        activeChar.sendPacket(SystemMsg.THE_PARTY_IS_FULL);
        return;
      }

      // Только Party Leader может приглашать новых членов
      if (Config.PARTY_LEADER_ONLY_CAN_INVITE && !activeChar.getParty().isLeader(activeChar)) {
        activeChar.sendPacket(SystemMsg.ONLY_THE_LEADER_CAN_GIVE_OUT_INVITATIONS);
        return;
      }

      if (activeChar.getParty().isInDimensionalRift()) {
        activeChar.sendMessage(
            new CustomMessage(
                "l2s.gameserver.clientpackets.RequestJoinParty.InDimensionalRift", activeChar));
        activeChar.sendActionFailed();
        return;
      }
    }

    if (target.isFakePlayer() && activeChar.isGM()) {
      Party party = activeChar.getParty();

      if (party == null) {
        activeChar.setParty(party = new Party(activeChar, Party.ITEM_ORDER_SPOIL));
      }

      party.addPartyMember(target);
      return;
    }

    new Request(L2RequestType.PARTY, activeChar, target)
        .setTimeout(10000L)
        .set("itemDistribution", _itemDistribution);

    target.sendPacket(new AskJoinParty(activeChar.getName(), _itemDistribution));
    activeChar.sendPacket(
        new SystemMessage2(SystemMsg.C1_HAS_BEEN_INVITED_TO_THE_PARTY).addName(target));
  }
 private static boolean BumbalumpSpawned() {
   return GameObjectsStorage.getByNpcId(RB_Icicle_Emperor_Bumbalump) != null;
 }