From 6e1db9489a790069d6c12ccb2968d2f3fa965a4c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 15 May 2024 21:43:29 -0500 Subject: [PATCH] track chaining for same nations --- src/engine/gameManager/PowersManager.java | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 900f2b27..c4c2e5ef 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -1577,7 +1577,7 @@ public enum PowersManager { trackChars = new HashSet<>(); HashSet allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER); - ArrayList nationsInRange = new ArrayList<>(); + //ArrayList nationsInRange = new ArrayList<>(); ArrayList purgeList = new ArrayList<>(); for(AbstractWorldObject trackChar : allInRange) { if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive()) @@ -1592,24 +1592,24 @@ public enum PowersManager { continue; if(allInRange.contains(trackChar)) { trackChars.add((AbstractCharacter)trackChar); - Guild nation = ((AbstractCharacter)trackChar).guild.getNation(); - if(nationsInRange.contains(nation) == false) - nationsInRange.add(nation); } } - //second round add all others in window if they share a nation with a current - for(AbstractWorldObject trackChar : allInRange) { + //track full range for chaining nation members + ArrayList nationsInRange = new ArrayList<>(); + for(AbstractCharacter pc : trackChars){ + if(nationsInRange.contains(pc.guild.getNation()) == false) + nationsInRange.add(pc.guild.getNation()); + } + HashSet fullRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,1024,MBServerStatics.MASK_PLAYER); + for(AbstractWorldObject trackChar : fullRange) { if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive()) continue; - - Guild nation = ((AbstractCharacter) trackChar).guild.getNation(); - if (allInRange.contains(trackChar) == true && nationsInRange.add(nation) == true && trackChars.contains(trackChar) == false) - trackChars.add((AbstractCharacter) trackChar); - else if(((AbstractCharacter) trackChar).guild.getNation().equals(playerCharacter.guild.getNation())) - trackChars.add((AbstractCharacter) trackChar); + if(nationsInRange.contains(((PlayerCharacter) trackChar).guild.getNation()) && trackChars.contains(trackChar) == false) + trackChars.add((AbstractCharacter)trackChar); } + TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg); // send track window