Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Clan


    {
      player.sendMessage("Cannot open the portal here.");
      return;
    }

    L2Clan clan = player.getClan();
    if(clan != null)
    {
      if(CastleManager.getInstance().getCastleByOwner(clan) != null)
      {
        Castle castle = CastleManager.getInstance().getCastleByOwner(clan);
View Full Code Here


    writeD(0x01); //1
    writeD(0x00); //0
    int size = _castle.getSiege().getAttackerClans().size();
    if(size > 0)
    {
      L2Clan clan;

      writeD(size);
      writeD(size);
      for(L2SiegeClan siegeclan : _castle.getSiege().getAttackerClans())
      {
        clan = ClanTable.getInstance().getClan(siegeclan.getClanId());
        if(clan == null)
        {
          continue;
        }

        writeD(clan.getClanId());
        writeS(clan.getName());
        writeS(clan.getLeaderName());
        writeD(clan.getCrestId());
        writeD(0x00); //signed time (seconds) (not storated by L2J)
        writeD(clan.getAllyId());
        writeS(clan.getAllyName());
        writeS(""); //AllyLeaderName
        writeD(clan.getAllyCrestId());
      }
    }
    else
    {
      writeD(0x00);
View Full Code Here

        if(player.isClanLeader())
        {
          NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
          html.setFile("data/html/chamberlain/chamberlain-report.htm");
          html.replace("%objectId%", String.valueOf(getObjectId()));
          L2Clan clan = ClanTable.getInstance().getClan(getCastle().getOwnerId());
          html.replace("%clanname%", clan.getName());
          html.replace("%clanleadername%", clan.getLeaderName());
          html.replace("%castlename%", getCastle().getName());
          {
            int currentPeriod = SevenSigns.getInstance().getCurrentPeriod();
            switch(currentPeriod)
            {
View Full Code Here

  public boolean useUserCommand(int id, L2PcInstance activeChar)
  {
    if(id != COMMAND_IDS[0] && id != COMMAND_IDS[1] && id != COMMAND_IDS[2])
      return false;

    L2Clan clan = activeChar.getClan();

    if(clan == null)
    {
      activeChar.sendMessage("You are not in a clan.");
      return false;
    }

    SystemMessage sm;
    Connection con = null;

    try
    {
      con = L2DatabaseFactory.getInstance().getConnection(false);
      PreparedStatement statement;

      if(id == 88)
      {
        // Attack List
        activeChar.sendPacket(new SystemMessage(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON));
        statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 not in (select clan1 from clan_wars where clan2=?)");
        statement.setInt(1, clan.getClanId());
        statement.setInt(2, clan.getClanId());
      }
      else if(id == 89)
      {
        // Under Attack List
        activeChar.sendPacket(new SystemMessage(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU));
        statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan2=? and clan_id=clan1 and clan1 not in (select clan2 from clan_wars where clan1=?)");
        statement.setInt(1, clan.getClanId());
        statement.setInt(2, clan.getClanId());
      }
      else
      // ID = 90
      {
        // War List
        activeChar.sendPacket(new SystemMessage(SystemMessageId.WAR_LIST));
        statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 in (select clan1 from clan_wars where clan2=?)");
        statement.setInt(1, clan.getClanId());
        statement.setInt(2, clan.getClanId());
      }

      ResultSet rset = statement.executeQuery();
      while(rset.next())
      {
View Full Code Here

      answer = 0;
     
      if(clanId != 0)
      {
        L2Clan clan = ClanTable.getInstance().getClan(clanId);

        if(clan == null)
        {
          answer = 0; // jeezes!
        }
        else if(clan.getLeaderId() == objid)
        {
          answer = 2;
        }
        else
        {
View Full Code Here

      _log.info("Found old crest file \"" + file.getName() + "\" for clanId " + clanId);

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

      L2Clan clan = ClanTable.getInstance().getClan(clanId);

      if(clan != null)
      {
        removeOldPledgeCrest(clan.getCrestId());

        file.renameTo(new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp"));
        _log.info("Renamed Clan crest to new format: Crest_" + newId + ".bmp");

        Connection con = null;

        try
        {
          con = L2DatabaseFactory.getInstance().getConnection(false);
          PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_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 crest id:" + e.getMessage());
        }
        finally
        {
          CloseUtil.close(con);
        }

        clan.setCrestId(newId);
        clan.setHasCrest(true);
      }
      else
      {
        _log.info("Clan Id: " + clanId + " does not exist in table.. deleting.");
        file.delete();
View Full Code Here

  public void onStart()
  {
    getEffected().startAbnormalEffect(L2Character.ABNORMAL_EFFECT_MAGIC_CIRCLE);
    if (getEffected() instanceof L2PcInstance)
    {
      L2Clan clan = ((L2PcInstance) getEffected()).getClan();
      if (clan != null)
      {
        SystemMessage msg = new SystemMessage(SystemMessageId.COURT_MAGICIAN_CREATED_PORTAL);
        clan.broadcastToOtherOnlineMembers(msg, ((L2PcInstance) getEffected()));
      }
    }
   
  }
View Full Code Here

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

    L2Clan playerClan = player.getClan();
    if(playerClan == null)
      return;

    L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
    if(clan == null)
    {
      player.sendMessage("No such clan.");
      player.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    if(!playerClan.isAtWarWith(clan.getClanId()))
    {
      player.sendMessage("You aren't at war with this clan.");
      player.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    // Check if player who does the request has the correct rights to do it
    if((player.getClanPrivileges() & L2Clan.CP_CL_PLEDGE_WAR) != L2Clan.CP_CL_PLEDGE_WAR)
    {
      player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT));
      return;
    }

    //_log.info("RequestStopPledgeWar: By leader or authorized player: " + playerClan.getLeaderName() + " of clan: "
    //  + playerClan.getName() + " to clan: " + _pledgeName);

    //        L2PcInstance leader = L2World.getInstance().getPlayer(clan.getLeaderName());
    //        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;
    //        }

    ClanTable.getInstance().deleteclanswars(playerClan.getClanId(), clan.getClanId());
    for(L2PcInstance cha : L2World.getInstance().getAllPlayers())
    {
      if(cha.getClan() == player.getClan() || cha.getClan() == clan)
      {
        cha.broadcastUserInfo();
View Full Code Here

    _clan = _activeChar.getClan();
    if(_clan == null)
      return;

    L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
    if(clan == null)
    {
      _activeChar.sendMessage("No such clan.");
      _activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    _log.info("RequestSurrenderPledgeWar by " + getClient().getActiveChar().getClan().getName() + " with " + _pledgeName);

    if(!_clan.isAtWarWith(clan.getClanId()))
    {
      _activeChar.sendMessage("You aren't at war with this clan.");
      _activeChar.sendPacket(ActionFailed.STATIC_PACKET);
      return;
    }

    SystemMessage msg = new SystemMessage(SystemMessageId.YOU_HAVE_SURRENDERED_TO_THE_S1_CLAN);
    msg.addString(_pledgeName);
    _activeChar.sendPacket(msg);
    msg = null;
    _activeChar.deathPenalty(false);
    ClanTable.getInstance().deleteclanswars(_clan.getClanId(), clan.getClanId());
    /*L2PcInstance leader = L2World.getInstance().getPlayer(clan.getLeaderName());
    if(leader != null && leader.isOnline() == 0)
    {
        player.sendMessage("Clan leader isn't online.");
        player.sendPacket(ActionFailed.STATIC_PACKET);
View Full Code Here

   * @param castleId the castle id
   * @return true, if is castle lord
   */
  public boolean isCastleLord(int castleId)
  {
    L2Clan clan = getClan();

    // player has clan and is the clan leader, check the castle info
    if(clan != null && clan.getLeader().getPlayerInstance() == this)
    {
      // if the clan has a castle and it is actually the queried castle, return true
      Castle castle = CastleManager.getInstance().getCastleByOwner(clan);
      if(castle != null && castle == CastleManager.getInstance().getCastleById(castleId))
      {
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.