Files
prestonbane/src/engine/devcmd/cmds/SlotTestCmd.java
T

94 lines
3.3 KiB
Java
Raw Normal View History

2023-04-24 16:41:25 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.ChatManager;
2023-05-03 18:04:42 -04:00
import engine.math.Vector3fImmutable;
2023-04-24 16:41:25 -04:00
import engine.objects.*;
2023-05-03 14:43:49 -04:00
import java.util.ArrayList;
2023-04-24 16:41:25 -04:00
public class SlotTestCmd extends AbstractDevCmd {
2023-07-15 09:23:48 -04:00
public SlotTestCmd() {
2023-04-24 16:41:25 -04:00
super("slottest");
}
2023-07-15 09:23:48 -04:00
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] args,
AbstractGameObject target) {
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
ArrayList<BuildingLocation> buildingLocations;
String outString = "Available Slots\r\n";
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
if (target == null)
return;
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
if (target.getObjectType() != GameObjectType.Building)
return;
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
Building building = (Building) target;
2023-05-03 14:43:49 -04:00
2023-07-15 09:23:48 -04:00
buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
2023-05-03 14:43:49 -04:00
2023-07-15 09:23:48 -04:00
if (buildingLocations == null) {
outString = "No slot information for mesh: " + building.meshUUID;
ChatManager.chatSystemInfo(playerCharacter, outString);
return;
}
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
// Goto slot location
2023-05-03 18:04:42 -04:00
2023-07-15 09:23:48 -04:00
if (args[0].isEmpty() == false) {
2023-05-03 18:04:42 -04:00
2023-07-15 09:23:48 -04:00
int slot = Integer.parseInt(args[0]);
Vector3fImmutable slotLocation;
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
slotLocation = building.getLoc().add(buildingLocation.getLocation());
slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
playerCharacter.teleport(slotLocation);
return;
}
2023-05-03 18:04:42 -04:00
2023-07-15 09:23:48 -04:00
for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
if (building.getHirelings().isEmpty() == false) {
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
outString += "\r\n\r\n";
outString += "Hirelings List:";
2023-04-24 17:28:21 -04:00
2023-07-15 09:23:48 -04:00
for (AbstractCharacter hireling : building.getHirelings().keySet())
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
2023-04-24 17:28:21 -04:00
2023-07-15 09:23:48 -04:00
}
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
ChatManager.chatSystemInfo(playerCharacter, outString);
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
}
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected String _getHelpString() {
return "Displays slot information for building";
}
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
@Override
protected String _getUsageString() {
2023-08-11 07:47:23 -04:00
return "./slottest <target building> n";
2023-04-24 16:41:25 -04:00
2023-07-15 09:23:48 -04:00
}
2023-04-24 16:41:25 -04:00
}