forked from MagicBane/Server
hotzone duration config, non repeating hotzones
This commit is contained in:
@@ -84,7 +84,8 @@ public enum ConfigManager {
|
||||
MB_MAGICBOT_GAMEVERSION,
|
||||
//drop rates
|
||||
MB_NORMAL_RATE,
|
||||
MB_HOTZONE_RATE;
|
||||
MB_HOTZONE_RATE,
|
||||
MB_HOTZONE_DURATION;
|
||||
// Map to hold our config pulled in from the environment
|
||||
// We also use the config to point to the current message pump
|
||||
// and determine the server type at runtime.
|
||||
|
||||
@@ -44,7 +44,6 @@ public enum ZoneManager {
|
||||
private static Set<Zone> macroZones = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
private static Set<Zone> npcCityZones = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
private static Set<Zone> playerCityZones = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
|
||||
// Find all zones coordinates fit into, starting with Sea Floor
|
||||
|
||||
public static ArrayList<Zone> getAllZonesIn(final Vector3fImmutable loc) {
|
||||
@@ -127,6 +126,7 @@ public enum ZoneManager {
|
||||
if (!zone.isMacroZone())
|
||||
return;
|
||||
ZoneManager.hotzone = zone;
|
||||
zone.hasBeenHotzone = true;
|
||||
}
|
||||
|
||||
public static boolean inHotZone(final Vector3fImmutable loc) {
|
||||
@@ -224,7 +224,10 @@ public enum ZoneManager {
|
||||
|
||||
if (zone.equals(ZoneManager.seaFloor))
|
||||
return false;
|
||||
|
||||
//no duplicate hotzones
|
||||
if(zone.hasBeenHotzone == true){
|
||||
return false;
|
||||
}
|
||||
// return false; //first time setting, accept it
|
||||
// if (this.hotzone.getUUID() == zone.getUUID())
|
||||
// return true; //no same hotzone
|
||||
|
||||
@@ -59,7 +59,8 @@ public class Zone extends AbstractGameObject {
|
||||
public final Set<Building> zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
public final Set<NPC> zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
public final Set<Mob> zoneMobSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
|
||||
public boolean hasBeenHotzone = false;
|
||||
public int hoursAsHotzone = 0;
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
|
||||
@@ -45,12 +45,14 @@ public class HourlyJobThread implements Runnable {
|
||||
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
Zone hotzone = ZoneManager.getHotZone();
|
||||
|
||||
if (hotzone == null) {
|
||||
Logger.error("Null hotzone returned from mapmanager");
|
||||
} else {
|
||||
Logger.info("new hotzone: " + hotzone.getName());
|
||||
WorldServer.setLastHZChange(System.currentTimeMillis());
|
||||
hotzone.hoursAsHotzone += 1;
|
||||
if(hotzone.hoursAsHotzone >= Integer.valueOf(ConfigManager.MB_HOTZONE_DURATION.getValue())) {
|
||||
Logger.info("new hotzone: " + hotzone.getName());
|
||||
WorldServer.setLastHZChange(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user