forked from MagicBane/Server
Rework of validation checks.
This commit is contained in:
@@ -335,28 +335,19 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
serverCity = ZoneManager.getCityAtLocation(buildingList.getLoc());
|
serverCity = ZoneManager.getCityAtLocation(buildingList.getLoc());
|
||||||
|
|
||||||
//no city found
|
//no city found
|
||||||
//check if attacker city.
|
|
||||||
if (serverCity == null){
|
|
||||||
Bane bane = Bane.getBaneByAttackerGuild(player.getGuild());
|
|
||||||
City attackerCity = null;
|
|
||||||
if (bane != null)
|
|
||||||
attackerCity = bane.getCity();
|
|
||||||
|
|
||||||
if (attackerCity != null)
|
if (serverCity == null) {
|
||||||
if (buildingList.getLoc().isInsideCircle(attackerCity.getLoc(), Enum.CityBoundsType.SIEGE.extents))
|
PlaceAssetMsg.sendPlaceAssetError(origin, 41, ""); // Cannot place outisde a guild zone
|
||||||
serverCity = attackerCity;
|
return false;
|
||||||
}
|
}
|
||||||
//no city found for attacker city,
|
|
||||||
//check if defender city
|
// No bane no bow
|
||||||
|
|
||||||
if (serverCity == null){
|
if (serverCity.getBane() == null) {
|
||||||
if (player.getGuild().getOwnedCity() != null)
|
PlaceAssetMsg.sendPlaceAssetError(origin, 66, ""); // There is no bane circle to support this building of war
|
||||||
if (buildingList.getLoc().isInsideCircle(player.getGuild().getOwnedCity().getLoc(), Enum.CityBoundsType.SIEGE.extents))
|
return false;
|
||||||
serverCity = player.getGuild().getOwnedCity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((serverCity != 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
|
||||||
@@ -368,9 +359,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
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.
|
|
||||||
|
|
||||||
// If there is a bane placed, we limit placement to 2x the stone rank's worth of attacker assets
|
// If there is a bane placed, we limit placement to 2x the stone rank's worth of attacker assets
|
||||||
// and 1x the tree rank for defenders
|
// and 1x the tree rank for defenders
|
||||||
@@ -434,6 +422,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
if (building.getGuild().equals(serverCity.getBane().getOwner().getGuild()))
|
if (building.getGuild().equals(serverCity.getBane().getOwner().getGuild()))
|
||||||
attackerBuildings.add(building);
|
attackerBuildings.add(building);
|
||||||
|
|
||||||
|
}
|
||||||
// Validate bane limits on siege assets
|
// Validate bane limits on siege assets
|
||||||
|
|
||||||
if (playerCharacter.getGuild().equals(serverCity.getGuild())) {
|
if (playerCharacter.getGuild().equals(serverCity.getGuild())) {
|
||||||
@@ -452,7 +442,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
// Passed validation
|
// Passed validation
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user