Browse Source

rollingDuration fleshed out

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

22
src/engine/gameManager/ForgeManager.java

@ -54,7 +54,7 @@ public enum ForgeManager implements Runnable {
// Resubmit workOrder // Resubmit workOrder
workOrder.completionTime = System.currentTimeMillis() + 10000; workOrder.rollingDuration = System.currentTimeMillis() + 10000;
workOrder.total_to_produce = workOrder.total_to_produce - 1; workOrder.total_to_produce = workOrder.total_to_produce - 1;
workOrders.add(workOrder); workOrders.add(workOrder);
@ -76,7 +76,7 @@ public enum ForgeManager implements Runnable {
public static void submit(WorkOrder workOrder) { public static void submit(WorkOrder workOrder) {
workOrder.workOrderID = wordOrderCounter.incrementAndGet(); 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. // 0 signifies single item roll. > 0 signifies multiple item roll.
@ -90,4 +90,22 @@ public enum ForgeManager implements Runnable {
return true; 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;
}
} }

1
src/engine/loot/WorkOrder.java

@ -27,6 +27,7 @@ public class WorkOrder implements Delayed {
public int prefixToken; public int prefixToken;
public int suffixToken; public int suffixToken;
public boolean isRandom; public boolean isRandom;
public long rollingDuration;
public long completionTime; public long completionTime;
public boolean runCompleted; public boolean runCompleted;

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

@ -86,6 +86,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
workOrder.prefixToken = msg.pToken; workOrder.prefixToken = msg.pToken;
workOrder.suffixToken = msg.sToken; workOrder.suffixToken = msg.sToken;
workOrder.itemName = msg.name; workOrder.itemName = msg.name;
workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder);
// Validate vendor can roll this item // Validate vendor can roll this item

Loading…
Cancel
Save