Files
Server/src/engine/devcmd/cmds/GetHeightCmd.java
T

70 lines
3.1 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
2023-10-08 09:18:43 -04:00
import engine.InterestManagement.Terrain;
2022-04-30 09:41:17 -04:00
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
2022-04-30 09:41:17 -04:00
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
public class GetHeightCmd extends AbstractDevCmd {
public GetHeightCmd() {
super("getHeight");
}
@Override
2023-09-11 11:08:03 -04:00
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
2022-04-30 09:41:17 -04:00
AbstractGameObject target) {
2023-09-11 11:08:03 -04:00
Zone currentZone;
Zone parentZone;
2023-09-11 15:59:08 -04:00
Zone heightmapZone;
2022-04-30 09:41:17 -04:00
2023-09-11 11:08:03 -04:00
currentZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
2023-10-08 09:18:43 -04:00
heightmapZone = Terrain.getNextZoneWithTerrain(currentZone);
parentZone = Terrain.getNextZoneWithTerrain(currentZone.parent);
2022-04-30 09:41:17 -04:00
2023-10-08 09:18:43 -04:00
float currentHeight = Terrain.getWorldHeight(currentZone, playerCharacter.getLoc());
float parentHeight = Terrain.getWorldHeight(parentZone, playerCharacter.getLoc());
2022-04-30 09:41:17 -04:00
2023-09-14 13:30:46 -04:00
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(playerCharacter.getLoc(), heightmapZone);
2023-10-08 09:59:13 -04:00
Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(zoneLoc);
2023-09-14 13:30:46 -04:00
2023-09-20 15:43:01 -04:00
this.throwbackInfo(playerCharacter, "Current Zone : " + currentZone.zoneName);
this.throwbackInfo(playerCharacter, "Heightmap Zone : " + heightmapZone.zoneName);
2023-10-08 09:22:53 -04:00
this.throwbackInfo(playerCharacter, "Global Height: " + heightmapZone.worldAltitude);
2023-09-20 15:43:01 -04:00
this.throwbackInfo(playerCharacter, "Sea Level: " + heightmapZone.seaLevel);
2023-10-08 09:22:53 -04:00
this.throwbackInfo(playerCharacter, "Grid : " + Math.floor(gridSquare.x) + "x" + Math.floor(gridSquare.y));
2023-10-09 09:35:24 -04:00
this.throwbackInfo(playerCharacter, "Blend: " + heightmapZone.terrain.terrainBlend(zoneLoc));
2023-10-08 09:32:08 -04:00
this.throwbackInfo(playerCharacter, "Height returned: " + Math.ceil(currentHeight));
2023-09-14 14:11:26 -04:00
2023-09-14 13:01:22 -04:00
this.throwbackInfo(playerCharacter, "------------");
2023-09-20 15:43:01 -04:00
this.throwbackInfo(playerCharacter, "Parent : " + parentZone.zoneName);
2023-10-08 09:32:08 -04:00
this.throwbackInfo(playerCharacter, "Height returned : " + Math.ceil(parentHeight));
2023-09-17 12:44:37 -04:00
this.throwbackInfo(playerCharacter, "------------");
2022-04-30 09:41:17 -04:00
}
@Override
protected String _getHelpString() {
2023-09-11 13:57:05 -04:00
return "Queries heightmap engine";
2022-04-30 09:41:17 -04:00
}
@Override
protected String _getUsageString() {
2023-09-11 13:57:05 -04:00
return "' /getheight";
2022-04-30 09:41:17 -04:00
}
}