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

78 lines
2.7 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;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
* ./hotzone <- display the current hotzone & time remaining
* ./hotzone random <- change hotzone to random new zone
*/
2023-02-23 17:14:34 -05:00
2022-04-30 09:41:17 -04:00
public class HotzoneCmd extends AbstractDevCmd {
public HotzoneCmd() {
super("hotzone");
}
@Override
2023-02-24 00:42:34 -05:00
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
2022-04-30 09:41:17 -04:00
AbstractGameObject target) {
StringBuilder data = new StringBuilder();
2023-02-24 00:42:34 -05:00
String outString;
2023-02-23 17:14:34 -05:00
2022-04-30 09:41:17 -04:00
for (String s : words) {
data.append(s);
data.append(' ');
}
2023-02-23 17:14:34 -05:00
2022-04-30 09:41:17 -04:00
String input = data.toString().trim();
if (input.length() == 0) {
2023-02-24 00:42:34 -05:00
outString = "Current hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
2022-04-30 09:41:17 -04:00
return;
}
if (input.equalsIgnoreCase("random")) {
ZoneManager.generateAndSetRandomHotzone();
2023-02-24 00:42:34 -05:00
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
outString += "Available hotZones: " + ZoneManager.availableHotZones();
throwbackInfo(playerCharacter, outString);
return;
2022-04-30 09:41:17 -04:00
}
2023-02-24 00:42:34 -05:00
if (input.equalsIgnoreCase("reset")) {
2023-02-24 00:32:18 -05:00
ZoneManager.resetHotZones();
2023-02-24 00:42:34 -05:00
throwbackInfo(playerCharacter, "Available hotZones: " + ZoneManager.availableHotZones());
return;
}
2023-02-23 17:47:22 -05:00
2023-02-23 17:14:34 -05:00
return;
2022-04-30 09:41:17 -04:00
}
2023-07-15 09:23:48 -04:00
2022-04-30 09:41:17 -04:00
@Override
protected String _getHelpString() {
2023-02-23 17:14:34 -05:00
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
2022-04-30 09:41:17 -04:00
}
@Override
protected String _getUsageString() {
2023-02-23 17:14:34 -05:00
return "'./hotzone [random]";
2022-04-30 09:41:17 -04:00
}
}