Public Repository for the Magicbane Shadowbane Emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.4 KiB

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// 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;
import engine.gameManager.PlayerManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import java.util.ArrayList;
public class SlotTestCmd extends AbstractDevCmd {
public SlotTestCmd() {
super("slottest");
}
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] args,
AbstractGameObject target) {
ArrayList<BuildingLocation> buildingLocations;
String outString = "Available Slots\r\n";
if (target == null)
return;
if (target.getObjectType() != GameObjectType.Building)
return;
Building building = (Building) target;
buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
if (buildingLocations == null) {
outString = "No slot information for mesh: " + building.meshUUID;
ChatManager.chatSystemInfo(playerCharacter, outString);
return;
}
// Goto slot location
if (args[0].isEmpty() == false) {
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);
PlayerManager.teleport(playerCharacter, slotLocation);
return;
}
for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
if (building.getHirelings().isEmpty() == false) {
outString += "\r\n\r\n";
outString += "Hirelings List:";
for (AbstractCharacter hireling : building.getHirelings().keySet())
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
}
ChatManager.chatSystemInfo(playerCharacter, outString);
}
@Override
protected String _getHelpString() {
return "Displays slot information for building";
}
@Override
protected String _getUsageString() {
return "./slottest <target building> n";
}
}