showChatWindow(player, _failDialog);
return;
}
if (actualCommand.equalsIgnoreCase("banish"))
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/Banish.htm");
sendHtmlMessage(player, html);
}
else if (actualCommand.equalsIgnoreCase("banish_foreigner"))
{
if (!isHaveRigths(player, getPrivDismiss()))
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
return;
}
getResidence().banishForeigner();
return;
}
else if (actualCommand.equalsIgnoreCase("Buy"))
{
if (val.equals(""))
{
return;
}
showShopWindow(player, Integer.valueOf(val), true);
}
else if (actualCommand.equalsIgnoreCase("manage_vault"))
{
if (val.equalsIgnoreCase("deposit"))
{
WarehouseFunctions.showDepositWindowClan(player);
}
else if (val.equalsIgnoreCase("withdraw"))
{
int value = Integer.valueOf(st.nextToken());
if (value == 99)
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/clan.htm");
html.replace("%npcname%", getName());
player.sendPacket(html);
}
else
{
WarehouseFunctions.showWithdrawWindowClan(player, value);
}
}
else
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/vault.htm");
sendHtmlMessage(player, html);
}
return;
}
else if (actualCommand.equalsIgnoreCase("door"))
{
showChatWindow(player, "residence/door.htm");
}
else if (actualCommand.equalsIgnoreCase("openDoors"))
{
if (isHaveRigths(player, getPrivDoors()))
{
for (int i : _doors)
{
ReflectionUtils.getDoor(i).openMe();
}
showChatWindow(player, "residence/door.htm");
}
else
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
}
}
else if (actualCommand.equalsIgnoreCase("closeDoors"))
{
if (isHaveRigths(player, getPrivDoors()))
{
for (int i : _doors)
{
ReflectionUtils.getDoor(i).closeMe();
}
showChatWindow(player, "residence/door.htm");
}
else
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
}
}
else if (actualCommand.equalsIgnoreCase("functions"))
{
if (!isHaveRigths(player, getPrivUseFunctions()))
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
return;
}
if (val.equalsIgnoreCase("tele"))
{
if (!getResidence().isFunctionActive(ResidenceFunction.TELEPORT))
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/teleportNotActive.htm");
sendHtmlMessage(player, html);
return;
}
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/teleport.htm");
TeleportLocation[] locs = getResidence().getFunction(ResidenceFunction.TELEPORT).getTeleports();
StringBuilder teleport_list = new StringBuilder(100 * locs.length);
String price;
final String delimiter = HtmlUtils.htmlNpcString(1000308);
for (TeleportLocation loc : locs)
{
price = String.valueOf(loc.getPrice());
teleport_list.append("<a action=\"bypass -h scripts_Util:Gatekeeper ");
teleport_list.append(loc.getX());
teleport_list.append(' ');
teleport_list.append(loc.getY());
teleport_list.append(' ');
teleport_list.append(loc.getZ());
teleport_list.append(' ');
teleport_list.append(price);
teleport_list.append("\" msg=\"811;F;");
teleport_list.append(loc.getName());
teleport_list.append("\">");
teleport_list.append(HtmlUtils.htmlNpcString(loc.getName()));
teleport_list.append(" - ");
teleport_list.append(price);
teleport_list.append(' ');
teleport_list.append(delimiter);
teleport_list.append("</a><br1>");
}
html.replace("%teleList%", teleport_list.toString());
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("item_creation"))
{
if (!getResidence().isFunctionActive(ResidenceFunction.ITEM_CREATE))
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/itemNotActive.htm");
sendHtmlMessage(player, html);
return;
}
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/item.htm");
String template = "<button value=\"Buy Item\" action=\"bypass -h npc_%objectId%_Buy %id%\" width=90 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">";
template = template.replaceAll("%id%", String.valueOf(getResidence().getFunction(ResidenceFunction.ITEM_CREATE).getBuylist()[1])).replace("%objectId%", String.valueOf(getObjectId()));
html.replace("%itemList%", template);
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("support"))
{
if (!getResidence().isFunctionActive(ResidenceFunction.SUPPORT))
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/supportNotActive.htm");
sendHtmlMessage(player, html);
return;
}
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/support.htm");
Object[][] allBuffs = getResidence().getFunction(ResidenceFunction.SUPPORT).getBuffs();
StringBuilder support_list = new StringBuilder(allBuffs.length * 50);
int i = 0;
for (Object[] buff : allBuffs)
{
Skill s = (Skill) buff[0];
support_list.append("<a action=\"bypass -h npc_%objectId%_support ");
support_list.append(String.valueOf(s.getId()));
support_list.append(' ');
support_list.append(String.valueOf(s.getLevel()));
support_list.append("\">");
support_list.append(s.getName());
support_list.append(" Lv.");
support_list.append(String.valueOf(s.getDisplayLevel()));
support_list.append("</a><br1>");
if ((++i % 5) == 0)
{
support_list.append("<br>");
}
}
html.replace("%magicList%", support_list.toString());
html.replace("%mp%", String.valueOf(Math.round(getCurrentMp())));
html.replace("%all%", Config.ALT_CH_ALL_BUFFS ? "<a action=\"bypass -h npc_%objectId%_support all\">Give all</a><br1><a action=\"bypass -h npc_%objectId%_support allW\">Give warrior</a><br1><a action=\"bypass -h npc_%objectId%_support allM\">Give mystic</a><br>" : "");
sendHtmlMessage(player, html);
}
else if (val.equalsIgnoreCase("back"))
{
showChatWindow(player, 0);
}
else
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/functions.htm");
if (getResidence().isFunctionActive(ResidenceFunction.RESTORE_EXP))
{
html.replace("%xp_regen%", String.valueOf(getResidence().getFunction(ResidenceFunction.RESTORE_EXP).getLevel()) + "%");
}
else
{
html.replace("%xp_regen%", "0%");
}
if (getResidence().isFunctionActive(ResidenceFunction.RESTORE_HP))
{
html.replace("%hp_regen%", String.valueOf(getResidence().getFunction(ResidenceFunction.RESTORE_HP).getLevel()) + "%");
}
else
{
html.replace("%hp_regen%", "0%");
}
if (getResidence().isFunctionActive(ResidenceFunction.RESTORE_MP))
{
html.replace("%mp_regen%", String.valueOf(getResidence().getFunction(ResidenceFunction.RESTORE_MP).getLevel()) + "%");
}
else
{
html.replace("%mp_regen%", "0%");
}
sendHtmlMessage(player, html);
}
}
else if (actualCommand.equalsIgnoreCase("manage"))
{
if (!isHaveRigths(player, getPrivSetFunctions()))
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
return;
}
if (val.equalsIgnoreCase("recovery"))
{
if (st.countTokens() >= 1)
{
val = st.nextToken();
boolean success = true;
if (val.equalsIgnoreCase("hp"))
{
success = getResidence().updateFunctions(ResidenceFunction.RESTORE_HP, Integer.valueOf(st.nextToken()));
}
else if (val.equalsIgnoreCase("mp"))
{
success = getResidence().updateFunctions(ResidenceFunction.RESTORE_MP, Integer.valueOf(st.nextToken()));
}
else if (val.equalsIgnoreCase("exp"))
{
success = getResidence().updateFunctions(ResidenceFunction.RESTORE_EXP, Integer.valueOf(st.nextToken()));
}
if (!success)
{
player.sendPacket(SystemMsg.THERE_IS_NOT_ENOUGH_ADENA_IN_THE_CLAN_HALL_WAREHOUSE);
}
else
{
broadcastDecoInfo();
}
}
showManageRecovery(player);
}
else if (val.equalsIgnoreCase("other"))
{
if (st.countTokens() >= 1)
{
val = st.nextToken();
boolean success = true;
if (val.equalsIgnoreCase("item"))
{
success = getResidence().updateFunctions(ResidenceFunction.ITEM_CREATE, Integer.valueOf(st.nextToken()));
}
else if (val.equalsIgnoreCase("tele"))
{
success = getResidence().updateFunctions(ResidenceFunction.TELEPORT, Integer.valueOf(st.nextToken()));
}
else if (val.equalsIgnoreCase("support"))
{
success = getResidence().updateFunctions(ResidenceFunction.SUPPORT, Integer.valueOf(st.nextToken()));
}
if (!success)
{
player.sendPacket(SystemMsg.THERE_IS_NOT_ENOUGH_ADENA_IN_THE_CLAN_HALL_WAREHOUSE);
}
else
{
broadcastDecoInfo();
}
}
showManageOther(player);
}
else if (val.equalsIgnoreCase("deco"))
{
if (st.countTokens() >= 1)
{
val = st.nextToken();
boolean success = true;
if (val.equalsIgnoreCase("platform"))
{
success = getResidence().updateFunctions(ResidenceFunction.PLATFORM, Integer.valueOf(st.nextToken()));
}
else if (val.equalsIgnoreCase("curtain"))
{
success = getResidence().updateFunctions(ResidenceFunction.CURTAIN, Integer.valueOf(st.nextToken()));
}
if (!success)
{
player.sendPacket(SystemMsg.THERE_IS_NOT_ENOUGH_ADENA_IN_THE_CLAN_HALL_WAREHOUSE);
}
else
{
broadcastDecoInfo();
}
}
showManageDeco(player);
}
else if (val.equalsIgnoreCase("back"))
{
showChatWindow(player, 0);
}
else
{
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("residence/manage.htm");
sendHtmlMessage(player, html);
}
return;
}
else if (actualCommand.equalsIgnoreCase("support"))