Browse Source

Lore Teleport list and repledge list construction

combat-2
FatBoy-DOTC 8 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 {
} }
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter pc) { public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter pc) {
ArrayList<City> cities = new ArrayList<>(); ArrayList<City> cities = new ArrayList<>();
if (pc == null) if (pc == null)
return cities; return cities;
Guild pcG = pc.getGuild();
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City); 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)) { for (AbstractGameObject ago : worldCities.values()) {
City city = (City) ago;
if (city.noTeleport) if (ago.getObjectType().equals(GameObjectType.City)) {
continue; City city = (City) ago;
if (city.parentZone != null && city.parentZone.guild_zone) { if (city.noTeleport)
continue;
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) { if (city.parentZone != null && city.parentZone.guild_zone) {
cities.add(city);
} else
//list Player cities
//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 (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) { if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
cities.add(city); 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))
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG)) cities.add(city);
cities.add(city);
} else if (city.isNpc == 1) { } else if (city.isNpc == 1) {
//list NPC cities //list NPC cities
Guild g = city.getGuild(); Guild g = city.getGuild();
if (g == null) { if (g == null) {
if (city.isNpc == 1) if (city.isNpc == 1)
if (city.isNoobIsle == 1) { if (city.isNoobIsle == 1) {
if (pc.getLevel() < 21) if (pc.getLevel() < 21)
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && city.getGuild().getGuildType().canJoin(pc)) {
cities.add(city);
} else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} } else if (pc.getLevel() > 9)
} else if (pc.getLevel() > 9)
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && city.getGuild().getGuildType().canJoin(pc)) {
cities.add(city);
} else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
}
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax()) } 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 {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} }
}
}
} }
} }
return cities; return cities;
} }
@ -380,60 +398,76 @@ public class City extends AbstractWorldObject {
Guild pcG = playerCharacter.getGuild(); Guild pcG = playerCharacter.getGuild();
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City); 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()) { City city = (City) ago;
if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago; if (city.noRepledge)
continue;
if (city.noRepledge) if (city.parentZone != null && city.parentZone.guild_zone) {
continue;
if (city.parentZone != null && city.parentZone.guild_zone) {
//list Player cities //list Player cities
//open city, just list //open city, just list
if (playerCharacter.getAccount().status.equals(AccountStatus.ADMIN)) { if (playerCharacter.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city); cities.add(city);
} else if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) { } else if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), playerCharacter)) if (!BuildingManager.IsPlayerHostile(city.getTOL(), playerCharacter))
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG)) } else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city); cities.add(city);
} else if (city.isNpc == 1) { } else if (city.isNpc == 1) {
//list NPC cities //list NPC cities
Guild guild = city.getGuild(); Guild guild = city.getGuild();
if (guild == null) { if (guild == null) {
if (city.isNpc == 1) if (city.isNpc == 1)
if (city.isNoobIsle == 1) { if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21) if (playerCharacter.getLevel() < 21)
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && city.getGuild().getGuildType().canJoin(playerCharacter)) {
cities.add(city);
} else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} } else if (playerCharacter.getLevel() > 9)
} else if (playerCharacter.getLevel() > 9)
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (city.getGuild().getGuildType().canJoin(playerCharacter)) {
cities.add(city);
}
} else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} } else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) {
} 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 {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} }
} }

Loading…
Cancel
Save