Browse Source

Comment cleanup

combat-2
MagicBot 8 months ago
parent
commit
4123157b92
  1. 22
      src/engine/gameManager/ForgeManager.java

22
src/engine/gameManager/ForgeManager.java

@ -73,7 +73,7 @@ public enum ForgeManager implements Runnable {
if (workOrder.total_produced >= workOrder.total_to_produce) { if (workOrder.total_produced >= workOrder.total_to_produce) {
// Set items as completed in the window. // Set items as completed in the window.
// CONFIRM_PRODUCE used to refresh item to the interface. // CONFIRM_PRODUCE to refresh item in the interface.
for (Item workOrderItem : workOrder.cooking) { for (Item workOrderItem : workOrder.cooking) {
workOrderItem.flags.add(mbEnums.ItemFlags.Identified); workOrderItem.flags.add(mbEnums.ItemFlags.Identified);
@ -81,20 +81,19 @@ public enum ForgeManager implements Runnable {
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
} }
workOrder.runCompleted.set(true); // Set to completed and update workOrder on disk
// Update workOrder on disk
workOrder.runCompleted.set(true);
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder); DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
continue; continue;
} }
// PERSIST current cooking batch and move // PERSIST current cooking batch of virtual
// our new items to vendor inventory // item then add to the vendor inventory
completeWorkOrderBatch(workOrder); completeWorkOrderBatch(workOrder);
// Create a new set of in-memory only virtual items // Create new set of in-memory only virtual items
forgeWorkOrderBatch(workOrder); forgeWorkOrderBatch(workOrder);
@ -143,9 +142,9 @@ public enum ForgeManager implements Runnable {
if (validation_result != 0) if (validation_result != 0)
return validation_result; return validation_result;
try {
// Configure this production run. // Configure this production run.
try {
workOrder.workOrderID = workOrderCounter.incrementAndGet(); workOrder.workOrderID = workOrderCounter.incrementAndGet();
workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder); workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder);
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
@ -161,14 +160,14 @@ public enum ForgeManager implements Runnable {
if (workOrder.multiple_slot_request == false && workOrder.total_to_produce == 0) if (workOrder.multiple_slot_request == false && workOrder.total_to_produce == 0)
workOrder.total_to_produce = 1; workOrder.total_to_produce = 1;
// Set total cost for production run // Calculate total cost for this production run
workOrder.total_to_produce *= workOrder.slots_used.get(); workOrder.total_to_produce *= workOrder.slots_used.get();
workOrder.production_cost = calcProductionCost(workOrder); workOrder.production_cost = calcProductionCost(workOrder);
workOrder.production_cost.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce)); workOrder.production_cost.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
// Withdraw gold and resource costs. Availability has previously been validated. // Withdraw gold and resources. Availability has previously been validated.
if (!WorkOrder.withdrawWorkOrderCost(workOrder)) if (!WorkOrder.withdrawWorkOrderCost(workOrder))
return 58; //58: The formula is beyond the means of this facility return 58; //58: The formula is beyond the means of this facility
@ -208,7 +207,7 @@ public enum ForgeManager implements Runnable {
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
// Bane circles // Bane circle special case
if (template.item_bane_rank > 0) if (template.item_bane_rank > 0)
rollingDuration = (long) template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()); rollingDuration = (long) template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
@ -379,7 +378,6 @@ public enum ForgeManager implements Runnable {
// Write updated workOrder to disk // Write updated workOrder to disk
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder); DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
} }
public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) { public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) {

Loading…
Cancel
Save