@ -768,7 +768,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
treeObject = ( Building ) cityObjectMap . get ( GameObjectType . Building ) ;
treeObject = ( Building ) cityObjectMap . get ( GameObjectType . Building ) ;
treeObject . runAfterLoad ( ) ;
treeObject . runAfterLoad ( ) ;
;
cityObject = ( City ) cityObjectMap . get ( GameObjectType . City ) ;
cityObject = ( City ) cityObjectMap . get ( GameObjectType . City ) ;
zoneObject = ( Zone ) cityObjectMap . get ( GameObjectType . Zone ) ;
zoneObject = ( Zone ) cityObjectMap . get ( GameObjectType . Zone ) ;
@ -819,7 +819,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
City . lastCityUpdate = System . currentTimeMillis ( ) ;
City . lastCityUpdate = System . currentTimeMillis ( ) ;
treeObject . setLoc ( treeObject . getLoc ( ) ) ;
treeObject . setLoc ( treeObject . getLoc ( ) ) ;
InterestManager . setObjectDirty ( treeObject ) ;
InterestManager . setObjectDirty ( treeObject ) ;
// WorldGrid.addObject(treeObject, playerCharacter);
serverRealm . addCity ( cityObject . getObjectUUID ( ) ) ;
serverRealm . addCity ( cityObject . getObjectUUID ( ) ) ;
playerNation . setCityUUID ( cityObject . getObjectUUID ( ) ) ;
playerNation . setCityUUID ( cityObject . getObjectUUID ( ) ) ;
@ -917,6 +916,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Early exit if something went horribly wrong
// Early exit if something went horribly wrong
// with locating the current realm and/or zone
// with locating the current realm and/or zone
if ( serverZone = = null )
if ( serverZone = = null )
return false ;
return false ;
@ -979,7 +979,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
City cityObject ;
City cityObject ;
PlacementInfo buildingList ;
PlacementInfo buildingList ;
// Setup working variables we'll need
// Setup working variables
buildingList = msg . getFirstPlacementInfo ( ) ;
buildingList = msg . getFirstPlacementInfo ( ) ;
serverZone = ZoneManager . findSmallestZone ( buildingList . getLoc ( ) ) ;
serverZone = ZoneManager . findSmallestZone ( buildingList . getLoc ( ) ) ;
@ -1092,7 +1093,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
placementCost = 0 ; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
placementCost = 0 ; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error.
// Overlap check and wall deed verifications
// Overlap check and wall deed verifications
for ( PlacementInfo wall : walls ) {
for ( PlacementInfo wall : walls ) {
@ -1111,7 +1111,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
for ( Building building : serverZone . zoneBuildingSet ) {
for ( Building building : serverZone . zoneBuildingSet ) {
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
//TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building.
if ( ( building . getBlueprintUUID ( ) ! = 0 ) & & ( Bounds . collide ( wall , building ) = = true ) ) {
if ( ( building . getBlueprintUUID ( ) ! = 0 ) & & ( Bounds . collide ( wall , building ) = = true ) ) {
@ -1131,12 +1130,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
return false ;
return false ;
}
}
}
}
placementCost = PlaceAssetMsg . getWallCost ( wall . getBlueprintUUID ( ) ) ;
placementCost = PlaceAssetMsg . getWallCost ( wall . getBlueprintUUID ( ) ) ;
if ( ! itemMan . modifyInventoryGold ( - placementCost ) ) {
if ( ! itemMan . modifyInventoryGold ( - placementCost ) ) {
ChatManager . chatSystemInfo ( player , player . getFirstName ( ) + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me." ) ;
ChatManager . chatSystemInfo ( player , player . getFirstName ( ) + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me." ) ;
return false ;
return false ;
}
}
// Attempt to place wall piece
// Attempt to place wall piece
wallPiece = createStructure ( player , wall , serverZone ) ;
wallPiece = createStructure ( player , wall , serverZone ) ;
@ -1147,14 +1148,12 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
}
}
// walls are auto protected
// walls are auto protected
wallPiece . setProtectionState ( ProtectionState . PROTECTED ) ;
wallPiece . setProtectionState ( ProtectionState . PROTECTED ) ;
PlaceAssetMsg . sendPlaceAssetConfirmWall ( origin , serverZone ) ;
PlaceAssetMsg . sendPlaceAssetConfirmWall ( origin , serverZone ) ;
}
}
// Deduct gold from character's inventory
return true ;
return true ;
}
}
@ -1174,6 +1173,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
}
}
// All siege buildings build in 15 minutes
// All siege buildings build in 15 minutes
if ( ( blueprint . getBuildingGroup ( ) . equals ( BuildingGroup . SIEGETENT ) )
if ( ( blueprint . getBuildingGroup ( ) . equals ( BuildingGroup . SIEGETENT ) )
| | ( blueprint . getBuildingGroup ( ) . equals ( BuildingGroup . BULWARK ) ) )
| | ( blueprint . getBuildingGroup ( ) . equals ( BuildingGroup . BULWARK ) ) )
completionDate = DateTime . now ( ) . plusMinutes ( 15 ) ;
completionDate = DateTime . now ( ) . plusMinutes ( 15 ) ;
@ -1193,6 +1193,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
completionDate , blueprint . getMeshForRank ( 0 ) , vendorRotation , buildingRotation ) ;
completionDate , blueprint . getMeshForRank ( 0 ) , vendorRotation , buildingRotation ) ;
// Make sure we have a valid mesh
// Make sure we have a valid mesh
if ( newMesh = = null ) {
if ( newMesh = = null ) {
Logger . error ( "CreateStructure: DB returned null object." ) ;
Logger . error ( "CreateStructure: DB returned null object." ) ;
return null ;
return null ;
@ -1364,15 +1365,16 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
newMesh = ( Building ) ago ;
newMesh = ( Building ) ago ;
newMesh . setObjectTypeMask ( MBServerStatics . MASK_BUILDING ) ;
newMesh . setObjectTypeMask ( MBServerStatics . MASK_BUILDING ) ;
MaintenanceManager . setMaintDateTime ( newMesh , LocalDateTime . now ( ) . plusDays ( 7 ) ) ;
MaintenanceManager . setMaintDateTime ( newMesh , LocalDateTime . now ( ) . plusDays ( 7 ) ) ;
// WorldGrid.addObject(newMesh, player);
newMesh . setLoc ( newMesh . getLoc ( ) ) ;
newMesh . setLoc ( newMesh . getLoc ( ) ) ;
InterestManager . setObjectDirty ( newMesh ) ;
InterestManager . setObjectDirty ( newMesh ) ;
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 . getPlayerCityUUID ( ) ) ;
if ( city = = null )
if ( city = = null )
return true ;
return true ;
city . setWarehouseBuildingID ( newMesh . getObjectUUID ( ) ) ;
city . setWarehouseBuildingID ( newMesh . getObjectUUID ( ) ) ;
Warehouse . warehouseByBuildingUUID . put ( newMesh . getObjectUUID ( ) , warehouse ) ;
Warehouse . warehouseByBuildingUUID . put ( newMesh . getObjectUUID ( ) , warehouse ) ;
}
}