Browse Source

track chaining for same nations

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
6e1db9489a
  1. 24
      src/engine/gameManager/PowersManager.java

24
src/engine/gameManager/PowersManager.java

@ -1577,7 +1577,7 @@ public enum PowersManager {
trackChars = new HashSet<>(); trackChars = new HashSet<>();
HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER); HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
ArrayList<Guild> nationsInRange = new ArrayList<>(); //ArrayList<Guild> nationsInRange = new ArrayList<>();
ArrayList<AbstractWorldObject> purgeList = new ArrayList<>(); ArrayList<AbstractWorldObject> purgeList = new ArrayList<>();
for(AbstractWorldObject trackChar : allInRange) { for(AbstractWorldObject trackChar : allInRange) {
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive()) if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
@ -1592,24 +1592,24 @@ public enum PowersManager {
continue; continue;
if(allInRange.contains(trackChar)) { if(allInRange.contains(trackChar)) {
trackChars.add((AbstractCharacter)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<Guild> nationsInRange = new ArrayList<>();
for(AbstractCharacter pc : trackChars){
if(nationsInRange.contains(pc.guild.getNation()) == false)
nationsInRange.add(pc.guild.getNation());
}
HashSet<AbstractWorldObject> fullRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,1024,MBServerStatics.MASK_PLAYER);
for(AbstractWorldObject trackChar : fullRange) {
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive()) if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
continue; continue;
if(nationsInRange.contains(((PlayerCharacter) trackChar).guild.getNation()) && trackChars.contains(trackChar) == false)
Guild nation = ((AbstractCharacter) trackChar).guild.getNation(); trackChars.add((AbstractCharacter)trackChar);
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);
} }
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg); TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
// send track window // send track window

Loading…
Cancel
Save