Browse Source

New method implemented.

feature-workorder
MagicBot 1 year ago
parent
commit
dd46224afe
  1. 19
      src/engine/net/client/handlers/OrderNPCMsgHandler.java

19
src/engine/net/client/handlers/OrderNPCMsgHandler.java

@ -37,7 +37,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
super(OrderNPCMsg.class); 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; PlayerCharacter player;
Contract contract; Contract contract;
@ -48,33 +48,28 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
player = SessionManager.getPlayerCharacter(origin); player = SessionManager.getPlayerCharacter(origin);
itemMan = player.getCharItemManager(); itemMan = player.getCharItemManager();
contract = mob.getContract(); contract = hireling.getContract();
if (!player.getCharItemManager().hasRoomInventory((short) 1)) { if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
ErrorPopupMsg.sendErrorPopup(player, 21); ErrorPopupMsg.sendErrorPopup(player, 21);
return; return;
} }
if (!building.getHirelings().containsKey(mob)) if (!building.getHirelings().containsKey(hireling))
return; return;
if (!NPCManager.removeMobileFromBuilding(mob, building)) { BuildingManager.removeHireling(building, hireling);
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
return;
}
building.getHirelings().remove(mob);
itemBase = ItemBase.getItemBase(contract.getContractID()); itemBase = ItemBase.getItemBase(contract.getContractID());
if (itemBase == null) { if (itemBase == null) {
Logger.error("Could not find Contract for npc: " + mob.getObjectUUID()); Logger.error("Could not find Contract for npc: " + hireling.getObjectUUID());
return; return;
} }
boolean itemWorked = false; 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.setNumOfItems(1);
item.containerType = Enum.ItemContainerType.INVENTORY; item.containerType = Enum.ItemContainerType.INVENTORY;
@ -299,7 +294,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
break; break;
case Mob: case Mob:
Mob mob = (Mob) abstractCharacter; Mob mob = (Mob) abstractCharacter;
processRedeedMob(mob, mob.building, origin); processRedeedHireling(mob, mob.building, origin);
break; break;
} }
} }

Loading…
Cancel
Save