From 8b9bc474b471f79a6fd3f8a7d0a55e5cf1bcbbb8 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 28 May 2024 21:37:03 -0500 Subject: [PATCH] box flag checker --- src/engine/objects/Mine.java | 35 +---------------------- src/engine/workthreads/BoxFlagThread.java | 10 +++---- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 02eef190..e28233c8 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -326,8 +326,6 @@ public class Mine extends AbstractGameObject { // all the requirements to claim; landed // guild with a warehouse, etc. - Guild playerGuild; - //verify the player exists if (playerCharacter == null) @@ -335,7 +333,7 @@ public class Mine extends AbstractGameObject { //verify the player is in valid guild - playerGuild = playerCharacter.getGuild(); + Guild playerGuild = playerCharacter.getGuild(); // Can't claim something if you don't have a guild! @@ -357,40 +355,9 @@ public class Mine extends AbstractGameObject { return false; } - // Number of mines is based on the rank of the nation's tree. - - City nationCapitol = playerGuild.getNation().getOwnedCity(); - - Building nationCapitolTOL = nationCapitol.getTOL(); - - if (nationCapitolTOL == null) - return false; - - //int treeRank = nationCapitolTOL.getRank(); - - //if (treeRank < 1) - // return false; - - //if (guildUnderMineLimit(playerGuild.getNation(), treeRank) == false) { - // ErrorPopupMsg.sendErrorMsg(playerCharacter, "Your nation cannot support another mine."); - // return false; - //} - return true; } - private static boolean guildUnderMineLimit(Guild playerGuild, int tolRank) { - - int mineCnt = 0; - - mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size(); - - for (Guild guild : playerGuild.getSubGuildList()) - mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size(); - - return mineCnt <= tolRank; - } - public boolean changeProductionType(Resource resource) { //if (!this.validForMine(resource)) // return false; diff --git a/src/engine/workthreads/BoxFlagThread.java b/src/engine/workthreads/BoxFlagThread.java index 20e69991..3a22a213 100644 --- a/src/engine/workthreads/BoxFlagThread.java +++ b/src/engine/workthreads/BoxFlagThread.java @@ -40,15 +40,15 @@ public class BoxFlagThread implements Runnable { if(LocalDateTime.now().isAfter(nextPulse)) { for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ if(pc.isEnteredWorld() && pc.isActive()){ - - if(PlayerCharacter.checkIfBoxed(pc)) { + pc.isBoxed = PlayerCharacter.checkIfBoxed(pc); + if(pc.isBoxed) { if(pc.title.equals(CharacterTitle.BOX) == false) { pc.title = CharacterTitle.BOX; //InterestManager.reloadCharacter(pc); InterestManager.setObjectDirty(pc); - } - if (pc.containsEffect(1672601862) == false) {//Deathshroud - PowersManager.applyPower(pc, pc, Vector3fImmutable.ZERO, 1672601862, 40, false); + if (pc.containsEffect(1672601862) == false) {//Deathshroud + PowersManager.applyPower(pc, pc, Vector3fImmutable.ZERO, 1672601862, 40, false); + } } }else{ if(pc.title.equals(CharacterTitle.NONE) == false) {