diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index df11c008..57889e36 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -332,14 +332,6 @@ public class MobileFSM { public static void DetermineAction(Mob mob) { if (mob == null) return; - //pet cleanup for errant pets - if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.Pet1.ordinal() && mob.getOwner() == null && mob.isSiege() == false){ - mob.despawn(); - DbManager.removeFromCache(mob); - WorldGrid.removeObject(mob); - ZoneManager.getSeaFloor().zoneMobSet.remove(mob); - return; - } if (mob.despawned && mob.getMobBase().getLoadID() == 13171) { //trebuchet spawn handler CheckForRespawn(mob); @@ -358,7 +350,9 @@ public class MobileFSM { } CheckForRespawn(mob); //check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting - CheckToSendMobHome(mob); + if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()){ + CheckToSendMobHome(mob); + } return; } if (!mob.isAlive()) { @@ -382,6 +376,7 @@ public class MobileFSM { if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) { mob.setCombatTarget(null); } + mob.updateLocation(); switch (mob.BehaviourType) { case GuardCaptain: GuardCaptainLogic(mob); @@ -440,6 +435,9 @@ public class MobileFSM { return; switch (mob.BehaviourType) { case Pet1: + if(mob.getOwner() == null){ + return; + } if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) { //mob no longer has its owner loaded, translocate pet to owner MovementManager.translocate(mob, mob.getOwner().getLoc(), null); @@ -640,6 +638,11 @@ public class MobileFSM { } private static void PetLogic(Mob mob) { + if(mob.getOwner() == null && mob.isNecroPet() == false && mob.isSiege() == false){ + if(ZoneManager.getSeaFloor().zoneMobSet.contains(mob)){ + mob.killCharacter("no owner"); + } + } if (mob.getCombatTarget() != null && !mob.getCombatTarget().isAlive()) mob.setCombatTarget(null); if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index e70778b9..d8344e6b 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1331,9 +1331,11 @@ public class Mob extends AbstractIntelligenceAgent { this.combatTarget = null; this.hasLoot = false; - if (this.parentZone != null) - this.parentZone.zoneMobSet.remove(this); - + //if (this.parentZone != null) + //this.parentZone.zoneMobSet.remove(this); + if(ZoneManager.getSeaFloor().zoneMobSet.contains(this)) { + ZoneManager.getSeaFloor().zoneMobSet.remove(this); + } try { this.clearEffects(); } catch (Exception e) { @@ -1372,7 +1374,6 @@ public class Mob extends AbstractIntelligenceAgent { this.combatTarget = null; this.hasLoot = this.charItemManager.getInventoryCount() > 0; - } catch (Exception e) { Logger.error(e); } diff --git a/src/engine/powers/poweractions/CreateMobPowerAction.java b/src/engine/powers/poweractions/CreateMobPowerAction.java index 969e2927..c13bcd5a 100644 --- a/src/engine/powers/poweractions/CreateMobPowerAction.java +++ b/src/engine/powers/poweractions/CreateMobPowerAction.java @@ -85,9 +85,9 @@ public class CreateMobPowerAction extends AbstractPowerAction { WorldGrid.RemoveWorldObject(currentPet); currentPet.setCombatTarget(null); - if (currentPet.getParentZone() != null) - currentPet.getParentZone().zoneMobSet.remove(currentPet); - + //if (currentPet.getParentZone() != null) + //currentPet.getParentZone().zoneMobSet.remove(currentPet); + seaFloor.zoneMobSet.remove(currentPet); currentPet.playerAgroMap.clear(); try { @@ -118,8 +118,8 @@ public class CreateMobPowerAction extends AbstractPowerAction { currentPet.setOwner(null); WorldGrid.RemoveWorldObject(currentPet); - - currentPet.getParentZone().zoneMobSet.remove(currentPet); + //currentPet.getParentZone().zoneMobSet.remove(currentPet); + seaFloor.zoneMobSet.remove(currentPet); currentPet.playerAgroMap.clear(); currentPet.clearEffects(); //currentPet.disableIntelligence();