hotzone dev command updated.
This commit is contained in:
@@ -22,9 +22,8 @@ import engine.server.world.WorldServer;
|
|||||||
/**
|
/**
|
||||||
* ./hotzone <- display the current hotzone & time remaining
|
* ./hotzone <- display the current hotzone & time remaining
|
||||||
* ./hotzone random <- change hotzone to random new zone
|
* ./hotzone random <- change hotzone to random new zone
|
||||||
* ./hotzone name of a macrozone <- change hotzone to the zone name provided
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HotzoneCmd extends AbstractDevCmd {
|
public class HotzoneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public HotzoneCmd() {
|
public HotzoneCmd() {
|
||||||
@@ -36,78 +35,36 @@ public class HotzoneCmd extends AbstractDevCmd {
|
|||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder();
|
StringBuilder data = new StringBuilder();
|
||||||
|
|
||||||
for (String s : words) {
|
for (String s : words) {
|
||||||
data.append(s);
|
data.append(s);
|
||||||
data.append(' ');
|
data.append(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
String input = data.toString().trim();
|
String input = data.toString().trim();
|
||||||
|
|
||||||
if (input.length() == 0) {
|
if (input.length() == 0) {
|
||||||
throwbackInfo(pc, "Current hotzone: " + hotzoneInfo());
|
throwbackInfo(pc, "Current hotZone: " + ZoneManager.hotZone.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Zone zone;
|
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("random")) {
|
if (input.equalsIgnoreCase("random")) {
|
||||||
throwbackInfo(pc, "Previous hotzone: " + hotzoneInfo());
|
throwbackInfo(pc, "Previous hotZone: " + ZoneManager.hotZone.getName());
|
||||||
ZoneManager.generateAndSetRandomHotzone();
|
ZoneManager.generateAndSetRandomHotzone();
|
||||||
zone = ZoneManager.hotZone;
|
throwbackInfo(pc, "New hotZone: " + ZoneManager.hotZone.getName());
|
||||||
} else {
|
|
||||||
zone = ZoneManager.findMacroZoneByName(input);
|
|
||||||
|
|
||||||
if (zone == null) {
|
|
||||||
throwbackError(pc, "Cannot find a macrozone with that name.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zone == ZoneManager.hotZone) {
|
|
||||||
throwbackInfo(pc, "That macrozone is already the Hotzone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ZoneManager.validHotZone(zone) == false) {
|
|
||||||
throwbackError(pc, "That macrozone cannot be set as the Hotzone.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
throwbackInfo(pc, "Previous hotzone: " + hotzoneInfo());
|
|
||||||
ZoneManager.setHotZone(zone);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throwbackInfo(pc, "New hotzone: " + hotzoneInfo());
|
return;
|
||||||
HotzoneChangeMsg hcm = new HotzoneChangeMsg(zone.getObjectType().ordinal(), zone.getObjectUUID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Use no arguments to see the current hotzone. Specify a macrozone name to change the hotzone, or \"random\" to change it randomly.";
|
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "'./hotzone [random | <macroZoneName>]";
|
return "'./hotzone [random]";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String hotzoneInfo() {
|
|
||||||
final int hotzoneTimeLeft = FastMath.secondsUntilNextHour();
|
|
||||||
final Zone hotzone = ZoneManager.hotZone;
|
|
||||||
String hotzoneInfo;
|
|
||||||
|
|
||||||
if (hotzone == null) {
|
|
||||||
hotzoneInfo = "none";
|
|
||||||
} else {
|
|
||||||
int hr = hotzoneTimeLeft/3600;
|
|
||||||
int rem = hotzoneTimeLeft%3600;
|
|
||||||
int mn = rem/60;
|
|
||||||
int sec = rem%60;
|
|
||||||
hotzoneInfo = hotzone.getName() +
|
|
||||||
" (" + (hr<10 ? "0" : "") + hr + ':' +
|
|
||||||
(mn<10 ? "0" : "") + mn + ':' +
|
|
||||||
(sec<10 ? "0" : "") + sec +
|
|
||||||
" remaining)";
|
|
||||||
}
|
|
||||||
return hotzoneInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user