From 35427cfb4a3de4c2dac6efb01b338fb8e12930c3 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 22 Jun 2024 19:04:04 -0500 Subject: [PATCH] reverse KOS function --- src/engine/objects/City.java | 52 +++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 84856dfd..7a8bde23 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -315,29 +315,43 @@ public class City extends AbstractWorldObject { if (!repledge) if (!city.getGuild().charter.equals(playerCharacter.guild.charter)) continue; - - if (repledge) + else if (!city.getGuild().charter.canJoin(playerCharacter)) continue; } - - if (!city.getTOL().reverseKOS) { - cities.add(city);//can teleport to any open ToL that shares 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 (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; + Integer playerUUID = playerCharacter.objectUUID; + Integer guildUUID = playerCharacter.guildUUID; + Integer nationUUID = playerCharacter.guild.getNation().getObjectUUID(); + boolean allowed = false; + if (city.getTOL().reverseKOS) { + //reverse KOS, specific values are allowed + if (city.getTOL().getCondemned().contains(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) { + //individual is cleared for teleport/repledge + allowed = true; + } else if (city.getTOL().getCondemned().contains(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) { + //player guild is cleared for teleport/repledge + allowed = true; + } else if (city.getTOL().getCondemned().contains(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active) { + //player nation is cleared for teleport/repledge + allowed = true; + } + } else { + //not reverse KOS, everyone is allowed by default + allowed = true; + //specific values are not allowed + if (city.getTOL().getCondemned().contains(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) { + //individual is cleared for teleport/repledge + allowed = false; + } else if (city.getTOL().getCondemned().contains(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) { + //player guild is cleared for teleport/repledge + allowed = false; + } else if (city.getTOL().getCondemned().contains(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active) { + //player nation is cleared for teleport/repledge + allowed = false; + } } - - 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 + if (allowed) { + cities.add(city); continue; } }