diff --git a/L2J_DataPack_BETA/dist/game/config/adminCommands.xml b/L2J_DataPack_BETA/dist/game/config/adminCommands.xml index 50f23bd97f885411325a60469c1065e97d9e5d0a..845ae929d2ae4e3a530ca50025aaf76da9d6db5d 100644 --- a/L2J_DataPack_BETA/dist/game/config/adminCommands.xml +++ b/L2J_DataPack_BETA/dist/game/config/adminCommands.xml @@ -283,6 +283,7 @@ <admin command="admin_geo_spawn_pos" accessLevel="7" /> <admin command="admin_geo_can_see" accessLevel="7" /> <admin command="admin_geo_can_move" accessLevel="7" /> + <admin command="admin_geogrid" accessLevel="7" /> <!-- ADMIN GEO EDITOR --> <admin command="admin_ge_status" accessLevel="7" /> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java index dd5e2bb890dd3758583307f12e5092bc18cba8f5..87f3f8815e55c0f758d65fca227bde437095a16f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminGeodata.java @@ -18,12 +18,15 @@ */ package handlers.admincommandhandlers; +import java.util.StringTokenizer; + import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; +import com.l2jserver.gameserver.util.GeoUtils; /** * @author -Nemesiss- @@ -36,89 +39,99 @@ public class AdminGeodata implements IAdminCommandHandler "admin_geo_pos", "admin_geo_spawn_pos", "admin_geo_can_move", - "admin_geo_can_see" + "admin_geo_can_see", + "admin_geogrid", }; @Override public boolean useAdminCommand(String command, L2PcInstance activeChar) { - if ("admin_geo_pos".equals(command)) - { - int worldX = activeChar.getX(); - int worldY = activeChar.getY(); - int worldZ = activeChar.getZ(); - int geoX = GeoData.getInstance().getGeoX(worldX); - int geoY = GeoData.getInstance().getGeoY(worldY); - - if (GeoData.getInstance().hasGeoPos(geoX, geoY)) - { - activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getNearestZ(geoX, geoY, worldZ)); - } - else - { - activeChar.sendMessage("There is no geodata at this position."); - } - } - else if ("admin_geo_spawn_pos".equals(command)) + final StringTokenizer st = new StringTokenizer(command, " "); + final String actualCommand = st.nextToken(); + switch (actualCommand.toLowerCase()) { - int worldX = activeChar.getX(); - int worldY = activeChar.getY(); - int worldZ = activeChar.getZ(); - int geoX = GeoData.getInstance().getGeoX(worldX); - int geoY = GeoData.getInstance().getGeoY(worldY); - - if (GeoData.getInstance().hasGeoPos(geoX, geoY)) + case "admin_geo_pos": { - activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getSpawnHeight(worldX, worldY, worldZ, worldZ)); - } - else - { - activeChar.sendMessage("There is no geodata at this position."); + final int worldX = activeChar.getX(); + final int worldY = activeChar.getY(); + final int worldZ = activeChar.getZ(); + final int geoX = GeoData.getInstance().getGeoX(worldX); + final int geoY = GeoData.getInstance().getGeoY(worldY); + + if (GeoData.getInstance().hasGeoPos(geoX, geoY)) + { + activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getNearestZ(geoX, geoY, worldZ)); + } + else + { + activeChar.sendMessage("There is no geodata at this position."); + } + break; } - } - else if ("admin_geo_can_move".equals(command)) - { - L2Object target = activeChar.getTarget(); - if (target != null) + case "admin_geo_spawn_pos": { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) + final int worldX = activeChar.getX(); + final int worldY = activeChar.getY(); + final int worldZ = activeChar.getZ(); + final int geoX = GeoData.getInstance().getGeoX(worldX); + final int geoY = GeoData.getInstance().getGeoY(worldY); + + if (GeoData.getInstance().hasGeoPos(geoX, geoY)) { - activeChar.sendMessage("Can move beeline."); + activeChar.sendMessage("WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoData.getInstance().getSpawnHeight(worldX, worldY, worldZ, worldZ)); } else { - activeChar.sendMessage("Can not move beeline!"); + activeChar.sendMessage("There is no geodata at this position."); } + break; } - else + case "admin_geo_can_move": { - activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); + final L2Object target = activeChar.getTarget(); + if (target != null) + { + if (GeoData.getInstance().canSeeTarget(activeChar, target)) + { + activeChar.sendMessage("Can move beeline."); + } + else + { + activeChar.sendMessage("Can not move beeline!"); + } + } + else + { + activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); + } + break; } - } - else if ("admin_geo_can_see".equals(command)) - { - L2Object target = activeChar.getTarget(); - if (target != null) + case "admin_geo_can_see": { - if (GeoData.getInstance().canSeeTarget(activeChar, target)) + final L2Object target = activeChar.getTarget(); + if (target != null) { - activeChar.sendMessage("Can see target."); + if (GeoData.getInstance().canSeeTarget(activeChar, target)) + { + activeChar.sendMessage("Can see target."); + } + else + { + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANT_SEE_TARGET)); + } } else { - activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANT_SEE_TARGET)); + activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); } + break; } - else + case "admin_geogrid": { - activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); + GeoUtils.debugGrid(activeChar); + break; } } - else - { - return false; - } - return true; }