Browse Source

New method implemented.

combat-2
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 { @@ -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 { @@ -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 { @@ -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;
}
}

Loading…
Cancel
Save