Refactored Zone to new system

This commit is contained in:
2023-10-18 08:25:05 -04:00
parent da32765902
commit e689cb541a
4 changed files with 51 additions and 77 deletions
+43 -34
View File
@@ -94,42 +94,26 @@ public class Zone extends AbstractWorldObject {
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");
this.max_blend = rs.getFloat("max_blend");
this.sea_level_type = rs.getString("sea_level_type");
this.sea_level_offset = rs.getFloat("sea_level");
this.terrain_type = rs.getString("terrain_type");
this.terrain_max_y = rs.getFloat("terrain_max_y");
this.terrain_image = rs.getInt("terrain_image");
this.major_radius = rs.getFloat("major_radius");
this.minor_radius = rs.getFloat("minor_radius");
this.min_blend = rs.getFloat("min_blend");
this.max_blend = rs.getFloat("max_blend");
this.sea_level_type = rs.getString("sea_level_type");
this.sea_level_offset = rs.getFloat("sea_level");
this.terrain_type = rs.getString("terrain_type");
this.terrain_max_y = rs.getFloat("terrain_max_y");
this.terrain_image = rs.getInt("terrain_image");
if (this.guild_zone) {
this.max_blend = 128;
this.min_blend = 128;
this.terrain_max_y = 5;
this.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.terrain_type = "PLANAR";
}
// Configuration for player cities
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);
if (this.guild_zone) {
this.max_blend = 128;
this.min_blend = 128;
this.terrain_max_y = 5;
this.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.terrain_type = "PLANAR";
}
// If zone doesn't yet hava a hash then write it back to the zone table
@@ -141,6 +125,31 @@ 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) {