Files
lakebane/src/engine/loot/WorkOrder.java
T

75 lines
2.7 KiB
Java
Raw Normal View History

2024-04-05 20:13:16 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.loot;
2024-04-08 04:42:44 -04:00
import engine.objects.Item;
2024-04-05 20:13:16 -04:00
import engine.objects.NPC;
import org.jetbrains.annotations.NotNull;
2024-04-08 04:42:44 -04:00
import java.util.ArrayList;
2024-04-05 20:13:16 -04:00
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
import static java.lang.Math.toIntExact;
public class WorkOrder implements Delayed {
2024-04-07 22:15:06 -04:00
public int workOrderID;
2024-04-05 20:13:16 -04:00
public NPC vendor;
public int slotCount;
2024-04-07 22:31:58 -04:00
public int total_to_produce;
2024-04-08 13:06:22 -04:00
public int total_produced;
2024-04-05 20:14:29 -04:00
public int templateID;
2024-04-05 20:13:16 -04:00
public String itemName;
public int prefixToken;
public int suffixToken;
2024-04-07 23:21:35 -04:00
public long rollingDuration;
2024-04-05 20:13:16 -04:00
public long completionTime;
2024-04-08 13:06:22 -04:00
public boolean runCompleted = false;
public boolean runCanceled = false;
2024-04-08 04:46:54 -04:00
2024-04-08 04:42:44 -04:00
public ArrayList<Item> cooking = new ArrayList<>();
2024-04-05 20:13:16 -04:00
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);
}
2024-04-08 16:42:44 -04:00
public String toString() {
2024-04-08 16:49:19 -04:00
String outSTring = "wordOrderID: " + 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: " + this.rollingDuration + "\r\n" +
"completionTime: " + this.completionTime + "\r\n" +
"runCompleted: " + this.runCompleted + "\r\n" +
"runCanceled: " + this.runCanceled + "\r\n";
2024-04-08 16:42:44 -04:00
return outSTring;
}
2024-04-05 20:13:16 -04:00
}