forked from MagicBane/Server
New method implemented.
This commit is contained in:
@@ -119,82 +119,6 @@ public enum NPCManager {
|
||||
playerCharacter.necroPets.clear();
|
||||
}
|
||||
|
||||
|
||||
public static void removeSiegeMinions(Mob mobile) {
|
||||
|
||||
for (Integer minionUUID : mobile.minions) {
|
||||
|
||||
Mob siegeMinion = Mob.getMob(minionUUID);
|
||||
|
||||
if (mobile.isMoving()) {
|
||||
|
||||
mobile.stopMovement(mobile.getLoc());
|
||||
|
||||
if (siegeMinion.parentZone != null)
|
||||
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
||||
}
|
||||
|
||||
try {
|
||||
siegeMinion.clearEffects();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
if (siegeMinion.parentZone != null)
|
||||
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
||||
|
||||
WorldGrid.RemoveWorldObject(siegeMinion);
|
||||
WorldGrid.removeObject(siegeMinion);
|
||||
DbManager.removeFromCache(siegeMinion);
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) siegeMinion.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
petOwner.setPet(null);
|
||||
|
||||
siegeMinion.guardCaptain = null;
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean removeMobileFromBuilding(Mob mobile, Building building) {
|
||||
|
||||
// Remove npc from it's building
|
||||
|
||||
try {
|
||||
mobile.clearEffects();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
if (mobile.parentZone != null)
|
||||
mobile.parentZone.zoneMobSet.remove(mobile);
|
||||
|
||||
if (building != null) {
|
||||
building.getHirelings().remove(mobile);
|
||||
removeSiegeMinions(mobile);
|
||||
}
|
||||
|
||||
// Delete npc from database
|
||||
|
||||
if (DbManager.MobQueries.DELETE_MOB(mobile) == 0)
|
||||
return false;
|
||||
|
||||
// Remove npc from the simulation
|
||||
|
||||
mobile.removeFromCache();
|
||||
DbManager.removeFromCache(mobile);
|
||||
WorldGrid.RemoveWorldObject(mobile);
|
||||
WorldGrid.removeObject(mobile);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void loadAllPirateNames() {
|
||||
|
||||
DbManager.NPCQueries.LOAD_PIRATE_NAMES();
|
||||
|
||||
Reference in New Issue
Block a user