Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Clan


    else
    {
      if(!(requestor.getRequest().getRequestPacket() instanceof RequestJoinAlly))
        return; // hax

      L2Clan clan = requestor.getClan();
      // we must double check this cause of hack
      if(clan.checkAllyJoinCondition(requestor, activeChar))
      {
        //TODO: Need correct message id
        requestor.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_SUCCEEDED_INVITING_FRIEND));
        activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ACCEPTED_ALLIANCE));
        activeChar.getClan().setAllyId(clan.getAllyId());
        activeChar.getClan().setAllyName(clan.getAllyName());
        activeChar.getClan().setAllyPenaltyExpiryTime(0, 0);
        activeChar.getClan().setAllyCrest(clan.getAllyCrestId());
        activeChar.getClan().updateClanInDB();
      }
    }

    activeChar.getRequest().onRequestResponse();
View Full Code Here


    {
      player.sendPacket(new SystemMessage(SystemMessageId.ONLY_CLAN_LEADER_WITHDRAW_ALLY));
      return;
    }

    L2Clan clan = player.getClan();

    if (clan.getAllyId() == 0)
    {
      player.sendPacket(new SystemMessage(SystemMessageId.NO_CURRENT_ALLIANCES));
      return;
    }

    if (clan.getClanId() == clan.getAllyId())
    {
      player.sendPacket(new SystemMessage(SystemMessageId.ALLIANCE_LEADER_CANT_WITHDRAW));
      return;
    }

    long currentTime = System.currentTimeMillis();

    clan.setAllyId(0);
    clan.setAllyName(null);
    clan.setAllyPenaltyExpiryTime(currentTime + Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000L, L2Clan.PENALTY_TYPE_CLAN_LEAVED); //24*60*60*1000 = 86400000
    clan.setAllyCrest(0);
    clan.updateClanInDB();

    player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_ALLIANCE));
  }
View Full Code Here

        if(rset.next())
        {
          String clanName = rset.getString("clan_name");
          if(clanName != null)
          {
            L2Clan clan = ClanTable.getInstance().getClanByName(clanName);
            if(clan != null)
            {
              clan.setReputationScore(clan.getReputationScore() + 100, true);
              clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
              SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION);
              sm.addString(partyMemberName);
              sm.addNumber(100);
              clan.broadcastToOnlineMembers(sm);
              sm = null;
            }
            clan = null;
          }
          clanName = null;
View Full Code Here

    L2PcInstance activeChar = getClient().getActiveChar();

    if(activeChar == null)
      return;

    L2Clan clan = activeChar.getClan();
    if(clan == null)
      return;

    if(_data == null)
    {
      CrestCache.getInstance().removePledgeCrestLarge(clan.getCrestId());

      clan.setHasCrestLarge(false);
      activeChar.sendMessage("The insignia has been removed.");

      for(L2PcInstance member : clan.getOnlineMembers(""))
      {
        member.broadcastUserInfo();
      }

      return;
    }

    if(_size > 2176)
    {
      activeChar.sendMessage("The insignia file size is greater than 2176 bytes.");
      return;
    }

    if((activeChar.getClanPrivileges() & L2Clan.CP_CL_REGISTER_CREST) == L2Clan.CP_CL_REGISTER_CREST)
    {
      if(clan.getHasCastle() == 0 && clan.getHasHideout() == 0)
      {
        activeChar.sendMessage("Only a clan that owns a clan hall or a castle can get their emblem displayed on clan related items"); //there is a system message for that but didnt found the id
        return;
      }

      CrestCache crestCache = CrestCache.getInstance();

      int newId = IdFactory.getInstance().getNextId();

      if(!crestCache.savePledgeCrestLarge(newId, _data))
      {
        _log.log(Level.INFO, "Error loading large crest of clan:" + clan.getName());
        return;
      }

      if(clan.hasCrestLarge())
      {
        crestCache.removePledgeCrestLarge(clan.getCrestLargeId());
      }

      Connection con = null;

      try
      {
        con = L2DatabaseFactory.getInstance().getConnection(false);
        PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?");
        statement.setInt(1, newId);
        statement.setInt(2, clan.getClanId());
        statement.executeUpdate();
        statement.close();

        statement = null;
      }
      catch(SQLException e)
      {
        if(Config.ENABLE_ALL_EXCEPTIONS)
          e.printStackTrace();
       
        _log.warning("could not update the large crest id:" + e.getMessage());
      }
      finally
      {
        CloseUtil.close(con);
        con = null;
      }

      clan.setCrestLargeId(newId);
      clan.setHasCrestLarge(true);

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

      for(L2PcInstance member : clan.getOnlineMembers(""))
      {
        member.broadcastUserInfo();
      }

    }
View Full Code Here

      activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER));
      return;
    }

    L2PcInstance target = (L2PcInstance) L2World.getInstance().findObject(_id);
    L2Clan clan = activeChar.getClan();

    if(!clan.checkAllyJoinCondition(activeChar, target))
      return;

    if(!activeChar.getRequest().setRequest(target, this))
      return;
