ClanTable.getInstance().dissolveClan(player);
}
public void levelUpClan(L2Player player)
{
L2Clan clan = player.getClan();
if(clan == null)
{
return;
}
if(!player.isClanLeader())
{
player.sendPacket(Msg.ONLY_THE_CLAN_LEADER_IS_ENABLED);
return;
}
boolean increaseClanLevel = false;
switch(clan.getLevel())
{
case 0:
// Upgrade to 1
if(player.getSp() >= 20000 && player.getAdena() >= 650000)
{
player.setSp(player.getSp() - 20000);
player.reduceAdena(650000, true);
increaseClanLevel = true;
}
break;
case 1:
// Upgrade to 2
if(player.getSp() >= 100000 && player.getAdena() >= 2500000)
{
player.setSp(player.getSp() - 100000);
player.reduceAdena(2500000, true);
increaseClanLevel = true;
}
break;
case 2:
// Upgrade to 3
// itemid 1419 == Blood Mark
if(player.getSp() >= 350000 && player.getInventory().getItemByItemId(1419) != null)
{
player.setSp(player.getSp() - 350000);
player.getInventory().destroyItemByItemId(1419, 1, true);
increaseClanLevel = true;
}
break;
case 3:
// Upgrade to 4
// itemid 3874 == Alliance Manifesto
if(player.getSp() >= 1000000 && player.getInventory().getItemByItemId(3874) != null)
{
player.setSp(player.getSp() - 1000000);
player.getInventory().destroyItemByItemId(3874, 1, true);
increaseClanLevel = true;
}
break;
case 4:
// Upgrade to 5
// itemid 3870 == Seal of Aspiration
if(player.getSp() >= 2500000 && player.getInventory().getItemByItemId(3870) != null)
{
player.setSp(player.getSp() - 2500000);
player.getInventory().destroyItemByItemId(3870, 1, true);
increaseClanLevel = true;
}
break;
case 5:
// Upgrade to 6
if(clan.getReputationScore() >= 10000 && clan.getMembersCount() >= 30)
{
clan.incReputation(-10000, false, "LvlUpClan");
increaseClanLevel = true;
}
break;
case 6:
// Upgrade to 7
if(clan.getReputationScore() >= 20000 && clan.getMembersCount() >= 80)
{
clan.incReputation(-20000, false, "LvlUpClan");
increaseClanLevel = true;
}
break;
case 7:
// Upgrade to 8
if(clan.getReputationScore() >= 40000 && clan.getMembersCount() >= 120)
{
clan.incReputation(-40000, false, "LvlUpClan");
increaseClanLevel = true;
}
break;
case 8:
// Upgrade to 9
// itemId 9910 == Blood Oath
if(clan.getReputationScore() >= 40000 && clan.getMembersCount() >= 120)
{
L2ItemInstance item = player.getInventory().getItemByItemId(9910);
if(item != null && item.getCount() >= 150)
{
clan.incReputation(-40000, false, "LvlUpClan");
player.getInventory().destroyItemByItemId(9910, 150, true);
increaseClanLevel = true;
}
}
break;
case 9:
// Upgrade to 10
// itemId 9911 == Blood Alliance
if(clan.getReputationScore() >= 40000 && clan.getMembersCount() >= 140)
{
L2ItemInstance item = player.getInventory().getItemByItemId(9911);
if(item != null && item.getCount() >= 5)
{
clan.incReputation(-40000, false, "LvlUpClan");
player.getInventory().destroyItemByItemId(9911, 5, true);
increaseClanLevel = true;
}
}
break;
case 10:
// Upgrade to 11
if(clan.getReputationScore() >= 75000 && clan.getMembersCount() >= 170 && clan.getHasCastle() > 0 && player.isQuestCompleted(QuestManager.getBecomeALordForCastle(clan.getHasCastle()).getName()))
{
clan.incReputation(-75000, false, "LvlUpClan");
increaseClanLevel = true;
}
break;
}
if(increaseClanLevel)
{
player.sendChanges();
clan.setLevel((byte) (clan.getLevel() + 1));
clan.updateClanInDB();
doCast(SkillTable.getInstance().getInfo(5103, 1), player, true);
if(clan.getLevel() >= CastleSiegeManager.getSiegeClanMinLevel())
{
SiegeManager.addSiegeSkills(player);
}
if(clan.getLevel() == 5)
{
player.sendPacket(Msg.NOW_THAT_YOUR_CLAN_LEVEL_IS_ABOVE_LEVEL_5_IT_CAN_ACCUMULATE_CLAN_REPUTATION_POINTS);
}
// notify all the members about it
PledgeShowInfoUpdate pu = new PledgeShowInfoUpdate(clan);
PledgeStatusChanged ps = new PledgeStatusChanged(clan);
for(L2ClanMember mbr : clan.getMembers())
{
if(mbr.isOnline())
{
mbr.getPlayer().updatePledgeClass();
mbr.getPlayer().sendPacket(Msg.CLANS_SKILL_LEVEL_HAS_INCREASED, pu, ps);