player.sendPacket(html);
}
private void doTeleport(L2PcInstance player, int val)
{
L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(val);
if (list != null)
{
//you cannot teleport to village that is in siege
if (SiegeManager.getInstance().getSiege(list.getLocX(), list.getLocY(), list.getLocZ()) != null)
{
player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
return;
}
else if (TownManager.getInstance().townHasCastleInSiege(list.getLocX(), list.getLocY()))
{
player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
return;
}
else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && player.getKarma() > 0) //karma
{
SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
sm.addString("Go away, you're not welcome here.");
player.sendPacket(sm);
return;
}
else if (list.getIsForNoble() && !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);
return;
}
else if (player.isAlikeDead())
{
return;
}
else if (!list.getIsForNoble() && (Config.ALT_GAME_FREE_TELEPORT || player.reduceAdena("Teleport", list.getPrice(), this, true)))
{
if (Config.DEBUG)
_log.fine("Teleporting player " + player.getName() + " to new location: "
+ list.getLocX() + ":" + list.getLocY() + ":" + list.getLocZ());
player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
}
else if(list.getIsForNoble() && (Config.ALT_GAME_FREE_TELEPORT || player.destroyItemByItemId("Noble Teleport", 6651, list.getPrice(), this, true)))
{
if (Config.DEBUG)
_log.fine("Teleporting player " + player.getName() + " to new location: "
+ list.getLocX() + ":" + list.getLocY() + ":" + list.getLocZ());
player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
}
}
else
{
_log.warning("No teleport destination with id:" + val);