From 82e50f108fbc46187cb6528cb0f0b504a84cef23 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 25 Aug 2024 14:43:45 -0400 Subject: [PATCH] Bane logic tweaking --- src/engine/workthreads/DestroyCityThread.java | 68 ++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/src/engine/workthreads/DestroyCityThread.java b/src/engine/workthreads/DestroyCityThread.java index 526819da..5bd21025 100644 --- a/src/engine/workthreads/DestroyCityThread.java +++ b/src/engine/workthreads/DestroyCityThread.java @@ -62,32 +62,6 @@ public class DestroyCityThread implements Runnable { newParent = cityZone.parent; formerGuild = city.getTOL().getGuild(); - // Former guild loses it's tree! - - if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) { - - //Successful Update of guild - - formerGuild.setGuildState(mbEnums.GuildState.Errant); - formerGuild.setNation(null); - formerGuild.setCityUUID(0); - GuildManager.updateAllGuildTags(formerGuild); - GuildManager.updateAllGuildBinds(formerGuild, null); - } - - if (formerGuild.getSubGuildList().isEmpty() == false) { - - subGuildList = new ArrayList<>(); - - for (Guild subGuild : formerGuild.getSubGuildList()) { - subGuildList.add(subGuild); - } - - for (Guild subGuild : subGuildList) { - formerGuild.removeSubGuild(subGuild); - } - } - // Build list of buildings within this parent zone for (Building cityBuilding : cityZone.zoneBuildingSet) { @@ -130,18 +104,48 @@ public class DestroyCityThread implements Runnable { // Destroy all remaining auto-protected city assets - EnumSet assetsToDestroy = EnumSet.of(mbEnums.BuildingGroup.TOL, mbEnums.BuildingGroup.BARRACK, + EnumSet autoProtectFilter = EnumSet.of(mbEnums.BuildingGroup.TOL, mbEnums.BuildingGroup.BARRACK, mbEnums.BuildingGroup.SPIRE, mbEnums.BuildingGroup.SHRINE, mbEnums.BuildingGroup.WAREHOUSE); - if (assetsToDestroy.contains(cityBuilding.getBlueprint().getBuildingGroup())) { + if (autoProtectFilter.contains(cityBuilding.getBlueprint().getBuildingGroup())) { - if (cityBuilding.getRank() != -1) + if (cityBuilding.getRank() > -1) BuildingManager.setRank(cityBuilding, -1); } - } - if (city.realm != null) - city.realm.removeCity(city.getObjectUUID()); + // Former guild loses tree! + + if (city.realm != null) + city.realm.removeCity(city.getObjectUUID()); + + city.getTOL().setOwner(null); + + if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) { + + //Successful Update of guild + + formerGuild.setGuildState(mbEnums.GuildState.Errant); + formerGuild.setNation(null); + formerGuild.setCityUUID(0); + GuildManager.updateAllGuildTags(formerGuild); + GuildManager.updateAllGuildBinds(formerGuild, null); + } + + // And all of it's sub guilds + + if (formerGuild.getSubGuildList().isEmpty() == false) { + + subGuildList = new ArrayList<>(); + + for (Guild subGuild : formerGuild.getSubGuildList()) { + subGuildList.add(subGuild); + } + + for (Guild subGuild : subGuildList) { + formerGuild.removeSubGuild(subGuild); + } + } + } // It's now safe to delete the city zone from the database // which will cause a cascade delete of everything else