Browse Source

Lore Teleport list and repledge list construction

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

104
src/engine/objects/City.java

@ -289,16 +289,48 @@ 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);
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 {
Guild pcG = pc.getGuild();
//add npc cities //add npc cities
for (AbstractGameObject ago : worldCities.values()) { for (AbstractGameObject ago : worldCities.values()) {
@ -342,31 +374,17 @@ public class City extends AbstractWorldObject {
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,7 +398,39 @@ 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()) { for (AbstractGameObject ago : worldCities.values()) {
@ -414,26 +464,10 @@ public class City extends AbstractWorldObject {
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