Browse Source

reverse KOS function

postwipe-teleporting
FatBoy-DOTC 6 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 { @@ -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;
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;
}
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().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
} 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 (allowed) {
cities.add(city);
continue;
}
}

Loading…
Cancel
Save