From 0c1b3d14603ded79a7027711f595b30226b6e85f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 2 Apr 2024 19:24:38 -0500 Subject: [PATCH] Group translocate not allowed outside active banes and mines --- src/engine/gameManager/PowersManager.java | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 3d4aac1a..c2c17a4f 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -215,9 +215,60 @@ public enum PowersManager { + Integer.toHexString(msg.getPowerUsedID()) + " (" + msg.getPowerUsedID() + ')'); } + Boolean earlyExit = false; //Sending recycle message to player if died while casting. if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor + earlyExit = true; + } + + if(msg.getPowerUsedID() == 430628895){ // group teleport + + Boolean activeBane = false; + + if(ZoneManager.getCityAtLocation(playerCharacter.loc) != null && ZoneManager.getCityAtLocation(playerCharacter.loc).getBane() != null) + activeBane = ZoneManager.getCityAtLocation(playerCharacter.loc).getBane().getSiegePhase().equals(SiegePhase.WAR); + + Zone currentZone = ZoneManager.findSmallestZone(playerCharacter.loc); + if(currentZone == null) + earlyExit = true; + + if(currentZone.isPlayerCity() && !activeBane) + earlyExit = true; + + if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) { + for (Building building : currentZone.zoneBuildingSet) { + if (Mine.getMineFromTower(building.getObjectUUID()) != null) { + Mine currentMine = Mine.getMineFromTower(building.getObjectUUID()); + if (currentMine.isActive == false) { + earlyExit = true; + } + } + } + } + Vector3fImmutable endLoc = new Vector3fImmutable(msg.getTargetX(),msg.getTargetY(),msg.getTargetZ()); + currentZone = ZoneManager.findSmallestZone(endLoc); + + if(currentZone == null) + earlyExit = true; + + if(currentZone.isPlayerCity() && !activeBane) + earlyExit = true; + + if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) { + for (Building building : currentZone.zoneBuildingSet) { + if (Mine.getMineFromTower(building.getObjectUUID()) != null) { + Mine currentMine = Mine.getMineFromTower(building.getObjectUUID()); + if (currentMine.isActive == false) { + earlyExit = true; + } + } + } + } + } + + if (earlyExit) { + RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID()); Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);