View Full Code Here

  /**
   * @param activeChar
   */
  private void notifyClanMembers(L2PcInstance activeChar)
  {
    L2Clan clan = activeChar.getClan();
    if (clan != null)
    {
      clan.getClanMember(activeChar.getObjectId()).setPlayerInstance(activeChar);
      clan.broadcastToOtherOnlineMembers(new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_LOGGED_IN).addString(activeChar.getName()), activeChar);
      clan.broadcastToOtherOnlineMembers(new PledgeShowMemberListUpdate(activeChar), activeChar);
    }
  }
View Full Code Here

    activeChar.setPledgeClass(pledgeClass);
  }
 
  private void notifyCastleOwner(L2PcInstance activeChar)
  {
    L2Clan clan = activeChar.getClan();
    if (clan != null)
    {
      if (clan.getHasCastle() > 0)
      {
        Castle castle = CastleManager.getInstance().getCastleById(clan.getHasCastle());
        if ((castle != null) && (activeChar.getObjectId() == clan.getLeaderId()))
          Announcements.getInstance().announceToAll("Lord " + activeChar.getName() + " Ruler Of " + castle.getName() + " Castle is now Online!");
      }
    }
  }
View Full Code Here

  {
    L2PcInstance activeChar = getClient().getActiveChar();
    if(activeChar == null)
      return;

    L2Clan clan = activeChar.getClan();
    if(clan != null)
    {
      PledgeShowMemberListAll pm = new PledgeShowMemberListAll(clan, activeChar);
      activeChar.sendPacket(pm);
    }
View Full Code Here

          str += "</center></body></html>";
        }
      }
      else
      {
        L2Clan owner = ClanTable.getInstance().getClan(getClanHall().getOwnerId());
        if(owner != null && owner.getLeader() != null)
        {
          str = "<html><body>Hello there!<br>This clan hall is owned by <font color=\"55FFFF\">" + owner.getLeader().getName() + " who is the Lord of the ";
          str += owner.getName() + "</font> clan.<br>";
          str += "I am sorry, but only the clan members who belong to the <font color=\"55FFFF\">" + owner.getName() + "</font> clan can enter the clan hall.</body></html>";
        }
        else
        {
          str = "<html><body>" + getName() + ":<br1>Clan hall <font color=\"LEVEL\">" + getClanHall().getName() + "</font> have no owner clan.<br>You can rent it at auctioneers..</body></html>";
        }
View Full Code Here

      player.sendMessage("You can't declare war. You are not clan leader.");
      player.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }
   
    L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
    if (clan == null)
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_WAR_CANNOT_DECLARED_CLAN_NOT_EXIST);
      player.sendPacket(sm);
      player.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }
    else if (_clan.getAllyId() == clan.getAllyId() && _clan.getAllyId() != 0)
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_WAR_AGAINST_A_ALLIED_CLAN_NOT_WORK);
      player.sendPacket(sm);
      player.sendPacket(ActionFailed.STATIC_PACKET);
      sm = null;
      return;
    }
    else if (clan.getLevel() < 3 || clan.getMembersCount() < Config.ALT_CLAN_MEMBERS_FOR_WAR)
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_WAR_DECLARED_IF_CLAN_LVL3_OR_15_MEMBER);
      player.sendPacket(sm);
      player.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }
    else if (_clan.isAtWarWith(clan.getClanId()))
    {
      SystemMessage sm = new SystemMessage(SystemMessageId.ALREADY_AT_WAR_WITH_S1_WAIT_5_DAYS); // msg id 628
      sm.addString(clan.getName());
      player.sendPacket(sm);
      player.sendPacket(ActionFailed.STATIC_PACKET);
      sm = null;
      return;
    }
   
    // _log.warning("RequestStartPledgeWar, leader: " + clan.getLeaderName() + " clan: "+ _clan.getName());
   
    // L2PcInstance leader = L2World.getInstance().getPlayer(clan.getLeaderName());
   
    // if(leader == null)
    // return;
   
    // if(leader != null && leader.isOnline() == 0)
    // {
    // player.sendMessage("Clan leader isn't online.");
    // player.sendPacket(ActionFailed.STATIC_PACKET);
    // return;
    // }
   
    // if (leader.isProcessingRequest())
    // {
    // SystemMessage sm = new SystemMessage(SystemMessage.S1_IS_BUSY_TRY_LATER);
    // sm.addString(leader.getName());
    // player.sendPacket(sm);
    // return;
    // }
   
    // if (leader.isTransactionInProgress())
    // {
    // SystemMessage sm = new SystemMessage(SystemMessage.S1_IS_BUSY_TRY_LATER);
    // sm.addString(leader.getName());
    // player.sendPacket(sm);
    // return;
    // }
   
    // leader.setTransactionRequester(player);
    // player.setTransactionRequester(leader);
    // leader.sendPacket(new StartPledgeWar(_clan.getName(),player.getName()));
   
    ClanTable.getInstance().storeclanswars(player.getClanId(), clan.getClanId());
    for (L2PcInstance cha : L2World.getInstance().getAllPlayers())
    {
      if (cha.getClan() == player.getClan() || cha.getClan() == clan)
      {
        cha.broadcastUserInfo();
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Clan

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.