|
|
@ -30,6 +30,8 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
DestroyBuildingMsg msg; |
|
|
|
DestroyBuildingMsg msg; |
|
|
|
msg = (DestroyBuildingMsg) baseMsg; |
|
|
|
msg = (DestroyBuildingMsg) baseMsg; |
|
|
|
|
|
|
|
Bane bane = null; |
|
|
|
|
|
|
|
Blueprint blueprint; |
|
|
|
|
|
|
|
|
|
|
|
int buildingUUID = msg.getUUID(); |
|
|
|
int buildingUUID = msg.getUUID(); |
|
|
|
|
|
|
|
|
|
|
@ -38,10 +40,9 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { |
|
|
|
if (pc == null || building == null) |
|
|
|
if (pc == null || building == null) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
Blueprint blueprint; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blueprint = building.getBlueprint(); |
|
|
|
blueprint = building.getBlueprint(); |
|
|
|
City city = building.getCity(); |
|
|
|
City city = building.getCity(); |
|
|
|
|
|
|
|
|
|
|
|
// Can't destroy buildings without a blueprint.
|
|
|
|
// Can't destroy buildings without a blueprint.
|
|
|
|
|
|
|
|
|
|
|
|
if (blueprint == null) |
|
|
|
if (blueprint == null) |
|
|
@ -55,11 +56,17 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
if (!BuildingManager.PlayerCanControlNotOwner(building, pc)) |
|
|
|
if (!BuildingManager.PlayerCanControlNotOwner(building, pc)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
Bane bane = city.getBane(); |
|
|
|
|
|
|
|
if(bane.getSiegePhase() == Enum.SiegePhase.WAR && bane != null) { |
|
|
|
// Can't delete siege assets during an active bane.
|
|
|
|
ErrorPopupMsg.sendErrorPopup(pc, 171); |
|
|
|
|
|
|
|
return true; |
|
|
|
if (city != null) |
|
|
|
} |
|
|
|
bane = city.getBane(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( bane != null && bane.getSiegePhase() == Enum.SiegePhase.WAR) { |
|
|
|
|
|
|
|
ErrorPopupMsg.sendErrorPopup(pc, 171); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Can't destroy a tree of life
|
|
|
|
// Can't destroy a tree of life
|
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.TOL) |
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.TOL) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -68,12 +75,17 @@ if(bane.getSiegePhase() == Enum.SiegePhase.WAR && bane != null) { |
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE) |
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cannot destroy mines outside of normal mine mechanics
|
|
|
|
|
|
|
|
|
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.MINE) |
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.MINE) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cannot delete rungates
|
|
|
|
|
|
|
|
|
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.RUNEGATE) |
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.RUNEGATE) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
//stop if active siege
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Turn off spire if destoying
|
|
|
|
// Turn off spire if destoying
|
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.SPIRE) |
|
|
|
if (blueprint.getBuildingGroup() == BuildingGroup.SPIRE) |
|
|
|
building.disableSpire(true); |
|
|
|
building.disableSpire(true); |
|
|
|