|
@@ -20,7 +20,7 @@ import java.util.logging.Level;
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.gameserver.ai.CtrlIntention;
|
|
import com.l2jserver.gameserver.ai.CtrlIntention;
|
|
import com.l2jserver.gameserver.communitybbs.CommunityBoard;
|
|
import com.l2jserver.gameserver.communitybbs.CommunityBoard;
|
|
-import com.l2jserver.gameserver.datatables.AdminCommandAccessRights;
|
|
|
|
|
|
+import com.l2jserver.gameserver.datatables.AdminTable;
|
|
import com.l2jserver.gameserver.handler.AdminCommandHandler;
|
|
import com.l2jserver.gameserver.handler.AdminCommandHandler;
|
|
import com.l2jserver.gameserver.handler.BypassHandler;
|
|
import com.l2jserver.gameserver.handler.BypassHandler;
|
|
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
|
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
|
@@ -39,10 +39,10 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
|
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
|
|
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
|
|
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
|
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
|
import com.l2jserver.gameserver.util.GMAudit;
|
|
import com.l2jserver.gameserver.util.GMAudit;
|
|
|
|
+import com.l2jserver.gameserver.util.Util;
|
|
|
|
|
|
/**
|
|
/**
|
|
* This class ...
|
|
* This class ...
|
|
- *
|
|
|
|
* @version $Revision: 1.12.4.5 $ $Date: 2005/04/11 10:06:11 $
|
|
* @version $Revision: 1.12.4.5 $ $Date: 2005/04/11 10:06:11 $
|
|
*/
|
|
*/
|
|
public final class RequestBypassToServer extends L2GameClientPacket
|
|
public final class RequestBypassToServer extends L2GameClientPacket
|
|
@@ -68,16 +68,16 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
|
if (!getClient().getFloodProtectors().getServerBypass().tryPerformAction(_command))
|
|
if (!getClient().getFloodProtectors().getServerBypass().tryPerformAction(_command))
|
|
return;
|
|
return;
|
|
|
|
|
|
- if(_command.isEmpty())
|
|
|
|
|
|
+ if (_command.isEmpty())
|
|
{
|
|
{
|
|
- _log.info(activeChar.getName()+" send empty requestbypass");
|
|
|
|
|
|
+ _log.info(activeChar.getName() + " send empty requestbypass");
|
|
activeChar.logout();
|
|
activeChar.logout();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- if (_command.startsWith("admin_")) //&& activeChar.getAccessLevel() >= Config.GM_ACCESSLEVEL)
|
|
|
|
|
|
+ if (_command.startsWith("admin_"))
|
|
{
|
|
{
|
|
String command = _command.split(" ")[0];
|
|
String command = _command.split(" ")[0];
|
|
|
|
|
|
@@ -85,89 +85,105 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
|
|
|
|
|
if (ach == null)
|
|
if (ach == null)
|
|
{
|
|
{
|
|
- if ( activeChar.isGM() )
|
|
|
|
|
|
+ if (activeChar.isGM())
|
|
|
|
+ {
|
|
activeChar.sendMessage("The command " + command.substring(6) + " does not exist!");
|
|
activeChar.sendMessage("The command " + command.substring(6) + " does not exist!");
|
|
-
|
|
|
|
- _log.warning("No handler registered for admin command '" + command + "'");
|
|
|
|
|
|
+ }
|
|
|
|
+ _log.warning(activeChar + " requested not registered admin command '" + command + "'");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!AdminCommandAccessRights.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
|
|
|
|
|
+ if (!AdminTable.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
|
{
|
|
{
|
|
activeChar.sendMessage("You don't have the access rights to use this command!");
|
|
activeChar.sendMessage("You don't have the access rights to use this command!");
|
|
_log.warning("Character " + activeChar.getName() + " tried to use admin command " + command + ", without proper access level!");
|
|
_log.warning("Character " + activeChar.getName() + " tried to use admin command " + command + ", without proper access level!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if (AdminCommandAccessRights.getInstance().requireConfirm(command))
|
|
|
|
|
|
+ if (AdminTable.getInstance().requireConfirm(command))
|
|
{
|
|
{
|
|
activeChar.setAdminConfirmCmd(_command);
|
|
activeChar.setAdminConfirmCmd(_command);
|
|
ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.S1);
|
|
ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.S1);
|
|
- dlg.addString("Are you sure you want execute command "+_command.substring(6)+" ?");
|
|
|
|
|
|
+ dlg.addString("Are you sure you want execute command " + _command.substring(6) + " ?");
|
|
activeChar.sendPacket(dlg);
|
|
activeChar.sendPacket(dlg);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
if (Config.GMAUDIT)
|
|
if (Config.GMAUDIT)
|
|
- GMAudit.auditGMAction(activeChar.getName()+" ["+activeChar.getObjectId()+"]", _command, (activeChar.getTarget() != null?activeChar.getTarget().getName():"no-target"));
|
|
|
|
|
|
+ {
|
|
|
|
+ GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
|
|
|
|
+ }
|
|
|
|
|
|
ach.useAdminCommand(_command, activeChar);
|
|
ach.useAdminCommand(_command, activeChar);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (_command.equals("come_here") && ( activeChar.isGM()))
|
|
|
|
|
|
+ else if (_command.equals("come_here") && activeChar.isGM())
|
|
{
|
|
{
|
|
comeHere(activeChar);
|
|
comeHere(activeChar);
|
|
}
|
|
}
|
|
else if (_command.startsWith("npc_"))
|
|
else if (_command.startsWith("npc_"))
|
|
{
|
|
{
|
|
- if(!activeChar.validateBypass(_command))
|
|
|
|
|
|
+ if (!activeChar.validateBypass(_command))
|
|
return;
|
|
return;
|
|
|
|
|
|
int endOfId = _command.indexOf('_', 5);
|
|
int endOfId = _command.indexOf('_', 5);
|
|
String id;
|
|
String id;
|
|
if (endOfId > 0)
|
|
if (endOfId > 0)
|
|
|
|
+ {
|
|
id = _command.substring(4, endOfId);
|
|
id = _command.substring(4, endOfId);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
|
|
+ {
|
|
id = _command.substring(4);
|
|
id = _command.substring(4);
|
|
- try
|
|
|
|
|
|
+ }
|
|
|
|
+ if (Util.isDigit(id))
|
|
{
|
|
{
|
|
L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
|
L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
|
|
|
|
|
- if (object instanceof L2Npc && endOfId > 0 && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
|
|
|
- ((L2Npc)object).onBypassFeedback(activeChar, _command.substring(endOfId+1));
|
|
|
|
-
|
|
|
|
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
|
|
|
+ if (object != null && object.isNpc() && endOfId > 0 && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
|
|
|
+ {
|
|
|
|
+ ((L2Npc) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- catch (NumberFormatException nfe) {}
|
|
|
|
|
|
+
|
|
|
|
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
|
}
|
|
}
|
|
else if (_command.startsWith("summon_"))
|
|
else if (_command.startsWith("summon_"))
|
|
{
|
|
{
|
|
- if(!activeChar.validateBypass(_command))
|
|
|
|
|
|
+ if (!activeChar.validateBypass(_command))
|
|
return;
|
|
return;
|
|
|
|
|
|
int endOfId = _command.indexOf('_', 8);
|
|
int endOfId = _command.indexOf('_', 8);
|
|
String id;
|
|
String id;
|
|
|
|
+
|
|
if (endOfId > 0)
|
|
if (endOfId > 0)
|
|
|
|
+ {
|
|
id = _command.substring(7, endOfId);
|
|
id = _command.substring(7, endOfId);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
|
|
+ {
|
|
id = _command.substring(7);
|
|
id = _command.substring(7);
|
|
- try
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (Util.isDigit(id))
|
|
{
|
|
{
|
|
L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
|
L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));
|
|
|
|
|
|
if (object instanceof L2MerchantSummonInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
|
if (object instanceof L2MerchantSummonInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2Npc.INTERACTION_DISTANCE, false, false))
|
|
- ((L2MerchantSummonInstance)object).onBypassFeedback(activeChar, _command.substring(endOfId+1));
|
|
|
|
-
|
|
|
|
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
|
|
|
+ {
|
|
|
|
+ ((L2MerchantSummonInstance) object).onBypassFeedback(activeChar, _command.substring(endOfId + 1));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- catch (NumberFormatException nfe) {}
|
|
|
|
|
|
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
|
}
|
|
}
|
|
// Navigate through Manor windows
|
|
// Navigate through Manor windows
|
|
else if (_command.startsWith("manor_menu_select"))
|
|
else if (_command.startsWith("manor_menu_select"))
|
|
{
|
|
{
|
|
final IBypassHandler manor = BypassHandler.getInstance().getHandler("manor_menu_select");
|
|
final IBypassHandler manor = BypassHandler.getInstance().getHandler("manor_menu_select");
|
|
if (manor != null)
|
|
if (manor != null)
|
|
|
|
+ {
|
|
manor.useBypass(_command, activeChar, null);
|
|
manor.useBypass(_command, activeChar, null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (_command.startsWith("_bbs"))
|
|
else if (_command.startsWith("_bbs"))
|
|
{
|
|
{
|
|
@@ -177,97 +193,106 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
|
|
+ {
|
|
CommunityBoard.getInstance().handleCommands(getClient(), _command);
|
|
CommunityBoard.getInstance().handleCommands(getClient(), _command);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (_command.startsWith("bbs"))
|
|
else if (_command.startsWith("bbs"))
|
|
{
|
|
{
|
|
if (Config.ENABLE_COMMUNITY_BOARD)
|
|
if (Config.ENABLE_COMMUNITY_BOARD)
|
|
{
|
|
{
|
|
if (!CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), _command)))
|
|
if (!CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), _command)))
|
|
|
|
+ {
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
|
|
+ {
|
|
CommunityBoard.getInstance().handleCommands(getClient(), _command);
|
|
CommunityBoard.getInstance().handleCommands(getClient(), _command);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (_command.startsWith("_mail"))
|
|
else if (_command.startsWith("_mail"))
|
|
{
|
|
{
|
|
if (!CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), "_bbsmail")))
|
|
if (!CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), "_bbsmail")))
|
|
|
|
+ {
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (_command.startsWith("_friend"))
|
|
else if (_command.startsWith("_friend"))
|
|
{
|
|
{
|
|
if (!CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), "_bbsfriend")))
|
|
if (!CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), "_bbsfriend")))
|
|
|
|
+ {
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
activeChar.sendPacket(SystemMessageId.CB_OFFLINE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (_command.startsWith("Quest "))
|
|
else if (_command.startsWith("Quest "))
|
|
{
|
|
{
|
|
- if(!activeChar.validateBypass(_command))
|
|
|
|
|
|
+ if (!activeChar.validateBypass(_command))
|
|
return;
|
|
return;
|
|
|
|
|
|
- L2PcInstance player = getClient().getActiveChar();
|
|
|
|
- if (player == null) return;
|
|
|
|
-
|
|
|
|
String p = _command.substring(6).trim();
|
|
String p = _command.substring(6).trim();
|
|
int idx = p.indexOf(' ');
|
|
int idx = p.indexOf(' ');
|
|
if (idx < 0)
|
|
if (idx < 0)
|
|
- player.processQuestEvent(p, "");
|
|
|
|
|
|
+ {
|
|
|
|
+ activeChar.processQuestEvent(p, "");
|
|
|
|
+ }
|
|
else
|
|
else
|
|
- player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
|
|
|
|
|
|
+ {
|
|
|
|
+ activeChar.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (_command.startsWith("_match"))
|
|
else if (_command.startsWith("_match"))
|
|
{
|
|
{
|
|
- L2PcInstance player = getClient().getActiveChar();
|
|
|
|
- if (player == null) return;
|
|
|
|
-
|
|
|
|
- String params = _command.substring(_command.indexOf("?")+1);
|
|
|
|
|
|
+ String params = _command.substring(_command.indexOf("?") + 1);
|
|
StringTokenizer st = new StringTokenizer(params, "&");
|
|
StringTokenizer st = new StringTokenizer(params, "&");
|
|
int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
|
int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
|
- if( heroid > 0)
|
|
|
|
|
|
+ if (heroid > 0)
|
|
{
|
|
{
|
|
- Hero.getInstance().showHeroFights(player, heroclass, heroid, heropage);
|
|
|
|
|
|
+ Hero.getInstance().showHeroFights(activeChar, heroclass, heroid, heropage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (_command.startsWith("_diary"))
|
|
else if (_command.startsWith("_diary"))
|
|
{
|
|
{
|
|
- L2PcInstance player = getClient().getActiveChar();
|
|
|
|
- if (player == null) return;
|
|
|
|
-
|
|
|
|
- String params = _command.substring(_command.indexOf("?")+1);
|
|
|
|
|
|
+ String params = _command.substring(_command.indexOf("?") + 1);
|
|
StringTokenizer st = new StringTokenizer(params, "&");
|
|
StringTokenizer st = new StringTokenizer(params, "&");
|
|
int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heroclass = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heropage = Integer.parseInt(st.nextToken().split("=")[1]);
|
|
int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
|
int heroid = Hero.getInstance().getHeroByClass(heroclass);
|
|
- if( heroid > 0)
|
|
|
|
|
|
+ if (heroid > 0)
|
|
{
|
|
{
|
|
- Hero.getInstance().showHeroDiary(player, heroclass, heroid, heropage);
|
|
|
|
|
|
+ Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);
|
|
final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);
|
|
if (handler != null)
|
|
if (handler != null)
|
|
|
|
+ {
|
|
handler.useBypass(_command, activeChar, null);
|
|
handler.useBypass(_command, activeChar, null);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
- _log.log(Level.WARNING, getClient()+" sent not handled RequestBypassToServer: ["+_command+"]");
|
|
|
|
|
|
+ {
|
|
|
|
+ _log.log(Level.WARNING, getClient() + " sent not handled RequestBypassToServer: [" + _command + "]");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
- _log.log(Level.WARNING, getClient()+" sent bad RequestBypassToServer: \""+_command+"\"", e);
|
|
|
|
|
|
+ _log.log(Level.WARNING, getClient() + " sent bad RequestBypassToServer: \"" + _command + "\"", e);
|
|
if (activeChar.isGM())
|
|
if (activeChar.isGM())
|
|
{
|
|
{
|
|
StringBuilder sb = new StringBuilder(200);
|
|
StringBuilder sb = new StringBuilder(200);
|
|
sb.append("<html><body>");
|
|
sb.append("<html><body>");
|
|
- sb.append("Bypass error: "+e+"<br1>");
|
|
|
|
- sb.append("Bypass command: "+_command+"<br1>");
|
|
|
|
|
|
+ sb.append("Bypass error: " + e + "<br1>");
|
|
|
|
+ sb.append("Bypass command: " + _command + "<br1>");
|
|
sb.append("StackTrace:<br1>");
|
|
sb.append("StackTrace:<br1>");
|
|
for (StackTraceElement ste : e.getStackTrace())
|
|
for (StackTraceElement ste : e.getStackTrace())
|
|
- sb.append(ste.toString()+"<br1>");
|
|
|
|
|
|
+ sb.append(ste.toString() + "<br1>");
|
|
sb.append("</body></html>");
|
|
sb.append("</body></html>");
|
|
// item html
|
|
// item html
|
|
- NpcHtmlMessage msg = new NpcHtmlMessage(0,12807);
|
|
|
|
|
|
+ NpcHtmlMessage msg = new NpcHtmlMessage(0, 12807);
|
|
msg.setHtml(sb.toString());
|
|
msg.setHtml(sb.toString());
|
|
msg.disableValidation();
|
|
msg.disableValidation();
|
|
activeChar.sendPacket(msg);
|
|
activeChar.sendPacket(msg);
|
|
@@ -281,12 +306,13 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
|
private static void comeHere(L2PcInstance activeChar)
|
|
private static void comeHere(L2PcInstance activeChar)
|
|
{
|
|
{
|
|
L2Object obj = activeChar.getTarget();
|
|
L2Object obj = activeChar.getTarget();
|
|
- if (obj == null) return;
|
|
|
|
|
|
+ if (obj == null)
|
|
|
|
+ return;
|
|
if (obj instanceof L2Npc)
|
|
if (obj instanceof L2Npc)
|
|
{
|
|
{
|
|
L2Npc temp = (L2Npc) obj;
|
|
L2Npc temp = (L2Npc) obj;
|
|
temp.setTarget(activeChar);
|
|
temp.setTarget(activeChar);
|
|
- temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX(),activeChar.getY(), activeChar.getZ(), 0 ));
|
|
|
|
|
|
+ temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|