|
|
|
@ -29,6 +29,8 @@ import java.util.concurrent.ConcurrentHashMap;
@@ -29,6 +29,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
|
|
public class Zone extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); |
|
|
|
|
public static long lastRespawn = 0; |
|
|
|
|
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<>()); |
|
|
|
@ -58,8 +60,6 @@ public class Zone extends AbstractWorldObject {
@@ -58,8 +60,6 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
public float global_height = 0; |
|
|
|
|
public float seaLevel = 0f; |
|
|
|
|
public float sea_level_offset = 0; |
|
|
|
|
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); |
|
|
|
|
public static long lastRespawn = 0; |
|
|
|
|
public float major_radius; |
|
|
|
|
public float minor_radius; |
|
|
|
|
public float min_blend; |
|
|
|
@ -79,20 +79,20 @@ public class Zone extends AbstractWorldObject {
@@ -79,20 +79,20 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
|
|
|
|
|
super(rs); |
|
|
|
|
|
|
|
|
|
this.parentZoneID = rs.getInt("parent"); |
|
|
|
|
this.playerCityUUID = rs.getInt("playerCityUUID"); |
|
|
|
|
this.guild_zone = this.playerCityUUID != 0; |
|
|
|
|
this.zoneName = rs.getString("zone_name"); |
|
|
|
|
this.xOffset = rs.getFloat("xOffset"); |
|
|
|
|
this.zOffset = rs.getFloat("zOffset"); |
|
|
|
|
this.yOffset = rs.getFloat("yOffset"); |
|
|
|
|
this.template = rs.getInt("template"); |
|
|
|
|
this.peace_zone = rs.getByte("peace_zone"); |
|
|
|
|
this.icon1 = rs.getString("icon1"); |
|
|
|
|
this.icon2 = rs.getString("icon2"); |
|
|
|
|
this.icon3 = rs.getString("icon3"); |
|
|
|
|
this.min_level = rs.getInt("min_level"); |
|
|
|
|
this.max_level = rs.getInt("max_level"); |
|
|
|
|
this.parentZoneID = rs.getInt("parent"); |
|
|
|
|
this.playerCityUUID = rs.getInt("playerCityUUID"); |
|
|
|
|
this.guild_zone = this.playerCityUUID != 0; |
|
|
|
|
this.zoneName = rs.getString("zone_name"); |
|
|
|
|
this.xOffset = rs.getFloat("xOffset"); |
|
|
|
|
this.zOffset = rs.getFloat("zOffset"); |
|
|
|
|
this.yOffset = rs.getFloat("yOffset"); |
|
|
|
|
this.template = rs.getInt("template"); |
|
|
|
|
this.peace_zone = rs.getByte("peace_zone"); |
|
|
|
|
this.icon1 = rs.getString("icon1"); |
|
|
|
|
this.icon2 = rs.getString("icon2"); |
|
|
|
|
this.icon3 = rs.getString("icon3"); |
|
|
|
|
this.min_level = rs.getInt("min_level"); |
|
|
|
|
this.max_level = rs.getInt("max_level"); |
|
|
|
|
this.major_radius = rs.getFloat("major_radius"); |
|
|
|
|
this.minor_radius = rs.getFloat("minor_radius"); |
|
|
|
|
this.min_blend = rs.getFloat("min_blend"); |
|
|
|
@ -121,36 +121,6 @@ public class Zone extends AbstractWorldObject {
@@ -121,36 +121,6 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void runAfterLoad() { |
|
|
|
|
|
|
|
|
|
// First zone is always the seafloor
|
|
|
|
|
|
|
|
|
|
if (ZoneManager.seaFloor == null) |
|
|
|
|
ZoneManager.seaFloor = this; |
|
|
|
|
|
|
|
|
|
if (this.terrain_type.equals("NONE")) |
|
|
|
|
this.terrain = null; |
|
|
|
|
else |
|
|
|
|
this.terrain = new Terrain(this); |
|
|
|
|
|
|
|
|
|
//this needs to be here specifically for new zones created after server boot (e.g. player city zones)
|
|
|
|
|
|
|
|
|
|
Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID); |
|
|
|
|
this.setParent(parentZone); |
|
|
|
|
|
|
|
|
|
if (this.min_level == 0 && parentZone != null) { |
|
|
|
|
this.min_level = parentZone.min_level; |
|
|
|
|
this.max_level = parentZone.max_level; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (parentZone != null) |
|
|
|
|
parentZone.addNode(this); |
|
|
|
|
|
|
|
|
|
ZoneManager.populateZoneCollections(this); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) { |
|
|
|
|
|
|
|
|
|
if (zone.template == 0 && zone.playerCityUUID == 0) |
|
|
|
@ -204,6 +174,30 @@ public class Zone extends AbstractWorldObject {
@@ -204,6 +174,30 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void runAfterLoad() { |
|
|
|
|
|
|
|
|
|
// First zone is always the seafloor
|
|
|
|
|
|
|
|
|
|
if (ZoneManager.seaFloor == null) |
|
|
|
|
ZoneManager.seaFloor = this; |
|
|
|
|
|
|
|
|
|
if (this.terrain_type.equals("NONE")) |
|
|
|
|
this.terrain = null; |
|
|
|
|
else |
|
|
|
|
this.terrain = new Terrain(this); |
|
|
|
|
|
|
|
|
|
this.setParent(); |
|
|
|
|
|
|
|
|
|
if (this.min_level == 0 && this.parent != null) { |
|
|
|
|
this.min_level = this.parent.min_level; |
|
|
|
|
this.max_level = this.parent.max_level; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ZoneManager.populateZoneCollections(this); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Method sets a default value for player cities |
|
|
|
|
* otherwise using values derived from the loadnum |
|
|
|
|
* field in the obj_zone database table. |
|
|
|
@ -217,14 +211,13 @@ public class Zone extends AbstractWorldObject {
@@ -217,14 +211,13 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setParent(final Zone value) { |
|
|
|
|
public void setParent() { |
|
|
|
|
|
|
|
|
|
this.parent = value; |
|
|
|
|
this.parentZoneID = (this.parent != null) ? this.parent.getObjectUUID() : 0; |
|
|
|
|
this.parent = ZoneManager.getZoneByZoneID(parentZoneID); |
|
|
|
|
|
|
|
|
|
// Seafloor
|
|
|
|
|
|
|
|
|
|
if (this.parent == null) { |
|
|
|
|
if (ZoneManager.seaFloor.equals(this)) { |
|
|
|
|
this.absX = this.xOffset; |
|
|
|
|
this.absY = MBServerStatics.SEA_FLOOR_ALTITUDE; |
|
|
|
|
this.global_height = MBServerStatics.SEA_FLOOR_ALTITUDE; |
|
|
|
@ -274,7 +267,7 @@ public class Zone extends AbstractWorldObject {
@@ -274,7 +267,7 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
|
|
|
|
|
// Macro zones have icons.
|
|
|
|
|
|
|
|
|
|
if (this.guild_zone == true) |
|
|
|
|
if (this.guild_zone) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
if (this.parent == null) |
|
|
|
@ -318,6 +311,7 @@ public class Zone extends AbstractWorldObject {
@@ -318,6 +311,7 @@ public class Zone extends AbstractWorldObject {
|
|
|
|
|
return this.parent.equals(ZoneManager.seaFloor); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setHash() { |
|
|
|
|
|
|
|
|
|
this.hash = DataWarehouse.hasher.encrypt(this.getObjectUUID()); |
|
|
|
|