Browse Source

hotzone duration config, non repeating hotzones

master
FatBoy-DOTC 2 years ago
parent
commit
38e25bf132
  1. 3
      src/engine/gameManager/ConfigManager.java
  2. 7
      src/engine/gameManager/ZoneManager.java
  3. 3
      src/engine/objects/Zone.java
  4. 8
      src/engine/workthreads/HourlyJobThread.java

3
src/engine/gameManager/ConfigManager.java

@ -84,7 +84,8 @@ public enum ConfigManager { @@ -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.

7
src/engine/gameManager/ZoneManager.java

@ -44,7 +44,6 @@ public enum ZoneManager { @@ -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 { @@ -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 { @@ -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

3
src/engine/objects/Zone.java

@ -59,7 +59,8 @@ public class Zone extends AbstractGameObject { @@ -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
*/

8
src/engine/workthreads/HourlyJobThread.java

@ -45,12 +45,14 @@ public class HourlyJobThread implements Runnable { @@ -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) {

Loading…
Cancel
Save