Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.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);
          sm = null;

          if(isHighestScore)
          {
            showChatWindow(player, 3, "c", false);
          }
          else
          {
            showChatWindow(player, 3, "d", false);
          }

          prevParticipants = null;
          bloodOfferings = null;
          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) && (overallData != null))
          {
            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);
          strBuffer = null;
          html = null;
          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


        L2PcInstance PlayerA = DuelManager.getInstance().getDuel(_owner.getDuelId()).getPlayerA();
        L2PcInstance PlayerB = DuelManager.getInstance().getDuel(_owner.getDuelId()).getPlayerB();
       
        if (DuelManager.getInstance().getDuel(_owner.getDuelId()).isPartyDuel())
        {
          L2Party partyA = PlayerA.getParty();
          L2Party partyB = PlayerB.getParty();
          L2Party partyEnemy = null;
         
          if (partyA != null)
          {
            if (partyA.getPartyMembers().contains(_owner))
              if (partyB != null)
                partyEnemy = partyB;
              else
                _target = PlayerB;
            else
              partyEnemy = partyA;
          }
          else
          {
            if (PlayerA == _owner)
              if (partyB != null)
                partyEnemy = partyB;
              else
                _target = PlayerB;
            else
              _target = PlayerA;
          }
          if (_target == PlayerA || _target == PlayerB)
            if (_target == ownerTarget)
              return;
          if (partyEnemy != null)
          {
            if (partyEnemy.getPartyMembers().contains(ownerTarget))
              _target = (L2Character) ownerTarget;
            return;
          }
        }
        if (PlayerA != _owner && ownerTarget == PlayerA)
View Full Code Here

   */
  public void cubicTargetForHeal()
  {
    L2Character target = null;
    double percentleft = 100.0;
    L2Party party = _owner.getParty();
   
    // if owner is in a duel but not in a party duel, then it is the same as he does not have a
    // party
    if (_owner.isInDuel())
      if (!DuelManager.getInstance().getDuel(_owner.getDuelId()).isPartyDuel())
        party = null;
   
    if (party != null && !_owner.isInOlympiadMode())
    {
      // Get all visible objects in a spheric area near the L2Character
      // Get a list of Party Members
      List<L2PcInstance> partyList = party.getPartyMembers();
      for (L2Character partyMember : partyList)
      {
        if (!partyMember.isDead())
        {
          // if party member not dead, check if he is in castrange of heal cubic
View Full Code Here

              }
             
              // Remove player from his party
              if (player.getParty() != null)
              {
                L2Party party = player.getParty();
                party.removePartyMember(player);
              }
             
              // player._originalTitleDM = player.getTitle();
              // player.setTitle("Kills: " + player._countDMkills);
             
View Full Code Here

     
      for (final L2PcInstance player : _players)
      {
        if (player.getParty() != null)
        {
          L2Party party = player.getParty();
          party.removePartyMember(player);
        }
      }
    }
  }
View Full Code Here

              }

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

              player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameTvT)) + Rnd.get(201) - 100, _teamsY.get(_teams.indexOf(player._teamNameTvT)) + Rnd.get(201) - 100, _teamsZ.get(_teams.indexOf(player._teamNameTvT)));
            }
          }
View Full Code Here

        {
          activeChar.sendMessage("Player is not in party.");
          return true;
        }

        L2Party p = player.getParty();

        for(L2PcInstance ppl : p.getPartyMembers())
        {
          Teleport(ppl, activeChar.getX(), activeChar.getY(), activeChar.getZ(), "Admin is teleporting you");
        }

        p = null;
View Full Code Here

            }

            //Remove player from his party
            if (player.getParty() != null)
            {
              L2Party party = player.getParty();
              party.removePartyMember(player);
            }
            player.teleToLocation(_startX, _startY, _startZ);
          }
        }
      }
View Full Code Here

            }

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

            player.teleToLocation(_startX, _startY, _startZ);
          }
        }
View Full Code Here

    for (L2PcInstance player : players
    player.sendPacket(new CreatureSay(1, Say2.HERO_VOICE, "LMS: ", "In 1 minute you will be unparalyzed and you will start fighting.The last one who survives is the winner"));
    for (L2PcInstance player : players
    if(player.getParty() != null)
    {
      L2Party party = player.getParty();
      party.removePartyMember(player);
    }
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.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.