Duplicate region field removed and inlined.

This commit is contained in:
2023-04-29 12:33:21 -04:00
parent de38c8727a
commit e554171e22
16 changed files with 95 additions and 101 deletions
+12 -12
View File
@@ -390,16 +390,16 @@ public class InfoCmd extends AbstractDevCmd {
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
}
if (targetNPC.getRegion() != null){
if (targetNPC.region != null) {
output += newline;
output += "BuildingID : " + targetNPC.getRegion().parentBuildingID;
output += "building level : " + targetNPC.getRegion().level;
output += "building room : " + targetNPC.getRegion().room;
}else if(targetNPC.getBuilding() != null) {
output += "BuildingID : " + targetNPC.region.parentBuildingID;
output += "building level : " + targetNPC.region.level;
output += "building room : " + targetNPC.region.room;
} else if (targetNPC.getBuilding() != null) {
output += newline;
output += "Building : " + targetNPC.getBuilding();
}else{
} else {
output += newline;
output += "No building found.";
}
@@ -463,13 +463,13 @@ public class InfoCmd extends AbstractDevCmd {
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
output += newline;
output += "isMoving : " + targetMob.isMoving();
if (targetMob.getRegion() != null){
if (targetMob.region != null) {
output += newline;
output += "BuildingID : " + targetMob.getRegion().parentBuildingID;
output += "building level : " + targetMob.getRegion().level;
output += "building room : " + targetMob.getRegion().room;
output += "BuildingID : " + targetMob.region.parentBuildingID;
output += "building level : " + targetMob.region.level;
output += "building room : " + targetMob.region.room;
}
if(targetMob.building != null) {
if (targetMob.building != null) {
output += "Building Name: " + targetMob.building.getName() + newline;
output += "BuildingID : " + targetMob.building + newline;
output += "Bind Loc : " + targetMob.getBindLoc() + newline;
+6 -6
View File
@@ -40,14 +40,14 @@ public class PrintLocationCmd extends AbstractDevCmd {
throwbackInfo(pc, "Lat: " + tar.getLoc().getX());
throwbackInfo(pc, "Lon: " + -tar.getLoc().getZ());
throwbackInfo(pc, "Alt: " + tar.getLoc().getY());
if (pc.getRegion() != null) {
this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.getRegion()));
this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.getRegion()));
this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.getRegion(), pc));
}else{
if (pc.region != null) {
this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.region));
this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.region));
this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.region, pc));
} else {
this.throwbackInfo(pc, "No Region Found for player.");
}
} else {
throwbackInfo(pc, "Server location for " + tar.getFirstName()
+ " not found");
+8 -8
View File
@@ -27,18 +27,18 @@ public class RegionCmd extends AbstractDevCmd {
AbstractGameObject target) {
if (pc.getRegion() == null){
this.throwbackInfo(pc, "No Region Found.");
return;
}
if (pc.region == null) {
this.throwbackInfo(pc, "No Region Found.");
return;
}
String newLine = System.getProperty("line.separator");
String result = "";
result+=(pc.getRegion().getClass().getSimpleName());
result+=( " {" );
result += (pc.region.getClass().getSimpleName());
result += (" {");
result+=(newLine);
Field[] fields = pc.getRegion().getClass().getDeclaredFields();
Field[] fields = pc.region.getClass().getDeclaredFields();
//print field names paired with their values
for ( Field field : fields ) {
@@ -51,7 +51,7 @@ public class RegionCmd extends AbstractDevCmd {
result+=( field.getName());
result+=(": ");
//requires access to private field:
result+=( field.get(pc.getRegion()).toString());
result += (field.get(pc.region).toString());
} catch ( IllegalAccessException ex ) {
System.out.println(ex);
}