Package lineage2.gameserver.model.pledge

Examples of lineage2.gameserver.model.pledge.Clan


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


   * @return AuctionSiegeClanObject
   */
  @Override
  public AuctionSiegeClanObject newSiegeClan(String type, int clanId, long param, long date)
  {
    Clan clan = ClanTable.getInstance().getClan(clanId);
    return clan == null ? null : new AuctionSiegeClanObject(type, clan, param, date);
  }
View Full Code Here

    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Clan clan = activeChar.getClan();
    if (clan == null)
    {
      return;
    }
    if ((activeChar.getClanPrivileges() & Clan.CP_CL_APPRENTICE) == Clan.CP_CL_APPRENTICE)
    {
      UnitMember sponsor = activeChar.getClan().getAnyMember(_sponsorName);
      UnitMember apprentice = activeChar.getClan().getAnyMember(_apprenticeName);
      if ((sponsor != null) && (apprentice != null))
      {
        if ((apprentice.getPledgeType() != Clan.SUBUNIT_ACADEMY) || (sponsor.getPledgeType() == Clan.SUBUNIT_ACADEMY))
        {
          return;
        }
        if (_mode == 1)
        {
          if (sponsor.hasApprentice())
          {
            activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestOustAlly.MemberAlreadyHasApprentice", activeChar));
            return;
          }
          if (apprentice.hasSponsor())
          {
            activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestOustAlly.ApprenticeAlreadyHasSponsor", activeChar));
            return;
          }
          sponsor.setApprentice(apprentice.getObjectId());
          clan.broadcastToOnlineMembers(new PledgeShowMemberListUpdate(apprentice));
          clan.broadcastToOnlineMembers(new SystemMessage(SystemMessage.S2_HAS_BEEN_DESIGNATED_AS_THE_APPRENTICE_OF_CLAN_MEMBER_S1).addString(sponsor.getName()).addString(apprentice.getName()));
        }
        else
        {
          if (!sponsor.hasApprentice())
          {
            activeChar.sendMessage(new CustomMessage("lineage2.gameserver.clientpackets.RequestOustAlly.MemberHasNoApprentice", activeChar));
            return;
          }
          sponsor.setApprentice(0);
          clan.broadcastToOnlineMembers(new PledgeShowMemberListUpdate(apprentice));
          clan.broadcastToOnlineMembers(new SystemMessage(SystemMessage.S2_CLAN_MEMBER_S1S_APPRENTICE_HAS_BEEN_REMOVED).addString(sponsor.getName()).addString(apprentice.getName()));
        }
        if (apprentice.isOnline())
        {
          apprentice.getPlayer().broadcastCharInfo();
        }
View Full Code Here

  /**
   * Method rewardSkills.
   */
  public void rewardSkills()
  {
    Clan owner = getOwner();
    if (owner != null)
    {
      for (Skill skill : _skills)
      {
        owner.addSkill(skill, false);
        owner.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.THE_CLAN_SKILL_S1_HAS_BEEN_ADDED).addSkillName(skill));
      }
    }
  }
View Full Code Here

  /**
   * Method removeSkills.
   */
  public void removeSkills()
  {
    Clan owner = getOwner();
    if (owner != null)
    {
      for (Skill skill : _skills)
      {
        owner.removeSkill(skill.getId());
      }
    }
  }
