Browse Source

Error trap

combat-2
MagicBot 1 year ago
parent
commit
a3d29bb8f0
  1. 102
      src/engine/objects/Zone.java

102
src/engine/objects/Zone.java

@ -77,63 +77,69 @@ public class Zone extends AbstractGameObject {
* ResultSet Constructor * ResultSet Constructor
*/ */
public Zone(ResultSet rs) throws SQLException { public Zone(ResultSet rs) throws SQLException {
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.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.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.terrain_type = "PLANAR";
}
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) super(rs);
Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID);
this.setParent(parentZone);
if (this.min_level == 0 && parentZone != null) { try {
this.min_level = parentZone.min_level; this.parentZoneID = rs.getInt("parent");
this.max_level = parentZone.max_level; 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");
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.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
this.terrain_type = "PLANAR";
}
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);
} catch (Exception e) {
Logger.error(e);
throw new RuntimeException(e);
} }
if (parentZone != null)
parentZone.addNode(this);
// If zone doesn't yet hava a hash then write it back to the zone table // If zone doesn't yet hava a hash then write it back to the zone table
if (hash == null) if (hash == null)
setHash(); setHash();
} }
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) { public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {

Loading…
Cancel
Save