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

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

@ -16,6 +16,7 @@ import engine.Enum.ItemType; @@ -16,6 +16,7 @@ import engine.Enum.ItemType;
import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.loot.WorkOrder;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@ -455,9 +456,17 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -455,9 +456,17 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
switch (msg.getActionType()) {
case ACTION_PRODUCE:
boolean isRandom = false;
if (msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0)
isRandom = true;
boolean isRandom = msg.getUnknown03() != 0 && msg.getpToken() == 0 && msg.getsToken() == 0;
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
if (msg.isMultiple()) {
int emptySlots = vendorNPC.getRank() - vendorNPC.getRolling().size();

Loading…
Cancel
Save