Browse Source

Framework for workorder creation.

feature-workorder
MagicBot 1 year ago
parent
commit
63fa98486b
  1. 9
      src/engine/loot/WorkOrder.java
  2. 15
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

9
src/engine/loot/WorkOrder.java

@ -9,6 +9,7 @@
package engine.loot; package engine.loot;
import engine.gameManager.ForgeManager; import engine.gameManager.ForgeManager;
import engine.objects.NPC;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Delayed; import java.util.concurrent.Delayed;
@ -19,11 +20,13 @@ import static java.lang.Math.toIntExact;
public class WorkOrder implements Delayed { public class WorkOrder implements Delayed {
public int workOrder; public int workOrder;
public int npcUUID; public NPC vendor;
public int slotCount; public int slotCount;
public int itemCount; public int itemCount;
public String prefix; public int itemBase;
public String suffix; public int prefixToken;
public int suffixToken;
public boolean isRandom;
public long completionTime; public long completionTime;
public boolean runCompleted; public boolean runCompleted;

15
src/engine/net/client/handlers/ItemProductionMsgHandler.java

@ -16,6 +16,7 @@ import engine.Enum.ItemType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.loot.WorkOrder;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
@ -455,9 +456,17 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
switch (msg.getActionType()) { switch (msg.getActionType()) {
case ACTION_PRODUCE: case ACTION_PRODUCE:
boolean isRandom = false;
if (msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0) boolean isRandom = msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0;
isRandom = true;
WorkOrder workOrder = new WorkOrder();
workOrder.vendor = vendorNPC;
workOrder.isRandom = isRandom;
workOrder.itemBase = msg.getItemUUID();
workOrder.itemCount = msg.getTotalProduction();
workOrder.prefixToken = msg.getpToken();
workOrder.suffixToken = msg.getsToken();
//Create Multiple Item Function.. Fill all empty slots //Create Multiple Item Function.. Fill all empty slots
if (msg.isMultiple()) { if (msg.isMultiple()) {
int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size(); int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size();

Loading…
Cancel
Save