Browse Source

pet troubles resolved

master
FatBoy-DOTC 1 year ago
parent
commit
9ea02c888f
  1. 19
      src/engine/ai/MobileFSM.java
  2. 9
      src/engine/objects/Mob.java
  3. 10
      src/engine/powers/poweractions/CreateMobPowerAction.java

19
src/engine/ai/MobileFSM.java

@ -332,14 +332,6 @@ public class MobileFSM { @@ -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 { @@ -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
if(mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()){
CheckToSendMobHome(mob);
}
return;
}
if (!mob.isAlive()) {
@ -382,6 +376,7 @@ public class MobileFSM { @@ -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 { @@ -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 { @@ -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)

9
src/engine/objects/Mob.java

@ -1331,9 +1331,11 @@ public class Mob extends AbstractIntelligenceAgent { @@ -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 { @@ -1372,7 +1374,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.combatTarget = null;
this.hasLoot = this.charItemManager.getInventoryCount() > 0;
} catch (Exception e) {
Logger.error(e);
}

10
src/engine/powers/poweractions/CreateMobPowerAction.java

@ -85,9 +85,9 @@ public class CreateMobPowerAction extends AbstractPowerAction { @@ -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 { @@ -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();

Loading…
Cancel
Save