|
|
@ -364,42 +364,18 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
if (building.getRank() < 1) { |
|
|
|
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; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Delete hireling if building has deranked.
|
|
|
|
// Delete hireling if building has deranked.
|
|
|
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NPC npc = null; |
|
|
|
|
|
|
|
Mob mob = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hireling.getObjectType() == Enum.GameObjectType.NPC) |
|
|
|
for (AbstractCharacter hireling : building.getHirelings().keySet()) { |
|
|
|
npc = (NPC) hireling; |
|
|
|
|
|
|
|
else if (hireling.getObjectType() == Enum.GameObjectType.Mob) |
|
|
|
|
|
|
|
mob = (Mob) hireling; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank())) |
|
|
|
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank())) |
|
|
|
|
|
|
|
BuildingManager.removeHireling(building, hireling); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|