diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index bb5ceab2..4586c408 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -479,7 +479,7 @@ public enum BuildingManager { } - public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Vector3fImmutable NpcLoc, Zone zone, Contract contract, Item item) { + public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Zone zone, Contract contract, Item item) { int rank = 1; @@ -500,7 +500,7 @@ public enum BuildingManager { if (NPC.ISWallArcher(contract)) { - mob = Mob.createMob( contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank * 10); + mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank * 10); if (mob == null) return false; @@ -511,9 +511,10 @@ public enum BuildingManager { MovementManager.translocate(mob, mob.getBindLoc(), mob.region); return true; } + if (NPC.ISGuardCaptain(contract.getContractID())) { - mob = Mob.createMob(contract.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank); + mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank); if (mob == null) return false; @@ -523,12 +524,7 @@ public enum BuildingManager { return true; } - // NPC in a Building derives position from slot - - if (building != null) - NpcLoc = Vector3fImmutable.ZERO; - - npc = NPC.createNPC(pirateName, contract.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building); + npc = NPC.createNPC(pirateName, contract.getObjectUUID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), false, zone, (short) rank, false, building); if (npc == null) return false; diff --git a/src/engine/net/client/handlers/ActivateNPCMsgHandler.java b/src/engine/net/client/handlers/ActivateNPCMsgHandler.java index 1701f85c..f1e2532a 100644 --- a/src/engine/net/client/handlers/ActivateNPCMsgHandler.java +++ b/src/engine/net/client/handlers/ActivateNPCMsgHandler.java @@ -4,7 +4,6 @@ import engine.Enum; import engine.Enum.ItemType; import engine.exception.MsgSendException; import engine.gameManager.*; -import engine.math.Vector3fImmutable; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; @@ -79,8 +78,6 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler { if (building.getBlueprint().getMaxSlots() == building.getHirelings().size()) return false; - Vector3fImmutable NpcLoc = new Vector3fImmutable(building.getLoc()); - Item contractItem = Item.getFromCache(msg.getContractItem()); if (contractItem == null) @@ -93,7 +90,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler { itemMan = player.getCharItemManager(); - zone = ZoneManager.findSmallestZone(NpcLoc); + zone = ZoneManager.findSmallestZone(building.getLoc()); if (zone == null) return false; @@ -108,7 +105,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler { if (contract.canSlotinBuilding(building) == false) return false; - if (!BuildingManager.addHireling(building, player, NpcLoc, zone, contract, contractItem)) + if (!BuildingManager.addHireling(building, player, zone, contract, contractItem)) return false; itemMan.delete(contractItem);