Browse Source

Validation work

combat-2
MagicBot 9 months ago
parent
commit
479e38e3f6
  1. 15
      src/engine/gameManager/ForgeManager.java
  2. 1
      src/engine/net/Protocol.java

15
src/engine/gameManager/ForgeManager.java

@ -10,6 +10,7 @@ package engine.gameManager; @@ -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 { @@ -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;

1
src/engine/net/Protocol.java

@ -340,7 +340,6 @@ public enum Protocol { @@ -340,7 +340,6 @@ public enum Protocol {
}
}
public static int FindNextValidOpcode(ByteBufferReader reader) {
int startPos = reader.position();
int bytesLeft = reader.remaining();

Loading…
Cancel
Save