08-14-2011, 11:05 AM
(Сообщение последний раз редактировалось: 08-15-2011, 12:48 AM NightAngel.)
Не пойму че не работает сохранение точки в Community Board Teleport.
Нажимаю сохранить точку возрата ,оно не сохраняет(Тоесть при нажатии вобще не чего не происходит)
сборка L2Jserver
вот как сделано тп исходники
CommunityBoard.java
вот TeleportBBSManager.java
вот Htm страница телепорта
Нажимаю сохранить точку возрата ,оно не сохраняет(Тоесть при нажатии вобще не чего не происходит)
сборка L2Jserver
вот как сделано тп исходники
CommunityBoard.java
Open
package com.l2jserver.gameserver.communitybbs;
import java.util.StringTokenizer;
import com.l2jserver.Config;
import com.l2jserver.gameserver.communitybbs.Manager.BuffBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.ClanBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.ClassBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.PostBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.TeleportBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.TopBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class CommunityBoard
{
private CommunityBoard()
{
}
public static CommunityBoard getInstance()
{
return SingletonHolder._instance;
}
public void handleCommands(L2GameClient client, String command)
{
L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
return;
if(activeChar.isDead() || activeChar.isAlikeDead() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isFlying() || activeChar.isInSiege() || activeChar.isCombatFlagEquipped())
{
}
if(activeChar.isInJail())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432 \u0442\u044E\u0440\u043C\u0435.");
return;
}
if(activeChar.isInDuel())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u0434\u0443\u0435\u043B\u0438.");
return;
}
if(activeChar.isInOlympiadMode())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u041E\u043B\u0438\u043C\u043F\u0438\u0430\u0434\u044B.");
return;
}
if(activeChar.getPvpFlag() != 0 || activeChar.getKarma() > 0)
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C CommunityBoard \u0432 \u0442\u0430\u043A\u043E\u043C \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0438.");
return;
}
if(TvTEvent.isStarted())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F TVT \u0435\u0432\u0435\u043D\u0442\u0430.");
return;
}
if(activeChar.isInsideZone((byte)0))
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432 \u0431\u043E\u0435\u0432\u043E\u0439 \u0437\u043E\u043D\u0435.");
return;
}
if(activeChar.isInsideZone((byte)2))
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432 \u0437\u043E\u043D\u0435 \u043E\u0441\u0430\u0434\u044B.");
return;
}
switch (Config.COMMUNITY_TYPE)
{
default:
case 0: //disabled
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CB_OFFLINE));
break;
case 1: // old
RegionBBSManager.getInstance().parsecmd(command, activeChar);
break;
case 2: // new
if (command.startsWith("_bbsclan"))
{
ClanBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsmemo"))
{
TopicBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbstopics"))
{
TopicBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsposts"))
{
PostBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbstop"))
{
TopBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbshome"))
{
TopBBSManager.getInstance().parsecmd(command, activeChar);
}
else if(command.startsWith("_bbsclass"))
{
ClassBBSManager.getInstance().parsecmd(command, activeChar);
break;
}
else if (command.startsWith("_bbs_buff"))
{
BuffBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsteleport;"))
{
TeleportBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsmultisell;"))
{
if(activeChar.isDead() || activeChar.isAlikeDead() || TvTEvent.isStarted() || activeChar.isInSiege() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || activeChar.getKarma() > 0 || activeChar.isInDuel()){
activeChar.sendMessage("В данных условиях использовать Шоп запрещено");
return;
}
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
TopBBSManager.getInstance().parsecmd("_bbstop;" + st.nextToken(), activeChar);
int multisell = Integer.parseInt(st.nextToken());
MultiSell.getInstance().separateAndSend(multisell, activeChar, null, false);
}
else if (command.startsWith("_bbsloc"))
{
RegionBBSManager.getInstance().parsecmd(command, activeChar);
}
else
{
ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
+ " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
break;
}
}
/**
* @param client
* @param url
* @param arg1
* @param arg2
* @param arg3
* @param arg4
* @param arg5
*/
public void handleWriteCommands(L2GameClient client, String url, String arg1, String arg2, String arg3, String arg4, String arg5)
{
L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
return;
switch (Config.COMMUNITY_TYPE)
{
case 2:
if (url.equals("Topic"))
{
TopicBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else if (url.equals("Post"))
{
PostBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else if (url.equals("Region"))
{
RegionBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else if (url.equals("Notice"))
{
ClanBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else
{
ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + url
+ " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
break;
case 1:
RegionBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
break;
default:
case 0:
ShowBoard sb = new ShowBoard("<html><body><br><br><center>The Community board is currently disabled</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
break;
}
}
@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final CommunityBoard _instance = new CommunityBoard();
}
}
import java.util.StringTokenizer;
import com.l2jserver.Config;
import com.l2jserver.gameserver.communitybbs.Manager.BuffBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.ClanBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.ClassBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.PostBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.TeleportBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.TopBBSManager;
import com.l2jserver.gameserver.communitybbs.Manager.TopicBBSManager;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class CommunityBoard
{
private CommunityBoard()
{
}
public static CommunityBoard getInstance()
{
return SingletonHolder._instance;
}
public void handleCommands(L2GameClient client, String command)
{
L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
return;
if(activeChar.isDead() || activeChar.isAlikeDead() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isFlying() || activeChar.isInSiege() || activeChar.isCombatFlagEquipped())
{
}
if(activeChar.isInJail())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432 \u0442\u044E\u0440\u043C\u0435.");
return;
}
if(activeChar.isInDuel())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u0434\u0443\u0435\u043B\u0438.");
return;
}
if(activeChar.isInOlympiadMode())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u041E\u043B\u0438\u043C\u043F\u0438\u0430\u0434\u044B.");
return;
}
if(activeChar.getPvpFlag() != 0 || activeChar.getKarma() > 0)
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C CommunityBoard \u0432 \u0442\u0430\u043A\u043E\u043C \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0438.");
return;
}
if(TvTEvent.isStarted())
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F TVT \u0435\u0432\u0435\u043D\u0442\u0430.");
return;
}
if(activeChar.isInsideZone((byte)0))
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432 \u0431\u043E\u0435\u0432\u043E\u0439 \u0437\u043E\u043D\u0435.");
return;
}
if(activeChar.isInsideZone((byte)2))
{
activeChar.sendMessage("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432 \u0437\u043E\u043D\u0435 \u043E\u0441\u0430\u0434\u044B.");
return;
}
switch (Config.COMMUNITY_TYPE)
{
default:
case 0: //disabled
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CB_OFFLINE));
break;
case 1: // old
RegionBBSManager.getInstance().parsecmd(command, activeChar);
break;
case 2: // new
if (command.startsWith("_bbsclan"))
{
ClanBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsmemo"))
{
TopicBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbstopics"))
{
TopicBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsposts"))
{
PostBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbstop"))
{
TopBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbshome"))
{
TopBBSManager.getInstance().parsecmd(command, activeChar);
}
else if(command.startsWith("_bbsclass"))
{
ClassBBSManager.getInstance().parsecmd(command, activeChar);
break;
}
else if (command.startsWith("_bbs_buff"))
{
BuffBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsteleport;"))
{
TeleportBBSManager.getInstance().parsecmd(command, activeChar);
}
else if (command.startsWith("_bbsmultisell;"))
{
if(activeChar.isDead() || activeChar.isAlikeDead() || TvTEvent.isStarted() || activeChar.isInSiege() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || activeChar.getKarma() > 0 || activeChar.isInDuel()){
activeChar.sendMessage("В данных условиях использовать Шоп запрещено");
return;
}
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
TopBBSManager.getInstance().parsecmd("_bbstop;" + st.nextToken(), activeChar);
int multisell = Integer.parseInt(st.nextToken());
MultiSell.getInstance().separateAndSend(multisell, activeChar, null, false);
}
else if (command.startsWith("_bbsloc"))
{
RegionBBSManager.getInstance().parsecmd(command, activeChar);
}
else
{
ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
+ " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
break;
}
}
/**
* @param client
* @param url
* @param arg1
* @param arg2
* @param arg3
* @param arg4
* @param arg5
*/
public void handleWriteCommands(L2GameClient client, String url, String arg1, String arg2, String arg3, String arg4, String arg5)
{
L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
return;
switch (Config.COMMUNITY_TYPE)
{
case 2:
if (url.equals("Topic"))
{
TopicBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else if (url.equals("Post"))
{
PostBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else if (url.equals("Region"))
{
RegionBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else if (url.equals("Notice"))
{
ClanBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
}
else
{
ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + url
+ " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
break;
case 1:
RegionBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar);
break;
default:
case 0:
ShowBoard sb = new ShowBoard("<html><body><br><br><center>The Community board is currently disabled</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
break;
}
}
@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final CommunityBoard _instance = new CommunityBoard();
}
}
Open
package com.l2jserver.gameserver.communitybbs.Manager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import javolution.text.TextBuilder;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
public class TeleportBBSManager extends BaseBBSManager
{
@SuppressWarnings("unused")
private static Logger _log = Logger.getLogger(TeleportBBSManager.class.getName());
public class CBteleport
{
public int TpId = 0; // Teport location ID
public String TpName = ""; // Location name
public int PlayerId = 0; // charID
public int xC = 0; // Location coords X
public int yC = 0; // Location coords Y
public int zC = 0; // Location coords Z
}
private static TeleportBBSManager _Instance = null;
public static TeleportBBSManager getInstance()
{
if(_Instance == null)
_Instance = new TeleportBBSManager();
return _Instance;
}
public String points[][];
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
if(command.equals("_bbsteleport;"))
{
showTp(activeChar);
}
else if(command.startsWith("_bbsteleport;delete;"))
{
StringTokenizer stDell = new StringTokenizer(command, ";");
stDell.nextToken();
stDell.nextToken();
int TpNameDell = Integer.parseInt(stDell.nextToken());
delTp(activeChar, TpNameDell);
showTp(activeChar);
}
else if(command.startsWith("_bbsteleport;save;"))
{
StringTokenizer stAdd = new StringTokenizer(command, ";");
stAdd.nextToken();
stAdd.nextToken();
String TpNameAdd = stAdd.nextToken();
AddTp(activeChar, TpNameAdd);
showTp(activeChar);
}
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(activeChar, xTp, yTp, zTp, priceTp);
showTp(activeChar);
}
else
{
ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
+ " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
}
@SuppressWarnings("cast")
private void goTp(L2PcInstance activeChar, int xTp, int yTp, int zTp, int priceTp)
{
if(activeChar.isDead() || activeChar.isAlikeDead() || TvTEvent.isStarted() || activeChar.isInSiege() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || activeChar.getKarma() > 0 || activeChar.isInDuel()){
activeChar.sendMessage("В данных условиях телепортация запрещена");
return;
}
if(priceTp > 0 && activeChar.getAdena() < priceTp)
{
activeChar.sendMessage("Недостаточно Адены");
return;
}
else
{
if(priceTp > 0)
{
activeChar.reduceAdena("Teleport", (long) priceTp, activeChar, true);
}
activeChar.teleToLocation(xTp,yTp,zTp);
}
}
private void showTp(L2PcInstance activeChar)
{
CBteleport tp;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement st = con.prepareStatement("SELECT * FROM comteleport WHERE charId=?;");
st.setLong(1, activeChar.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 -h _bbsteleport;teleport; " + tp.xC + " " + tp.yC + " " + tp.zC + " " +100000 + "\" 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 -h _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>");
String content = HtmCache.getInstance().getHtmForce(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/50.htm");
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setHtml(content);
adminReply.replace("%tp%", html.toString());
/*separateAndSend(adminReply.getHtm(), activeChar);*/
return;
}
catch (Exception e)
{
}
finally
{
try
{
con.close();
}
catch (Exception e)
{
}
}
}
private void delTp(L2PcInstance activeChar, int TpNameDell)
{
Connection conDel = null;
try
{
conDel = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement stDel = conDel.prepareStatement("DELETE FROM comteleport WHERE charId=? AND TpId=?;");
stDel.setInt(1, activeChar.getObjectId());
stDel.setInt(2, TpNameDell);
stDel.execute();
}
catch (Exception e)
{
}
finally
{
try
{
conDel.close();
}
catch (Exception e)
{
}
}
}
private void AddTp(L2PcInstance activeChar, String TpNameAdd)
{
if(activeChar.isDead() || activeChar.isAlikeDead() || activeChar.isCastingNow() || activeChar.isAttackingNow())
{
activeChar.sendMessage("Сохранить закладку в вашем состоянии невозможно");
return;
}
if(activeChar.isInCombat())
{
activeChar.sendMessage("Сохранить закладку в боевом режиме нельзя");
return;
}
if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZone((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byte)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) || activeChar.isInsideZone((byte)8) || activeChar.isFlying())
{
activeChar.sendMessage("Нельзя сохранить данную локацию");
return;
}
if(TpNameAdd.equals("") || TpNameAdd.equals(null))
{
activeChar.sendMessage("Вы не ввели имя закладки");
return;
}
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement st = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=?;");
st.setLong(1, activeChar.getObjectId());
ResultSet rs = st.executeQuery();
rs.next();
if(rs.getInt(1) <= 9)
{
PreparedStatement st1 = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=? AND name=?;");
st1.setLong(1, activeChar.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, activeChar.getObjectId());
stAdd.setInt(2, activeChar.getX());
stAdd.setInt(3, activeChar.getY());
stAdd.setInt(4, activeChar.getZ());
stAdd.setString(5, TpNameAdd);
stAdd.execute();
}
else
{
PreparedStatement stAdd = con.prepareStatement("UPDATE comteleport SET xPos=?, yPos=?, zPos=? WHERE charId=? AND name=?;");
stAdd.setInt(1, activeChar.getObjectId());
stAdd.setInt(2, activeChar.getX());
stAdd.setInt(3, activeChar.getY());
stAdd.setInt(4, activeChar.getZ());
stAdd.setString(5, TpNameAdd);
stAdd.execute();
}
}
else
{
activeChar.sendMessage("Вы не можете сохранить более десяти закладок");
}
}
catch (Exception e)
{
}
finally
{
try
{
con.close();
}
catch (Exception e)
{
}
}
}
@Override
public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
{
}
}
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import javolution.text.TextBuilder;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
public class TeleportBBSManager extends BaseBBSManager
{
@SuppressWarnings("unused")
private static Logger _log = Logger.getLogger(TeleportBBSManager.class.getName());
public class CBteleport
{
public int TpId = 0; // Teport location ID
public String TpName = ""; // Location name
public int PlayerId = 0; // charID
public int xC = 0; // Location coords X
public int yC = 0; // Location coords Y
public int zC = 0; // Location coords Z
}
private static TeleportBBSManager _Instance = null;
public static TeleportBBSManager getInstance()
{
if(_Instance == null)
_Instance = new TeleportBBSManager();
return _Instance;
}
public String points[][];
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
if(command.equals("_bbsteleport;"))
{
showTp(activeChar);
}
else if(command.startsWith("_bbsteleport;delete;"))
{
StringTokenizer stDell = new StringTokenizer(command, ";");
stDell.nextToken();
stDell.nextToken();
int TpNameDell = Integer.parseInt(stDell.nextToken());
delTp(activeChar, TpNameDell);
showTp(activeChar);
}
else if(command.startsWith("_bbsteleport;save;"))
{
StringTokenizer stAdd = new StringTokenizer(command, ";");
stAdd.nextToken();
stAdd.nextToken();
String TpNameAdd = stAdd.nextToken();
AddTp(activeChar, TpNameAdd);
showTp(activeChar);
}
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(activeChar, xTp, yTp, zTp, priceTp);
showTp(activeChar);
}
else
{
ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + command
+ " is not implemented yet</center><br><br></body></html>", "101");
activeChar.sendPacket(sb);
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
}
@SuppressWarnings("cast")
private void goTp(L2PcInstance activeChar, int xTp, int yTp, int zTp, int priceTp)
{
if(activeChar.isDead() || activeChar.isAlikeDead() || TvTEvent.isStarted() || activeChar.isInSiege() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || activeChar.getKarma() > 0 || activeChar.isInDuel()){
activeChar.sendMessage("В данных условиях телепортация запрещена");
return;
}
if(priceTp > 0 && activeChar.getAdena() < priceTp)
{
activeChar.sendMessage("Недостаточно Адены");
return;
}
else
{
if(priceTp > 0)
{
activeChar.reduceAdena("Teleport", (long) priceTp, activeChar, true);
}
activeChar.teleToLocation(xTp,yTp,zTp);
}
}
private void showTp(L2PcInstance activeChar)
{
CBteleport tp;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement st = con.prepareStatement("SELECT * FROM comteleport WHERE charId=?;");
st.setLong(1, activeChar.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 -h _bbsteleport;teleport; " + tp.xC + " " + tp.yC + " " + tp.zC + " " +100000 + "\" 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 -h _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>");
String content = HtmCache.getInstance().getHtmForce(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/50.htm");
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setHtml(content);
adminReply.replace("%tp%", html.toString());
/*separateAndSend(adminReply.getHtm(), activeChar);*/
return;
}
catch (Exception e)
{
}
finally
{
try
{
con.close();
}
catch (Exception e)
{
}
}
}
private void delTp(L2PcInstance activeChar, int TpNameDell)
{
Connection conDel = null;
try
{
conDel = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement stDel = conDel.prepareStatement("DELETE FROM comteleport WHERE charId=? AND TpId=?;");
stDel.setInt(1, activeChar.getObjectId());
stDel.setInt(2, TpNameDell);
stDel.execute();
}
catch (Exception e)
{
}
finally
{
try
{
conDel.close();
}
catch (Exception e)
{
}
}
}
private void AddTp(L2PcInstance activeChar, String TpNameAdd)
{
if(activeChar.isDead() || activeChar.isAlikeDead() || activeChar.isCastingNow() || activeChar.isAttackingNow())
{
activeChar.sendMessage("Сохранить закладку в вашем состоянии невозможно");
return;
}
if(activeChar.isInCombat())
{
activeChar.sendMessage("Сохранить закладку в боевом режиме нельзя");
return;
}
if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZone((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byte)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) || activeChar.isInsideZone((byte)8) || activeChar.isFlying())
{
activeChar.sendMessage("Нельзя сохранить данную локацию");
return;
}
if(TpNameAdd.equals("") || TpNameAdd.equals(null))
{
activeChar.sendMessage("Вы не ввели имя закладки");
return;
}
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement st = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=?;");
st.setLong(1, activeChar.getObjectId());
ResultSet rs = st.executeQuery();
rs.next();
if(rs.getInt(1) <= 9)
{
PreparedStatement st1 = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=? AND name=?;");
st1.setLong(1, activeChar.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, activeChar.getObjectId());
stAdd.setInt(2, activeChar.getX());
stAdd.setInt(3, activeChar.getY());
stAdd.setInt(4, activeChar.getZ());
stAdd.setString(5, TpNameAdd);
stAdd.execute();
}
else
{
PreparedStatement stAdd = con.prepareStatement("UPDATE comteleport SET xPos=?, yPos=?, zPos=? WHERE charId=? AND name=?;");
stAdd.setInt(1, activeChar.getObjectId());
stAdd.setInt(2, activeChar.getX());
stAdd.setInt(3, activeChar.getY());
stAdd.setInt(4, activeChar.getZ());
stAdd.setString(5, TpNameAdd);
stAdd.execute();
}
}
else
{
activeChar.sendMessage("Вы не можете сохранить более десяти закладок");
}
}
catch (Exception e)
{
}
finally
{
try
{
con.close();
}
catch (Exception e)
{
}
}
}
@Override
public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
{
}
}
Open
<html>
<body>
<center>
<table>
<tr>
<td><button value="Новости" action="bypass -h _bbstop" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Справка" action="bypass -h _bbstop;20" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Магазин" action="bypass -h _bbstop;30" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Баффер" action="bypass -h _bbstop;60" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Телепорт" action="bypass -h _bbsteleport;" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Карьера" action="bypass -h _bbsclass;" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
</table>
<img src="L2UI.SquareWhite" width=600 height=1>
<table width=600 bgcolor=CCCCCC>
<tr>
<td></td>
<td><a action="bypass -h _bbstop"><font color=F2C202>Главная</font></a></td>
<td><font color=F2C202> -> </font></td>
<td><a action="bypass -h _bbsteleport;"><font color=F2C202>Телепорт</font></a></td>
<td width=50></td>
<td align=left><font color=D70000>Все ТП 15к Адена. Возврат на точку: 100к адены</font></td>
</tr>
</table>
<img src="L2UI.SquareWhite" width=600 height=1>
<table width=600>
<tr><td>
<center>
<table>
<tr>
<td>
<center>
<button value="START zone" action="bypass -h _bbsteleport;teleport; 16327 213129 -9360 2000000000" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="PvP zone" action="bypass -h _bbsteleport;teleport; 73890 142656 -3778 1" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<table height=30>
<tr>
<td><button value="Farm 1" action="bypass -h _bbsteleport;teleport; -78280 -44248 -10624 100000" width=57 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Farm 2" action="bypass -h _bbsteleport;teleport; -87688 -51080 -10624 100000" width=57 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Farm 3" action="bypass -h _bbsteleport;teleport; -81928 -55288 -10624 100000" width=57 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
</table>
<button value="Starting zone" action="bypass -h _bbstop;52" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="TownShips" action="bypass -h _bbstop;521" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
</center>
</td>
<td>
<center>
<button value="Королевства" action="bypass -h _bbstop;522" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Некрополисы" action="bypass -h _bbstop;518" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Катакомбы" action="bypass -h _bbstop;519" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Interlude зоны" action="bypass -h _bbstop;524" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Kamael зоны" action="bypass -h _bbstop;525" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
</center>
</td>
<td>
<table width=220>
<tr>
<td>
<center>Персональные точки возврата:</center>
</td>
</tr>
<tr>
<td>
<center>
<edit var="name" width=180 length=10>
<button value="Сохранить текущую точку возврата" action="bypass -h _bbsteleport;save; $name" width=220 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<br>
%tp%
</center>
</td>
</tr>
</table>
</tr>
</td>
</table>
</center>
</td></tr>
</table>
<img src="L2UI.SquareWhite" width=600 height=1>
<font color=3293F3>PVP Community Board</font>
</center>
</body>
</html>
<body>
<center>
<table>
<tr>
<td><button value="Новости" action="bypass -h _bbstop" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Справка" action="bypass -h _bbstop;20" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Магазин" action="bypass -h _bbstop;30" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Баффер" action="bypass -h _bbstop;60" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Телепорт" action="bypass -h _bbsteleport;" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Карьера" action="bypass -h _bbsclass;" width=80 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
</table>
<img src="L2UI.SquareWhite" width=600 height=1>
<table width=600 bgcolor=CCCCCC>
<tr>
<td></td>
<td><a action="bypass -h _bbstop"><font color=F2C202>Главная</font></a></td>
<td><font color=F2C202> -> </font></td>
<td><a action="bypass -h _bbsteleport;"><font color=F2C202>Телепорт</font></a></td>
<td width=50></td>
<td align=left><font color=D70000>Все ТП 15к Адена. Возврат на точку: 100к адены</font></td>
</tr>
</table>
<img src="L2UI.SquareWhite" width=600 height=1>
<table width=600>
<tr><td>
<center>
<table>
<tr>
<td>
<center>
<button value="START zone" action="bypass -h _bbsteleport;teleport; 16327 213129 -9360 2000000000" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="PvP zone" action="bypass -h _bbsteleport;teleport; 73890 142656 -3778 1" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<table height=30>
<tr>
<td><button value="Farm 1" action="bypass -h _bbsteleport;teleport; -78280 -44248 -10624 100000" width=57 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Farm 2" action="bypass -h _bbsteleport;teleport; -87688 -51080 -10624 100000" width=57 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Farm 3" action="bypass -h _bbsteleport;teleport; -81928 -55288 -10624 100000" width=57 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
</table>
<button value="Starting zone" action="bypass -h _bbstop;52" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="TownShips" action="bypass -h _bbstop;521" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
</center>
</td>
<td>
<center>
<button value="Королевства" action="bypass -h _bbstop;522" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Некрополисы" action="bypass -h _bbstop;518" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Катакомбы" action="bypass -h _bbstop;519" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Interlude зоны" action="bypass -h _bbstop;524" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<button value="Kamael зоны" action="bypass -h _bbstop;525" width=190 height=30 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
</center>
</td>
<td>
<table width=220>
<tr>
<td>
<center>Персональные точки возврата:</center>
</td>
</tr>
<tr>
<td>
<center>
<edit var="name" width=180 length=10>
<button value="Сохранить текущую точку возврата" action="bypass -h _bbsteleport;save; $name" width=220 height=20 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF">
<br>
%tp%
</center>
</td>
</tr>
</table>
</tr>
</td>
</table>
</center>
</td></tr>
</table>
<img src="L2UI.SquareWhite" width=600 height=1>
<font color=3293F3>PVP Community Board</font>
</center>
</body>
</html>