From 479e38e3f66508ca23b2a2c08e52237436428ba6 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 12 Apr 2024 17:06:42 -0400 Subject: [PATCH] Validation work --- src/engine/gameManager/ForgeManager.java | 15 +++++++++++++++ src/engine/net/Protocol.java | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index 9a22f064..2a78868f 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -10,6 +10,7 @@ package engine.gameManager; import engine.loot.WorkOrder; import engine.mbEnums; +import engine.net.client.msg.ErrorPopupMsg; import engine.objects.Item; import engine.objects.ItemTemplate; import engine.objects.PlayerCharacter; @@ -133,6 +134,20 @@ public enum ForgeManager implements Runnable { public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) { + ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); + + if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt)) { + if (playerCharacter != null) + ErrorPopupMsg.sendErrorPopup(playerCharacter, 30); //30: That person cannot carry that item + return false; + } + + if (!workOrder.vendor.getItemModTable().contains(((byte) template.modTable))) { + if (playerCharacter != null) + ErrorPopupMsg.sendErrorPopup(playerCharacter, 59); //59: This hireling does not have this formula + return false; + } + // use Warehouse.caclulateOverdraft(workorder) method return true; diff --git a/src/engine/net/Protocol.java b/src/engine/net/Protocol.java index 67adc7e1..ec9ef72e 100644 --- a/src/engine/net/Protocol.java +++ b/src/engine/net/Protocol.java @@ -340,7 +340,6 @@ public enum Protocol { } } - public static int FindNextValidOpcode(ByteBufferReader reader) { int startPos = reader.position(); int bytesLeft = reader.remaining();