@ -137,7 +137,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
private static boolean validateBuildingPlacement ( Zone serverZone , PlaceAssetMsg msg , ClientConnection origin , PlayerCharacter player , PlacementInfo placementInfo ) {
private static boolean validateBuildingPlacement ( Zone serverZone , PlaceAssetMsg msg , ClientConnection origin , PlayerCharacter player , PlacementInfo placementInfo ) {
if ( serverZone . isPlayerCity ( ) = = false ) {
if ( serverZone . isPlayerCity = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 52 , player . getName ( ) ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 52 , player . getName ( ) ) ;
return false ;
return false ;
}
}
@ -156,7 +156,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Retrieve the building details we're placing
// Retrieve the building details we're placing
if ( serverZone . isNPCCity ( ) = = true ) {
if ( serverZone . isNPCCity = = true ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 15 , "" ) ; // Cannot place in a peace zone
PlaceAssetMsg . sendPlaceAssetError ( origin , 15 , "" ) ; // Cannot place in a peace zone
return false ;
return false ;
}
}
@ -185,7 +185,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Players cannot place buildings in mob zones.
// Players cannot place buildings in mob zones.
if ( ( serverZone . isMacroZone ( ) = = true )
if ( ( serverZone . isMacroZone ( ) = = true )
| | ( serverZone . getParent ( ) . isMacroZone ( ) = = true ) ) {
| | ( serverZone . parent . isMacroZone ( ) = = true ) ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ; // No building may be placed within this territory
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ; // No building may be placed within this territory
return false ;
return false ;
}
}
@ -201,8 +201,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Cannot place assets on a dead tree
// Cannot place assets on a dead tree
if ( ( serverZone . isPlayerCity ( ) )
if ( ( serverZone . isPlayerCity )
& & ( City . getCity ( serverZone . getPlayerCityUUID ( ) ) . getTOL ( ) . getRank ( ) = = - 1 ) ) {
& & ( City . getCity ( serverZone . playerCityID ) . getTOL ( ) . getRank ( ) = = - 1 ) ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "Cannot place asset on dead tree until world heals" ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "Cannot place asset on dead tree until world heals" ) ;
return false ;
return false ;
}
}
@ -261,14 +261,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Must be a player city
// Must be a player city
if ( serverZone . isPlayerCity ( ) = = false ) {
if ( serverZone . isPlayerCity = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 41 , player . getName ( ) ) ; // Cannot place outside a guild zone
PlaceAssetMsg . sendPlaceAssetError ( origin , 41 , player . getName ( ) ) ; // Cannot place outside a guild zone
return false ;
return false ;
}
}
//Test zone has a city object
//Test zone has a city object
City city = City . getCity ( serverZone . getPlayerCityUUID ( ) ) ;
City city = City . getCity ( serverZone . playerCityID ) ;
if ( city = = null ) {
if ( city = = null ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 52 , "" ) ; //"no city to associate asset with"
PlaceAssetMsg . sendPlaceAssetError ( origin , 52 , "" ) ; //"no city to associate asset with"
@ -512,7 +512,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if ( serverZone = = null )
if ( serverZone = = null )
return false ;
return false ;
cityObject = City . getCity ( serverZone . getPlayerCityUUID ( ) ) ;
cityObject = City . getCity ( serverZone . playerCityID ) ;
// Early exit if something went horribly wrong
// Early exit if something went horribly wrong
@ -571,7 +571,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// No valid player city found
// No valid player city found
if ( serverCity = = null | | serverCity . getParent ( ) . isPlayerCity ( ) = = false ) {
if ( serverCity = = null | | serverCity . getParent ( ) . isPlayerCity = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 52 , "" ) ; // Cannot place outisde a guild zone
PlaceAssetMsg . sendPlaceAssetError ( origin , 52 , "" ) ; // Cannot place outisde a guild zone
return false ;
return false ;
}
}
@ -749,8 +749,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
cityObjects = DbManager . CityQueries . CREATE_CITY ( playerCharacter . getObjectUUID ( ) , serverZone . getObjectUUID ( ) ,
cityObjects = DbManager . CityQueries . CREATE_CITY ( playerCharacter . getObjectUUID ( ) , serverZone . getObjectUUID ( ) ,
serverRealm . getRealmID ( ) ,
serverRealm . getRealmID ( ) ,
plantLoc . x - serverZone . getAbsX ( ) , plantLoc . y ,
plantLoc . x - serverZone . absX , plantLoc . y ,
plantLoc . z - serverZone . getAbsZ ( ) , treeInfo . getRot ( ) . y , treeInfo . getW ( ) , playerCharacter . getGuild ( ) . getName ( ) , LocalDateTime . now ( ) ) ;
plantLoc . z - serverZone . absZ , treeInfo . getRot ( ) . y , treeInfo . getW ( ) , playerCharacter . getGuild ( ) . getName ( ) , LocalDateTime . now ( ) ) ;
// Uh oh!
// Uh oh!
@ -783,10 +783,10 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Link the zone with the city and then add
// Link the zone with the city and then add
// to the appropriate hash tables and cache
// to the appropriate hash tables and cache
zoneObject . setPlayerCity ( true ) ;
zoneObject . isPlayerCity = true ;
if ( zoneObject . getParent ( ) ! = null )
if ( zoneObject . parent ! = null )
zoneObject . getParent ( ) . addNode ( zoneObject ) ; //add as child to parent
zoneObject . parent . addNode ( zoneObject ) ; //add as child to parent
ZoneManager . addZone ( zoneObject . getObjectUUID ( ) , zoneObject ) ;
ZoneManager . addZone ( zoneObject . getObjectUUID ( ) , zoneObject ) ;
ZoneManager . addPlayerCityZone ( zoneObject ) ;
ZoneManager . addPlayerCityZone ( zoneObject ) ;
@ -857,7 +857,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if ( serverZone = = null )
if ( serverZone = = null )
return false ;
return false ;
cityObject = City . getCity ( serverZone . getPlayerCityUUID ( ) ) ;
cityObject = City . getCity ( serverZone . playerCityID ) ;
if ( cityObject = = null )
if ( cityObject = = null )
return false ;
return false ;
@ -931,7 +931,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
int shrineCount = 0 ;
int shrineCount = 0 ;
cityObject = City . getCity ( serverZone . getPlayerCityUUID ( ) ) ;
cityObject = City . getCity ( serverZone . playerCityID ) ;
// Cannot place shrine in abandoned city. Shrines must be owned
// Cannot place shrine in abandoned city. Shrines must be owned
// by the tol owner not the person placing them.
// by the tol owner not the person placing them.
@ -1001,7 +1001,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
int barracksCount = 0 ;
int barracksCount = 0 ;
cityObject = City . getCity ( serverZone . getPlayerCityUUID ( ) ) ;
cityObject = City . getCity ( serverZone . playerCityID ) ;
// Cannot place barracks in abandoned city.
// Cannot place barracks in abandoned city.
@ -1061,7 +1061,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if ( validateCityBuildingPlacement ( serverZone , msg , origin , player , msg . getFirstPlacementInfo ( ) ) = = false )
if ( validateCityBuildingPlacement ( serverZone , msg , origin , player , msg . getFirstPlacementInfo ( ) ) = = false )
return false ;
return false ;
cityObject = City . getCity ( serverZone . getPlayerCityUUID ( ) ) ;
cityObject = City . getCity ( serverZone . playerCityID ) ;
// We need to be able to access how much gold a character is carrying
// We need to be able to access how much gold a character is carrying
@ -1117,7 +1117,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
building . removeFromCache ( ) ;
building . removeFromCache ( ) ;
WorldGrid . RemoveWorldObject ( building ) ;
WorldGrid . RemoveWorldObject ( building ) ;
WorldGrid . removeObject ( building ) ;
WorldGrid . removeObject ( building ) ;
building . getParentZone ( ) . getParent ( ) . zoneBuildingSet . remove ( building ) ;
building . getParentZone ( ) . parent . zoneBuildingSet . remove ( building ) ;
if ( building . getBlueprint ( ) ! = null & & building . getBlueprint ( ) . getBuildingGroup ( ) . equals ( BuildingGroup . BARRACK ) ) {
if ( building . getBlueprint ( ) ! = null & & building . getBlueprint ( ) . getBuildingGroup ( ) . equals ( BuildingGroup . BARRACK ) ) {
building . RemoveFromBarracksList ( ) ;
building . RemoveFromBarracksList ( ) ;
}
}
@ -1229,7 +1229,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
shrineType = Shrine . getShrineTypeByBlueprintUUID ( blueprint . getBlueprintUUID ( ) ) ;
shrineType = Shrine . getShrineTypeByBlueprintUUID ( blueprint . getBlueprintUUID ( ) ) ;
city = City . getCity ( currentZone . getPlayerCityUUID ( ) ) ;
city = City . getCity ( currentZone . playerCityID ) ;
if ( city = = null )
if ( city = = null )
return false ;
return false ;
@ -1294,7 +1294,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
return false ;
return false ;
}
}
city = City . getCity ( currentZone . getPlayerCityUUID ( ) ) ;
city = City . getCity ( currentZone . playerCityID ) ;
if ( city = = null )
if ( city = = null )
return false ;
return false ;
@ -1369,7 +1369,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
newMesh . runAfterLoad ( ) ;
newMesh . runAfterLoad ( ) ;
} else if ( ago . getObjectType ( ) = = GameObjectType . Warehouse ) {
} else if ( ago . getObjectType ( ) = = GameObjectType . Warehouse ) {
Warehouse warehouse = ( Warehouse ) ago ;
Warehouse warehouse = ( Warehouse ) ago ;
City city = City . getCity ( currentZone . getPlayerCityUUID ( ) ) ;
City city = City . getCity ( currentZone . playerCityID ) ;
if ( city = = null )
if ( city = = null )
return true ;
return true ;