示例#1
0
 public GMViewItemList(Player cha, ItemInstance[] items, int size) {
   _size = size;
   _items = items;
   _name = cha.getName();
   _limit = cha.getInventoryLimit();
   _player = cha;
 }
  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));
  }
示例#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));
  }
  public String getName() {
    if (_player == null) return "";

    return _player.getName();
  }