Browse Source

Appropriate error messages for BOW limits.

master
MagicBot 2 years ago
parent
commit
7a670ffdbf
  1. 34
      src/engine/net/client/handlers/PlaceAssetMsgHandler.java

34
src/engine/net/client/handlers/PlaceAssetMsgHandler.java

@ -415,7 +415,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
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;
@ -428,28 +427,22 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
else if (building.getGuild().equals(serverCity.getBane().getOwner().getGuild())) else if (building.getGuild().equals(serverCity.getBane().getOwner().getGuild()))
numAttackerBuildings++; numAttackerBuildings++;
// Validate bane limits on siege assets // Validate bane limits on siege assets
//if (serverCity.getBane() != null)
// if ((player.getGuild().equals(serverCity.getBane().getOwner().getGuild())) &&
// (numAttackerBuildings >= serverCity.getBane().getStone().getRank() * 2)) {
// return true;
// }
//if ((player.getGuild().equals(serverCity.getGuild())) &&
// (numDefenderBuildings >= serverCity.getTOL().getRank())) {
// return true;
//}
int maxAttackerAssets = serverCity.getBane().getStone().getRank() * 2; int maxAttackerAssets = serverCity.getBane().getStone().getRank() * 2;
int maxDefenderAssets = serverCity.getRank(); int maxDefenderAssets = serverCity.getRank();
if(player.getGuild() == serverCity.getGuild()){
if(player.getGuild().equals(serverCity.getGuild())){
//defender attempting to place asset //defender attempting to place asset
if(numDefenderBuildings == maxDefenderAssets){ if(numDefenderBuildings >= maxDefenderAssets){
PlaceAssetMsg.sendPlaceAssetError(origin,62, "");
return true; return true;
} }
} }
else if(player.getGuild() == serverCity.getBane().getStone().getGuild()){ else if(player.getGuild().equals(serverCity.getBane().getStone().getGuild())){
//attacker attempting to place asset //attacker attempting to place asset
if(numAttackerBuildings == maxAttackerAssets){ if(numAttackerBuildings >= maxAttackerAssets){
PlaceAssetMsg.sendPlaceAssetError(origin,61, "");
return true; return true;
} }
} }
@ -459,10 +452,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
} }
} }
// 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)
@ -470,11 +459,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
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!

Loading…
Cancel
Save