From dd46224afe4c2547a9ce4fabf1b9351a85c11a89 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 9 Sep 2023 08:44:00 -0400 Subject: [PATCH] New method implemented. --- .../client/handlers/OrderNPCMsgHandler.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/engine/net/client/handlers/OrderNPCMsgHandler.java b/src/engine/net/client/handlers/OrderNPCMsgHandler.java index ec62bd25..802e302d 100644 --- a/src/engine/net/client/handlers/OrderNPCMsgHandler.java +++ b/src/engine/net/client/handlers/OrderNPCMsgHandler.java @@ -37,7 +37,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler { super(OrderNPCMsg.class); } - public static void processRedeedMob(Mob mob, Building building, ClientConnection origin) { + public static void processRedeedHireling(Mob hireling, Building building, ClientConnection origin) { PlayerCharacter player; Contract contract; @@ -48,33 +48,28 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler { player = SessionManager.getPlayerCharacter(origin); itemMan = player.getCharItemManager(); - contract = mob.getContract(); + contract = hireling.getContract(); if (!player.getCharItemManager().hasRoomInventory((short) 1)) { ErrorPopupMsg.sendErrorPopup(player, 21); return; } - if (!building.getHirelings().containsKey(mob)) + if (!building.getHirelings().containsKey(hireling)) return; - if (!NPCManager.removeMobileFromBuilding(mob, building)) { - PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity"); - return; - } - - building.getHirelings().remove(mob); + BuildingManager.removeHireling(building, hireling); itemBase = ItemBase.getItemBase(contract.getContractID()); if (itemBase == null) { - Logger.error("Could not find Contract for npc: " + mob.getObjectUUID()); + Logger.error("Could not find Contract for npc: " + hireling.getObjectUUID()); return; } boolean itemWorked = false; - item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) mob.getRank() - 1), (byte) ((byte) mob.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), ""); + item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) hireling.getRank() - 1), (byte) ((byte) hireling.getRank() - 1), (short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0, new ArrayList<>(), ""); item.setNumOfItems(1); item.containerType = Enum.ItemContainerType.INVENTORY; @@ -299,7 +294,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler { break; case Mob: Mob mob = (Mob) abstractCharacter; - processRedeedMob(mob, mob.building, origin); + processRedeedHireling(mob, mob.building, origin); break; } }