From 5224c7944186d93dcfa78ba2a59239ae18ab7d5f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 19 Jun 2024 14:53:57 -0400 Subject: [PATCH] Condemned uuid is key not value in map --- src/engine/objects/City.java | 53 +++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 126c8757..1eeef20e 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -288,10 +288,11 @@ public class City extends AbstractWorldObject { return city.getBindLoc(); } - public static ArrayList getCitiesToTeleportTo(PlayerCharacter pc) { + public static ArrayList getCitiesToTeleportTo(PlayerCharacter playerCharacter) { + ArrayList cities = new ArrayList<>(); - if (pc == null) + if (playerCharacter == null) return cities; ConcurrentHashMap worldCities = DbManager.getMap(mbEnums.GameObjectType.City); @@ -299,43 +300,57 @@ public class City extends AbstractWorldObject { if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { //handle compiling of cities able to be teleported to for lore rule-set for (AbstractGameObject ago : worldCities.values()) { + City city = (City) ago; + if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion")) continue; // cannot teleport to perdition or bastion - if (city.isNpc == 1 && city.getGuild().charter.equals(pc.guild.charter)) { - cities.add(city); // anyone of the same charter can teleport to a safehold of that charter - continue; - } else if (city.isNoobIsle == 1 && pc.level <= 20) { + + if (city.isNoobIsle == 1 && playerCharacter.level <= 20) { cities.add(city); // everyone can go to noob island if they are under level 20 continue; - } else if (city.cityName.equals("Khan'Ov Srekel")) { + } + + if (city.cityName.equals("Khan'Ov Srekel")) { cities.add(city); //everyone anytime can teleport to khan continue; - } else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(pc.guild.charter)) + } + + if (city.isNpc == 1 && city.getGuild().charter.equals(playerCharacter.guild.charter)) { + cities.add(city); // anyone of the same charter can teleport to a safehold of that charter + continue; + } + + if (playerCharacter.guild.isEmptyGuild() && city.isNpc == 1) { + cities.add(city); // Erranrs can travel everywhere. + continue; + } + + if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(playerCharacter.guild.charter)) if (!city.getTOL().reverseKOS) { cities.add(city);//can teleport to any open ToL that shares charter continue; } else { - if (city.getTOL().getCondemned().contains(pc.objectUUID) && city.getTOL().getCondemned().get(pc.objectUUID).active) { + 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 (city.getTOL().getCondemned().contains(pc.guildUUID) && city.getTOL().getCondemned().get(pc.guildUUID).active) { + 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().getCondemned().contains(pc.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(pc.guild.getNation().getObjectUUID()).active) { + 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.getGuild().getNation().equals(pc.guild.getNation())) { + if (city.getGuild().getNation().equals(playerCharacter.guild.getNation())) { cities.add(city);//can always teleport inside your own nation } } } else { - Guild pcG = pc.getGuild(); + Guild pcG = playerCharacter.getGuild(); //add npc cities for (AbstractGameObject ago : worldCities.values()) { @@ -348,7 +363,7 @@ public class City extends AbstractWorldObject { if (city.parentZone != null && city.parentZone.guild_zone) { - if (pc.getAccount().status.equals(AccountStatus.ADMIN)) { + if (playerCharacter.getAccount().status.equals(AccountStatus.ADMIN)) { cities.add(city); } else //list Player cities @@ -357,9 +372,9 @@ public class City extends AbstractWorldObject { if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) { - if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) { + if (!BuildingManager.IsPlayerHostile(city.getTOL(), playerCharacter)) { if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { - if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) { + if (city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())) { cities.add(city); } } else { @@ -378,12 +393,12 @@ public class City extends AbstractWorldObject { if (g == null) { if (city.isNpc == 1) if (city.isNoobIsle == 1) { - if (pc.getLevel() < 21) + if (playerCharacter.getLevel() < 21) cities.add(city); //verify nation or guild is same - } else if (pc.getLevel() > 9) + } else if (playerCharacter.getLevel() > 9) cities.add(city); //verify nation or guild is same - } else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax()) + } else if (playerCharacter.getLevel() >= g.getTeleportMin() && playerCharacter.getLevel() <= g.getTeleportMax()) cities.add(city); //verify nation or guild is same }