|
|
@ -308,6 +308,52 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void removeHireling(Building building, AbstractCharacter hireling) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mob guardCaptain = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hireling.getObjectType().equals(GameObjectType.Mob)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
guardCaptain = (Mob) hireling; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear minions from database if a guard captain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (guardCaptain.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) |
|
|
|
|
|
|
|
DbManager.MobQueries.REMOVE_ALL_MINIONS(hireling.getObjectUUID()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear minions from world
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer minionUUID : hireling.minions) { |
|
|
|
|
|
|
|
Mob minionMob = Mob.getMob(minionUUID); |
|
|
|
|
|
|
|
DbManager.removeFromCache(minionMob); |
|
|
|
|
|
|
|
WorldGrid.RemoveWorldObject(minionMob); |
|
|
|
|
|
|
|
WorldGrid.unloadObject(minionMob); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (minionMob.getParentZone() != null) |
|
|
|
|
|
|
|
minionMob.getParentZone().zoneMobSet.remove(minionMob); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove hireling from building
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
building.getHirelings().remove(hireling); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Delete hireling from database
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hireling.getObjectType().equals(GameObjectType.Mob)) |
|
|
|
|
|
|
|
DbManager.MobQueries.DELETE_MOB((Mob) hireling); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
DbManager.NPCQueries.DELETE_NPC((NPC) hireling); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Unload hireling from world
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbManager.removeFromCache(hireling); |
|
|
|
|
|
|
|
WorldGrid.RemoveWorldObject(hireling); |
|
|
|
|
|
|
|
WorldGrid.removeObject(hireling); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void cleanupHirelings(Building building) { |
|
|
|
public static void cleanupHirelings(Building building) { |
|
|
|
|
|
|
|
|
|
|
|
// Early exit: Cannot have hirelings in a building
|
|
|
|
// Early exit: Cannot have hirelings in a building
|
|
|
|