@ -33,12 +33,12 @@ public class Zone extends AbstractGameObject {
public final Set < Building > zoneBuildingSet = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public final Set < Building > zoneBuildingSet = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public final Set < NPC > zoneNPCSet = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public final Set < NPC > zoneNPCSet = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public final Set < Mob > zoneMobSet = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public final Set < Mob > zoneMobSet = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public final int playerCityID ;
public final int playerCityUU ID ;
public final String zoneName ;
public final String zoneName ;
public final float xCoord ;
public final float xOffset ;
public final float zCoord ;
public final float zOffset ;
public final float yCoord ;
public final float yOffset ;
public final int loadNum ;
public final int zoneTemplate ;
public final byte peaceZone ;
public final byte peaceZone ;
public final String Icon1 ;
public final String Icon1 ;
public final String Icon2 ;
public final String Icon2 ;
@ -54,13 +54,13 @@ public class Zone extends AbstractGameObject {
public Zone parent = null ;
public Zone parent = null ;
public Bounds bounds ;
public Bounds bounds ;
public boolean isNPCCity = false ;
public boolean isNPCCity = false ;
public boolean isPlayerCity = fals e ;
public boolean isGuildZon e ;
public String hash ;
public String hash ;
public float worldAltitude = 0 ;
public float worldAltitude = 0 ;
public float seaLevel = 0f ;
public float seaLevel = 0f ;
public static final Set < Mob > respawnQue = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public static final Set < Mob > respawnQue = Collections . newSetFromMap ( new ConcurrentHashMap < > ( ) ) ;
public static long lastRespawn = 0 ;
public static long lastRespawn = 0 ;
public Bounds maxBlend ;
public Bounds blendBounds ;
/ * *
/ * *
* ResultSet Constructor
* ResultSet Constructor
@ -68,22 +68,21 @@ public class Zone extends AbstractGameObject {
public Zone ( ResultSet rs ) throws SQLException {
public Zone ( ResultSet rs ) throws SQLException {
super ( rs ) ;
super ( rs ) ;
this . parentZoneID = rs . getInt ( "parent" ) ;
this . parentZoneID = rs . getInt ( "parent" ) ;
this . playerCityID = rs . getInt ( "isPlayerCity " ) ;
this . playerCityUU ID = rs . getInt ( "playerCityUUID " ) ;
this . isPlayerCity = this . playerCityID ! = 0 ;
this . isGuildZone = this . playerCityUU ID ! = 0 ;
this . zoneName = rs . getString ( "Name" ) ;
this . zoneName = rs . getString ( "Name" ) ;
this . xCoord = rs . getFloat ( "XCoord" ) ;
this . xOffset = rs . getFloat ( "xOffset" ) ;
this . zCoord = rs . getFloat ( "ZCoord" ) ;
this . zOffset = rs . getFloat ( "zOffset" ) ;
this . yCoord = rs . getFloat ( "YOffset" ) ;
this . yOffset = rs . getFloat ( "yOffset" ) ;
this . loadNum = rs . getInt ( "LoadNum" ) ;
this . zoneTemplate = rs . getInt ( "zoneTemplate" ) ;
this . peaceZone = rs . getByte ( "SafeZone" ) ;
this . peaceZone = rs . getByte ( "paceZone" ) ;
this . Icon1 = rs . getString ( "Icon1" ) ;
this . Icon1 = rs . getString ( "icon1" ) ;
this . Icon2 = rs . getString ( "Icon2" ) ;
this . Icon2 = rs . getString ( "icon2" ) ;
this . Icon3 = rs . getString ( "Icon3" ) ;
this . Icon3 = rs . getString ( "icon3" ) ;
this . minLvl = rs . getInt ( "min_level" ) ;
this . maxLvl = rs . getInt ( "max_level" ) ;
this . hash = rs . getString ( "hash" ) ;
this . hash = rs . getString ( "hash" ) ;
this . minLvl = rs . getInt ( "minLvl" ) ;
this . maxLvl = rs . getInt ( "maxLvl" ) ;
//this needs to be here specifically for new zones created after server boot (e.g. player city zones)
//this needs to be here specifically for new zones created after server boot (e.g. player city zones)
Zone parentZone = ZoneManager . getZoneByUUID ( parentZoneID ) ;
Zone parentZone = ZoneManager . getZoneByUUID ( parentZoneID ) ;
@ -107,28 +106,28 @@ public class Zone extends AbstractGameObject {
public static void serializeForClientMsg ( Zone zone , ByteBufferWriter writer ) {
public static void serializeForClientMsg ( Zone zone , ByteBufferWriter writer ) {
if ( zone . loadNum = = 0 & & zone . playerCityID = = 0 )
if ( zone . zoneTemplate = = 0 & & zone . playerCityUU ID = = 0 )
Logger . warn ( "Warning! WorldServerMap with ID " + zone . getObjectUUID ( ) + " has a loadnum of 0 (player city) and no city linked. This will probably crash the client!" ) ;
Logger . warn ( "Warning! WorldServerMap with ID " + zone . getObjectUUID ( ) + " has a loadnum of 0 (player city) and no city linked. This will probably crash the client!" ) ;
// Player City Terraform values serialized here.
// Player City Terraform values serialized here.
if ( zone . playerCityID > 0 ) {
if ( zone . playerCityUU ID > 0 ) {
writer . put ( ( byte ) 1 ) ; // Player City - True
writer . put ( ( byte ) 1 ) ; // Player City - True
writer . putFloat ( Enum . CityBoundsType . ZONE . halfExtents ) ;
writer . putFloat ( Enum . CityBoundsType . ZONE . halfExtents ) ;
writer . putFloat ( Enum . CityBoundsType . ZONE . halfExtents ) ;
writer . putFloat ( Enum . CityBoundsType . ZONE . halfExtents ) ;
} else
} else
writer . put ( ( byte ) 0 ) ; // Player City - False
writer . put ( ( byte ) 0 ) ; // Player City - False
writer . putFloat ( zone . xCoord ) ;
writer . putFloat ( zone . xOffset ) ;
writer . putFloat ( zone . zCoord ) ;
writer . putFloat ( zone . zOffset ) ;
writer . putFloat ( zone . yCoord ) ;
writer . putFloat ( zone . yOffset ) ;
writer . putInt ( 0 ) ;
writer . putInt ( 0 ) ;
writer . putInt ( 0 ) ;
writer . putInt ( 0 ) ;
writer . putInt ( zone . loadNum ) ;
writer . putInt ( zone . zoneTemplate ) ;
if ( zone . playerCityID > 0 ) {
if ( zone . playerCityUU ID > 0 ) {
City k = City . getCity ( zone . playerCityID ) ;
City k = City . getCity ( zone . playerCityUU ID ) ;
if ( k ! = null ) {
if ( k ! = null ) {
writer . putInt ( k . getObjectType ( ) . ordinal ( ) ) ;
writer . putInt ( k . getObjectType ( ) . ordinal ( ) ) ;
@ -141,7 +140,7 @@ public class Zone extends AbstractGameObject {
}
}
writer . putInt ( zone . nodes . size ( ) ) ;
writer . putInt ( zone . nodes . size ( ) ) ;
City city = City . getCity ( zone . playerCityID ) ;
City city = City . getCity ( zone . playerCityUU ID ) ;
if ( city ! = null )
if ( city ! = null )
writer . putString ( city . getCityName ( ) ) ;
writer . putString ( city . getCityName ( ) ) ;
@ -168,7 +167,7 @@ public class Zone extends AbstractGameObject {
this . bounds = Bounds . borrow ( ) ;
this . bounds = Bounds . borrow ( ) ;
Vector2f zoneSize = ZoneManager . _zone_size_data . get ( this . loadNum ) ;
Vector2f zoneSize = ZoneManager . _zone_size_data . get ( this . zoneTemplate ) ;
// Default to player zone size on error? Maybe log this
// Default to player zone size on error? Maybe log this
@ -182,10 +181,10 @@ public class Zone extends AbstractGameObject {
// Set heightmap blending bounds
// Set heightmap blending bounds
if ( heightMap = = null ) {
if ( heightMap = = null ) {
this . maxBlend = bounds ;
this . blendBounds = bounds ;
} else {
} else {
this . maxBlend = Bounds . borrow ( ) ;
this . blendBounds = Bounds . borrow ( ) ;
this . maxBlend . setBounds ( new Vector2f ( this . absX , this . absZ ) , bounds . getHalfExtents ( ) . subtract ( heightMap . zone_minBlend , heightMap . zone_minBlend ) , 0 . 0f ) ;
this . blendBounds . setBounds ( new Vector2f ( this . absX , this . absZ ) , bounds . getHalfExtents ( ) . subtract ( heightMap . zone_minBlend , heightMap . zone_minBlend ) , 0 . 0f ) ;
}
}
}
}
@ -198,17 +197,17 @@ public class Zone extends AbstractGameObject {
// Seafloor
// Seafloor
if ( this . parent = = null ) {
if ( this . parent = = null ) {
this . absX = this . xCoord ;
this . absX = this . xOffset ;
this . absY = MBServerStatics . SEA_FLOOR_ALTITUDE ;
this . absY = MBServerStatics . SEA_FLOOR_ALTITUDE ;
this . absZ = this . zCoord ;
this . absZ = this . zOffset ;
this . seaLevel = 0 ;
this . seaLevel = 0 ;
this . setBounds ( ) ;
this . setBounds ( ) ;
return ;
return ;
}
}
this . absX = this . xCoord + parent . absX ;
this . absX = this . xOffset + parent . absX ;
this . absY = this . yCoord + parent . absY ;
this . absY = this . yOffset + parent . absY ;
this . absZ = this . zCoord + parent . absZ ;
this . absZ = this . zOffset + parent . absZ ;
if ( this . minLvl = = 0 | | this . maxLvl = = 0 ) {
if ( this . minLvl = = 0 | | this . maxLvl = = 0 ) {
this . minLvl = this . parent . minLvl ;
this . minLvl = this . parent . minLvl ;
@ -239,7 +238,7 @@ public class Zone extends AbstractGameObject {
// Macro zones have icons.
// Macro zones have icons.
if ( this . isPlayerCity = = true )
if ( this . isGuildZone = = true )
return false ;
return false ;
if ( this . parent = = null )
if ( this . parent = = null )
@ -311,10 +310,10 @@ public class Zone extends AbstractGameObject {
public HeightMap getHeightMap ( ) {
public HeightMap getHeightMap ( ) {
if ( this . isPlayerCity )
if ( this . isGuildZone )
return HeightMap . PlayerCityHeightMap ;
return HeightMap . PlayerCityHeightMap ;
return HeightMap . heightmapByLoadNum . get ( this . loadNum ) ;
return HeightMap . heightmapByLoadNum . get ( this . zoneTemplate ) ;
}
}
}
}