|
|
@ -9,9 +9,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
package engine.devcmd.cmds; |
|
|
|
package engine.devcmd.cmds; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
import engine.devcmd.AbstractDevCmd; |
|
|
|
import engine.objects.AbstractGameObject; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
|
|
|
|
|
|
@ -25,42 +25,17 @@ public class RegionCmd extends AbstractDevCmd { |
|
|
|
protected void _doCmd(PlayerCharacter pc, String[] words, |
|
|
|
protected void _doCmd(PlayerCharacter pc, String[] words, |
|
|
|
AbstractGameObject target) { |
|
|
|
AbstractGameObject target) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Regions region = ((AbstractCharacter)target).region; |
|
|
|
if (pc.region == null) { |
|
|
|
if (region == null) { |
|
|
|
this.throwbackInfo(pc, "No Region Found."); |
|
|
|
this.throwbackInfo(pc, "No Region Found."); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(region != null) { |
|
|
|
String newLine = System.getProperty("line.separator"); |
|
|
|
this.throwbackInfo(pc, "Region Info: " + ((AbstractCharacter) target).getName()); |
|
|
|
String result = ""; |
|
|
|
this.throwbackInfo(pc, "Region Name: " + region); |
|
|
|
result += (pc.region.getClass().getSimpleName()); |
|
|
|
this.throwbackInfo(pc, "Region Height: " + region.lerpY((AbstractCharacter)target)); |
|
|
|
result += (" {"); |
|
|
|
|
|
|
|
result += (newLine); |
|
|
|
|
|
|
|
Field[] fields = pc.region.getClass().getDeclaredFields(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//print field names paired with their values
|
|
|
|
|
|
|
|
for (Field field : fields) { |
|
|
|
|
|
|
|
field.setAccessible(true); |
|
|
|
|
|
|
|
result += (" "); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (field.getName().contains("Furniture")) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
result += (field.getName()); |
|
|
|
|
|
|
|
result += (": "); |
|
|
|
|
|
|
|
//requires access to private field:
|
|
|
|
|
|
|
|
result += (field.get(pc.region).toString()); |
|
|
|
|
|
|
|
} catch (IllegalAccessException ex) { |
|
|
|
|
|
|
|
System.out.println(ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
result.trim(); |
|
|
|
|
|
|
|
result += (newLine); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
result += ("}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.throwbackInfo(pc, result.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|