@Override public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (!super.useAdminCommand(command, activeChar)) { return false; } if (command.equals("admin_teleto")) { activeChar.setTeleMode(1); } if (command.equals("admin_teleto r")) { activeChar.setTeleMode(2); } if (command.equals("admin_teleto end")) { activeChar.setTeleMode(0); } if (command.equals("admin_show_moves")) { com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage(activeChar, "teleports.htm"); } if (command.equals("admin_show_moves_other")) { com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage( activeChar, "tele/other.html"); } else if (command.equals("admin_show_teleport")) { showTeleportCharWindow(activeChar); } else if (command.equals("admin_recall_npc")) { recallNPC(activeChar); } else if (command.equals("admin_teleport_to_character")) { teleportToCharacter(activeChar, activeChar.getTarget()); } else if (command.startsWith("admin_walk")) { try { String val = command.substring(11); StringTokenizer st = new StringTokenizer(val); String x1 = st.nextToken(); int x = Integer.parseInt(x1); String y1 = st.nextToken(); int y = Integer.parseInt(y1); String z1 = st.nextToken(); int z = Integer.parseInt(z1); L2CharPosition pos = new L2CharPosition(x, y, z, 0); activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, pos); pos = null; x1 = null; y1 = null; z1 = null; st = null; } catch (Exception e) { if (Config.DEBUG) { _log.info("admin_walk: " + e); } } } else if (command.startsWith("admin_move_to")) { try { String val = command.substring(14); teleportTo(activeChar, val); val = null; } catch (StringIndexOutOfBoundsException e) { // Case of empty or missing coordinates com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage( activeChar, "teleports.htm"); } } else if (command.startsWith("admin_teleport_character")) { try { String val = command.substring(25); if (activeChar.getAccessLevel().isGm()) { teleportCharacter(activeChar, val); } val = null; } catch (StringIndexOutOfBoundsException e) { // Case of empty coordinates activeChar.sendMessage("Wrong or no Coordinates given."); showTeleportCharWindow(activeChar); // back to character teleport } } else if (command.startsWith("admin_teleportto ")) { try { String targetName = command.substring(17); L2PcInstance player = L2World.getInstance().getPlayer(targetName); teleportToCharacter(activeChar, player); targetName = null; player = null; } catch (StringIndexOutOfBoundsException e) { // ignore } } else if (command.startsWith("admin_recall ")) { try { String targetName = command.substring(13); L2PcInstance player = L2World.getInstance().getPlayer(targetName); if (activeChar.getAccessLevel().isGm()) { teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ()); } player = null; } catch (StringIndexOutOfBoundsException e) { // ignore } } else if (command.startsWith("admin_sendhome ")) { try { String targetName = command.substring(15); L2PcInstance player = L2World.getInstance().getPlayer(targetName); player.teleToLocation(MapRegionTable.TeleportWhereType.Town); targetName = null; player = null; } catch (StringIndexOutOfBoundsException e) { // ignore } } else if (command.equals("admin_tele")) { showTeleportWindow(activeChar); } else if (command.startsWith("admin_go")) { int intVal = 150; int x = activeChar.getX(), y = activeChar.getY(), z = activeChar.getZ(); try { String val = command.substring(8); StringTokenizer st = new StringTokenizer(val); String dir = st.nextToken(); if (st.hasMoreTokens()) { intVal = Integer.parseInt(st.nextToken()); } if (dir.equals("east")) { x += intVal; } else if (dir.equals("west")) { x -= intVal; } else if (dir.equals("north")) { y -= intVal; } else if (dir.equals("south")) { y += intVal; } else if (dir.equals("up")) { z += intVal; } else if (dir.equals("down")) { z -= intVal; } activeChar.teleToLocation(x, y, z, false); showTeleportWindow(activeChar); dir = null; st = null; val = null; } catch (Exception e) { activeChar.sendMessage("Usage: //go<north|south|east|west|up|down> [offset] (default 150)"); } } return true; }
private void showTeleportWindow(L2PcInstance activeChar) { com.l2scoria.gameserver.handler.admin.impl.HelpPage.showHelpPage(activeChar, "move.htm"); }