From 52a0c9500271a36373b4f393f202e68e5354062e Mon Sep 17 00:00:00 2001 From: fatboy Date: Thu, 18 Apr 2024 12:58:18 -0500 Subject: [PATCH] cannot be subbed if you have a bane placed nations can only have 1 bane placed at a time --- .../net/client/handlers/InviteToSubHandler.java | 6 ++++++ src/engine/objects/Bane.java | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/engine/net/client/handlers/InviteToSubHandler.java b/src/engine/net/client/handlers/InviteToSubHandler.java index 70171c73..9a60802e 100644 --- a/src/engine/net/client/handlers/InviteToSubHandler.java +++ b/src/engine/net/client/handlers/InviteToSubHandler.java @@ -25,6 +25,8 @@ import engine.objects.Guild; import engine.objects.GuildStatusController; import engine.objects.PlayerCharacter; +import static engine.objects.Bane.getBaneByAttackerGuild; + public class InviteToSubHandler extends AbstractClientMsgHandler { public InviteToSubHandler() { @@ -110,6 +112,10 @@ public class InviteToSubHandler extends AbstractClientMsgHandler { if(targetGuild.getOwnedCity().getBane() != null) return true; // cannot be subbed if you have a bane placed on you + + if(getBaneByAttackerGuild(targetGuild) != null) + return true; // cannot sub to a nation if you have a bane placed + //target must be GL or IC if (GuildStatusController.isInnerCouncil(target.getGuildStatus()) == false && GuildStatusController.isGuildLeader(target.getGuildStatus()) == false) { diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index 058073ce..70a4b4fc 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -215,12 +215,6 @@ public final class Bane { Vector3fImmutable localLocation = ZoneManager.worldToLocal(player.getLoc(), cityZone); - if (localLocation == null) { - PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity"); - Logger.info("Failed to Convert World coordinates to local zone coordinates"); - return false; - } - Building stone = DbManager.BuildingQueries.CREATE_BUILDING( cityZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(), localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank, @@ -231,6 +225,12 @@ public final class Bane { return false; } + for(Guild subGuild : baningGuild.getNation().getSubGuildList()) { + if (getBaneByAttackerGuild(subGuild) != null) { + PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Your Nation Already Has a Bane Placed"); + return false; + } + } stone.addEffectBit((1 << 19)); stone.setMaxHitPoints(stone.getBlueprint().getMaxHealth(stone.getRank())); stone.setCurrentHitPoints(stone.getMaxHitPoints());