Browse Source

reverse KOS function

postwipe-teleporting
FatBoy-DOTC 5 months ago
parent
commit
35427cfb4a
  1. 52
      src/engine/objects/City.java

52
src/engine/objects/City.java

@ -315,29 +315,43 @@ public class City extends AbstractWorldObject {
if (!repledge) if (!repledge)
if (!city.getGuild().charter.equals(playerCharacter.guild.charter)) if (!city.getGuild().charter.equals(playerCharacter.guild.charter))
continue; continue;
else
if (repledge)
if (!city.getGuild().charter.canJoin(playerCharacter)) if (!city.getGuild().charter.canJoin(playerCharacter))
continue; continue;
} }
Integer playerUUID = playerCharacter.objectUUID;
if (!city.getTOL().reverseKOS) { Integer guildUUID = playerCharacter.guildUUID;
cities.add(city);//can teleport to any open ToL that shares charter Integer nationUUID = playerCharacter.guild.getNation().getObjectUUID();
continue; boolean allowed = false;
} if (city.getTOL().reverseKOS) {
//reverse KOS, specific values are allowed
if (city.getTOL().getCondemned().containsKey(playerCharacter.objectUUID) && city.getTOL().getCondemned().get(playerCharacter.objectUUID).active) { if (city.getTOL().getCondemned().contains(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) {
cities.add(city);//this player is allowed for the reverse KOS //individual is cleared for teleport/repledge
continue; 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 {
if (city.getTOL().getCondemned().containsKey(playerCharacter.guildUUID) && city.getTOL().getCondemned().get(playerCharacter.guildUUID).active) { //not reverse KOS, everyone is allowed by default
cities.add(city);//this guild is allowed for the reverse KOS allowed = true;
continue; //specific values are not allowed
} if (city.getTOL().getCondemned().contains(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) {
//individual is cleared for teleport/repledge
if (city.getTOL().getCondemned().containsKey(playerCharacter.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(playerCharacter.guild.getNation().getObjectUUID()).active) { allowed = false;
cities.add(city);//this nation is allowed for the reverse KOS } 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 (allowed) {
cities.add(city);
continue; continue;
} }
} }

Loading…
Cancel
Save