Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2Clan$SubPledge


  @Override
  protected void runImpl()
  {
    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(new ActionFailed());
      return;
    }

    if (!playerClan.isAtWarWith(clan.getClanId()))
    {
      player.sendMessage("You aren't at war with this clan.");
      player.sendPacket(new ActionFailed());
      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(new ActionFailed());
    //            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


    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_DISMISS_YOURSELF));
      return;
    }

    L2Clan clan = activeChar.getClan();

    L2ClanMember member = clan.getClanMember(_target);
    if (member == null)
    {
      _log.warning("Target ("+_target+") is not member of the clan");
      return;
    }
    if (member.isOnline() && member.getPlayerInstance().isInCombat())
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.CLAN_MEMBER_CANNOT_BE_DISMISSED_DURING_COMBAT));
      return;
    }

        // this also updates the database
    clan.removeClanMember(_target, System.currentTimeMillis() + Config.ALT_CLAN_JOIN_DAYS * 86400000L); //24*60*60*1000 = 86400000
        clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + Config.ALT_CLAN_JOIN_DAYS * 86400000L); //24*60*60*1000 = 86400000
        clan.updateClanInDB();

    SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_EXPELLED);
    sm.addString(member.getName());
    clan.broadcastToOnlineMembers(sm);
    sm = null;
    activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_CLAN_MEMBER));
    activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_MUST_WAIT_BEFORE_ACCEPTING_A_NEW_MEMBER));

      // Remove the Player From the Member list
    clan.broadcastToOnlineMembers(new PledgeShowMemberListDelete(_target));

    if (member.isOnline())
    {
      L2PcInstance player = member.getPlayerInstance();
      player.sendPacket(new SystemMessage(SystemMessageId.CLAN_MEMBERSHIP_TERMINATED));
View Full Code Here

    if (_activeChar == null)
        return;
        _clan = _activeChar.getClan();
    if (_clan == null)
        return;
        L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);

        if(clan == null)
        {
          _activeChar.sendMessage("No such clan.");
          _activeChar.sendPacket(new ActionFailed());
            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(new ActionFailed());
            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(new ActionFailed());
View Full Code Here

    L2PcInstance activeChar = getClient().getActiveChar();

    if (activeChar == null)
        return;

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

    if (clan.getDissolvingExpiryTime() > System.currentTimeMillis())
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_SET_CREST_WHILE_DISSOLUTION_IN_PROGRESS));
          return;
    }

    if (_length < 0)
    {
          activeChar.sendMessage("File transfer error.");
          return;
        }
    if (_length > 256)
        {
          activeChar.sendMessage("The clan crest file size was too big (max 256 bytes).");
          return;
        }
    if (_length == 0 || _data.length == 0)
    {
      CrestCache.getInstance().removePledgeCrest(clan.getCrestId());

            clan.setHasCrest(false);
      activeChar.sendPacket(new SystemMessage(SystemMessageId.CLAN_CREST_HAS_BEEN_DELETED));

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

            return;
    }
   

    if ((activeChar.getClanPrivileges() & L2Clan.CP_CL_REGISTER_CREST) == L2Clan.CP_CL_REGISTER_CREST)
    {
      if (clan.getLevel() < 3)
      {
        activeChar.sendPacket(new SystemMessage(SystemMessageId.CLAN_LVL_3_NEEDED_TO_SET_CREST));
        return;
      }

            CrestCache crestCache = CrestCache.getInstance();

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

            if(clan.hasCrest())
            {
              crestCache.removePledgeCrest(newId);
            }

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

            java.sql.Connection con = null;

            try
            {
                con = L2DatabaseFactory.getInstance().getConnection();
                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();
            }
            catch (SQLException e)
            {
                _log.warning("could not update the crest id:"+e.getMessage());
            }
            finally
            {
                try { con.close(); } catch (Exception e) {}
            }

            clan.setCrestId(newId);
            clan.setHasCrest(true);

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

    }
  }
