try {
if (command.equalsIgnoreCase("TerritoryStatus")) {
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("data/html/merchant/territorystatus.htm");
html.replace("%npcname%", getName());
Castle castle = getCastle(player);
if (castle != null && castle.getId() > 0) {
html.replace("%castlename%", castle.getName());
html.replace("%taxpercent%", String.valueOf(castle.getTaxPercent()));
if (castle.getOwnerId() > 0) {
L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId());
if (clan != null) {
html.replace("%clanname%", clan.getName());
html.replace("%clanleadername%", clan.getLeaderName());
} else {
html.replace("%clanname%", "unexistant clan");
html.replace("%clanleadername%", "None");
}
} else {
html.replace("%clanname%", "NPC");
html.replace("%clanleadername%", "None");
}
} else {
html.replace("%castlename%", "Open");
html.replace("%taxpercent%", "0");
html.replace("%clanname%", "No");
html.replace("%clanleadername%", getName());
}
player.sendPacket(html);
} else if (command.startsWith("Quest")) {
String quest = command.substring(5).trim();
if (quest.length() == 0) {
showQuestWindow(player);
} else {
showQuestWindow(player, quest);
}
} else if (command.startsWith("Chat")) {
try {
int val = Integer.parseInt(command.substring(5));
showChatWindow(player, val);
} catch (NumberFormatException nfe) {
String filename = command.substring(5).trim();
if (filename.length() == 0) {
showChatWindow(player, "data/html/npcdefault.htm");
} else {
showChatWindow(player, filename);
}
}
} else if (command.startsWith("Loto")) {
int val = Integer.parseInt(command.substring(5));
showLotoWindow(player, val);
} else if (command.startsWith("AttributeCancel")) {
player.sendPacket(new ExShowBaseAttributeCancelWindow(player,
RequestExRemoveItemAttribute.UNENCHANT_PRICE));
} else if (command.startsWith("CPRecovery")) {
makeCPRecovery(player);
} else if (command.startsWith("NpcLocationInfo")) {
int val = Integer.parseInt(command.substring(16));
L2NpcInstance npc = L2ObjectsStorage.getByNpcId(val);
if (npc != null) {
// Убираем флажок на карте и стрелку на компасе
player.sendPacket(new RadarControl(2, 2, npc.getLoc()));
// Ставим флажок на карте и стрелку на компасе
player.sendPacket(new RadarControl(0, 1, npc.getLoc()));
}
} else if (command.startsWith("SupportMagic")) {
makeSupportMagic(player);
} else if (command.startsWith("ProtectionBlessing")) {
// Не выдаём блессиг протекшена ПКшникам.
if (player.getKarma() > 0) {
return;
}
if (player.getLevel() > 39 || player.getClassId().getLevel() >= 3) {
String content = "<html><body>Blessing of protection not available for characters whose level more than 39 or completed second class transfer.</body></html>";
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setHtml(content);
player.sendPacket(html);
return;
}
SkillTable.getInstance().getInfo(5182, 1).getEffects(player, player, false, false);
} else if (command.startsWith("Multisell") || command.startsWith("multisell")) {
String listId = command.substring(9).trim();
Castle castle = getCastle(player);
L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(listId), player,
castle != null ? castle.getTaxRate() : 0);
} else if (command.startsWith("EnterRift")) {
StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // no need for "enterRift"
Integer b1 = Integer.parseInt(st.nextToken()); // type
DimensionalRiftManager.getInstance().start(player, b1, this);