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

89 lines
3.3 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-10 16:06:09 -04:00
import engine.mbEnums;
2024-04-14 16:29:17 -04:00
import engine.objects.Item;
2024-04-05 20:13:16 -04:00
import engine.objects.NPC;
2024-04-13 07:18:55 -04:00
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
2024-04-14 16:29:17 -04:00
import java.util.ArrayList;
2024-04-10 16:06:09 -04:00
import java.util.HashMap;
2024-04-05 20:13:16 -04:00
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
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;
2024-04-13 07:54:26 -04:00
public int slots_used;
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;
public boolean multiple_slot_request;
2024-04-10 16:06:09 -04:00
public HashMap<mbEnums.ResourceType, Integer> production_cost = new HashMap<>();
2024-04-10 16:47:02 -04:00
public HashMap<mbEnums.ResourceType, Integer> production_cost_total = new HashMap<>();
2024-04-05 20:14:29 -04:00
public int templateID;
2024-04-13 07:54:26 -04:00
public String item_name_override;
2024-04-05 20:13:16 -04:00
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-14 16:29:17 -04:00
public ArrayList<Item> cooking = new ArrayList<>();
2024-04-08 04:46:54 -04:00
2024-04-05 20:13:16 -04:00
public WorkOrder() {
}
2024-04-20 15:58:01 -04:00
public WorkOrder(String json) {
}
2024-04-05 20:13:16 -04:00
@Override
public long getDelay(TimeUnit unit) {
long timeRemaining = completionTime - System.currentTimeMillis();
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
}
@Override
2024-04-13 07:31:17 -04:00
public int compareTo(Delayed o) {
return Long.compare(this.completionTime, ((WorkOrder) o).completionTime);
2024-04-05 20:13:16 -04:00
}
2024-04-08 16:42:44 -04:00
public String toString() {
2024-04-13 07:18:55 -04:00
LocalDateTime localDateTime = Instant.ofEpochMilli(this.completionTime)
.atZone(ZoneId.systemDefault()).toLocalDateTime();
2024-04-13 07:26:39 -04:00
Duration duration = Duration.ofMillis(this.rollingDuration);
2024-04-13 07:18:55 -04:00
2024-04-08 16:58:07 -04:00
String outSTring = "\r\nwordOrderID: " + this.workOrderID + "\r\n" +
2024-04-08 16:49:19 -04:00
"vendor: " + this.vendor.getObjectUUID() + "\r\n" +
2024-04-13 07:54:26 -04:00
"slots_used: " + this.slots_used + "\r\n" +
2024-04-08 16:49:19 -04:00
"total_to_produce: " + this.total_to_produce + "\r\n" +
"total_produced: " + this.total_produced + "\r\n" +
"templateID: " + this.templateID + "\r\n" +
2024-04-13 07:54:26 -04:00
"item_name_override: " + this.item_name_override + "\r\n" +
2024-04-08 16:49:19 -04:00
"prefixToken: " + this.prefixToken + "\r\n" +
"suffixToken: " + this.suffixToken + "\r\n" +
2024-04-13 07:18:55 -04:00
"rollingDuration: " + duration + "\r\n" +
"completionTime: " + localDateTime + "\r\n" +
2024-04-08 16:49:19 -04:00
"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
}