forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -22,129 +22,128 @@ import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
public class ZoneInfoCmd extends AbstractDevCmd {
|
||||
|
||||
public ZoneInfoCmd() {
|
||||
public ZoneInfoCmd() {
|
||||
super("zoneinfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
// Arg Count Check
|
||||
Zone zone = null;
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
// Arg Count Check
|
||||
Zone zone = null;
|
||||
|
||||
if (player == null) {
|
||||
throwbackError(player, "Unable to find the pc making the request.");
|
||||
return;
|
||||
}
|
||||
if (player == null) {
|
||||
throwbackError(player, "Unable to find the pc making the request.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
int targetID = Integer.parseInt(words[0]);
|
||||
try {
|
||||
int targetID = Integer.parseInt(words[0]);
|
||||
|
||||
//try get zone by objectUUID
|
||||
zone = ZoneManager.getZoneByUUID(targetID);
|
||||
//try get zone by objectUUID
|
||||
zone = ZoneManager.getZoneByUUID(targetID);
|
||||
|
||||
//that failed, try get by zoneID
|
||||
if (zone == null)
|
||||
zone = ZoneManager.getZoneByZoneID(targetID);
|
||||
//that failed, try get by zoneID
|
||||
if (zone == null)
|
||||
zone = ZoneManager.getZoneByZoneID(targetID);
|
||||
|
||||
//no zone found, so fail
|
||||
if (zone == null) {
|
||||
throwbackError(player, "Zone with ID " + targetID + "not found");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||
}
|
||||
//no zone found, so fail
|
||||
if (zone == null) {
|
||||
throwbackError(player, "Zone with ID " + targetID + "not found");
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||
}
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(player, "Zone not found");
|
||||
return;
|
||||
}
|
||||
if (zone == null) {
|
||||
throwbackError(player, "Zone not found");
|
||||
return;
|
||||
}
|
||||
|
||||
String newline = "\r\n ";
|
||||
String newline = "\r\n ";
|
||||
|
||||
|
||||
int objectUUID = zone.getObjectUUID();
|
||||
String output;
|
||||
int objectUUID = zone.getObjectUUID();
|
||||
String output;
|
||||
|
||||
output = "Target Information:" + newline;
|
||||
output += StringUtils.addWS("UUID: " + objectUUID, 20);
|
||||
output += newline;
|
||||
output += "name: " + zone.getName();
|
||||
output += newline;
|
||||
output += "loadNum: " + zone.getLoadNum();
|
||||
if (zone.getParent() != null) {
|
||||
output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
|
||||
output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
|
||||
output = "Target Information:" + newline;
|
||||
output += StringUtils.addWS("UUID: " + objectUUID, 20);
|
||||
output += newline;
|
||||
output += "name: " + zone.getName();
|
||||
output += newline;
|
||||
output += "loadNum: " + zone.getLoadNum();
|
||||
if (zone.getParent() != null) {
|
||||
output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
|
||||
output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
|
||||
|
||||
} else
|
||||
output += StringUtils.addWS(", parent: none", 30);
|
||||
output += newline;
|
||||
output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
|
||||
output += newline;
|
||||
output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
|
||||
output += newline;
|
||||
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
||||
output += newline;
|
||||
} else
|
||||
output += StringUtils.addWS(", parent: none", 30);
|
||||
output += newline;
|
||||
output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
|
||||
output += newline;
|
||||
output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
|
||||
output += newline;
|
||||
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
||||
output += newline;
|
||||
|
||||
if (zone.getHeightMap() != null){
|
||||
output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
|
||||
output += newline;
|
||||
output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
|
||||
output += newline;
|
||||
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
|
||||
if (zone.getHeightMap() != null) {
|
||||
output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
|
||||
output += newline;
|
||||
output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
|
||||
output += newline;
|
||||
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
|
||||
|
||||
}
|
||||
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
||||
output += newline;
|
||||
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
|
||||
output += newline;
|
||||
output += "Sea Level = " +zone.getSeaLevel();
|
||||
output += newline;
|
||||
output += "World Altitude = " + zone.getWorldAltitude();
|
||||
throwbackInfo(player, output);
|
||||
}
|
||||
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
|
||||
output += newline;
|
||||
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
|
||||
output += newline;
|
||||
output += "Sea Level = " + zone.getSeaLevel();
|
||||
output += newline;
|
||||
output += "World Altitude = " + zone.getWorldAltitude();
|
||||
throwbackInfo(player, output);
|
||||
|
||||
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
||||
City city = ZoneManager.getCityAtLocation(player.getLoc());
|
||||
|
||||
output += newline;
|
||||
output += (city == null)? "None" : city.getParent().getName();
|
||||
output += newline;
|
||||
output += (city == null) ? "None" : city.getParent().getName();
|
||||
|
||||
if (city != null ) {
|
||||
if (city != null) {
|
||||
|
||||
if (city.isLocationOnCityGrid(player.getLoc()))
|
||||
output += " (Grid)";
|
||||
else if (city.isLocationOnCityZone(player.getLoc()))
|
||||
output += " (Zone)";
|
||||
else if (city.isLocationWithinSiegeBounds(player.getLoc()))
|
||||
output += " (Siege)";
|
||||
} else {
|
||||
output = "children:";
|
||||
if (city.isLocationOnCityGrid(player.getLoc()))
|
||||
output += " (Grid)";
|
||||
else if (city.isLocationOnCityZone(player.getLoc()))
|
||||
output += " (Zone)";
|
||||
else if (city.isLocationWithinSiegeBounds(player.getLoc()))
|
||||
output += " (Siege)";
|
||||
} else {
|
||||
output = "children:";
|
||||
|
||||
ArrayList<Zone> nodes = zone.getNodes();
|
||||
ArrayList<Zone> nodes = zone.getNodes();
|
||||
|
||||
if (nodes.isEmpty())
|
||||
output += " none";
|
||||
if (nodes.isEmpty())
|
||||
output += " none";
|
||||
|
||||
for (Zone child : nodes) {
|
||||
output += newline;
|
||||
output += child.getName() + " (" + child.getLoadNum() + ')';
|
||||
}
|
||||
}
|
||||
throwbackInfo(player, output);
|
||||
}
|
||||
for (Zone child : nodes) {
|
||||
output += newline;
|
||||
output += child.getName() + " (" + child.getLoadNum() + ')';
|
||||
}
|
||||
}
|
||||
throwbackInfo(player, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Gets information on an Object.";
|
||||
}
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Gets information on an Object.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /info targetID'";
|
||||
}
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /info targetID'";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user