View Full Code Here

   * @param level int
   * @return boolean
   */
  public boolean updateFunctions(int type, int level)
  {
    Clan clan = getOwner();
    if (clan == null)
    {
      return false;
    }
    long count = clan.getAdenaCount();
    ResidenceFunction function = getFunction(type);
    if (function == null)
    {
      return false;
    }
    if (function.isActive() && (function.getLevel() == level))
    {
      return true;
    }
    int lease = level == 0 ? 0 : getFunction(type).getLease(level);
    Connection con = null;
    PreparedStatement statement = null;
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      if (!function.isActive())
      {
        if (count >= lease)
        {
          clan.getWarehouse().destroyItemByItemId(ItemTemplate.ITEM_ID_ADENA, lease);
        }
        else
        {
          return false;
        }
        long time = Calendar.getInstance().getTimeInMillis() + 86400000;
        statement = con.prepareStatement("REPLACE residence_functions SET id=?, type=?, lvl=?, endTime=?");
        statement.setInt(1, getId());
        statement.setInt(2, type);
        statement.setInt(3, level);
        statement.setInt(4, (int) (time / 1000));
        statement.execute();
        function.setLvl(level);
        function.setEndTimeInMillis(time);
        function.setActive(true);
        startAutoTaskForFunction(function);
      }
      else
      {
        if (count >= (lease - getFunction(type).getLease()))
        {
          if (lease > getFunction(type).getLease())
          {
            clan.getWarehouse().destroyItemByItemId(ItemTemplate.ITEM_ID_ADENA, lease - getFunction(type).getLease());
          }
        }
        else
        {
          return false;
View Full Code Here

  {
    if (getOwnerId() == 0)
    {
      return;
    }
    Clan clan = getOwner();
    if (clan == null)
    {
      return;
    }
    if (function.getEndTimeInMillis() > System.currentTimeMillis())
    {
      ThreadPoolManager.getInstance().schedule(new AutoTaskForFunctions(function), function.getEndTimeInMillis() - System.currentTimeMillis());
    }
    else if (function.isInDebt() && (clan.getAdenaCount() >= function.getLease()))
    {
      clan.getWarehouse().destroyItemByItemId(ItemTemplate.ITEM_ID_ADENA, function.getLease());
      function.updateRentTime(false);
      ThreadPoolManager.getInstance().schedule(new AutoTaskForFunctions(function), function.getEndTimeInMillis() - System.currentTimeMillis());
    }
    else if (!function.isInDebt())
    {
View Full Code Here

    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Clan clan = activeChar.getClan();
    if (clan == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    if (!((activeChar.getClanPrivileges() & Clan.CP_CL_CLAN_WAR) == Clan.CP_CL_CLAN_WAR))
    {
      activeChar.sendActionFailed();
      return;
    }
    if (clan.getWarsCount() >= 30)
    {
      activeChar.sendPacket(Msg.A_DECLARATION_OF_WAR_AGAINST_MORE_THAN_30_CLANS_CANT_BE_MADE_AT_THE_SAME_TIME, ActionFail.STATIC);
      return;
    }
    if ((clan.getLevel() < 3) || (clan.getAllSize() < 15))
    {
      activeChar.sendPacket(Msg.A_CLAN_WAR_CAN_BE_DECLARED_ONLY_IF_THE_CLAN_IS_LEVEL_THREE_OR_ABOVE_AND_THE_NUMBER_OF_CLAN_MEMBERS_IS_FIFTEEN_OR_GREATER, ActionFail.STATIC);
      return;
    }
    Clan targetClan = ClanTable.getInstance().getClanByName(_pledgeName);
    if (targetClan == null)
    {
      activeChar.sendPacket(Msg.THE_DECLARATION_OF_WAR_CANT_BE_MADE_BECAUSE_THE_CLAN_DOES_NOT_EXIST_OR_ACT_FOR_A_LONG_PERIOD, ActionFail.STATIC);
      return;
    }
    else if (clan.equals(targetClan))
    {
      activeChar.sendPacket(Msg.FOOL_YOU_CANNOT_DECLARE_WAR_AGAINST_YOUR_OWN_CLAN, ActionFail.STATIC);
      return;
    }
    else if (clan.isAtWarWith(targetClan.getClanId()))
    {
      activeChar.sendPacket(Msg.THE_DECLARATION_OF_WAR_HAS_BEEN_ALREADY_MADE_TO_THE_CLAN, ActionFail.STATIC);
      return;
    }
    else if ((clan.getAllyId() == targetClan.getAllyId()) && (clan.getAllyId() != 0))
    {
      activeChar.sendPacket(Msg.A_DECLARATION_OF_CLAN_WAR_AGAINST_AN_ALLIED_CLAN_CANT_BE_MADE, ActionFail.STATIC);
      return;
    }
    else if ((targetClan.getLevel() < 3) || (targetClan.getAllSize() < 15))
    {
      activeChar.sendPacket(Msg.A_CLAN_WAR_CAN_BE_DECLARED_ONLY_IF_THE_CLAN_IS_LEVEL_THREE_OR_ABOVE_AND_THE_NUMBER_OF_CLAN_MEMBERS_IS_FIFTEEN_OR_GREATER, ActionFail.STATIC);
      return;
    }
    ClanTable.getInstance().startClanWar(activeChar.getClan(), targetClan);
View Full Code Here

    getResidence().broadcastResidenceState();
  }

    @Override
    public void processStep(Clan newOwnerClan) {
        Clan oldOwnerClan = getResidence().getOwner();

        getResidence().changeOwner(newOwnerClan);

        if (oldOwnerClan != null) {
            SiegeClanObject ownerSiegeClan = getSiegeClan(DEFENDERS, oldOwnerClan);
View Full Code Here

        removeObjects(DEFENDERS);
        removeObjects(DEFENDERS_WAITING);
        removeObjects(DEFENDERS_REFUSED);

        Clan ownerClan = getResidence().getOwner();
        if (ownerClan != null) {
            if (_oldOwner == ownerClan) {
                getResidence().setRewardCount(getResidence().getRewardCount() + 1);
                ownerClan.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_BEEN_ADDED_TO_YOUR_CLANS_REPUTATION_SCORE).addInteger(ownerClan.incReputation(1500, false, toString())));
            } else {
                broadcastToWorld(new SystemMessage2(SystemMsg.CLAN_S1_IS_VICTORIOUS_OVER_S2S_CASTLE_SIEGE).addString(ownerClan.getName()).addResidenceName(getResidence()));

                ownerClan.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.SINCE_YOUR_CLAN_EMERGED_VICTORIOUS_FROM_THE_SIEGE_S1_POINTS_HAVE_BEEN_ADDED_TO_YOUR_CLANS_REPUTATION_SCORE).addInteger(ownerClan.incReputation(3000, false, toString())));

                if (_oldOwner != null)
                    _oldOwner.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.YOUR_CLAN_HAS_FAILED_TO_DEFEND_THE_CASTLE_S1_POINTS_HAVE_BEEN_DEDUCTED_FROM_YOU_CLAN_REPUTATION_SCORE_AND_ADDED_TO_YOUR_OPPONENTS).addInteger(-_oldOwner.incReputation(-3000, false, toString())));

                for (UnitMember member : ownerClan) {
View Full Code Here

TOP

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

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.