Package lineage2.gameserver.model

Examples of lineage2.gameserver.model.Request


    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Request request = activeChar.getRequest();
    if ((request == null) || !request.isTypeOf(L2RequestType.CHANNEL))
    {
      return;
    }
    if (!request.isInProgress())
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (activeChar.isOutOfControl())
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    Player requestor = request.getRequestor();
    if (requestor == null)
    {
      request.cancel();
      activeChar.sendPacket(Msg.THAT_PLAYER_IS_NOT_ONLINE);
      activeChar.sendActionFailed();
      return;
    }
    if (requestor.getRequest() != request)
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (_response == 0)
    {
      request.cancel();
      requestor.sendPacket(new SystemMessage(SystemMessage.S1_HAS_DECLINED_THE_CHANNEL_INVITATION).addString(activeChar.getName()));
      return;
    }
    if (!requestor.isInParty() || !activeChar.isInParty() || activeChar.getParty().isInCommandChannel())
    {
      request.cancel();
      requestor.sendPacket(Msg.NO_USER_HAS_BEEN_INVITED_TO_THE_COMMAND_CHANNEL);
      return;
    }
    if (activeChar.isTeleporting())
    {
      request.cancel();
      activeChar.sendPacket(Msg.YOU_CANNOT_JOIN_A_COMMAND_CHANNEL_WHILE_TELEPORTING);
      requestor.sendPacket(Msg.NO_USER_HAS_BEEN_INVITED_TO_THE_COMMAND_CHANNEL);
      return;
    }
    try
    {
      if (requestor.getParty().isInCommandChannel())
      {
        requestor.getParty().getCommandChannel().addParty(activeChar.getParty());
      }
      else if (CommandChannel.checkAuthority(requestor))
      {
        boolean haveSkill = requestor.getSkillLevel(CommandChannel.CLAN_IMPERIUM_ID) > 0;
        boolean haveItem = false;
        if (!haveSkill)
        {
          haveItem = requestor.getInventory().destroyItemByItemId(CommandChannel.STRATEGY_GUIDE_ID, 1);
          if (haveItem)
          {
            requestor.sendPacket(SystemMessage2.removeItems(CommandChannel.STRATEGY_GUIDE_ID, 1));
          }
        }
        if (!haveSkill && !haveItem)
        {
          return;
        }
        CommandChannel channel = new CommandChannel(requestor);
        requestor.sendPacket(Msg.THE_COMMAND_CHANNEL_HAS_BEEN_FORMED);
        channel.addParty(activeChar.getParty());
      }
    }
    finally
    {
      request.done();
    }
  }
View Full Code Here


   * @param target Player
   */
  @Override
  public void askDuel(Player player, Player target)
  {
    Request request = new Request(Request.L2RequestType.DUEL, player, target).setTimeout(10000L);
    request.set("duelType", 0);
    player.setRequest(request);
    target.setRequest(request);
    player.sendPacket(new SystemMessage2(SystemMsg.C1_HAS_BEEN_CHALLENGED_TO_A_DUEL).addName(target));
    target.sendPacket(new SystemMessage2(SystemMsg.C1_HAS_CHALLENGED_YOU_TO_A_DUEL).addName(player), new ExDuelAskStart(player.getName(), 0));
  }
View Full Code Here

    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Request request = activeChar.getRequest();
    if ((request == null) || !request.isTypeOf(L2RequestType.ALLY))
    {
      return;
    }
    if (!request.isInProgress())
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (activeChar.isOutOfControl())
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    Player requestor = request.getRequestor();
    if (requestor == null)
    {
      request.cancel();
      activeChar.sendPacket(Msg.THAT_PLAYER_IS_NOT_ONLINE);
      activeChar.sendActionFailed();
      return;
    }
    if (requestor.getRequest() != request)
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (requestor.getAlliance() == null)
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (_response == 0)
    {
      request.cancel();
      requestor.sendPacket(Msg.YOU_HAVE_FAILED_TO_INVITE_A_CLAN_INTO_THE_ALLIANCE);
      return;
    }
    try
    {
      Alliance ally = requestor.getAlliance();
      activeChar.sendPacket(Msg.YOU_HAVE_ACCEPTED_THE_ALLIANCE);
      activeChar.getClan().setAllyId(requestor.getAllyId());
      activeChar.getClan().updateClanInDB();
      ally.addAllyMember(activeChar.getClan(), true);
      ally.broadcastAllyStatus();
    }
    finally
    {
      request.done();
    }
  }
View Full Code Here

   * @param target Player
   */
  @Override
  public void askDuel(Player player, Player target)
  {
    Request request = new Request(Request.L2RequestType.DUEL, player, target).setTimeout(10000L);
    request.set("duelType", 1);
    player.setRequest(request);
    target.setRequest(request);
   
    player.sendPacket(new SystemMessage2(SystemMsg.C1S_PARTY_HAS_BEEN_CHALLENGED_TO_A_DUEL).addName(target));
    target.sendPacket(new SystemMessage2(SystemMsg.C1S_PARTY_HAS_CHALLENGED_YOUR_PARTY_TO_A_DUEL).addName(player), new ExDuelAskStart(player.getName(), 1));
View Full Code Here

        if (PartySubstitute.getInstance().isGoodPlayer(p, pp))
        {
          if (pp.isProcessingRequest())
            continue;

          new Request(L2RequestType.SUBSTITUTE, p, pp).setTimeout(10000L);
          pp.sendPacket(new ExRegistWaitingSubstituteOk(p.getParty(), p));

          break;
        }
      }
