From 7d49395c414a3374b80b33a7c05892a31fd31666 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 9 Sep 2023 08:31:20 -0400 Subject: [PATCH] New method implemented. --- src/engine/devcmd/cmds/RemoveObjectCmd.java | 45 ++------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/src/engine/devcmd/cmds/RemoveObjectCmd.java b/src/engine/devcmd/cmds/RemoveObjectCmd.java index 3a6a9fa7..6f7ac8f0 100644 --- a/src/engine/devcmd/cmds/RemoveObjectCmd.java +++ b/src/engine/devcmd/cmds/RemoveObjectCmd.java @@ -11,7 +11,6 @@ package engine.devcmd.cmds; import engine.Enum.BuildingGroup; import engine.Enum.DbObjectType; -import engine.Enum.GameObjectType; import engine.InterestManagement.WorldGrid; import engine.devcmd.AbstractDevCmd; import engine.gameManager.BuildingManager; @@ -138,54 +137,16 @@ public class RemoveObjectCmd extends AbstractDevCmd { Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID()); } - //remove cached shrines. if ((building.getBlueprintUUID() != 0) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) Shrine.RemoveShrineFromCacheByBuilding(building); - for (AbstractCharacter ac : building.getHirelings().keySet()) { - NPC npc = null; - Mob mobA = null; - - if (ac.getObjectType() == GameObjectType.NPC) - npc = (NPC) ac; - else if (ac.getObjectType() == GameObjectType.Mob) - mobA = (Mob) ac; - - if (npc != null) { - - for (Integer minionUUID : npc.minions) { - Mob minionMob = Mob.getMob(minionUUID); - WorldGrid.RemoveWorldObject(minionMob); - WorldGrid.removeObject(minionMob, pc); - - if (minionMob.getParentZone() != null) - minionMob.getParentZone().zoneMobSet.remove(minionMob); - } - - DbManager.NPCQueries.DELETE_NPC(npc); - DbManager.removeFromCache(npc); - WorldGrid.RemoveWorldObject(npc); - WorldGrid.removeObject(npc, pc); - } else if (mobA != null) { - - for (Integer minionUUID : mobA.minions) { - Mob minionMob = Mob.getMob(minionUUID); - WorldGrid.RemoveWorldObject(minionMob); - WorldGrid.removeObject(minionMob, pc); - - if (minionMob.getParentZone() != null) - minionMob.getParentZone().zoneMobSet.remove(minionMob); - } - DbManager.MobQueries.DELETE_MOB(mobA); - DbManager.removeFromCache(mobA); - WorldGrid.RemoveWorldObject(mobA); - WorldGrid.removeObject(mobA, pc); - } + // Remove hirelings for this building + for (AbstractCharacter abstractCharacter : building.getHirelings().keySet()) + BuildingManager.removeHireling(building, abstractCharacter); - } Zone zone = building.getParentZone(); DbManager.BuildingQueries.DELETE_FROM_DATABASE(building); DbManager.removeFromCache(building);