Package lineage2.gameserver.model.pledge

Examples of lineage2.gameserver.model.pledge.Clan$ClanReputationComparator


  public void reCalcNextTime(boolean onStart)
  {
    clearActions();
    _onTimeActions.clear();
   
    Clan owner = getResidence().getOwner();
   
    _endSiegeDate.setTimeInMillis(0);
    if ((getResidence().getAuctionLength() == 0) && (owner == null))
    {
      getResidence().getSiegeDate().setTimeInMillis(System.currentTimeMillis());
View Full Code Here


  {
    List<AuctionSiegeClanObject> siegeClanObjects = removeObjects(ATTACKERS);
    AuctionSiegeClanObject[] clans = siegeClanObjects.toArray(new AuctionSiegeClanObject[siegeClanObjects.size()]);
    Arrays.sort(clans, SiegeClanObject.SiegeClanComparatorImpl.getInstance());
   
    Clan oldOwner = getResidence().getOwner();
    AuctionSiegeClanObject winnerSiegeClan = clans.length > 0 ? clans[0] : null;
   
    if (winnerSiegeClan != null)
    {
      SystemMessage2 msg = new SystemMessage2(SystemMsg.THE_CLAN_HALL_WHICH_WAS_PUT_UP_FOR_AUCTION_HAS_BEEN_AWARDED_TO_S1_CLAN).addString(winnerSiegeClan.getClan().getName());
      for (AuctionSiegeClanObject $siegeClan : siegeClanObjects)
      {
        Player player = $siegeClan.getClan().getLeader().getPlayer();
        if (player != null)
        {
          player.sendPacket(msg);
        }
        else
        {
          PlayerMessageStack.getInstance().mailto($siegeClan.getClan().getLeaderId(), msg);
        }
       
        if ($siegeClan != winnerSiegeClan)
        {
          long returnBid = $siegeClan.getParam() - (long) ($siegeClan.getParam() * 0.1);
         
          $siegeClan.getClan().getWarehouse().addItem(ItemTemplate.ITEM_ID_ADENA, returnBid);
        }
      }
     
      SiegeClanDAO.getInstance().delete(getResidence());
     
      if (oldOwner != null)
      {
        oldOwner.getWarehouse().addItem(ItemTemplate.ITEM_ID_ADENA, getResidence().getDeposit());
      }
     
      getResidence().setAuctionLength(0);
      getResidence().setAuctionMinBid(0);
      getResidence().setAuctionDescription(StringUtils.EMPTY);
      getResidence().getSiegeDate().setTimeInMillis(0);
      getResidence().getLastSiegeDate().setTimeInMillis(0);
      getResidence().getOwnDate().setTimeInMillis(System.currentTimeMillis());
      getResidence().setJdbcState(JdbcEntityState.UPDATED);
     
      getResidence().changeOwner(winnerSiegeClan.getClan());
      getResidence().startCycleTask();
    }
    else
    {
      if (oldOwner != null)
      {
        Player player = oldOwner.getLeader().getPlayer();
        if (player != null)
        {
          player.sendPacket(SystemMsg.THE_CLAN_HALL_WHICH_HAD_BEEN_PUT_UP_FOR_AUCTION_WAS_NOT_SOLD_AND_THEREFORE_HAS_BEEN_RELISTED);
        }
        else
        {
          PlayerMessageStack.getInstance().mailto(oldOwner.getLeaderId(), SystemMsg.THE_CLAN_HALL_WHICH_HAD_BEEN_PUT_UP_FOR_AUCTION_WAS_NOT_SOLD_AND_THEREFORE_HAS_BEEN_RELISTED.packet(null));
        }
      }
    }
   
    super.stopEvent(step);
View Full Code Here

    writeD(_defenderClans.size());
    writeD(_defenderClans.size());
    for (DefenderClan defenderClan : _defenderClans)
    {
      Clan clan = defenderClan._clan;

      writeD(clan.getClanId());
      writeS(clan.getName());
      writeS(clan.getLeaderName());
      writeD(clan.getCrestId());
      writeD(defenderClan._time);
      writeD(defenderClan._type);
      writeD(clan.getAllyId());
      Alliance alliance = clan.getAlliance();
      if (alliance != null)
      {
        writeS(alliance.getAllyName());
        writeS(alliance.getAllyLeaderName());
        writeD(alliance.getAllyCrestId());
View Full Code Here

    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Clan clan = activeChar.getClan();
    if (clan == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    if (!activeChar.isClanLeader())
    {
      activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.ChangeAffiliations", activeChar));
      activeChar.sendActionFailed();
      return;
    }
    UnitMember subject = clan.getAnyMember(_subjectName);
    if (subject == null)
    {
      activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.NotInYourClan", activeChar));
      activeChar.sendActionFailed();
      return;
    }
    if (subject.getPledgeType() == _targetUnit)
    {
      activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.AlreadyInThatCombatUnit", activeChar));
      activeChar.sendActionFailed();
      return;
    }
    if ((_targetUnit != 0) && (clan.getSubUnit(_targetUnit) == null))
    {
      activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.NoSuchCombatUnit", activeChar));
      activeChar.sendActionFailed();
      return;
    }
    if (Clan.isAcademy(_targetUnit))
    {
      activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.AcademyViaInvitation", activeChar));
      activeChar.sendActionFailed();
      return;
    }
    if (Clan.isAcademy(subject.getPledgeType()))
    {
      activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.CantMoveAcademyMember", activeChar));
      activeChar.sendActionFailed();
      return;
    }
    UnitMember replacement = null;
    if (_replace > 0)
    {
      replacement = clan.getAnyMember(_replaceName);
      if (replacement == null)
      {
        activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.CharacterNotBelongClan", activeChar));
        activeChar.sendActionFailed();
        return;
      }
      if (replacement.getPledgeType() != _targetUnit)
      {
        activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.CharacterNotBelongCombatUnit", activeChar));
        activeChar.sendActionFailed();
        return;
      }
      if (replacement.isSubLeader() != 0)
      {
        activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.CharacterLeaderAnotherCombatUnit", activeChar));
        activeChar.sendActionFailed();
        return;
      }
    }
    else
    {
      if (clan.getUnitMembersSize(_targetUnit) >= clan.getSubPledgeLimit(_targetUnit))
      {
        if (_targetUnit == Clan.SUBUNIT_MAIN_CLAN)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessage.S1_IS_FULL_AND_CANNOT_ACCEPT_ADDITIONAL_CLAN_MEMBERS_AT_THIS_TIME).addString(clan.getName()));
        }
        else
        {
          activeChar.sendPacket(Msg.THE_ACADEMY_ROYAL_GUARD_ORDER_OF_KNIGHTS_IS_FULL_AND_CANNOT_ACCEPT_NEW_MEMBERS_AT_THIS_TIME);
        }
        activeChar.sendActionFailed();
        return;
      }
      if (subject.isSubLeader() != 0)
      {
        activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestPledgeReorganizeMember.MemberLeaderAnotherUnit", activeChar));
        activeChar.sendActionFailed();
        return;
      }
    }
    SubUnit oldUnit = null;
    if (replacement != null)
    {
      oldUnit = replacement.getSubUnit();
      oldUnit.replace(replacement.getObjectId(), subject.getPledgeType());
      clan.broadcastToOnlineMembers(new PledgeShowMemberListUpdate(replacement));
      if (replacement.isOnline())
      {
        replacement.getPlayer().updatePledgeClass();
        replacement.getPlayer().broadcastCharInfo();
      }
    }
    oldUnit = subject.getSubUnit();
    oldUnit.replace(subject.getObjectId(), _targetUnit);
    clan.broadcastToOnlineMembers(new PledgeShowMemberListUpdate(subject));
    if (subject.isOnline())
    {
      subject.getPlayer().updatePledgeClass();
      subject.getPlayer().broadcastCharInfo();
    }
View Full Code Here

   * @param step boolean
   */
  @Override
  public void stopEvent(boolean step)
  {
    Clan newOwner = getResidence().getOwner();
    if (newOwner != null)
    {
      newOwner.broadcastToOnlineMembers(PlaySound.SIEGE_VICTORY);
      newOwner.incReputation(1700, false, toString());
      broadcastTo(new SystemMessage2(SystemMsg.S1_CLAN_HAS_DEFEATED_S2).addString(newOwner.getName()).addResidenceName(getResidence()), ATTACKERS);
      broadcastTo(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_IS_FINISHED).addResidenceName(getResidence()), ATTACKERS);
    }
    else
    {
      broadcastTo(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_HAS_ENDED_IN_A_DRAW).addResidenceName(getResidence()), ATTACKERS);
View Full Code Here

  protected CastleSiegeInfo(Residence residence, Player player)
  {
    _id = residence.getId();
    _ownerObjectId = residence.getOwnerId();
    Clan owner = residence.getOwner();
    if (owner != null)
    {
      _isLeader = player.isGM() || owner.getLeaderId(Clan.SUBUNIT_MAIN_CLAN) == player.getObjectId();
      _ownerName = owner.getName();
      _leaderName = owner.getLeaderName(Clan.SUBUNIT_MAIN_CLAN);
      Alliance ally = owner.getAlliance();
      if (ally != null)
      {
        _allyId = ally.getAllyId();
        _allyName = ally.getAllyName();
      }
View Full Code Here

   * @param step boolean
   */
  @Override
  public void stopEvent(boolean step)
  {
    Clan newOwner = getResidence().getOwner();
    if (newOwner != null)
    {
      if (_oldOwner != newOwner)
      {
        newOwner.broadcastToOnlineMembers(PlaySound.SIEGE_VICTORY);
        newOwner.incReputation(1700, false, toString());
        if (_oldOwner != null)
        {
          _oldOwner.incReputation(-1700, false, toString());
        }
      }
      broadcastInZone(new SystemMessage2(SystemMsg.S1_CLAN_HAS_DEFEATED_S2).addString(newOwner.getName()).addResidenceName(getResidence()));
      broadcastInZone(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_IS_FINISHED).addResidenceName(getResidence()));
    }
    else
    {
      broadcastInZone(new SystemMessage2(SystemMsg.THE_SIEGE_OF_S1_HAS_ENDED_IN_A_DRAW).addResidenceName(getResidence()));
View Full Code Here

    Fortress fort = ResidenceHolder.getInstance().getResidenceByObject(Fortress.class, player);
    if (fort == null)
    {
      return false;
    }
    Clan clan = player.getClan();
    if (clan == null)
    {
      return false;
    }
    if (clan.getClanId() != fort.getOwnerId())
    {
      return false;
    }
    return true;
  }
View Full Code Here

  @Override
  public void onBypassFeedback(final Player player, final String command)
  {
    ClanHall clanHall = getClanHall();
    ClanHallTeamBattleEvent siegeEvent = clanHall.getSiegeEvent();
    Clan clan = player.getClan();
    if (command.equalsIgnoreCase("registrationMenu"))
    {
      if (!checkCond(player, true))
      {
        return;
      }
      showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_1.htm");
    }
    else if (command.equalsIgnoreCase("registerAsClan"))
    {
      if (!checkCond(player, false))
      {
        return;
      }
      List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
      CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
      if (siegeClan != null)
      {
        showFlagInfo(player, siegeClans.indexOf(siegeClan));
        return;
      }
      QuestState questState = player.getQuestState(_655_AGrandPlanForTamingWildBeasts.class);
      if ((questState == null) || (questState.getQuestItemsCount(8293) != 1))
      {
        showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_27.htm");
        return;
      }
      questState.exitCurrentQuest(true);
      register(player);
    }
    else if (command.equalsIgnoreCase("registerAsMember"))
    {
      CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if (siegeClan == null)
      {
        showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_7.htm");
        return;
      }
      if (siegeClan.getClan().getLeaderId() == player.getObjectId())
      {
        showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_5.htm");
        return;
      }
      if (siegeClan.getPlayers().contains(player.getObjectId()))
      {
        showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_9.htm");
      }
      else
      {
        if (siegeClan.getPlayers().size() >= 18)
        {
          showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_8.htm");
          return;
        }
        siegeClan.getPlayers().add(player.getObjectId());
        SiegePlayerDAO.getInstance().insert(clanHall, clan.getClanId(), player.getObjectId());
        showChatWindow(player, "residence2/clanhall/farm_kel_mahum_messenger_9.htm");
      }
    }
    else if (command.startsWith("formAlliance"))
    {
View Full Code Here

   * Method register.
   * @param player Player
   */
  private void register(Player player)
  {
    Clan clan = player.getClan();
    ClanHall clanHall = getClanHall();
    ClanHallTeamBattleEvent siegeEvent = clanHall.getSiegeEvent();
    CTBSiegeClanObject siegeClan = new CTBSiegeClanObject(SiegeEvent.ATTACKERS, clan, 0);
    siegeClan.getPlayers().add(player.getObjectId());
    siegeEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
    SiegeClanDAO.getInstance().insert(clanHall, siegeClan);
    SiegePlayerDAO.getInstance().insert(clanHall, clan.getClanId(), player.getObjectId());
    List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
    showFlagInfo(player, siegeClans.indexOf(siegeClan));
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.pledge.Clan$ClanReputationComparator

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.