// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2022 // www.magicbane.com package engine.devcmd.cmds; import engine.InterestManagement.HeightMap; import engine.devcmd.AbstractDevCmd; import engine.gameManager.ZoneManager; import engine.math.Bounds; import engine.math.Vector2f; import engine.objects.AbstractGameObject; import engine.objects.PlayerCharacter; import engine.objects.Zone; public class GetHeightCmd extends AbstractDevCmd { public GetHeightCmd() { super("getHeight"); } @Override protected void _doCmd(PlayerCharacter playerCharacter, String[] words, AbstractGameObject target) { Zone currentZone; Zone parentZone; Zone heightmapZone; currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc()); heightmapZone = HeightMap.getNextZoneWithTerrain(currentZone); parentZone = HeightMap.getNextZoneWithTerrain(currentZone.parent); float currentHeight = HeightMap.getWorldHeight(currentZone, playerCharacter.getLoc()); float parentHeight = HeightMap.getWorldHeight(parentZone, playerCharacter.getLoc()); Vector2f zoneLoc = ZoneManager.worldToZoneSpace(playerCharacter.getLoc(), heightmapZone); Vector2f gridSquare = heightmapZone.getHeightMap().getGridSquare(zoneLoc); this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName); this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName); this.throwbackInfo(playerCharacter, "Zone Height: " + heightmapZone.worldAltitude); this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.seaLevel); this.throwbackInfo(playerCharacter, "Drowning Height: " + (heightmapZone.seaLevel + playerCharacter.getCharacterHeight())); this.throwbackInfo(playerCharacter, "Grid : " + (int) gridSquare.x + "x" + (int) gridSquare.y); this.throwbackInfo(playerCharacter, "*** 256: " + currentHeight); this.throwbackInfo(playerCharacter, "***Adjusted Height: " + (currentHeight + playerCharacter.getCharacterHeight())); this.throwbackInfo(playerCharacter, "------------"); this.throwbackInfo(playerCharacter, "Parent : " + parentZone.zoneName); this.throwbackInfo(playerCharacter, "Height returned : " + parentHeight); this.throwbackInfo(playerCharacter, "------------"); this.throwbackInfo(playerCharacter, "Min: " + heightmapZone.getHeightMap().zone_minBlend + " Max: " + heightmapZone.getHeightMap().zone_maxBlend); if (Bounds.collide(playerCharacter.getLoc(), heightmapZone.maxBlend)) { this.throwbackInfo(playerCharacter, "Blend: Max (Child)"); return; } this.throwbackInfo(playerCharacter, "Blend: Min (LERP)"); } @Override protected String _getHelpString() { return "Queries heightmap engine"; } @Override protected String _getUsageString() { return "' /getheight"; } }