Browse Source

Bane logic tweaking

bane-updates
MagicBot 3 months ago
parent
commit
82e50f108f
  1. 64
      src/engine/workthreads/DestroyCityThread.java

64
src/engine/workthreads/DestroyCityThread.java

@ -62,32 +62,6 @@ public class DestroyCityThread implements Runnable {
newParent = cityZone.parent; newParent = cityZone.parent;
formerGuild = city.getTOL().getGuild(); 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 // Build list of buildings within this parent zone
for (Building cityBuilding : cityZone.zoneBuildingSet) { for (Building cityBuilding : cityZone.zoneBuildingSet) {
@ -130,19 +104,49 @@ public class DestroyCityThread implements Runnable {
// Destroy all remaining auto-protected city assets // Destroy all remaining auto-protected city assets
EnumSet<mbEnums.BuildingGroup> assetsToDestroy = EnumSet.of(mbEnums.BuildingGroup.TOL, mbEnums.BuildingGroup.BARRACK, EnumSet<mbEnums.BuildingGroup> autoProtectFilter = EnumSet.of(mbEnums.BuildingGroup.TOL, mbEnums.BuildingGroup.BARRACK,
mbEnums.BuildingGroup.SPIRE, mbEnums.BuildingGroup.SHRINE, mbEnums.BuildingGroup.WAREHOUSE); 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); BuildingManager.setRank(cityBuilding, -1);
} }
}
// Former guild loses tree!
if (city.realm != null) if (city.realm != null)
city.realm.removeCity(city.getObjectUUID()); 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 // It's now safe to delete the city zone from the database
// which will cause a cascade delete of everything else // which will cause a cascade delete of everything else

Loading…
Cancel
Save