сборка ребилион, хроники High Five.
Дело в том что после того как была нажата кнопка телепорта (из комунки) страница переходит в пустую, как исправить, чтобы она на этой странице телепорта и оставалась?
\community\pages\teleport\index.htm:
<html><body><center><br>
<table align=center bgcolor=555555 border=0 width=600><tr>
<td height=30></td>
<td><button value="Главная" action="bypass _bbspage:index" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
<td><button value="Магазин" action="bypass _bbspage:shop/index" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
<td><button value="Бафер" action="bypass _bbsbuff;" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
<td><button value="Телепорт" action="bypass _bbspage:teleport/index" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
<td><button value="Сервисы" action="bypass _bbspage:services/index" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
<td><button value="Эвенты" action="bypass _bbspage:events/index" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
<td><button value="Статистика" action="bypass _bbsstat" width=90 height=25 back="L2UI_ct1.button_df_down" fore="L2UI_ct1.button_df"></td>
</tr></table>
<table width=630 height=440 border=0 cellpadding=0 cellspacing=0 background="L2UI_CT1.windows_df_drawer_bg_darker">
<tr><td valign="top" align="center">
<br><center><table width=350><tr><td>
<font color=LEVEL><center>Города</center></font>
<table width=350 bgcolor=414141 border=0>
<tr><td align=center>
<button action="bypass _bbsteleport;teleport; 147096 25896 -2038 0" value="Аден" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 82840 149096 -3494 0" value="Гиран" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 82424 53336 -1521 0" value="Орен" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 17096 144920 -3043 0" value="Дион" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
</td>
<td align=center>
<button action="bypass _bbsteleport;teleport; 43560 -47656 -822 0" value="Руна" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; -12744 122760 -3142 0" value="Глудио" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 147992 -55320 -2759 0" value="Годдард" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 87160 -141512 -1365 0" value="Шутгарт" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
</td>
<td align=center>
<button action="bypass _bbsteleport;teleport; 111208 221016 -3571 0" value="Хейн" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 116589 76268 -2734 0" value="Д. Охотников" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; -83063 150791 -3133 0" value="Глудин" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 17144 170156 -3502 0" value="Флоран" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
</td></tr>
</table>
<br><font color=LEVEL><center>Деревни</center></font>
<table width=350 bgcolor=414141 border=0>
<tr><td align=center>
<button action="bypass _bbsteleport;teleport; 45873 49288 -3064 0" value="Эльфийская Деревня" width=150 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; 12428 16551 -4588 0" value="Деревня Тёмных Эльфов" width=150 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; -82687 243157 -3734 0" value="Говорящий Остров" width=150 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
</td>
<td align=center>
<button action="bypass _bbsteleport;teleport; 116551 -182493 -1525 0" value="Деревня Гномов" width=150 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; -44133 -113911 -244 0" value="Деревня Орков" width=150 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
<button action="bypass _bbsteleport;teleport; -116934 46616 368 0" value="Деревня Камаэль" width=150 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
</td></tr>
</table>
<br><font color=LEVEL><center>PvP Арены</center></font>
<table width=350 bgcolor=414141 border=0>
<tr>
<td align=center><button action="bypass _bbsteleport;teleport; 73890 142656 -3778 0" value="Арена Гирана" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button action="bypass _bbsteleport;teleport; -87160 142312 -3671 0" value="Арена Глудина" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button action="bypass _bbsteleport;teleport; 146936 46728 -3432 0" value="Коллизей" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>
<br><font color=LEVEL><center>Остальное</center></font>
<table width=350 bgcolor=414141 border=0>
<tr>
<td align=center><button action="bypass _bbspage:teleport/catacombs" value="Катакомбы" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button action="bypass _bbspage:teleport/necropolis" value="Некрополи" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td align=center><button action="bypass _bbspage:teleport/hunters_zone" value="Зоны Охоты" width=100 height=20 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>
</td></tr></table>
</center></body></html>
\data\scripts\services\community\TeleportManager.java:
package services.community;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import javolution.text.TextBuilder;
import l2r.commons.dbutils.DbUtils;
import l2r.gameserver.Config;
import l2r.gameserver.data.htm.HtmCache;
import l2r.gameserver.database.DatabaseFactory;
import l2r.gameserver.handler.bbs.CommunityBoardManager;
import l2r.gameserver.handler.bbs.ICommunityBoardHandler;
import l2r.gameserver.model.Player;
import l2r.gameserver.model.Zone.ZoneType;
import l2r.gameserver.network.serverpackets.ShowBoard;
import l2r.gameserver.network.serverpackets.SystemMessage;
import l2r.gameserver.scripts.ScriptFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author KilRoy
* Community Board v2.0 Teleport MOD
*/
public class TeleportManager implements ScriptFile, ICommunityBoardHandler
{
private static final Logger _log = LoggerFactory.getLogger(TeleportManager.class);
@Override
public void onLoad()
{
if(Config.COMMUNITYBOARD_ENABLED && Config.BBS_PVP_TELEPORT_ENABLED)
{
_log.info("CommunityBoard: Manage Teleport service loaded.");
CommunityBoardManager.getInstance().registerHandler(this);
}
}
@Override
public void onReload()
{
if(Config.COMMUNITYBOARD_ENABLED && Config.BBS_PVP_TELEPORT_ENABLED)
CommunityBoardManager.getInstance().removeHandler(this);
}
@Override
public void onShutdown()
{}
@Override
public String[] getBypassCommands()
{
return new String[] { "_bbsteleport;", "_bbsteleport;delete;", "_bbsteleport;save; ", "_bbsteleport;teleport;" };
}
public class CBteleport
{
public int TpId = 0; // Teport loc ID
public String TpName = ""; // Loc name
public int PlayerId = 0; // charID
public int xC = 0; // Location coords
public int yC = 0; //
public int zC = 0; //
}
@Override
public void onBypassCommand(Player player, String command)
{
player.setSessionVar("add_fav", null);
if(command.equals("_bbsteleport;"))
{
showTp(player);
}
else if(command.startsWith("_bbsteleport;delete;"))
{
StringTokenizer stDell = new StringTokenizer(command, ";");
stDell.nextToken();
stDell.nextToken();
int TpNameDell = Integer.parseInt(stDell.nextToken());
delTp(player, TpNameDell);
showTp(player);
}
else if(command.startsWith("_bbsteleport;save; "))
{
StringTokenizer stAdd = new StringTokenizer(command, ";");
stAdd.nextToken();
stAdd.nextToken();
String TpNameAdd = stAdd.nextToken();
AddTp(player, TpNameAdd);
showTp(player);
}
else if(command.startsWith("_bbsteleport;teleport;"))
{
StringTokenizer stGoTp = new StringTokenizer(command, " ");
stGoTp.nextToken();
int xTp = Integer.parseInt(stGoTp.nextToken());
int yTp = Integer.parseInt(stGoTp.nextToken());
int zTp = Integer.parseInt(stGoTp.nextToken());
int priceTp = Integer.parseInt(stGoTp.nextToken());
goTp(player, xTp, yTp, zTp, priceTp);
showTp(player);
}
else
{
ShowBoard.separateAndSend("<html><body><br><br><center>Функция: " + command + " пока не реализована</center><br><br></body></html>", player);
}
}
private void goTp(Player player, int xTp, int yTp, int zTp, int priceTp)
{
if(player.isCursedWeaponEquipped()/* ||player.isInJail() */||player.getReflectionId() != 0 || player.getPvpFlag() != 0 || player.isDead() || player.isAlikeDead() || player.isCastingNow() || player.isInCombat() || player.isAttackingNow() || player.isInOlympiadMode() || player.isFlying() || player.isTerritoryFlagEquipped() || player.isInZone(ZoneType.no_escape) || player.isInZone(ZoneType.SIEGE) || player.isInZone(ZoneType.epic))
{
player.sendMessage(player.isLangRus() ? "Телепортация невозможна!" : "Teleportation is not possible!");
return;
}
if(priceTp > 0 && player.getAdena() < priceTp)
{
player.sendPacket(new SystemMessage(SystemMessage.YOU_DO_NOT_HAVE_ENOUGH_ADENA));
return;
}
if(priceTp > 0)
{
player.reduceAdena((long) priceTp, true);
}
player.teleToLocation(xTp, yTp, zTp);
}
private void showTp(Player player)
{
CBteleport tp;
Connection con = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
PreparedStatement st = con.prepareStatement("SELECT * FROM comteleport WHERE charId=?;");
st.setLong(1, player.getObjectId());
ResultSet rs = st.executeQuery();
TextBuilder html = new TextBuilder();
html.append("<table width=220>");
while(rs.next())
{
tp = new CBteleport();
tp.TpId = rs.getInt("TpId");
tp.TpName = rs.getString("name");
tp.PlayerId = rs.getInt("charId");
tp.xC = rs.getInt("xPos");
tp.yC = rs.getInt("yPos");
tp.zC = rs.getInt("zPos");
html.append("<tr>");
html.append("<td>");
html.append("<button value=\"" + tp.TpName + "\" action=\"bypass _bbsteleport;teleport; " + tp.xC + " " + tp.yC + " " + tp.zC + " " + Config.BBS_PVP_TELEPORT_POINT_PRICE + "\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
html.append("</td>");
html.append("<td>");
html.append("<button value=\"Удалить\" action=\"bypass _bbsteleport;delete;" + tp.TpId + "\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
html.append("</td>");
html.append("</tr>");
}
html.append("</table>");
DbUtils.closeQuietly(st, rs);
String content = HtmCache.getInstance().getNotNull("scripts/services/communityPVP/pages/teleport/teleport.htm", player);
content = content.replace("%tp%", html.toString());
ShowBoard.separateAndSend(content, player);
return;
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
DbUtils.closeQuietly(con);
}
}
private void delTp(Player player, int TpNameDell)
{
Connection conDel = null;
try
{
conDel = DatabaseFactory.getInstance().getConnection();
PreparedStatement stDel = conDel.prepareStatement("DELETE FROM comteleport WHERE charId=? AND TpId=?;");
stDel.setInt(1, player.getObjectId());
stDel.setInt(2, TpNameDell);
stDel.execute();
DbUtils.closeQuietly(stDel);
}
catch(Exception e)
{
_log.warn("data error on Delete Teleport: " + e);
e.printStackTrace();
}
finally
{
DbUtils.closeQuietly(conDel);
}
}
private void AddTp(Player player, String TpNameAdd)
{
if(player.isCursedWeaponEquipped() /*|| player.isInJail()*/ ||player.isDead() || player.isAlikeDead() || player.isCastingNow() || player.isAttackingNow() || player.isInZone(ZoneType.no_escape) || player.isInZone(ZoneType.SIEGE) || player.isOlympiadGameStart() || player.isInZone(ZoneType.epic))
{
player.sendMessage(player.isLangRus() ? "Сохранить закладку в вашем состоянии нельзя!" : "Bookmark in your condition can not be!");
return;
}
if(player.isInCombat() || player.getPvpFlag() != 0)
{
player.sendMessage(player.isLangRus() ? "Сохранение закладок в бою невозможно!" : "Bookmark in combat can not be!");
return;
}
if(TpNameAdd.equals("") || TpNameAdd.equals(null))
{
player.sendMessage(player.isLangRus() ? "Вы не ввели имя закладки!" : "You have not entered the name of a bookmark!");
return;
}
Connection con = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
PreparedStatement st = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=?;");
st.setLong(1, player.getObjectId());
ResultSet rs = st.executeQuery();
rs.next();
if(rs.getInt(1) <= Config.BBS_PVP_TELEPORT_MAX_POINT_COUNT - 1)
{
PreparedStatement st1 = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=? AND name=?;");
st1.setLong(1, player.getObjectId());
st1.setString(2, TpNameAdd);
ResultSet rs1 = st1.executeQuery();
rs1.next();
if(rs1.getInt(1) == 0)
{
PreparedStatement stAdd = con.prepareStatement("INSERT INTO comteleport (charId,xPos,yPos,zPos,name) VALUES(?,?,?,?,?)");
stAdd.setInt(1, player.getObjectId());
stAdd.setInt(2, player.getX());
stAdd.setInt(3, player.getY());
stAdd.setInt(4, player.getZ());
stAdd.setString(5, TpNameAdd);
stAdd.execute();
DbUtils.closeQuietly(stAdd);
}
else
{
PreparedStatement stAdd = con.prepareStatement("UPDATE comteleport SET xPos=?, yPos=?, zPos=? WHERE charId=? AND name=?;");
stAdd.setInt(1, player.getObjectId());
stAdd.setInt(2, player.getX());
stAdd.setInt(3, player.getY());
stAdd.setInt(4, player.getZ());
stAdd.setString(5, TpNameAdd);
stAdd.execute();
DbUtils.closeQuietly(stAdd);
}
}
else
{
player.sendMessage(player.isLangRus() ? "Вы не можете сохранить более " + Config.BBS_PVP_TELEPORT_MAX_POINT_COUNT + " закладок" : "You can not save more than "+ Config.BBS_PVP_TELEPORT_MAX_POINT_COUNT +" bookmarks ");
return;
}
DbUtils.closeQuietly(st, rs);
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
DbUtils.closeQuietly(con);
}
}
@Override
public void onWriteCommand(Player player, String bypass, String arg1, String arg2, String arg3, String arg4, String arg5)
{}
}
пробовал <button action="bypass _bbsteleport;teleport; 82840 149096 -3494 0; _bbsteleport" -не помогло
пробовал <button action="bypass _bbsteleport;teleport; 82840 149096 -3494 0; _bbsteleport\index" -не помогло
пробовал <button action="bypass _bbsteleport;teleport; 82840 149096 -3494 0; _bbspage:teleport/index" -не помогло