View Full Code Here

          {
              returnItem(_sellerClanName, 57, _highestBidderMaxBid, true);
              returnItem(_sellerClanName, 57, ClanHallManager.getInstance().getClanHallById(_itemId).getLease(), false);
          }
        deleteAuctionFromDB();
        L2Clan Clan = ClanTable.getInstance().getClanByName(_bidders.get(_highestBidderId).getClanName());
        _bidders.remove(_highestBidderId);
        Clan.setAuctionBiddedAt(0, true);
        removeBids();
        ClanHallManager.getInstance().setOwner(_itemId, Clan);
      }else{
        /** Task waiting ClanHallManager is loaded every 3s */
            ThreadPoolManager.getInstance().scheduleGeneral(new AutoEndTask(), 3000);
View Full Code Here

        }
    }

    public void updatePlayerSiegeStateFlags(boolean clear)
    {
      L2Clan clan;
      for(L2SiegeClan siegeclan : getAttackerClans())
        {
             clan = ClanTable.getInstance().getClan(siegeclan.getClanId());
             for (L2PcInstance member : clan.getOnlineMembers(""))
             {
                 if (clear) member.setSiegeState((byte)0);
                 else member.setSiegeState((byte)1);
                 member.sendPacket(new UserInfo(member));
                 for (L2PcInstance player : member.getKnownList().getKnownPlayers().values()) {
              player.sendPacket(new RelationChanged(member, member.getRelation(player), member.isAutoAttackable(player)));
                 }
             }
        }
      for(L2SiegeClan siegeclan : getDefenderClans())
        {
            clan = ClanTable.getInstance().getClan(siegeclan.getClanId());
            for (L2PcInstance member : clan.getOnlineMembers(""))
            {
                if (clear) member.setSiegeState((byte)0);
                else member.setSiegeState((byte)2);
                member.sendPacket(new UserInfo(member));
                for (L2PcInstance player : member.getKnownList().getKnownPlayers().values()) {
View Full Code Here

     * @return
     */
    public List<L2PcInstance> getAttackersInZone()
    {
      List<L2PcInstance> players = new FastList<L2PcInstance>();
      L2Clan clan;
      for(L2SiegeClan siegeclan : getAttackerClans())
        {
             clan = ClanTable.getInstance().getClan(siegeclan.getClanId());
             for (L2PcInstance player : clan.getOnlineMembers(""))
             {
               if (checkIfInZone(player.getX(), player.getY(), player.getZ())) players.add(player);
             }
        }
      return players;
View Full Code Here

     * @return
     */
    public List<L2PcInstance> getDefendersButNotOwnersInZone()
    {
        List<L2PcInstance> players = new FastList<L2PcInstance>();
      L2Clan clan;
      for(L2SiegeClan siegeclan : getDefenderClans())
        {
             clan = ClanTable.getInstance().getClan(siegeclan.getClanId());
             if (clan.getClanId() == getCastle().getOwnerId()) continue;
             for (L2PcInstance player : clan.getOnlineMembers(""))
             {
               if (checkIfInZone(player.getX(), player.getY(), player.getZ())) players.add(player);
             }
        }
      return players;
View Full Code Here

     * @return
     */
    public List<L2PcInstance> getOwnersInZone()
    {
        List<L2PcInstance> players = new FastList<L2PcInstance>();
      L2Clan clan;
      for(L2SiegeClan siegeclan : getDefenderClans())
        {
             clan = ClanTable.getInstance().getClan(siegeclan.getClanId());
             if (clan.getClanId() != getCastle().getOwnerId()) continue;
             for (L2PcInstance player : clan.getOnlineMembers(""))
             {
               if (checkIfInZone(player.getX(), player.getY(), player.getZ())) players.add(player);
             }
        }
      return players;
View Full Code Here

  {
    if (Config.DEBUG)
      _log.fine("infos for clan " + _clanId + " requested");

    L2PcInstance activeChar = getClient().getActiveChar();
    L2Clan clan = ClanTable.getInstance().getClan(_clanId);
    if (clan == null)
    {
      _log.warning("Clan data for clanId " + _clanId + " is missing");
      return; // we have no clan data ?!? should not happen
    }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2Clan$SubPledge

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.