Browse Source

New method implemented.

feature-workorder
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; @@ -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 { @@ -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);
// Remove hirelings for this building
if (minionMob.getParentZone() != null)
minionMob.getParentZone().zoneMobSet.remove(minionMob);
}
for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
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();
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building);

Loading…
Cancel
Save