View Full Code Here

    Player parthner1 = getClient().getActiveChar();
    if ((parthner1 == null) || (_amount < 1))
    {
      return;
    }
    Request request = parthner1.getRequest();
    if ((request == null) || !request.isTypeOf(L2RequestType.TRADE))
    {
      parthner1.sendActionFailed();
      return;
    }
    if (!request.isInProgress())
    {
      request.cancel();
      parthner1.sendPacket(SendTradeDone.FAIL);
      parthner1.sendActionFailed();
      return;
    }
    if (parthner1.isOutOfControl())
    {
      request.cancel();
      parthner1.sendPacket(SendTradeDone.FAIL);
      parthner1.sendActionFailed();
      return;
    }
    Player parthner2 = request.getOtherPlayer(parthner1);
    if (parthner2 == null)
    {
      request.cancel();
      parthner1.sendPacket(SendTradeDone.FAIL);
      parthner1.sendPacket(Msg.THAT_PLAYER_IS_NOT_ONLINE);
      parthner1.sendActionFailed();
      return;
    }
    if (parthner2.getRequest() != request)
    {
      request.cancel();
      parthner1.sendPacket(SendTradeDone.FAIL);
      parthner1.sendActionFailed();
      return;
    }
    if (request.isConfirmed(parthner1) || request.isConfirmed(parthner2))
    {
      parthner1.sendPacket(SystemMsg.YOU_MAY_NO_LONGER_ADJUST_ITEMS_IN_THE_TRADE_BECAUSE_THE_TRADE_HAS_BEEN_CONFIRMED);
      parthner1.sendActionFailed();
      return;
    }
View Full Code Here

    if (room.getPlayers().size() >= room.getMaxMembersSize())
    {
      player.sendPacket(SystemMsg.THE_PARTY_ROOM_IS_FULL);
      return;
    }
    new Request(L2RequestType.PARTY_ROOM, player, targetPlayer).setTimeout(10000L);
    targetPlayer.sendPacket(new ExAskJoinPartyRoom(player.getName(), room.getTopic()));
    player.sendPacket(new SystemMessage2(SystemMsg.S1_HAS_SENT_AN_INVITATION_TO_ROOM_S2).addName(player).addString(room.getTopic()));
    targetPlayer.sendPacket(new SystemMessage2(SystemMsg.S1_HAS_SENT_AN_INVITATION_TO_ROOM_S2).addName(player).addString(room.getTopic()));
  }
View Full Code Here

      {
        activeChar.sendPacket(SystemMsg.ONLY_THE_LEADER_CAN_GIVE_OUT_INVITATIONS);
        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));
  }
View Full Code Here

    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Request request = activeChar.getRequest();
    if ((request == null) || !request.isTypeOf(L2RequestType.TRADE_REQUEST))
    {
      activeChar.sendActionFailed();
      return;
    }
    if (!request.isInProgress())
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (activeChar.isOutOfControl())
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    Player requestor = request.getRequestor();
    if (requestor == null)
    {
      request.cancel();
      activeChar.sendPacket(SystemMsg.THAT_PLAYER_IS_NOT_ONLINE);
      activeChar.sendActionFailed();
      return;
    }
    if (requestor.getRequest() != request)
    {
      request.cancel();
      activeChar.sendActionFailed();
      return;
    }
    if (_response == 0)
    {
      request.cancel();
      requestor.sendPacket(new SystemMessage2(SystemMsg.C1_HAS_DENIED_YOUR_REQUEST_TO_TRADE).addString(activeChar.getName()));
      return;
    }
    if (!activeChar.isInRangeZ(requestor, Creature.INTERACTION_DISTANCE))
    {
      request.cancel();
      activeChar.sendPacket(SystemMsg.YOUR_TARGET_IS_OUT_OF_RANGE);
      return;
    }
    if (requestor.isActionsDisabled())
    {
      request.cancel();
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addString(requestor.getName()));
      activeChar.sendActionFailed();
      return;
    }
    try
    {
      new Request(L2RequestType.TRADE, activeChar, requestor);
      requestor.setTradeList(new CopyOnWriteArrayList<TradeItem>());
      requestor.sendPacket(new SystemMessage2(SystemMsg.YOU_BEGIN_TRADING_WITH_C1).addString(activeChar.getName()), new TradeStart(requestor, activeChar));
      activeChar.setTradeList(new CopyOnWriteArrayList<TradeItem>());
      activeChar.sendPacket(new SystemMessage2(SystemMsg.YOU_BEGIN_TRADING_WITH_C1).addString(requestor.getName()), new TradeStart(activeChar, requestor));
    }
    finally
    {
      request.done();
    }
  }
View Full Code Here

    if (target.isBusy())
    {
      activeChar.sendPacket(new SystemMessage(SystemMessage.S1_IS_BUSY_PLEASE_TRY_AGAIN_LATER).addString(target.getName()));
      return;
    }
    new Request(L2RequestType.ALLY, activeChar, target).setTimeout(10000L);
    target.sendPacket(new SystemMessage(SystemMessage.S2_THE_LEADER_OF_S1_HAS_REQUESTED_AN_ALLIANCE).addString(activeChar.getAlliance().getAllyName()).addName(activeChar));
    target.sendPacket(new AskJoinAlliance(activeChar.getObjectId(), activeChar.getName(), activeChar.getAlliance().getAllyName()));
    return;
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.Request

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.