Browse Source

New method implemented.

combat-2
MagicBot 1 year ago
parent
commit
7d49395c41
  1. 45
      src/engine/devcmd/cmds/RemoveObjectCmd.java

45
src/engine/devcmd/cmds/RemoveObjectCmd.java

@ -11,7 +11,6 @@ package engine.devcmd.cmds;
import engine.Enum.BuildingGroup; import engine.Enum.BuildingGroup;
import engine.Enum.DbObjectType; import engine.Enum.DbObjectType;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager; import engine.gameManager.BuildingManager;
@ -138,54 +137,16 @@ public class RemoveObjectCmd extends AbstractDevCmd {
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID()); Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
} }
//remove cached shrines. //remove cached shrines.
if ((building.getBlueprintUUID() != 0) if ((building.getBlueprintUUID() != 0)
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
Shrine.RemoveShrineFromCacheByBuilding(building); Shrine.RemoveShrineFromCacheByBuilding(building);
for (AbstractCharacter ac : building.getHirelings().keySet()) { // Remove hirelings for this building
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) for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
minionMob.getParentZone().zoneMobSet.remove(minionMob); BuildingManager.removeHireling(building, abstractCharacter);
}
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);
}
}
Zone zone = building.getParentZone(); Zone zone = building.getParentZone();
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building); DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building); DbManager.removeFromCache(building);

Loading…
Cancel
Save