From fff1e80f61302c7bce14fc2fd9c60c5baba4dcc1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 19 Jun 2024 17:49:46 -0400 Subject: [PATCH] More logic work --- src/engine/objects/City.java | 103 ++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 21f934d8..e900587a 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -295,80 +295,85 @@ public class City extends AbstractWorldObject { ConcurrentHashMap worldCities = DbManager.getMap(mbEnums.GameObjectType.City); - //handle compiling of cities able to be teleported to for lore rule-set + //handle compiling of cities able to be teleported to for lore rule-set - for (AbstractGameObject ago : worldCities.values()) { - - City city = (City) ago; + for (AbstractGameObject ago : worldCities.values()) { - // Filter Player cities + City city = (City) ago; - if (city.parentZone == null) - continue; + // Filter Player cities - if (city.parentZone.guild_zone && city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(playerCharacter.guild.charter)) { - - // Filter Lore cities + if (city.parentZone == null) + continue; - if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { + if (city.parentZone.guild_zone && city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(playerCharacter.guild.charter)) { - if (!repledge) - if (!city.getGuild().charter.equals(playerCharacter.guild.charter)) - continue; + // Filter Lore cities - if (repledge) - if (!city.getGuild().charter.canJoin(playerCharacter)) - continue; - } + if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { - if (!city.getTOL().reverseKOS) { - cities.add(city);//can teleport to any open ToL that shares charter - continue; - } + if (!repledge) + if (!city.getGuild().charter.equals(playerCharacter.guild.charter)) + continue; - if (city.getTOL().getCondemned().containsKey(playerCharacter.objectUUID) && city.getTOL().getCondemned().get(playerCharacter.objectUUID).active) { - cities.add(city);//this player is allowed for the reverse KOS - continue; - } + if (repledge) + if (!city.getGuild().charter.canJoin(playerCharacter)) + continue; + } - if (city.getTOL().getCondemned().containsKey(playerCharacter.guildUUID) && city.getTOL().getCondemned().get(playerCharacter.guildUUID).active) { - cities.add(city);//this guild is allowed for the reverse KOS - continue; - } + if (!city.getTOL().reverseKOS) { + cities.add(city);//can teleport to any open ToL that shares charter + continue; + } - if (city.getTOL().getCondemned().containsKey(playerCharacter.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(playerCharacter.guild.getNation().getObjectUUID()).active) { - cities.add(city);//this nation is allowed for the reverse KOS - continue; - } + if (city.getTOL().getCondemned().containsKey(playerCharacter.objectUUID) && city.getTOL().getCondemned().get(playerCharacter.objectUUID).active) { + cities.add(city);//this player is allowed for the reverse KOS + continue; } - // Filter NPC cities + if (city.getTOL().getCondemned().containsKey(playerCharacter.guildUUID) && city.getTOL().getCondemned().get(playerCharacter.guildUUID).active) { + cities.add(city);//this guild is allowed for the reverse KOS + continue; + } - if (city.isNoobIsle == 1 && playerCharacter.level <= 20) { - cities.add(city); // everyone can go to noob island if they are under level 20 + if (city.getTOL().getCondemned().containsKey(playerCharacter.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(playerCharacter.guild.getNation().getObjectUUID()).active) { + cities.add(city);//this nation is allowed for the reverse KOS continue; } + } - if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion")) - continue; // cannot teleport to perdition or bastion + // Filter NPC cities - // Filter Lore cities + if (city.isNoobIsle == 1 && playerCharacter.level < 20) { + cities.add(city); // everyone can go to noob island if they are under level 20 + continue; + } - if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { + // Players cannot teleport to perdition or bastion - if (!repledge) - if (!city.getGuild().charter.equals(playerCharacter.guild.charter)) - continue; + if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion")) + continue; - if (repledge) - if (!city.getGuild().charter.canJoin(playerCharacter)) - continue; - } + // These cities are available for anyone off noob island - if (city.isNpc == 1) + if (playerCharacter.level >= 20 && (city.cityName.equals("Sea Dog's Rest") || city.cityName.equals("Khan'Ov Srekel") || city.cityName.equals("City of Khar Th'Sekt"))) { + cities.add(city); + continue; + } + + // Add Lore cities + + if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { + + if (repledge) { + if (city.getGuild().charter.canJoin(playerCharacter)) + cities.add(city); + } else if (city.getGuild().charter.equals(playerCharacter.guild.charter)) cities.add(city); } + } + return cities; }