From 584ad46b754eec8109eb1ebc79bad58e290342eb Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 9 May 2023 20:27:24 -0500 Subject: [PATCH] duplicate zoneMobSet additions fixed --- src/engine/devcmd/cmds/aiInfoCmd.java | 3 ++- src/engine/objects/Mob.java | 2 ++ src/engine/objects/NPC.java | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/engine/devcmd/cmds/aiInfoCmd.java b/src/engine/devcmd/cmds/aiInfoCmd.java index ed89f486..27fb2574 100644 --- a/src/engine/devcmd/cmds/aiInfoCmd.java +++ b/src/engine/devcmd/cmds/aiInfoCmd.java @@ -94,12 +94,13 @@ public class aiInfoCmd extends AbstractDevCmd { } else{ output += "BehaviourType: NULL" + newline; } + output += "Aggro Range: " + mob.getAggroRange() + newline; output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline; if(mob.playerAgroMap.size() > 0){ output += "Players Loaded:" + newline; } for(Map.Entry entry : mob.playerAgroMap.entrySet()){ - output += "Player ID: " + entry.getKey() + " In Range To Aggro: " + entry.getValue() + newline; + output += "Player ID: " + entry.getKey() + " Is Safemode: " + entry.getValue() + newline; } } throwbackInfo(pc, output); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 158dd83c..2106344b 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -806,6 +806,8 @@ public class Mob extends AbstractIntelligenceAgent { mob.npcOwner = guardCaptain; mob.spawnTime = (int)(-2.500 * guardCaptain.building.getRank() + 22.5) * 60; mob.BehaviourType = Enum.MobBehaviourType.GuardMinion; + mob.parentZone = parent; + parent.zoneMobSet.add(mob); return mob; } diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index a7907c9b..8fcb793f 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -918,10 +918,10 @@ public class NPC extends AbstractCharacter { if (this.parentZone != null) { if (zone.getObjectUUID() != this.parentZone.getObjectUUID()) { this.parentZone.zoneNPCSet.remove(this); - zone.zoneNPCSet.add(this); + //zone.zoneNPCSet.add(this); } } else { - zone.zoneNPCSet.add(this); + //zone.zoneNPCSet.add(this); } } else if (this.parentZone != null) { this.parentZone.zoneNPCSet.remove(this); @@ -988,6 +988,9 @@ public class NPC extends AbstractCharacter { if (npcWithoutID.mobBase == null) { return null; } + if (parent != null) { + npcWithoutID.setRelPos(parent, spawn.x - parent.absX, spawn.y - parent.absY, spawn.z - parent.absZ); + } NPC npc; try { npc = DbManager.NPCQueries.ADD_NPC(npcWithoutID, isMob);