diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index 545e4060..0812058a 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -54,7 +54,7 @@ public enum ForgeManager implements Runnable { // Resubmit workOrder - workOrder.completionTime = System.currentTimeMillis() + 10000; + workOrder.rollingDuration = System.currentTimeMillis() + 10000; workOrder.total_to_produce = workOrder.total_to_produce - 1; workOrders.add(workOrder); @@ -76,7 +76,7 @@ public enum ForgeManager implements Runnable { public static void submit(WorkOrder workOrder) { workOrder.workOrderID = wordOrderCounter.incrementAndGet(); - workOrder.completionTime = System.currentTimeMillis() + 10000; + workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; // 0 signifies single item roll. > 0 signifies multiple item roll. @@ -90,4 +90,22 @@ public enum ForgeManager implements Runnable { return true; } + + public static long calcRollingDuration(WorkOrder workOrder) { + + long rollingDuration; + float rank = workOrder.vendor.getBuilding().getRank() - 1; + float rate = (float) (2.5 * rank); + float baseTime = (20 - rate) * 60000; + + // Bane circles + + if (workOrder.templateID > 910010 && workOrder.templateID < 910019) { + rank = workOrder.templateID - 910010; + baseTime = rank * 60 * 60 * 3 * 1000; + } + + rollingDuration = (long) (baseTime * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())); + return rollingDuration; + } } diff --git a/src/engine/loot/WorkOrder.java b/src/engine/loot/WorkOrder.java index 3ba418ad..c3677bf8 100644 --- a/src/engine/loot/WorkOrder.java +++ b/src/engine/loot/WorkOrder.java @@ -27,6 +27,7 @@ public class WorkOrder implements Delayed { public int prefixToken; public int suffixToken; public boolean isRandom; + public long rollingDuration; public long completionTime; public boolean runCompleted; diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 836fb0b1..2da4d985 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -86,6 +86,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { workOrder.prefixToken = msg.pToken; workOrder.suffixToken = msg.sToken; workOrder.itemName = msg.name; + workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder); // Validate vendor can roll this item