From d1aa5818792526eea4522c5e99eb84ebc53f7bd9 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 29 Dec 2024 21:05:25 -0600 Subject: [PATCH] players coutn towards Siege Cap at banes for 3 minutes after leaving bane area --- src/engine/objects/City.java | 42 +++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 8c48d440..5b2a43db 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -39,6 +39,7 @@ import java.sql.SQLException; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; @@ -88,6 +89,8 @@ public class City extends AbstractWorldObject { private boolean reverseKOS = false; private String hash; + public HashMap baneAttendees; + /** * ResultSet Constructor */ @@ -1017,7 +1020,15 @@ public class City extends AbstractWorldObject { currentMemory.add(player.getObjectUUID()); // Player is already in our memory - + if(this.getBane() != null){ + //handle zerg mechanics here + if(this.getBane().getSiegePhase().equals(SiegePhase.WAR)){ + //bane is live, start tallying players + if(!this.baneAttendees.containsKey(player.getObjectUUID())){ + this.baneAttendees.put(player.getObjectUUID(),System.currentTimeMillis()); + } + } + } if (_playerMemory.contains(player.getObjectUUID())) continue; @@ -1047,11 +1058,25 @@ public class City extends AbstractWorldObject { } + private void onExitBane(){ + ArrayList toRemove = new ArrayList<>(); + for(int uuid : this.baneAttendees.keySet()){ + if(!_playerMemory.contains(uuid)){ + if(System.currentTimeMillis() - this.baneAttendees.get(uuid) > 180000){ + toRemove.add(uuid); + } + } + } + for(Integer uuid : toRemove){ + this.baneAttendees.remove(uuid); + } + } + private void onExit(HashSet currentMemory) { PlayerCharacter player; int playerUUID = 0; - HashSet toRemove = new HashSet<>(); + HashSet toRemoveStandard = new HashSet<>(); Iterator iter = _playerMemory.iterator(); while (iter.hasNext()) { @@ -1073,21 +1098,28 @@ public class City extends AbstractWorldObject { this.removeAllCityEffects(player, false); + player.ZergMultiplier = 1.0f; // We will remove this player after iteration is complete // so store it in a temporary collection - toRemove.add(playerUUID); + toRemoveStandard.add(playerUUID); // ***For debugging // Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size()); } // Remove players from city memory - _playerMemory.removeAll(toRemove); - for (Integer removalUUID : toRemove) { + _playerMemory.removeAll(toRemoveStandard); + for (Integer removalUUID : toRemoveStandard) { if (this.cityOutlaws.contains(removalUUID)) this.cityOutlaws.remove(removalUUID); } + if(this.getBane() != null){ + //handle zerg mechanics here + if(this.getBane().getSiegePhase().equals(SiegePhase.WAR)){ + this.onExitBane(); + } + } } public int getWarehouseBuildingID() {