public void start(Player player, int type, NpcInstance npc) {
    if (!player.isInParty()) {
      showHtmlFile(player, "rift/NoParty.htm", npc);
      return;
    }

    if (!player.isGM()) {
      if (!player.getParty().isLeader(player)) {
        showHtmlFile(player, "rift/NotPartyLeader.htm", npc);
        return;
      }

      if (player.getParty().isInDimensionalRift()) {
        showHtmlFile(player, "rift/Cheater.htm", npc);

        if (!player.isGM())
          _log.warn(
              "Player "
                  + player.getName()
                  + "("
                  + player.getObjectId()
                  + ") was cheating in dimension rift area!");

        return;
      }

      if (player.getParty().getMemberCount() < Config.RIFT_MIN_PARTY_SIZE) {
        showHtmlFile(player, "rift/SmallParty.htm", npc);
        return;
      }

      for (Player p : player.getParty().getPartyMembers())
        if (!checkIfInPeaceZone(p.getLoc())) {
          showHtmlFile(player, "rift/NotInWaitingRoom.htm", npc);
          return;
        }

      ItemInstance i;
      for (Player p : player.getParty().getPartyMembers()) {
        i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);
        if (i == null || i.getCount() < getNeededItems(type)) {
          showHtmlFile(player, "rift/NoFragments.htm", npc);
          return;
        }
      }

      for (Player p : player.getParty().getPartyMembers())
        if (!p.getInventory()
            .destroyItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID, getNeededItems(type))) {
          showHtmlFile(player, "rift/NoFragments.htm", npc);
          return;
        }
    }

    new DimensionalRift(player.getParty(), type, Rnd.get(1, _rooms.get(type).size() - 1));
  }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    if (command.startsWith("tryenter")) {
      if (NaiaLock.isEntranceActive()) {
        // instance
        if (!player.isInParty()) {
          player.sendPacket(SystemMsg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
          return;
        }
        if (!player.getParty().isLeader(player)) {
          player.sendPacket(SystemMsg.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
          return;
        }
        for (Player member : player.getParty().getPartyMembers()) {
          if (member.getLevel() < 80) {
            player.sendPacket(
                new SystemMessage(
                        SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED)
                    .addName(member));
            return;
          }
          if (!member.isInRange(this, 500)) {
            player.sendPacket(
                new SystemMessage(
                        SystemMessage
                            .C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED)
                    .addName(member));
            return;
          }
        }
        NaiaTowerManager.startNaiaTower(player);

        broadcastPacket(new MagicSkillUse(this, this, 5527, 1, 0, 0));
        doDie(null);
      } else {
        broadcastPacket(new MagicSkillUse(this, this, 5527, 1, 0, 0));
        doDie(null);
      }
    } else super.onBypassFeedback(player, command);
  }
示例#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));
  }