Browse Source

pet troubles resolved

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

21
src/engine/ai/MobileFSM.java

@ -332,14 +332,6 @@ public class MobileFSM {
public static void DetermineAction(Mob mob) { public static void DetermineAction(Mob mob) {
if (mob == null) if (mob == null)
return; 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) { if (mob.despawned && mob.getMobBase().getLoadID() == 13171) {
//trebuchet spawn handler //trebuchet spawn handler
CheckForRespawn(mob); CheckForRespawn(mob);
@ -358,7 +350,9 @@ public class MobileFSM {
} }
CheckForRespawn(mob); CheckForRespawn(mob);
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting //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; return;
} }
if (!mob.isAlive()) { if (!mob.isAlive()) {
@ -382,6 +376,7 @@ public class MobileFSM {
if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) { if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
} }
mob.updateLocation();
switch (mob.BehaviourType) { switch (mob.BehaviourType) {
case GuardCaptain: case GuardCaptain:
GuardCaptainLogic(mob); GuardCaptainLogic(mob);
@ -440,6 +435,9 @@ public class MobileFSM {
return; return;
switch (mob.BehaviourType) { switch (mob.BehaviourType) {
case Pet1: case Pet1:
if(mob.getOwner() == null){
return;
}
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) { if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner //mob no longer has its owner loaded, translocate pet to owner
MovementManager.translocate(mob, mob.getOwner().getLoc(), null); MovementManager.translocate(mob, mob.getOwner().getLoc(), null);
@ -640,6 +638,11 @@ public class MobileFSM {
} }
private static void PetLogic(Mob mob) { 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()) if (mob.getCombatTarget() != null && !mob.getCombatTarget().isAlive())
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam) if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)

9
src/engine/objects/Mob.java

@ -1331,9 +1331,11 @@ public class Mob extends AbstractIntelligenceAgent {
this.combatTarget = null; this.combatTarget = null;
this.hasLoot = false; this.hasLoot = false;
if (this.parentZone != null) //if (this.parentZone != null)
this.parentZone.zoneMobSet.remove(this); //this.parentZone.zoneMobSet.remove(this);
if(ZoneManager.getSeaFloor().zoneMobSet.contains(this)) {
ZoneManager.getSeaFloor().zoneMobSet.remove(this);
}
try { try {
this.clearEffects(); this.clearEffects();
} catch (Exception e) { } catch (Exception e) {
@ -1372,7 +1374,6 @@ public class Mob extends AbstractIntelligenceAgent {
this.combatTarget = null; this.combatTarget = null;
this.hasLoot = this.charItemManager.getInventoryCount() > 0; this.hasLoot = this.charItemManager.getInventoryCount() > 0;
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} }

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

@ -85,9 +85,9 @@ public class CreateMobPowerAction extends AbstractPowerAction {
WorldGrid.RemoveWorldObject(currentPet); WorldGrid.RemoveWorldObject(currentPet);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
if (currentPet.getParentZone() != null) //if (currentPet.getParentZone() != null)
currentPet.getParentZone().zoneMobSet.remove(currentPet); //currentPet.getParentZone().zoneMobSet.remove(currentPet);
seaFloor.zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear(); currentPet.playerAgroMap.clear();
try { try {
@ -118,8 +118,8 @@ public class CreateMobPowerAction extends AbstractPowerAction {
currentPet.setOwner(null); currentPet.setOwner(null);
WorldGrid.RemoveWorldObject(currentPet); WorldGrid.RemoveWorldObject(currentPet);
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
currentPet.getParentZone().zoneMobSet.remove(currentPet); seaFloor.zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear(); currentPet.playerAgroMap.clear();
currentPet.clearEffects(); currentPet.clearEffects();
//currentPet.disableIntelligence(); //currentPet.disableIntelligence();

Loading…
Cancel
Save