Jump to content
  • 0

Help Community Board


L2jTeam

Question

7 answers to this question

Recommended Posts

  • 0
package com.l2jserver.gameserver.communitybbs.Manager;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import javolution.util.FastList;
import javolution.util.FastMap;
import javolution.text.TextBuilder;

import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.model.L2TeleportLocation;
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.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
import com.l2jserver.util.StringUtil;

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() || activeChar.isCastingNow() || activeChar.isInCombat() || activeChar.isAttackingNow() || activeChar.isInOlympiadMode() || activeChar.isInJail() || activeChar.isFlying() || 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();
		ResultSet rs = s.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)
{

}
}

Link to comment
Share on other sites

  • 0

error

Microsoft Windows [Version 6.1.7600]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

c:\Server\L2jServer\svn.l2jserver.com\L2J_Server>ant
Buildfile: c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\build.xml

checkRequirements:

getChangelogDateVersion:

init:
   [delete] Deleting directory c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\
build\bin
    [mkdir] Created dir: c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\build\
bin

dist:
     [sync] Removed 2 dangling files from c:\Server\L2jServer\svn.l2jserver.com\
L2J_Server\build\dist

compile:
    [javac] Compiling 1667 source files to c:\Server\L2jServer\svn.l2jserver.com
\L2J_Server\build\bin
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:27: error: cannot find s
ymbol
    [javac]     private static Logger _log = Logger.getLogger(TeleportBBSManager
.class.getName());
    [javac]                    ^
    [javac]   symbol:   class Logger
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\CommunityBoard.java:87: error: cannot find symbol
    [javac]                                     BuffBBSManager.getInstance().par
secmd(command, activeChar);
    [javac]                                     ^
    [javac]   symbol:   variable BuffBBSManager
    [javac]   location: class CommunityBoard
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:27: error: cannot find s
ymbol
    [javac]     private static Logger _log = Logger.getLogger(TeleportBBSManager
.class.getName());
    [javac]                                  ^
    [javac]   symbol:   variable Logger
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:119: error: cannot find
symbol
    [javac]             Connection con = null;
    [javac]             ^
    [javac]   symbol:   class Connection
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:123: error: cannot find
symbol
    [javac]                     PreparedStatement st = con.prepareStatement("SEL
ECT * FROM comteleport WHERE charId=?;");
    [javac]                     ^
    [javac]   symbol:   class PreparedStatement
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:125: error: cannot find
symbol
    [javac]                     ResultSet rs = st.executeQuery();
    [javac]                     ^
    [javac]   symbol:   class ResultSet
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:126: error: cannot find
symbol
    [javac]                     ResultSet rs = s.executeQuery();
    [javac]                     ^
    [javac]   symbol:   class ResultSet
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:126: error: cannot find
symbol
    [javac]                     ResultSet rs = s.executeQuery();
    [javac]                                    ^
    [javac]   symbol:   variable s
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:175: error: cannot find
symbol
    [javac]                                     Connection conDel = null;
    [javac]                                     ^
    [javac]   symbol:   class Connection
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:179: error: cannot find
symbol
    [javac]                                                     PreparedStatemen
t stDel = conDel.prepareStatement("DELETE FROM comteleport WHERE charId=? AND Tp
Id=?;");
    [javac]                                                     ^
    [javac]   symbol:   class PreparedStatement
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]                      ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]                                                           ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]
                          ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]
                                                              ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]

                   ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]

                                                       ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:214: error: no suitable
method found for isInsideZone(byte)
    [javac]         if(activeChar.isInsideZone((byte)11) || activeChar.isInsideZ
one((byte)5) || activeChar.isInsideZone((byte)9) || activeChar.isInsideZone((byt
e)10) || activeChar.isInsideZone((byte)3) || activeChar.isInsideZone((byte)16) |
| activeChar.isInsideZone((byte)8) || activeChar.isFlying())
    [javac]


            ^
    [javac]     method L2Character.isInsideZone(ZoneId) is not applicable
    [javac]       (actual argument byte cannot be converted to ZoneId by method
invocation conversion)
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:224: error: cannot find
symbol
    [javac]                                     Connection con = null;
    [javac]                                     ^
    [javac]   symbol:   class Connection
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:229: error: cannot find
symbol
    [javac]                                                     PreparedStatemen
t st = con.prepareStatement("SELECT COUNT(*) FROM comteleport WHERE charId=?;");

    [javac]                                                     ^
    [javac]   symbol:   class PreparedStatement
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:231: error: cannot find
symbol
    [javac]                                                     ResultSet rs = s
t.executeQuery();
    [javac]                                                     ^
    [javac]   symbol:   class ResultSet
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:235: error: cannot find
symbol
    [javac]
PreparedStatement st1 = con.prepareStatement("SELECT COUNT(*) FROM comteleport W
HERE charId=? AND name=?;");
    [javac]
^
    [javac]   symbol:   class PreparedStatement
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:238: error: cannot find
symbol
    [javac]
ResultSet rs1 = st1.executeQuery();
    [javac]
^
    [javac]   symbol:   class ResultSet
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:242: error: cannot find
symbol
    [javac]
                PreparedStatement stAdd = con.prepareStatement("INSERT INTO comt
eleport (charId,xPos,yPos,zPos,name) VALUES(?,?,?,?,?)");
    [javac]
                ^
    [javac]   symbol:   class PreparedStatement
    [javac]   location: class TeleportBBSManager
    [javac] c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\java\com\l2jserver\
gameserver\communitybbs\Manager\TeleportBBSManager.java:252: error: cannot find
symbol
    [javac]
                PreparedStatement stAdd = con.prepareStatement("UPDATE comtelepo
rt SET xPos=?, yPos=?, zPos=? WHERE charId=? AND name=?;");
    [javac]
                ^
    [javac]   symbol:   class PreparedStatement
    [javac]   location: class TeleportBBSManager
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 24 errors

BUILD FAILED
c:\Server\L2jServer\svn.l2jserver.com\L2J_Server\build.xml:64: Compile failed; s
ee the compiler error output for details.

Total time: 18 seconds

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...