|
|
|
@ -600,6 +600,7 @@ public class Mine extends AbstractGameObject {
@@ -600,6 +600,7 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
Building building = BuildingManager.getBuilding(this.buildingID); |
|
|
|
|
currentPlayers = WorldGrid.getObjectsInRangePartial(building.loc, Enum.CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER); |
|
|
|
|
this.totalPLayers = currentPlayers.size(); |
|
|
|
|
boolean added = false; |
|
|
|
|
for (AbstractWorldObject playerObject : currentPlayers) { |
|
|
|
|
|
|
|
|
|
if (playerObject == null) |
|
|
|
@ -607,48 +608,63 @@ public class Mine extends AbstractGameObject {
@@ -607,48 +608,63 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
|
|
|
|
|
player = (PlayerCharacter) playerObject; |
|
|
|
|
Guild nation = player.getGuild().getNation(); |
|
|
|
|
|
|
|
|
|
if(nation == null) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if(this.presentPlayers.containsKey(nation)) { |
|
|
|
|
if (this.presentPlayers.get(nation).contains(player) == false) |
|
|
|
|
{ |
|
|
|
|
this.presentPlayers.get(nation).add(player); |
|
|
|
|
added = true; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
ArrayList<PlayerCharacter> present = new ArrayList<>(); |
|
|
|
|
present.add(player); |
|
|
|
|
this.presentPlayers.put(nation, present); |
|
|
|
|
added = true; |
|
|
|
|
} |
|
|
|
|
if(added) |
|
|
|
|
for(Guild guild : this.presentPlayers.keySet()) { |
|
|
|
|
ChatManager.chatSystemInfo(player, "Guild: " + guild.getName() + " COUNT: " + presentPlayers.get(guild).size()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
onExit(); |
|
|
|
|
onExit(this.presentPlayers); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
Logger.error(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onExit() { |
|
|
|
|
private void onExit(HashMap<Guild,ArrayList<PlayerCharacter>> checkList) { |
|
|
|
|
ArrayList<PlayerCharacter> allPlayers = new ArrayList<>(); |
|
|
|
|
for(ArrayList<PlayerCharacter> players: presentPlayers.values()){ |
|
|
|
|
allPlayers.addAll(players); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean updated = false; |
|
|
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> currentPlayers; |
|
|
|
|
PlayerCharacter player; |
|
|
|
|
Building building = BuildingManager.getBuilding(this.buildingID); |
|
|
|
|
currentPlayers = WorldGrid.getObjectsInRangePartial(building.loc, Enum.CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER); |
|
|
|
|
this.totalPLayers = currentPlayers.size(); |
|
|
|
|
for (AbstractWorldObject playerObject : currentPlayers) { |
|
|
|
|
|
|
|
|
|
if (playerObject == null) |
|
|
|
|
continue; |
|
|
|
|
for (PlayerCharacter playerObject : allPlayers) { |
|
|
|
|
|
|
|
|
|
player = (PlayerCharacter) playerObject; |
|
|
|
|
Guild nation = player.getGuild().getNation(); |
|
|
|
|
if(this.presentPlayers.containsKey(nation)) { |
|
|
|
|
if (this.presentPlayers.get(nation).contains(player) == false) |
|
|
|
|
{ |
|
|
|
|
this.presentPlayers.get(nation).remove(player); |
|
|
|
|
if (currentPlayers.contains(playerObject) == false) { |
|
|
|
|
Guild nation = playerObject.getGuild().getNation(); |
|
|
|
|
if (this.presentPlayers.containsKey(nation)) { |
|
|
|
|
if (this.presentPlayers.get(nation).contains(playerObject) == true) { |
|
|
|
|
this.presentPlayers.get(nation).remove(playerObject); |
|
|
|
|
updated = true; |
|
|
|
|
ChatManager.chatSystemInfo(playerObject,"Leaving Mine Vicinity"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(Guild guild : this.presentPlayers.keySet()) { |
|
|
|
|
ChatManager.chatSystemInfo(player, "Guild: " + guild.getName() + " COUNT: " + presentPlayers.get(guild).size()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(updated) |
|
|
|
|
for (Guild guild : this.presentPlayers.keySet()) { |
|
|
|
|
ChatManager.chatSystemInfo(playerObject, "Guild: " + guild.getName() + " COUNT: " + presentPlayers.get(guild).size()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|