// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2022 // www.magicbane.com package engine.loot; import engine.mbEnums; import engine.objects.Item; import engine.objects.NPC; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; import static java.lang.Math.toIntExact; public class WorkOrder implements Delayed { public int workOrderID; public NPC vendor; public int slotCount; public int total_to_produce; public int total_produced; public HashMap production_cost = new HashMap<>(); public HashMap production_cost_total = new HashMap<>(); public int templateID; public String itemName; public int prefixToken; public int suffixToken; public long rollingDuration; public long completionTime; public boolean runCompleted = false; public boolean runCanceled = false; public ArrayList cooking = new ArrayList<>(); public WorkOrder() { } @Override public long getDelay(TimeUnit unit) { long timeRemaining = completionTime - System.currentTimeMillis(); return unit.convert(timeRemaining, TimeUnit.MILLISECONDS); } @Override public int compareTo(@NotNull Delayed o) { return toIntExact(this.completionTime - ((WorkOrder) o).completionTime); } public String toString() { LocalDateTime localDateTime = Instant.ofEpochMilli(this.completionTime) .atZone(ZoneId.systemDefault()).toLocalDateTime(); Duration duration = Duration.ofMillis(38114000); String outSTring = "\r\nwordOrderID: " + this.workOrderID + "\r\n" + "vendor: " + this.vendor.getObjectUUID() + "\r\n" + "slotCount: " + this.slotCount + "\r\n" + "total_to_produce: " + this.total_to_produce + "\r\n" + "total_produced: " + this.total_produced + "\r\n" + "templateID: " + this.templateID + "\r\n" + "itemName: " + this.itemName + "\r\n" + "prefixToken: " + this.prefixToken + "\r\n" + "suffixToken: " + this.suffixToken + "\r\n" + "rollingDuration: " + duration + "\r\n" + "completionTime: " + localDateTime + "\r\n" + "runCompleted: " + this.runCompleted + "\r\n" + "runCanceled: " + this.runCanceled + "\r\n"; return outSTring; } }