|
|
|
@ -364,42 +364,18 @@ public enum BuildingManager {
@@ -364,42 +364,18 @@ public enum BuildingManager {
|
|
|
|
|
|
|
|
|
|
if (building.getRank() < 1) { |
|
|
|
|
|
|
|
|
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) { |
|
|
|
|
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) |
|
|
|
|
BuildingManager.removeHireling(building, slottedNPC); |
|
|
|
|
|
|
|
|
|
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC) |
|
|
|
|
((NPC) slottedNPC).remove(); |
|
|
|
|
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob) |
|
|
|
|
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Delete hireling if building has deranked.
|
|
|
|
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) { |
|
|
|
|
|
|
|
|
|
NPC npc = null; |
|
|
|
|
Mob mob = null; |
|
|
|
|
|
|
|
|
|
if (hireling.getObjectType() == Enum.GameObjectType.NPC) |
|
|
|
|
npc = (NPC) hireling; |
|
|
|
|
else if (hireling.getObjectType() == Enum.GameObjectType.Mob) |
|
|
|
|
mob = (Mob) hireling; |
|
|
|
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) { |
|
|
|
|
|
|
|
|
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank())) |
|
|
|
|
|
|
|
|
|
if (npc != null) { |
|
|
|
|
if (!npc.remove()) |
|
|
|
|
Logger.error("Failed to remove npc " + npc.getObjectUUID() |
|
|
|
|
+ "from Building " + building.getObjectUUID()); |
|
|
|
|
else |
|
|
|
|
building.getHirelings().remove(npc); |
|
|
|
|
} else if (mob != null) { |
|
|
|
|
if (!NPCManager.removeMobileFromBuilding(mob, building)) |
|
|
|
|
Logger.error("Failed to remove npc " + npc.getObjectUUID() |
|
|
|
|
+ "from Building " + building.getObjectUUID()); |
|
|
|
|
else |
|
|
|
|
building.getHirelings().remove(npc); |
|
|
|
|
} |
|
|
|
|
BuildingManager.removeHireling(building, hireling); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|