showVaultWindowDeposit(player);
else if (val.equalsIgnoreCase("withdraw"))
showVaultWindowWithdraw(player);
else
{
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/vault.htm");
sendHtmlMessage(player, html);
}
}
else
player.sendMessage("You are not authorized to do this!");
return;
}
else if (actualCommand.equalsIgnoreCase("door"))
{
if ((player.getClanPrivileges() & L2Clan.CP_CH_OPEN_DOOR) == L2Clan.CP_CH_OPEN_DOOR)
{
if (val.equalsIgnoreCase("open"))
getClanHall().openCloseDoors(true);
else if (val.equalsIgnoreCase("close"))
getClanHall().openCloseDoors(false);
else
{
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/door.htm");
sendHtmlMessage(player, html);
}
}
else
player.sendMessage("You are not authorized to do this!");
}
else if (actualCommand.equalsIgnoreCase("functions"))
{
if (val.equalsIgnoreCase("tele"))
{
NpcHtmlMessage html = new NpcHtmlMessage(1);
if (getClanHall().getFunction(ClanHall.FUNC_TELEPORT) == null)
html.setFile("data/html/clanHallManager/chamberlain-nac.htm");
else
html.setFile("data/html/clanHallManager/tele"+getClanHall().getLocation()+getClanHall().getFunction(ClanHall.FUNC_TELEPORT).getLvl()+".htm");
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("item_creation"))
{
if (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE) == null){
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/chamberlain-nac.htm");
sendHtmlMessage(player, html);
return;
}
if (st.countTokens() < 1) return;
int valbuy = Integer.parseInt(st.nextToken())+(getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLvl()*100000);
showBuyWindow(player, valbuy);
}
else if (val.equalsIgnoreCase("support"))
{
NpcHtmlMessage html = new NpcHtmlMessage(1);
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT)== null)
html.setFile("data/html/clanHallManager/chamberlain-nac.htm");
else{
html.setFile("data/html/clanHallManager/support"+getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl()+".htm");
html.replace("%mp%", String.valueOf(getCurrentMp()));
}
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("back"))
showMessageWindow(player);
else{
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/functions.htm");
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
html.replace("%xp_regen%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl()) + "%");
else
html.replace("%xp_regen%", "0");
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) != null)
html.replace("%hp_regen%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl()) + "%");
else
html.replace("%hp_regen%", "0");
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) != null)
html.replace("%mp_regen%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl()) + "%");
else
html.replace("%mp_regen", "0");
sendHtmlMessage(player, html);
}
}
else if (actualCommand.equalsIgnoreCase("manage"))
{
if ((player.getClanPrivileges() & L2Clan.CP_CH_SET_FUNCTIONS) == L2Clan.CP_CH_SET_FUNCTIONS)
{
if (val.equalsIgnoreCase("recovery"))
{
if (st.countTokens() >= 1)
{
if(getClanHall().getOwnerId() == 0){
player.sendMessage("This clan Hall have no owner, you cannot change configuration");
return;
}
val = st.nextToken();
if (val.equalsIgnoreCase("hp"))
{
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Mp editing invoked");
val = st.nextToken();
int percent = Integer.valueOf(val);
switch (percent)
{
case 0:
fee = 0;
break;
case 20:
fee = Config.CH_HPREG1_FEE;
break;
case 40:
fee = Config.CH_HPREG2_FEE;
break;
case 80:
fee = Config.CH_HPREG3_FEE;
break;
case 100:
fee = Config.CH_HPREG4_FEE;
break;
case 120:
fee = Config.CH_HPREG5_FEE;
break;
case 140:
fee = Config.CH_HPREG6_FEE;
break;
case 160:
fee = Config.CH_HPREG7_FEE;
break;
case 180:
fee = Config.CH_HPREG8_FEE;
break;
case 200:
fee = Config.CH_HPREG9_FEE;
break;
case 220:
fee = Config.CH_HPREG10_FEE;
break;
case 240:
fee = Config.CH_HPREG11_FEE;
break;
case 260:
fee = Config.CH_HPREG12_FEE;
break;
default:
fee = Config.CH_HPREG13_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_RESTORE_HP, percent, fee, Config.CH_HPREG_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
else if (val.equalsIgnoreCase("mp"))
{
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Mp editing invoked");
val = st.nextToken();
int percent = Integer.valueOf(val);
switch (percent)
{
case 0:
fee = 0;
break;
case 5:
fee = Config.CH_MPREG1_FEE;
break;
case 10:
fee = Config.CH_MPREG2_FEE;
break;
case 15:
fee = Config.CH_MPREG3_FEE;
break;
case 30:
fee = Config.CH_MPREG4_FEE;
break;
default:
fee = Config.CH_MPREG5_FEE;
break;
}
if(!getClanHall().updateFunctions(ClanHall.FUNC_RESTORE_MP, percent, fee, Config.CH_MPREG_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
else if (val.equalsIgnoreCase("exp"))
{
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Exp editing invoked");
val = st.nextToken();
int percent = Integer.valueOf(val);
switch (percent)
{
case 0:
fee = 0;
break;
case 5:
fee = Config.CH_EXPREG1_FEE;
break;
case 10:
fee = Config.CH_EXPREG2_FEE;
break;
case 15:
fee = Config.CH_EXPREG3_FEE;
break;
case 25:
fee = Config.CH_EXPREG4_FEE;
break;
case 35:
fee = Config.CH_EXPREG5_FEE;
break;
case 40:
fee = Config.CH_EXPREG6_FEE;
break;
default:
fee = Config.CH_EXPREG7_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_RESTORE_EXP, percent, fee, Config.CH_EXPREG_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
}
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/edit_recovery"+getClanHall().getGrade()+".htm");
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP) != null){
html.replace("%hp%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLvl()) + "%");
html.replace("%hpPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getLease()));
html.replace("%hpDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_RESTORE_HP).getEndTime()));
}else{
html.replace("%hp%", "0");
html.replace("%hpPrice%", "0");
html.replace("%hpDate%","0");
}
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP) != null){
html.replace("%exp%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl()) + "%");
html.replace("%expPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getLease()));
html.replace("%expDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_RESTORE_EXP).getEndTime()));
}else{
html.replace("%exp%", "0");
html.replace("%expPrice%", "0");
html.replace("%expDate%","0");
}
if (getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP) != null ){
html.replace("%mp%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLvl()) + "%");
html.replace("%mpPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getLease()));
html.replace("%mpDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_RESTORE_MP).getEndTime()));
}else{
html.replace("%mp%", "0");
html.replace("%mpPrice%", "0");
html.replace("%mpDate%","0");
}
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("other"))
{
if (st.countTokens() >= 1)
{
if(getClanHall().getOwnerId() == 0){
player.sendMessage("This clan Hall have no owner, you cannot change configuration");
return;
}
val = st.nextToken();
if (val.equalsIgnoreCase("item"))
{
if (st.countTokens() >= 1)
{
if(getClanHall().getOwnerId() == 0){
player.sendMessage("This clan Hall have no owner, you cannot change configuration");
return;
}
if (Config.DEBUG) _log.warning("Item editing invoked");
val = st.nextToken();
int fee;
int lvl = Integer.valueOf(val);
switch (lvl)
{
case 0:
fee = 0;
break;
case 1:
fee = Config.CH_ITEM1_FEE;
break;
case 2:
fee = Config.CH_ITEM2_FEE;
break;
default:
fee = Config.CH_ITEM3_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_ITEM_CREATE, lvl, fee, Config.CH_ITEM_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
else if (val.equalsIgnoreCase("tele"))
{
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Tele editing invoked");
val = st.nextToken();
int lvl = Integer.valueOf(val);
switch (lvl)
{
case 0:
fee = 0;
break;
case 1:
fee = Config.CH_TELE1_FEE;
break;
default:
fee = Config.CH_TELE2_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_TELEPORT, lvl, fee, Config.CH_TELE_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_TELEPORT) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
else if (val.equalsIgnoreCase("support"))
{
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Support editing invoked");
val = st.nextToken();
int lvl = Integer.valueOf(val);
switch (lvl)
{
case 0:
fee = 0;
break;
case 1:
fee = Config.CH_SUPPORT1_FEE;
break;
case 2:
fee = Config.CH_SUPPORT2_FEE;
break;
case 3:
fee = Config.CH_SUPPORT3_FEE;
break;
case 4:
fee = Config.CH_SUPPORT4_FEE;
break;
case 5:
fee = Config.CH_SUPPORT5_FEE;
break;
case 6:
fee = Config.CH_SUPPORT6_FEE;
break;
case 7:
fee = Config.CH_SUPPORT7_FEE;
break;
default:
fee = Config.CH_SUPPORT8_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_SUPPORT, lvl, fee, Config.CH_SUPPORT_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_SUPPORT) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
}
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/edit_other"+getClanHall().getGrade()+".htm");
if (getClanHall().getFunction(ClanHall.FUNC_TELEPORT) != null){
html.replace("%tele%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_TELEPORT).getLvl()));
html.replace("%telePrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_TELEPORT).getLease()));
html.replace("%teleDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_TELEPORT).getEndTime()));
}else{
html.replace("%tele%", "0");
html.replace("%telePrice%", "0");
html.replace("%teleDate%","0");
}
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT) != null){
html.replace("%support%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl()));
html.replace("%supportPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLease()));
html.replace("%supportDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getEndTime()));
}else{
html.replace("%support%", "0");
html.replace("%supportPrice%", "0");
html.replace("%supportDate%","0");
}
if (getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE) != null){
html.replace("%item%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLvl()));
html.replace("%itemPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getLease()));
html.replace("%itemDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_ITEM_CREATE).getEndTime()));
}else{
html.replace("%item%", "0");
html.replace("%itemPrice%", "0");
html.replace("%itemDate%","0");
}
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("deco"))
{
if (st.countTokens() >= 1)
{
if(getClanHall().getOwnerId() == 0){
player.sendMessage("This clan Hall have no owner, you cannot change configuration");
return;
}
val = st.nextToken();
if (val.equalsIgnoreCase("curtains")){
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Deco curtains editing invoked");
val = st.nextToken();
int lvl = Integer.valueOf(val);
switch (lvl)
{
case 0:
fee = 0;
break;
case 1:
fee = Config.CH_CURTAIN1_FEE;
break;
default:
fee = Config.CH_CURTAIN2_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_DECO_CURTAINS, lvl, fee, Config.CH_CURTAIN_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}else if (val.equalsIgnoreCase("porch")){
if (st.countTokens() >= 1)
{
int fee;
if (Config.DEBUG) _log.warning("Deco curtains editing invoked");
val = st.nextToken();
int lvl = Integer.valueOf(val);
switch (lvl)
{
case 0:
fee = 0;
break;
case 1:
fee = Config.CH_FRONT1_FEE;
break;
default:
fee = Config.CH_FRONT2_FEE;
break;
}
if (!getClanHall().updateFunctions(ClanHall.FUNC_DECO_FRONTPLATEFORM, lvl, fee, Config.CH_FRONT_FEE_RATIO, (getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM) == null)))
player.sendMessage("You don't have enough adena in your clan's warehouse");
else
revalidateDeco(player);
}
}
}
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/deco.htm");
if (getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS) != null){
html.replace("%curtain%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS).getLvl()));
html.replace("%curtainPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS).getLease()));
html.replace("%curtainDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_DECO_CURTAINS).getEndTime()));
}else{
html.replace("%curtain%", "0");
html.replace("%curtainPrice%", "0");
html.replace("%curtainDate%","0");
}
if (getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM) != null){
html.replace("%porch%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM).getLvl()));
html.replace("%porchPrice%", String.valueOf(getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM).getLease()));
html.replace("%porchDate%",format.format(getClanHall().getFunction(ClanHall.FUNC_DECO_FRONTPLATEFORM).getEndTime()));
}else{
html.replace("%porch%", "0");
html.replace("%porchPrice%", "0");
html.replace("%porchDate%","0");
}
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("back"))
showMessageWindow(player);
else
{
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile("data/html/clanHallManager/manage.htm");
sendHtmlMessage(player, html);
}
}
else
player.sendMessage("You are not authorized to do this!");
return;
}
else if (actualCommand.equalsIgnoreCase("support"))
{
setTarget(player);
L2Skill skill;
if (val == "") return;
try
{
int skill_id = Integer.parseInt(val);
try
{
int skill_lvl = 0;
if (st.countTokens() >= 1) skill_lvl = Integer.parseInt(st.nextToken());
skill = SkillTable.getInstance().getInfo(skill_id,skill_lvl);
if (skill.getSkillType() == SkillType.SUMMON)
player.doCast(skill);
else
doCast(skill);
if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT)== null)
return;
NpcHtmlMessage html = new NpcHtmlMessage(1);
if(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl() == 0)
return;
html.setFile("data/html/clanHallManager/support"+getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl()+".htm");
html.replace("%mp%", String.valueOf(getCurrentMp()));
sendHtmlMessage(player, html);
}
catch (Exception e)
{
player.sendMessage("Invalid skill level!");