From bb91502cb4253234edcc126f480336ccc20b53e0 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 29 Feb 2024 19:30:47 -0600 Subject: [PATCH] pet debugging --- src/engine/gameManager/PowersManager.java | 5 ++++- src/engine/objects/Mob.java | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index a3a603d9..8d4f05ff 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -350,9 +350,12 @@ public enum PowersManager { } else { // get target AbstractWorldObject target = getTarget(msg); + if(target == null && msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){ + Mob pet = Mob.dynamic_pets.get(msg.getTargetID()); + target = pet; + } if (target == null) { - ChatManager.chatSystemInfo(PlayerCharacter.getPlayerCharacter(msg.getSourceID()), "Target Null"); return true; } if (!target.isAlive() && target.getObjectType().equals(GameObjectType.Building) == false && msg.getPowerUsedID() != 428589216) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 00bdfb28..7d8a8b86 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -42,6 +42,8 @@ import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; public class Mob extends AbstractIntelligenceAgent { private static int staticID = 0; + + public static HashMap dynamic_pets = new HashMap<>(); //mob specific public final ConcurrentHashMap playerAgroMap = new ConcurrentHashMap<>(); //key = Player value = hate value @@ -561,7 +563,8 @@ public class Mob extends AbstractIntelligenceAgent { petMinion.despawned = false; petMinion.runAfterLoad(); - DbManager.addToCache(petMinion); + //DbManager.addToCache(petMinion); + Mob.dynamic_pets.put(petMinion.getObjectUUID(),petMinion); petMinion.setLoc(petMinion.bindLoc); return petMinion; @@ -933,7 +936,9 @@ public class Mob extends AbstractIntelligenceAgent { this.playerAgroMap.clear(); WorldGrid.RemoveWorldObject(this); - DbManager.removeFromCache(this); + //DbManager.removeFromCache(this); + if(Mob.dynamic_pets.containsKey(this.getObjectUUID())) + Mob.dynamic_pets.remove(this.getObjectUUID()); PlayerCharacter petOwner = (PlayerCharacter) this.guardCaptain; if (petOwner != null) {