Browse Source

Begin adding workOrder logic

combat-2
MagicBot 9 months ago
parent
commit
d539e419fe
  1. 9
      src/engine/gameManager/ForgeManager.java
  2. 5
      src/engine/loot/WorkOrder.java
  3. 5
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

9
src/engine/gameManager/ForgeManager.java

@ -18,7 +18,7 @@ public enum ForgeManager implements Runnable {
FORGE_MANAGER; FORGE_MANAGER;
private final BlockingQueue<WorkOrder> workOrders = new DelayQueue(); private static final BlockingQueue<WorkOrder> workOrders = new DelayQueue();
public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); public static final AtomicInteger wordOrderCounter = new AtomicInteger(0);
@Override @Override
@ -60,8 +60,13 @@ public enum ForgeManager implements Runnable {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
public static void submit(WorkOrder workOrder) {
workOrder.workOrderID = wordOrderCounter.incrementAndGet();
workOrder.completionTime = System.currentTimeMillis() + 10000;
workOrders.add(workOrder);
} }
} }

5
src/engine/loot/WorkOrder.java

@ -8,7 +8,6 @@
package engine.loot; package engine.loot;
import engine.gameManager.ForgeManager;
import engine.objects.NPC; import engine.objects.NPC;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -19,7 +18,7 @@ import static java.lang.Math.toIntExact;
public class WorkOrder implements Delayed { public class WorkOrder implements Delayed {
public int workOrder; public int workOrderID;
public NPC vendor; public NPC vendor;
public int slotCount; public int slotCount;
public int itemCount; public int itemCount;
@ -33,8 +32,6 @@ public class WorkOrder implements Delayed {
public WorkOrder() { public WorkOrder() {
this.workOrder = ForgeManager.wordOrderCounter.incrementAndGet();
this.completionTime = System.currentTimeMillis() + 10000;
} }
@Override @Override

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

@ -13,6 +13,7 @@ package engine.net.client.handlers;
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.mbEnums; import engine.mbEnums;
import engine.mbEnums.GameObjectType; import engine.mbEnums.GameObjectType;
import engine.mbEnums.ItemType; import engine.mbEnums.ItemType;
@ -75,6 +76,10 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (msg.unknown03 != 0 && msg.pToken == 0 && msg.sToken == 0) if (msg.unknown03 != 0 && msg.pToken == 0 && msg.sToken == 0)
isRandom = true; isRandom = true;
// Create new work order
WorkOrder workOrder = new WorkOrder();
//Create Multiple Item Function.. Fill all empty slots //Create Multiple Item Function.. Fill all empty slots
if (msg.size > 0) { if (msg.size > 0) {

Loading…
Cancel
Save