Browse Source

Cleanup of cache usage

combat-2
MagicBot 9 months ago
parent
commit
673f606de8
  1. 8
      src/engine/gameManager/ForgeManager.java
  2. 4
      src/engine/loot/WorkOrder.java

8
src/engine/gameManager/ForgeManager.java

@ -287,10 +287,16 @@ public enum ForgeManager implements Runnable {
for (int i = 0; i < workOrder.slots_used; ++i) { for (int i = 0; i < workOrder.slots_used; ++i) {
Item forged_item = forgeItem(workOrder); Item forged_item = forgeItem(workOrder);
// Add item to in-memory caches
ForgeManager.inMemoryItemLookup.put(forged_item.objectUUID, forged_item); ForgeManager.inMemoryItemLookup.put(forged_item.objectUUID, forged_item);
workOrder.cooking.add(forged_item); ForgeManager.vendorItemLookup.computeIfAbsent(workOrder.vendor, k -> new ArrayList<>());
ForgeManager.vendorItemLookup.get(workOrder.vendor).add(forged_item);
vendorItemLookup.get(workOrder.vendor).add(forged_item); vendorItemLookup.get(workOrder.vendor).add(forged_item);
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
Logger.info("Forging item: " + forged_item.objectUUID + " (" + forged_item.templateID + ") " + forged_item.template.item_base_name); Logger.info("Forging item: " + forged_item.objectUUID + " (" + forged_item.templateID + ") " + forged_item.template.item_base_name);
workOrder.total_produced = workOrder.total_produced + 1; workOrder.total_produced = workOrder.total_produced + 1;

4
src/engine/loot/WorkOrder.java

@ -9,14 +9,12 @@
package engine.loot; package engine.loot;
import engine.mbEnums; import engine.mbEnums;
import engine.objects.Item;
import engine.objects.NPC; import engine.objects.NPC;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.Delayed; import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -40,8 +38,6 @@ public class WorkOrder implements Delayed {
public boolean runCompleted = false; public boolean runCompleted = false;
public boolean runCanceled = false; public boolean runCanceled = false;
public ArrayList<Item> cooking = new ArrayList<>();
public WorkOrder() { public WorkOrder() {
} }

Loading…
Cancel
Save