// {
if (isBusy() && getBusyMessage().length() > 0)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile("/data/html/npcbusy.htm");
html.replace("%busymessage%", getBusyMessage());
html.replace("%npcname%", getName());
html.replace("%playername%", player.getName());
player.sendPacket(html);
html = null;
}
else if (command.equalsIgnoreCase("TerritoryStatus"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
{
if (getCastle().getOwnerId() > 0)
{
html.setFile("/data/html/territorystatus.htm");
L2Clan clan = ClanTable.getInstance().getClan(getCastle().getOwnerId());
html.replace("%clanname%", clan.getName());
html.replace("%clanleadername%", clan.getLeaderName());
}
else
{
html.setFile("/data/html/territorynoclan.htm");
}
}
html.replace("%castlename%", getCastle().getName());
html.replace("%taxpercent%", "" + getCastle().getTaxPercent());
html.replace("%objectId%", String.valueOf(getObjectId()));
{
if (getCastle().getCastleId() > 6)
{
html.replace("%territory%", "The Kingdom of Elmore");
}
else
{
html.replace("%territory%", "The Kingdom of Aden");
}
}
player.sendPacket(html);
html = null;
}
else if (command.startsWith("Quest"))
{
String quest = "";
try
{
quest = command.substring(5).trim();
}
catch (IndexOutOfBoundsException ioobe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
ioobe.printStackTrace();
}
if (quest.length() == 0)
{
showQuestWindow(player);
}
else
{
showQuestWindow(player, quest);
}
}
else if (command.startsWith("Chat"))
{
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (IndexOutOfBoundsException ioobe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
ioobe.printStackTrace();
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
}
showChatWindow(player, val);
}
else if (command.startsWith("Link"))
{
String path = command.substring(5).trim();
if (path.indexOf("..") != -1)
return;
String filename = "/data/html/" + path;
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(filename);
html.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(html);
filename = null;
html = null;
}
else if (command.startsWith("NobleTeleport"))
{
if (!player.isNoble())
{
String filename = "/data/html/teleporter/nobleteleporter-no.htm";
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(filename);
html.replace("%objectId%", String.valueOf(getObjectId()));
html.replace("%npcname%", getName());
player.sendPacket(html);
html = null;
filename = null;
return;
}
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (IndexOutOfBoundsException ioobe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
ioobe.printStackTrace();
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
}
showChatWindow(player, val);
}
else if (command.startsWith("Loto"))
{
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (IndexOutOfBoundsException ioobe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
ioobe.printStackTrace();
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
}
if (val == 0)
{
// new loto ticket
for (int i = 0; i < 5; i++)
{
player.setLoto(i, 0);
}
}
showLotoWindow(player, val);
}
else if (command.startsWith("CPRecovery"))
{
makeCPRecovery(player);
}
else if (command.startsWith("SupportMagic"))
{
makeSupportMagic(player);
}
else if (command.startsWith("GiveBlessing"))
{
giveBlessingSupport(player);
}
else if (command.startsWith("multisell"))
{
L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(command.substring(9).trim()), player, false, getCastle().getTaxRate());
}
else if (command.startsWith("exc_multisell"))
{
L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(command.substring(13).trim()), player, true, getCastle().getTaxRate());
}
else if (command.startsWith("Augment"))
{
int cmdChoice = Integer.parseInt(command.substring(8, 9).trim());
switch (cmdChoice)
{
case 1:
player.sendPacket(new SystemMessage(SystemMessageId.SELECT_THE_ITEM_TO_BE_AUGMENTED));
player.sendPacket(new ExShowVariationMakeWindow());
break;
case 2:
player.sendPacket(new SystemMessage(SystemMessageId.SELECT_THE_ITEM_FROM_WHICH_YOU_WISH_TO_REMOVE_AUGMENTATION));
player.sendPacket(new ExShowVariationCancelWindow());
break;
}
}
else if (command.startsWith("npcfind_byid"))
{
try
{
L2Spawn spawn = SpawnTable.getInstance().getTemplate(Integer.parseInt(command.substring(12).trim()));
if (spawn != null)
{
player.sendPacket(new RadarControl(0, 1, spawn.getLocx(), spawn.getLocy(), spawn.getLocz()));
spawn = null;
}
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
player.sendMessage("Wrong command parameters");
}
}
else if (command.startsWith("newbie_give_coupon"))
{
try
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
if (player.getLevel() > 25 || player.getLevel() < 6 || !player.isNewbie())
{
html.setFile("data/html/adventurers_guide/31760-3.htm");
player.sendPacket(html);
}
else if (player.getCoupon(0))
{
html.setFile("data/html/adventurers_guide/31760-1.htm");
player.sendPacket(html);
}
else
{
player.getInventory().addItem("Weapon Coupon", 7832, 1, player, this);
player.addCoupon(1);
html.setFile("data/html/adventurers_guide/31760-2.htm");
player.sendPacket(html);
}
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
player.sendMessage("Wrong command parameters");
}
}
else if (command.startsWith("newbie_give_weapon"))
{
try
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
if (player.getLevel() > 25 || player.getLevel() < 6 || !player.isNewbie())
{
html.setFile("data/html/adventurers_guide/31760-3.htm");
player.sendPacket(html);
}
else
{
L2Multisell.getInstance().SeparateAndSend(10010, player, false, getCastle().getTaxRate());
}
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
player.sendMessage("Wrong command parameters");
}
}
else if (command.startsWith("newbie_return_weapon"))
{
try
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
if (player.getLevel() > 25 || player.getLevel() < 6 || !player.isNewbie())
{
html.setFile("data/html/adventurers_guide/31760-3.htm");
player.sendPacket(html);
}
else
{
L2Multisell.getInstance().SeparateAndSend(10011, player, false, getCastle().getTaxRate());
}
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
player.sendMessage("Wrong command parameters");
}
}
else if (command.startsWith("traveller_give_coupon"))
{
try
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
if (player.getLevel() > 25 || player.getClassId().level() != 1 || !player.isNewbie())
{
html.setFile("data/html/adventurers_guide/31760-6.htm");
player.sendPacket(html);
}
else if (player.getCoupon(1))
{
html.setFile("data/html/adventurers_guide/31760-4.htm");
player.sendPacket(html);
}
else
{
player.getInventory().addItem("Weapon Coupon", 7833, 1, player, this);
player.addCoupon(2);
html.setFile("data/html/adventurers_guide/31760-5.htm");
player.sendPacket(html);
}
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
player.sendMessage("Wrong command parameters");
}
}
else if (command.startsWith("traveller_give_weapon"))
{
try
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
if (player.getLevel() > 25 || player.getClassId().level() != 1 || !player.isNewbie())
{
html.setFile("data/html/adventurers_guide/31760-6.htm");
player.sendPacket(html);
}
else
{
L2Multisell.getInstance().SeparateAndSend(10012, player, false, getCastle().getTaxRate());
}
}
catch (NumberFormatException nfe)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
nfe.printStackTrace();
player.sendMessage("Wrong command parameters");
}
}
else if (command.startsWith("traveller_return_weapon"))
{
try
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
if (player.getLevel() > 25 || player.getClassId().level() != 1 || !player.isNewbie())
{
html.setFile("data/html/adventurers_guide/31760-6.htm");
player.sendPacket(html);
}
else
{
L2Multisell.getInstance().SeparateAndSend(10013, player, false, getCastle().getTaxRate());