@ -92,7 +92,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if ( buildingList = = null ) {
if ( buildingList = = null ) {
Logger . error ( "Player " + playerCharacter . getCombinedName ( )
Logger . error ( "Player " + playerCharacter . getCombinedName ( )
+ " null building list on deed use" ) ;
+ " null building list on deed use" ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
closePlaceAssetWindow ( origin ) ;
closePlaceAssetWindow ( origin ) ;
return true ;
return true ;
@ -115,7 +115,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if ( buildingBlueprint = = null ) {
if ( buildingBlueprint = = null ) {
Logger . error ( "Player " + playerCharacter . getCombinedName ( )
Logger . error ( "Player " + playerCharacter . getCombinedName ( )
+ " null blueprint UUID: " + buildingList . getBlueprintUUID ( ) + " on deed use" ) ;
+ " null blueprint UUID: " + buildingList . getBlueprintUUID ( ) + " on deed use" ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
closePlaceAssetWindow ( origin ) ;
closePlaceAssetWindow ( origin ) ;
return true ;
return true ;
@ -130,66 +130,66 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
boolean close = true ;
boolean close = true ;
lock . writeLock ( ) . lock ( ) ;
lock . writeLock ( ) . lock ( ) ;
boolean isSiege = false ;
try {
try {
switch ( buildingBlueprint . getBuildingGroup ( ) ) {
switch ( buildingBlueprint . getBuildingGroup ( ) ) {
case TOL :
case TOL :
if ( contract = = null )
if ( contract = = null )
break ;
break ;
buildingCreated = placeTreeOfLife ( playerCharacter , origin , msg ) ;
buildingCreated = placeTreeOfLife ( playerCharacter , origin , msg ) ;
break ;
case WAREHOUSE :
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeWarehouse ( playerCharacter , origin , msg ) ;
break ;
case SIEGETENT :
case BULWARK :
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeSiegeEquip ( playerCharacter , origin , msg ) ;
break ;
case SPIRE :
if ( contract = = null )
break ;
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
case WAREHOUSE :
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeWarehouse ( playerCharacter , origin , msg ) ;
break ;
break ;
buildingCreated = placeSpire ( playerCharacter , origin , msg ) ;
case SIEGETENT :
break ;
case BULWARK :
case SHRINE :
if ( contract = = null )
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeSiegeEquip ( playerCharacter , origin , msg ) ;
break ;
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
case SPIRE :
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeSpire ( playerCharacter , origin , msg ) ;
break ;
break ;
buildingCreated = placeShrine ( playerCharacter , origin , msg ) ;
case SHRINE :
break ;
if ( contract = = null )
case BARRACK :
break ;
if ( contract = = null )
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeShrine ( playerCharacter , origin , msg ) ;
break ;
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
case BARRACK :
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeBarrack ( playerCharacter , origin , msg ) ;
break ;
break ;
buildingCreated = placeBarrack ( playerCharacter , origin , msg ) ;
case WALLSTRAIGHT :
break ;
case WALLCORNER :
case WALLSTRAIGHT :
case SMALLGATE :
case WALLCORNER :
case ARTYTOWER :
case SMALLGATE :
case WALLSTAIRS :
case ARTYTOWER :
buildingCreated = placeCityWalls ( playerCharacter , origin , msg ) ;
case WALLSTAIRS :
close = false ;
buildingCreated = placeCityWalls ( playerCharacter , origin , msg ) ;
close = false ;
break ;
default :
if ( contract = = null )
break ;
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
default :
if ( contract = = null )
break ;
if ( ! playerCharacter . getCharItemManager ( ) . doesCharOwnThisItem ( contract . getObjectUUID ( ) ) )
break ;
buildingCreated = placeSingleBuilding ( playerCharacter , origin , msg ) ;
break ;
break ;
buildingCreated = placeSingleBuilding ( playerCharacter , origin , msg ) ;
break ;
}
}
} catch ( Exception e ) {
} catch ( Exception e ) {
Logger . error ( "PlaceAssetHandler" , e . getMessage ( ) ) ;
Logger . error ( "PlaceAssetHandler" , e . getMessage ( ) ) ;
@ -230,7 +230,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
buildingList = msg . getFirstPlacementInfo ( ) ;
buildingList = msg . getFirstPlacementInfo ( ) ;
serverZone = ZoneManager . findSmallestZone ( buildingList . getLoc ( ) ) ;
serverZone = ZoneManager . findSmallestZone ( buildingList . getLoc ( ) ) ;
// Early exit if something went horribly wrong
// Early exit if something went horribly wrong
// with locating the current or zone
// with locating the current or zone
@ -346,125 +345,125 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
City attackerCity = null ;
City attackerCity = null ;
if ( bane ! = null )
if ( bane ! = null )
attackerCity = bane . getCity ( ) ;
attackerCity = bane . getCity ( ) ;
if ( attackerCity ! = null )
if ( attackerCity ! = null )
if ( buildingList . getLoc ( ) . isInsideCircle ( attackerCity . getLoc ( ) , Enum . CityBoundsType . SIEGE . extents ) )
if ( buildingList . getLoc ( ) . isInsideCircle ( attackerCity . getLoc ( ) , Enum . CityBoundsType . SIEGE . extents ) )
serverCity = attackerCity ;
serverCity = attackerCity ;
}
}
//no city found for attacker city,
//no city found for attacker city,
//check if defender city
//check if defender city
if ( serverCity = = null ) {
if ( serverCity = = null ) {
if ( player . getGuild ( ) . getOwnedCity ( ) ! = null )
if ( player . getGuild ( ) . getOwnedCity ( ) ! = null )
if ( buildingList . getLoc ( ) . isInsideCircle ( player . getGuild ( ) . getOwnedCity ( ) . getLoc ( ) , Enum . CityBoundsType . SIEGE . extents ) )
if ( buildingList . getLoc ( ) . isInsideCircle ( player . getGuild ( ) . getOwnedCity ( ) . getLoc ( ) , Enum . CityBoundsType . SIEGE . extents ) )
serverCity = player . getGuild ( ) . getOwnedCity ( ) ;
serverCity = player . getGuild ( ) . getOwnedCity ( ) ;
}
}
if ( ( serverCity ! = null ) & &
if ( ( serverCity ! = null ) & &
( serverCity . getBane ( ) ! = null ) ) {
( serverCity . getBane ( ) ! = null ) ) {
// Set the server zone to the city zone in order to account for being inside
// Set the server zone to the city zone in order to account for being inside
// the siege bounds buffer area
// the siege bounds buffer area
serverZone = serverCity . getParent ( ) ;
serverZone = serverCity . getParent ( ) ;
if ( ( player . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) = = false )
if ( ( player . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) = = false )
& & ( player . getGuild ( ) . equals ( serverCity . getGuild ( ) ) = = false ) ) {
& & ( player . getGuild ( ) . equals ( serverCity . getGuild ( ) ) = = false ) ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 54 , "" ) ; // Must belong to attacker or defender
PlaceAssetMsg . sendPlaceAssetError ( origin , 54 , "" ) ; // Must belong to attacker or defender
return false ;
return false ;
}
}
}
}
// cant place siege equipment off city zone.
// cant place siege equipment off city zone.
// Create the siege Building
// Create the siege Building
siegeBuilding = createStructure ( player , msg . getFirstPlacementInfo ( ) , serverZone ) ;
siegeBuilding = createStructure ( player , msg . getFirstPlacementInfo ( ) , serverZone ) ;
if ( serverCity = = null )
if ( serverCity = = null )
return true ;
return true ;
// Oops something went really wrong
// Oops something went really wrong
if ( siegeBuilding = = null )
if ( siegeBuilding = = null )
return false ;
return false ;
if ( serverCity . getBane ( ) = = null )
return true ;
if ( serverCity . getBane ( ) = = null )
return true ;
// If there is an bane placed, we protect 2x the stone rank's worth of attacker assets
// If there is an bane placed, we protect 2x the stone rank's worth of attacker assets
// and 1x the tree rank's worth of assets automatically
// and 1x the tree rank's worth of assets automatically
HashSet < AbstractWorldObject > awoList = WorldGrid . getObjectsInRangePartial ( serverCity , 1000 , MBServerStatics . MASK_BUILDING ) ;
HashSet < AbstractWorldObject > awoList = WorldGrid . getObjectsInRangePartial ( serverCity , 1000 , MBServerStatics . MASK_BUILDING ) ;
for ( AbstractWorldObject awo : awoList ) {
for ( AbstractWorldObject awo : awoList ) {
Building building = ( Building ) awo ;
Building building = ( Building ) awo ;
if ( building . getBlueprint ( ) ! = null )
if ( building . getBlueprint ( ) ! = null )
if ( ! building . getBlueprint ( ) . isSiegeEquip ( ) )
if ( ! building . getBlueprint ( ) . isSiegeEquip ( ) )
continue ;
continue ;
if ( ! building . getLoc ( ) . isInsideCircle ( serverCity . getLoc ( ) , Enum . CityBoundsType . SIEGE . extents ) )
if ( ! building . getLoc ( ) . isInsideCircle ( serverCity . getLoc ( ) , Enum . CityBoundsType . SIEGE . extents ) )
continue ;
continue ;
if ( building . getGuild ( ) = = null )
if ( building . getGuild ( ) = = null )
continue ;
continue ;
if ( building . getGuild ( ) . isErrant ( ) )
if ( building . getGuild ( ) . isErrant ( ) )
continue ;
continue ;
if ( ! building . getGuild ( ) . equals ( serverCity . getGuild ( ) ) & & ! building . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) )
if ( ! building . getGuild ( ) . equals ( serverCity . getGuild ( ) ) & & ! building . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) )
continue ;
continue ;
// Only count auto protected buildings
// Only count auto protected buildings
if ( building . getProtectionState ( ) ! = ProtectionState . PROTECTED )
if ( building . getProtectionState ( ) ! = ProtectionState . PROTECTED )
continue ;
continue ;
if ( building . getGuild ( ) . equals ( serverCity . getGuild ( ) ) )
numDefenderBuildings + + ;
else
if ( building . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) )
numAttackerBuildings + + ;
if ( building . getGuild ( ) . equals ( serverCity . getGuild ( ) ) )
numDefenderBuildings + + ;
else
if ( building . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) )
numAttackerBuildings + + ;
}
}
// Validate bane limits on siege assets
// Validate bane limits on siege assets
if ( serverCity . getBane ( ) ! = null )
if ( serverCity . getBane ( ) ! = null )
if ( ( player . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) ) & &
if ( ( player . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) ) & &
( numAttackerBuildings > = serverCity . getBane ( ) . getStone ( ) . getRank ( ) * 2 ) ) {
( numAttackerBuildings > = serverCity . getBane ( ) . getStone ( ) . getRank ( ) * 2 ) ) {
return true ;
return true ;
}
}
if ( ( player . getGuild ( ) . equals ( serverCity . getGuild ( ) ) ) & &
if ( ( player . getGuild ( ) . equals ( serverCity . getGuild ( ) ) ) & &
( numDefenderBuildings > = serverCity . getTOL ( ) . getRank ( ) ) ) {
( numDefenderBuildings > = serverCity . getTOL ( ) . getRank ( ) ) ) {
return true ;
return true ;
}
}
// passes validation: can assign auto-protection to war asset
// passes validation: can assign auto-protection to war asset
if ( serverCity . getBane ( ) ! = null )
if ( serverCity . getBane ( ) ! = null )
if ( serverCity . isLocationOnCityGrid ( siegeBuilding . getBounds ( ) ) )
if ( serverCity . isLocationOnCityGrid ( siegeBuilding . getBounds ( ) ) )
if ( player . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) )
if ( player . getGuild ( ) . equals ( serverCity . getBane ( ) . getOwner ( ) . getGuild ( ) ) )
return true ;
return true ;
siegeBuilding . setProtectionState ( ProtectionState . PROTECTED ) ;
siegeBuilding . setProtectionState ( ProtectionState . PROTECTED ) ;
// No bane placed. We're done!
// No bane placed. We're done!
return true ;
return true ;
}
}
@ -507,8 +506,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
}
}
Vector3fImmutable plantLoc = new Vector3fImmutable ( treeInfo . getLoc ( ) . x ,
Vector3fImmutable plantLoc = new Vector3fImmutable ( treeInfo . getLoc ( ) . x ,
serverZone . getHeightMap ( ) . getInterpolatedTerrainHeight ( treeInfo . getLoc ( ) ) ,
serverZone . getHeightMap ( ) . getInterpolatedTerrainHeight ( treeInfo . getLoc ( ) ) ,
treeInfo . getLoc ( ) . z ) ;
treeInfo . getLoc ( ) . z ) ;
cityObjects = DbManager . CityQueries . CREATE_CITY ( playerCharacter . getObjectUUID ( ) , serverZone . getObjectUUID ( ) ,
cityObjects = DbManager . CityQueries . CREATE_CITY ( playerCharacter . getObjectUUID ( ) , serverZone . getObjectUUID ( ) ,
serverRealm . getRealmID ( ) ,
serverRealm . getRealmID ( ) ,
@ -527,18 +526,18 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
for ( AbstractGameObject gameObject : cityObjects ) {
for ( AbstractGameObject gameObject : cityObjects ) {
switch ( gameObject . getObjectType ( ) ) {
switch ( gameObject . getObjectType ( ) ) {
case Building :
case Building :
treeObject = ( Building ) gameObject ;
treeObject = ( Building ) gameObject ;
treeObject . runAfterLoad ( ) ;
treeObject . runAfterLoad ( ) ;
break ;
break ;
case City :
case City :
cityObject = ( City ) gameObject ;
cityObject = ( City ) gameObject ;
break ;
break ;
case Zone :
case Zone :
cityZone = ( Zone ) gameObject ;
cityZone = ( Zone ) gameObject ;
break ;
break ;
default :
default :
// log some error here? *** Refactor
// log some error here? *** Refactor
}
}
}
}
@ -562,7 +561,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
ZoneManager . addZone ( cityZone . getObjectUUID ( ) , cityZone ) ;
ZoneManager . addZone ( cityZone . getObjectUUID ( ) , cityZone ) ;
ZoneManager . addPlayerCityZone ( cityZone ) ;
ZoneManager . addPlayerCityZone ( cityZone ) ;
serverZone . addNode ( cityZone ) ;
serverZone . addNode ( cityZone ) ;
cityZone . generateWorldAltitude ( ) ;
cityZone . generateWorldAltitude ( ) ;
cityObject . setParent ( cityZone ) ;
cityObject . setParent ( cityZone ) ;
@ -708,7 +707,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
}
}
blueprint = Blueprint . getBlueprint ( msg . getFirstPlacementInfo ( ) . getBlueprintUUID ( ) ) ;
blueprint = Blueprint . getBlueprint ( msg . getFirstPlacementInfo ( ) . getBlueprintUUID ( ) ) ;
if ( blueprint = = null ) {
if ( blueprint = = null ) {
return false ;
return false ;
}
}
@ -716,7 +715,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
for ( Building building : serverZone . zoneBuildingSet ) {
for ( Building building : serverZone . zoneBuildingSet ) {
if ( building . getBlueprint ( ) = = null )
if ( building . getBlueprint ( ) = = null )
continue ;
continue ;
if ( building . getBlueprint ( ) . getBuildingGroup ( ) = = BuildingGroup . SHRINE ) {
if ( building . getBlueprint ( ) . getBuildingGroup ( ) = = BuildingGroup . SHRINE ) {
if ( building . getBlueprintUUID ( ) = = blueprint . getMeshForRank ( 0 ) ) {
if ( building . getBlueprintUUID ( ) = = blueprint . getMeshForRank ( 0 ) ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 43 , "" ) ; // "shrine of that type exists"
PlaceAssetMsg . sendPlaceAssetError ( origin , 43 , "" ) ; // "shrine of that type exists"
@ -811,13 +810,13 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if ( serverZone = = null )
if ( serverZone = = null )
return false ;
return false ;
if ( player . getCharItemManager ( ) . getGoldTrading ( ) > 0 ) {
if ( player . getCharItemManager ( ) . getGoldTrading ( ) > 0 ) {
ErrorPopupMsg . sendErrorPopup ( player , 195 ) ;
ErrorPopupMsg . sendErrorPopup ( player , 195 ) ;
return false ;
return false ;
}
}
// Method checks validation conditions arising when placing
// Method checks validation conditions arising when placing
// buildings. Player must be on a city grid, must be
// buildings. Player must be on a city grid, must be
@ -956,7 +955,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Method validates the location we have selected for our new city
// Method validates the location we have selected for our new city
private static boolean validateTreeOfLifePlacement ( PlayerCharacter playerCharacter , Realm serverRealm , Zone serverZone ,
private static boolean validateTreeOfLifePlacement ( PlayerCharacter playerCharacter , Realm serverRealm , Zone serverZone ,
ClientConnection origin , PlaceAssetMsg msg ) {
ClientConnection origin , PlaceAssetMsg msg ) {
PlacementInfo placementInfo = msg . getFirstPlacementInfo ( ) ;
PlacementInfo placementInfo = msg . getFirstPlacementInfo ( ) ;
@ -995,7 +994,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if (
if (
( realmType . equals ( RealmType . MAELSTROM ) ) | |
( realmType . equals ( RealmType . MAELSTROM ) ) | |
( realmType . equals ( RealmType . OBLIVION ) ) ) {
( realmType . equals ( RealmType . OBLIVION ) ) ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , playerCharacter . getName ( ) ) ; // No building may be placed within this territory
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , playerCharacter . getName ( ) ) ; // No building may be placed within this territory
return false ;
return false ;
}
}
@ -1107,7 +1106,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
float buildingRotation = buildingInfo . getRot ( ) . y ;
float buildingRotation = buildingInfo . getRot ( ) . y ;
float vendorRotation = buildingInfo . getW ( ) ;
float vendorRotation = buildingInfo . getW ( ) ;
ArrayList < AbstractGameObject > shrineObjects = DbManager . ShrineQueries . CREATE_SHRINE (
ArrayList < AbstractGameObject > shrineObjects = DbManager . ShrineQueries . CREATE_SHRINE (
currentZone . getObjectUUID ( ) , player . getObjectUUID ( ) , blueprint . getName ( ) , blueprint . getMeshForRank ( 0 ) ,
currentZone . getObjectUUID ( ) , player . getObjectUUID ( ) , blueprint . getName ( ) , blueprint . getMeshForRank ( 0 ) ,
localLoc , 1 . 0f , blueprint . getMaxHealth ( 0 ) , ProtectionState . PROTECTED , 0 , 0 ,
localLoc , 1 . 0f , blueprint . getMaxHealth ( 0 ) , ProtectionState . PROTECTED , 0 , 0 ,
@ -1121,20 +1120,20 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
for ( AbstractGameObject ago : shrineObjects ) {
for ( AbstractGameObject ago : shrineObjects ) {
switch ( ago . getObjectType ( ) ) {
switch ( ago . getObjectType ( ) ) {
case Building :
case Building :
newMesh = ( Building ) ago ;
newMesh = ( Building ) ago ;
newMesh . runAfterLoad ( ) ;
newMesh . runAfterLoad ( ) ;
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 ) ;
WorldGrid . addObject ( newMesh , player ) ;
break ;
break ;
case Shrine :
case Shrine :
newShrine = ( Shrine ) ago ;
newShrine = ( Shrine ) ago ;
newShrine . getShrineType ( ) . addShrineToServerList ( newShrine ) ;
newShrine . getShrineType ( ) . addShrineToServerList ( newShrine ) ;
break ;
break ;
default :
default :
PlaceAssetMsg . sendPlaceAssetError ( player . getClientConnection ( ) , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
PlaceAssetMsg . sendPlaceAssetError ( player . getClientConnection ( ) , 1 , "A Serious error has occurred. Please post details for to ensure transaction integrity" ) ;
break ;
break ;
}
}
}
}
@ -1172,7 +1171,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
float vendorRotation = buildingInfo . getW ( ) ;
float vendorRotation = buildingInfo . getW ( ) ;
DateTime completionDate = DateTime . now ( ) . plusHours ( blueprint . getRankTime ( 1 ) ) ;
DateTime completionDate = DateTime . now ( ) . plusHours ( blueprint . getRankTime ( 1 ) ) ;
newMesh = DbManager . BuildingQueries . CREATE_BUILDING (
newMesh = DbManager . BuildingQueries . CREATE_BUILDING (
currentZone . getObjectUUID ( ) , player . getObjectUUID ( ) , blueprint . getName ( ) , blueprint . getMeshForRank ( 0 ) ,
currentZone . getObjectUUID ( ) , player . getObjectUUID ( ) , blueprint . getName ( ) , blueprint . getMeshForRank ( 0 ) ,
localLoc , 1 . 0f , blueprint . getMaxHealth ( 0 ) , ProtectionState . PROTECTED , 0 , 0 ,
localLoc , 1 . 0f , blueprint . getMaxHealth ( 0 ) , ProtectionState . PROTECTED , 0 , 0 ,
@ -1249,6 +1248,85 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
RealmType currentRealm ;
RealmType currentRealm ;
if ( Blueprint . getBlueprint ( placementInfo . getBlueprintUUID ( ) ) . isSiegeEquip ( ) = = false )
{
if ( serverZone . isPlayerCity ( ) = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
City city = ZoneManager . getCityAtLocation ( placementInfo . getLoc ( ) ) ;
if ( player . getGuild ( ) . equals ( city . getGuild ( ) ) = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
if ( city . isLocationOnCityGrid ( placementInfo . getLoc ( ) ) = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
}
else
{
City city = ZoneManager . getCityAtLocation ( placementInfo . getLoc ( ) ) ;
if ( city = = null )
{
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
Bane bane = city . getBane ( ) ;
//check if player is owner/IC of tree or bane
if ( player . getGuild ( ) . equals ( city . getGuild ( ) ) = = true )
{
//is from owners guild
if ( GuildStatusController . isGuildLeader ( player . getGuildStatus ( ) ) = = false & & GuildStatusController . isInnerCouncil ( player . getGuildStatus ( ) ) = = false )
{
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
}
else
{
//is not from owners guild
if ( bane = = null )
{
//bane was null
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
if ( city = = null )
{
//city was null
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
//check if player is from siege guild
if ( player . getGuild ( ) . equals ( bane . getOwner ( ) . getGuild ( ) ) = = false )
{
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
//check if player is GL or IC of the bane guild
if ( GuildStatusController . isGuildLeader ( player . getGuildStatus ( ) ) = = false & & GuildStatusController . isInnerCouncil ( player . getGuildStatus ( ) ) = = false )
{
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
//cannot place on grid until bane is live
if ( bane . getSiegePhase ( ) ! = SiegePhase . WAR & & city . isLocationOnCityGrid ( placementInfo . getLoc ( ) ) = = true )
{
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
if ( city . isLocationWithinSiegeBounds ( placementInfo . getLoc ( ) ) = = false & & city . isLocationOnCityZone ( placementInfo . getLoc ( ) ) = = false )
{
PlaceAssetMsg . sendPlaceAssetError ( origin , 57 , player . getName ( ) ) ;
return false ;
}
}
}
// Retrieve the building details we're placing
// Retrieve the building details we're placing
if ( serverZone . isNPCCity ( ) = = true ) {
if ( serverZone . isNPCCity ( ) = = true ) {
@ -1259,7 +1337,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Errant guilds cannot place assets
// Errant guilds cannot place assets
if ( player . getGuild ( ) . getGuildState ( ) = = GuildState . Errant ) {
if ( player . getGuild ( ) . getGuildState ( ) = = GuildState . Errant ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "Only soverign or sworn guilds may place assets." ) ;
PlaceAssetMsg . sendPlaceAssetError ( origin , 1 , "Only sovereign or sworn guilds may place assets." ) ;
return false ;
}
// Player must be GL or IC of a guild to place buildings.
if ( GuildStatusController . isGuildLeader ( player . getGuildStatus ( ) ) = = false & & GuildStatusController . isInnerCouncil ( player . getGuildStatus ( ) ) = = false ) {
PlaceAssetMsg . sendPlaceAssetError ( origin , 10 , "" ) ; // You must be a guild leader
return false ;
return false ;
}
}
@ -1282,7 +1367,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if (
if (
( currentRealm . equals ( RealmType . MAELSTROM ) ) | |
( currentRealm . equals ( RealmType . MAELSTROM ) ) | |
( currentRealm . equals ( RealmType . OBLIVION ) ) ) {
( currentRealm . equals ( RealmType . OBLIVION ) ) ) {
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 ;
}
}
@ -1373,8 +1458,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
PlaceAssetMsg . sendPlaceAssetError ( origin , 9 , "" ) ; //You must be a guild member to place this asset
PlaceAssetMsg . sendPlaceAssetError ( origin , 9 , "" ) ; //You must be a guild member to place this asset
return false ;
return false ;
}
}
return true ;
return true ;
}
}
}
}