Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2Party


            showChatWindow(player, val, null, true);
        }
        else if (command.startsWith("Festival"))
        {
            L2Party playerParty = player.getParty();
            int val = Integer.parseInt(command.substring(9, 10));

            switch (val) {
                case 1: // Become a Participant
                    // Check if the festival period is active, if not then don't allow registration.
                    if (SevenSigns.getInstance().isSealValidationPeriod())
                    {
                        showChatWindow(player, 2, "a", false);
                        return;
                    }

                    // Check if a festival is in progress, then don't allow registration yet.
                    if (SevenSignsFestival.getInstance().isFestivalInitialized())
                    {
                        player.sendMessage("You cannot sign up while a festival is in progress.");
                        return;
                    }

                    // Check if the player is in a formed party already.
                    if (playerParty == null) {
                        showChatWindow(player, 2, "b", false);
                        return;
                    }

                    // Check if the player is the party leader.
                    if (!playerParty.isLeader(player)) {
                        showChatWindow(player, 2, "c", false);
                        return;
                    }

                    // Check to see if the party has at least 5 members.
                    if (playerParty.getMemberCount() < Config.ALT_FESTIVAL_MIN_PLAYER)
                    {
                        showChatWindow(player, 2, "b", false);
                        return;
                    }

                    // Check if all the party members are in the required level range.
                    if (playerParty.getLevel() > SevenSignsFestival.getMaxLevelForFestival(_festivalType))
                    {
                        showChatWindow(player, 2, "d", false);
                        return;
                    }

                    // TODO: Check if the player has delevelled by comparing their skill levels.

                    /*
                     * Check to see if the player has already signed up,
                     * if they are then update the participant list providing all the
                     * required criteria has been met.
                     */
                    if (player.isFestivalParticipant()) {
                        SevenSignsFestival.getInstance().setParticipants(_festivalOracle, _festivalType, playerParty);
                        showChatWindow(player, 2, "f", false);
                        return;
                    }

                    showChatWindow(player, 1, null, false);
                    break;
                case 2: // Festival 2 xxxx
                    int stoneType = Integer.parseInt(command.substring(11));
                    int stonesNeeded = 0;

                    switch (stoneType) {
                        case SevenSigns.SEAL_STONE_BLUE_ID:
                            stonesNeeded = _blueStonesNeeded;
                            break;
                        case SevenSigns.SEAL_STONE_GREEN_ID:
                            stonesNeeded = _greenStonesNeeded;
                            break;
                        case SevenSigns.SEAL_STONE_RED_ID:
                            stonesNeeded = _redStonesNeeded;
                            break;
                    }

                    if (!player.destroyItemByItemId("SevenSigns", stoneType, stonesNeeded, this, true)) return;

                    SevenSignsFestival.getInstance().setParticipants(_festivalOracle, _festivalType, playerParty);
                    SevenSignsFestival.getInstance().addAccumulatedBonus(_festivalType, stoneType, stonesNeeded);

                    showChatWindow(player, 2, "e", false);
                    break;
                case 3: // Score Registration
                    // Check if the festival period is active, if not then don't register the score.
                    if (SevenSigns.getInstance().isSealValidationPeriod())
                    {
                        showChatWindow(player, 3, "a", false);
                        return;
                    }

                    // Check if a festival is in progress, if it is don't register the score.
                    if (SevenSignsFestival.getInstance().isFestivalInProgress())
                    {
                        player.sendMessage("You cannot register a score while a festival is in progress.");
                        return;
                    }

                    // Check if the player is in a party.
                    if (playerParty == null) {
                        showChatWindow(player, 3, "b", false);
                        return;
                    }

                    List<L2PcInstance> prevParticipants = SevenSignsFestival.getInstance().getPreviousParticipants(_festivalOracle, _festivalType);

                    // Check if there are any past participants.
                    if (prevParticipants == null)
                        return;

                    // Check if this player was among the past set of participants for this festival.
                    if (!prevParticipants.contains(player)) {
                        showChatWindow(player, 3, "b", false);
                        return;
                    }

                    // Check if this player was the party leader in the festival.
                    if (player.getObjectId() != prevParticipants.get(0).getObjectId()) {
                        showChatWindow(player, 3, "b", false);
                        return;
                    }

                    L2ItemInstance bloodOfferings = player.getInventory().getItemByItemId(SevenSignsFestival.FESTIVAL_OFFERING_ID);
                    int offeringCount = 0;

                    // Check if the player collected any blood offerings during the festival.
                    if (bloodOfferings == null) {
                        player.sendMessage("You do not have any blood offerings to contribute.");
                        return;
                    }

                    offeringCount = bloodOfferings.getCount();

                    int offeringScore = offeringCount * SevenSignsFestival.FESTIVAL_OFFERING_VALUE;
                    boolean isHighestScore = SevenSignsFestival.getInstance().setFinalScore(player, _festivalOracle, _festivalType, offeringScore);

                    player.destroyItem("SevenSigns", bloodOfferings, this, false);

                    // Send message that the contribution score has increased.
                    SystemMessage sm = new SystemMessage(SystemMessageId.CONTRIB_SCORE_INCREASED);
                    sm.addNumber(offeringScore);
                    player.sendPacket(sm);

                    if (isHighestScore)
                        showChatWindow(player, 3, "c", false);
                    else
                        showChatWindow(player, 3, "d", false);
                    break;
                case 4: // Current High Scores
                    TextBuilder strBuffer = new TextBuilder("<html><body>Festival Guide:<br>These are the top scores of the week, for the ");

                    final StatsSet dawnData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DAWN, _festivalType);
                    final StatsSet duskData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DUSK, _festivalType);
                    final StatsSet overallData = SevenSignsFestival.getInstance().getOverallHighestScoreData(_festivalType);

                    final int dawnScore = dawnData.getInteger("score");
                    final int duskScore = duskData.getInteger("score");
                    int overallScore = 0;

                    // If no data is returned, assume there is no record, or all scores are 0.
                    if (overallData != null)
                        overallScore = overallData.getInteger("score");

                    strBuffer.append(SevenSignsFestival.getFestivalName(_festivalType) + " festival.<br>");

                    if (dawnScore > 0)
                        strBuffer.append("Dawn: " + calculateDate(dawnData.getString("date")) + ". Score " + dawnScore + "<br>" + dawnData.getString("members") + "<br>");
                    else
                        strBuffer.append("Dawn: No record exists. Score 0<br>");

                    if (duskScore > 0)
                        strBuffer.append("Dusk: " + calculateDate(duskData.getString("date")) + ". Score " + duskScore + "<br>" + duskData.getString("members") + "<br>");
                    else
                        strBuffer.append("Dusk: No record exists. Score 0<br>");

                    if (overallScore > 0) {
                        String cabalStr = "Children of Dusk";

                        if (overallData.getString("cabal").equals("dawn"))
                            cabalStr = "Children of Dawn";

                        strBuffer.append("Consecutive top scores: " + calculateDate(overallData.getString("date")) + ". Score " + overallScore + "<br>Affilated side: " + cabalStr + "<br>" + overallData.getString("members") + "<br>");
                    }
                    else
                        strBuffer.append("Consecutive top scores: No record exists. Score 0<br>");

                    strBuffer.append("<a action=\"bypass -h npc_" + getObjectId() + "_Chat 0\">Go back.</a></body></html>");

                    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                    html.setHtml(strBuffer.toString());
                    player.sendPacket(html);
                    break;
                case 8: // Increase the Festival Challenge
                    if (playerParty == null)
                        return;

                    if (!SevenSignsFestival.getInstance().isFestivalInProgress())
                        return;

                    if (!playerParty.isLeader(player)) {
                        showChatWindow(player, 8, "a", false);
                        break;
                    }

                    if (SevenSignsFestival.getInstance().increaseChallenge(_festivalOracle, _festivalType))
                        showChatWindow(player, 8, "b", false);
                    else
                        showChatWindow(player, 8, "c", false);
                    break;
                case 9: // Leave the Festival
                    if (playerParty == null)
                        return;

                    /**
                     * If the player is the party leader, remove all participants from the festival
                     * (i.e. set the party to null, when updating the participant list)
                     * otherwise just remove this player from the "arena", and also remove them from the party.
                     */
                    boolean isLeader = playerParty.isLeader(player);

                    if (isLeader) {
                        SevenSignsFestival.getInstance().updateParticipants(player, null);
                    }
                    else {
                        SevenSignsFestival.getInstance().updateParticipants(player, playerParty);
                        playerParty.removePartyMember(player);
                    }
                    break;
                case 0: // Distribute Accumulated Bonus
                    if (!SevenSigns.getInstance().isSealValidationPeriod())
                    {
View Full Code Here


  {
    SystemMessage msg;

    if (!target.isProcessingRequest())
    {
        requestor.setParty(new L2Party(requestor, _itemDistribution));

        requestor.onTransactionRequest(target);
        target.sendPacket(new AskJoinParty(requestor.getName(), _itemDistribution));
        requestor.getParty().increasePendingInvitationNumber();
View Full Code Here

        {
          if (activeChar.getParty().isLeader(activeChar)
              && activeChar.getParty().isInCommandChannel())
          {
            L2CommandChannel channel = activeChar.getParty().getCommandChannel();
            L2Party party = activeChar.getParty();
            channel.removeParty(party);

            SystemMessage sm = SystemMessage.sendString("Your party has left the CommandChannel.");
            party.broadcastToPartyMembers(sm);
            sm = SystemMessage.sendString(party.getPartyMembers().get(0).getName() +"'s party has left the CommandChannel.");
            channel.broadcastToChannelMembers(sm);
            return true;
          }
        }
View Full Code Here

        SystemMessage sm = SystemMessage.sendString("You are not in a party.");
        activeChar.sendPacket(sm);
        return false;
      }

        L2Party playerParty = activeChar.getParty();
      int memberCount = playerParty.getMemberCount();
      int lootDistribution = playerParty.getLootDistribution();
      String partyLeader = playerParty.getPartyMembers().get(0).getName();

        activeChar.sendPacket(new SystemMessage(SystemMessageId.PARTY_INFORMATION));

        switch (lootDistribution) {
        case L2Party.ITEM_LOOTER:
View Full Code Here

      return;

    //activeChar is in a Party?
    if (activeChar.isInParty())
    {
      L2Party activeParty = activeChar.getParty();
      //activeChar is PartyLeader? && activeChars Party is already in a CommandChannel?
      if (activeParty.getPartyMembers().get(0).equals(activeChar))
      {
        // if activeChars Party is in CC, is activeChar CCLeader?
        if (activeParty.isInCommandChannel() && activeParty.getCommandChannel().getChannelLeader().equals(activeChar))
        {
          //in CC and the CCLeader
          //target in a party?
          if (player.isInParty())
          {
            //targets party already in a CChannel?
            if (player.getParty().isInCommandChannel())
            {
              activeChar.sendMessage("Your target is already in a CommandChannel");
            }
            else
            {
              //ready to open a new CC
              //send request to targets Party's PartyLeader
              askJoinMPCC(activeChar, player);
            }
          }
          else
          {
            activeChar.sendMessage("Your target has no Party.");
          }

        }
        else if (activeParty.isInCommandChannel() && !activeParty.getCommandChannel().getChannelLeader().equals(activeChar))
        {
          //in CC, but not the CCLeader
          activeChar.sendMessage("Only the CommandChannelLeader can give out an invite.");
        }
        else
View Full Code Here

                }*/
       
        //Remove player from his party
        if (player.getParty() != null)
        {
          L2Party party = player.getParty();
          party.removePartyMember(player);
        }

        //Remove Hero Weapons
        // check to prevent the using of weapon/shield on strider/wyvern
        L2ItemInstance wpn = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
View Full Code Here

                        target = null;
                        if (_owner.isInParty())
                        {
                            caster = _owner;
                            L2PcInstance player = _owner;
                            L2Party party = player.getParty();
                            double percentleft = 100.0;
                            if (party != null)
                            {
                                // Get all visible objects in a spheric area near the L2Character
                                // Get a list of Party Members
                                List<L2PcInstance> partyList = party.getPartyMembers();
                                L2Character partyMember = null;
                                int x, y, z;
                                // temporary range check until real behavior of cubics is known/coded
                                int range = 400; //skill.getCastRange();
                                for (int i = 0; i < partyList.size(); i++)
View Full Code Here

      // NPE prevention.  If the player is null, there is nothing to return
      if (player == null )
        return null;
      if ((player.getParty() == null) || (player.getParty().getPartyMembers().size()==0))
        return player;
      L2Party party = player.getParty();
      return party.getPartyMembers().get(Rnd.get(party.getPartyMembers().size()));
    }
View Full Code Here

        return getRandomPartyMember(player);
     
     
      // normal cases...if the player is not in a party, check the player's state
      QuestState temp = null;
      L2Party party = player.getParty();
      // if this player is not in a party, just check if this player instance matches the conditions itself
      if ( (party == null) || (party.getPartyMembers().size()==0) )
      {
        temp = player.getQuestState(getName());
        if( (temp != null) && (temp.get(var)!=null) && ((String) temp.get(var)).equalsIgnoreCase(value) )
        return player;  // match
       
        return null// no match
      }
     
      // if the player is in a party, gather a list of all matching party members (possibly
      // including this player)
      FastList<L2PcInstance> candidates = new FastList<L2PcInstance>();
     
      // get the target for enforcing distance limitations.
      L2Object target = player.getTarget();
      if (target == null) target = player;
     
      for(L2PcInstance partyMember: party.getPartyMembers())
      {
        temp = partyMember.getQuestState(getName());
        if( (temp != null) && (temp.get(var)!=null) && ((String) temp.get(var)).equalsIgnoreCase(value)
            && partyMember.isInsideRadius(target, 1500, true, false))
          candidates.add(partyMember);
View Full Code Here

      if (state == null)
        return getRandomPartyMember(player);
     
      // normal cases...if the player is not in a partym check the player's state
      QuestState temp = null;
      L2Party party = player.getParty();
      // if this player is not in a party, just check if this player instance matches the conditions itself
      if ( (party == null) || (party.getPartyMembers().size()==0) )
      {
        temp = player.getQuestState(getName());
        if( (temp != null) && (temp.getState() == state) )
        return player;  // match
       
        return null// no match
      }
     
      // if the player is in a party, gather a list of all matching party members (possibly
      // including this player)
      FastList<L2PcInstance> candidates = new FastList<L2PcInstance>();

      // get the target for enforcing distance limitations.
      L2Object target = player.getTarget();
      if (target == null) target = player;
     
      for(L2PcInstance partyMember: party.getPartyMembers())
      {
        temp = partyMember.getQuestState(getName());
        if( (temp != null) && (temp.getState() == state) && partyMember.isInsideRadius(target, 1500, true, false) )
          candidates.add(partyMember);
      }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2Party

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.