Skip to content
Snippets Groups Projects
Commit b4669baf authored by St3eT's avatar St3eT
Browse files

BETA: Added admin command to debug geodata (!//geogrid)

parent 672acb53
No related branches found
No related tags found
No related merge requests found
...@@ -283,6 +283,7 @@ ...@@ -283,6 +283,7 @@
<admin command="admin_geo_spawn_pos" accessLevel="7" /> <admin command="admin_geo_spawn_pos" accessLevel="7" />
<admin command="admin_geo_can_see" accessLevel="7" /> <admin command="admin_geo_can_see" accessLevel="7" />
<admin command="admin_geo_can_move" accessLevel="7" /> <admin command="admin_geo_can_move" accessLevel="7" />
<admin command="admin_geogrid" accessLevel="7" />
<!-- ADMIN GEO EDITOR --> <!-- ADMIN GEO EDITOR -->
<admin command="admin_ge_status" accessLevel="7" /> <admin command="admin_ge_status" accessLevel="7" />
......
...@@ -18,12 +18,15 @@ ...@@ -18,12 +18,15 @@
*/ */
package handlers.admincommandhandlers; package handlers.admincommandhandlers;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.GeoUtils;
/** /**
* @author -Nemesiss- * @author -Nemesiss-
...@@ -36,89 +39,99 @@ public class AdminGeodata implements IAdminCommandHandler ...@@ -36,89 +39,99 @@ public class AdminGeodata implements IAdminCommandHandler
"admin_geo_pos", "admin_geo_pos",
"admin_geo_spawn_pos", "admin_geo_spawn_pos",
"admin_geo_can_move", "admin_geo_can_move",
"admin_geo_can_see" "admin_geo_can_see",
"admin_geogrid",
}; };
@Override @Override
public boolean useAdminCommand(String command, L2PcInstance activeChar) public boolean useAdminCommand(String command, L2PcInstance activeChar)
{ {
if ("admin_geo_pos".equals(command)) final StringTokenizer st = new StringTokenizer(command, " ");
{ final String actualCommand = st.nextToken();
int worldX = activeChar.getX(); switch (actualCommand.toLowerCase())
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))
{ {
int worldX = activeChar.getX(); case "admin_geo_pos":
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().getSpawnHeight(worldX, worldY, worldZ, worldZ)); final int worldX = activeChar.getX();
} final int worldY = activeChar.getY();
else final int worldZ = activeChar.getZ();
{ final int geoX = GeoData.getInstance().getGeoX(worldX);
activeChar.sendMessage("There is no geodata at this position."); 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;
} }
} case "admin_geo_spawn_pos":
else if ("admin_geo_can_move".equals(command))
{
L2Object target = activeChar.getTarget();
if (target != null)
{ {
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 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;
} }
} case "admin_geo_can_see":
else if ("admin_geo_can_see".equals(command))
{
L2Object target = activeChar.getTarget();
if (target != null)
{ {
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 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; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment