Browse Source

Lore Teleport list and repledge list construction

combat-2
FatBoy-DOTC 6 months ago
parent
commit
9e9716fc88
  1. 218
      src/engine/objects/City.java

218
src/engine/objects/City.java

@ -289,84 +289,102 @@ public class City extends AbstractWorldObject { @@ -289,84 +289,102 @@ public class City extends AbstractWorldObject {
}
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter pc) {
ArrayList<City> cities = new ArrayList<>();
if (pc == null)
return cities;
Guild pcG = pc.getGuild();
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City);
//add npc cities
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.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) {
cities.add(city); // everyone can go to noob island if they are under level 20
continue;
} else 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.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) {
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) {
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) {
cities.add(city);//this nation is allowed for the reverse KOS
continue;
}
}
}
} else {
for (AbstractGameObject ago : worldCities.values()) {
Guild pcG = pc.getGuild();
//add npc cities
if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago;
for (AbstractGameObject ago : worldCities.values()) {
if (city.noTeleport)
continue;
if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago;
if (city.parentZone != null && city.parentZone.guild_zone) {
if (city.noTeleport)
continue;
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city);
} else
//list Player cities
if (city.parentZone != null && city.parentZone.guild_zone) {
//open city, just list
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city);
} else
//list Player cities
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
//open city, just list
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
cities.add(city);
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
cities.add(city);
}
} else {
cities.add(city); //verify nation or guild is same
}
} else {
cities.add(city); //verify nation or guild is same
}
}
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city);
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city);
} else if (city.isNpc == 1) {
} else if (city.isNpc == 1) {
//list NPC cities
//list NPC cities
Guild g = city.getGuild();
if (g == null) {
if (city.isNpc == 1)
if (city.isNoobIsle == 1) {
if (pc.getLevel() < 21)
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && city.getGuild().getGuildType().canJoin(pc)) {
cities.add(city);
} else {
Guild g = city.getGuild();
if (g == null) {
if (city.isNpc == 1)
if (city.isNoobIsle == 1) {
if (pc.getLevel() < 21)
cities.add(city); //verify nation or guild is same
}
} else if (pc.getLevel() > 9)
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && city.getGuild().getGuildType().canJoin(pc)) {
cities.add(city);
} else {
} else if (pc.getLevel() > 9)
cities.add(city); //verify nation or guild is same
}
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().canJoin(pc)) {
cities.add(city);
}
} else {
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
cities.add(city); //verify nation or guild is same
}
}
}
}
}
}
return cities;
}
@ -380,60 +398,76 @@ public class City extends AbstractWorldObject { @@ -380,60 +398,76 @@ public class City extends AbstractWorldObject {
Guild pcG = playerCharacter.getGuild();
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City);
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.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;
} else 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")) {
cities.add(city); //everyone anytime can teleport to khan
continue;
} else 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(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(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(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;
}
}
}
} else {
//add npc cities
//add npc cities
for (AbstractGameObject ago : worldCities.values()) {
if (ago.getObjectType().equals(GameObjectType.City)) {
for (AbstractGameObject ago : worldCities.values()) {
if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago;
City city = (City) ago;
if (city.noRepledge)
continue;
if (city.noRepledge)
continue;
if (city.parentZone != null && city.parentZone.guild_zone) {
if (city.parentZone != null && city.parentZone.guild_zone) {
//list Player cities
//open city, just list
//list Player cities
//open city, just list
if (playerCharacter.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city);
} else if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (playerCharacter.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city);
} else if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), playerCharacter))
cities.add(city); //verify nation or guild is same
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city);
if (!BuildingManager.IsPlayerHostile(city.getTOL(), playerCharacter))
cities.add(city); //verify nation or guild is same
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city);
} else if (city.isNpc == 1) {
//list NPC cities
} else if (city.isNpc == 1) {
//list NPC cities
Guild guild = city.getGuild();
Guild guild = city.getGuild();
if (guild == null) {
if (city.isNpc == 1)
if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21)
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && city.getGuild().getGuildType().canJoin(playerCharacter)) {
cities.add(city);
} else {
if (guild == null) {
if (city.isNpc == 1)
if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21)
cities.add(city); //verify nation or guild is same
}
} else if (playerCharacter.getLevel() > 9)
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().canJoin(playerCharacter)) {
cities.add(city);
}
} else {
} else if (playerCharacter.getLevel() > 9)
cities.add(city); //verify nation or guild is same
}
} else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) {
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().canJoin(playerCharacter)) {
cities.add(city);
}
} else {
} else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) {
cities.add(city); //verify nation or guild is same
}
}

Loading…
Cancel
Save