|
|
|
@ -11,12 +11,13 @@ package engine.loot;
@@ -11,12 +11,13 @@ package engine.loot;
|
|
|
|
|
import engine.mbEnums; |
|
|
|
|
import engine.objects.Item; |
|
|
|
|
import engine.objects.NPC; |
|
|
|
|
import org.json.simple.JSONValue; |
|
|
|
|
import org.json.simple.JSONObject; |
|
|
|
|
|
|
|
|
|
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.ConcurrentHashMap; |
|
|
|
|
import java.util.concurrent.Delayed; |
|
|
|
@ -50,10 +51,35 @@ public class WorkOrder implements Delayed {
@@ -50,10 +51,35 @@ public class WorkOrder implements Delayed {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String toJson(WorkOrder workOrder) { |
|
|
|
|
public static JSONObject toJson(WorkOrder workOrder) { |
|
|
|
|
|
|
|
|
|
String jsonString = JSONValue.toJSONString(workOrder); |
|
|
|
|
return jsonString; |
|
|
|
|
JSONObject jsonWorkOrder = new JSONObject(); |
|
|
|
|
|
|
|
|
|
jsonWorkOrder.put("jsonWorkOrder", workOrder.workOrderID); |
|
|
|
|
jsonWorkOrder.put("vendor", workOrder.vendor.getObjectUUID()); |
|
|
|
|
jsonWorkOrder.put("slots_used", workOrder.slots_used); |
|
|
|
|
jsonWorkOrder.put("total_to_produce", workOrder.total_to_produce); |
|
|
|
|
jsonWorkOrder.put("total_produced", workOrder.total_produced); |
|
|
|
|
jsonWorkOrder.put("multiple_slot_request", workOrder.multiple_slot_request); |
|
|
|
|
jsonWorkOrder.put("production_cost", workOrder.production_cost); |
|
|
|
|
jsonWorkOrder.put("production_cost_total", workOrder.production_cost_total); |
|
|
|
|
jsonWorkOrder.put("templateID", workOrder.templateID); |
|
|
|
|
jsonWorkOrder.put("item_name_override", workOrder.item_name_override); |
|
|
|
|
jsonWorkOrder.put("prefixToken", workOrder.prefixToken); |
|
|
|
|
jsonWorkOrder.put("suffixToken", workOrder.suffixToken); |
|
|
|
|
jsonWorkOrder.put("rollingDuration", workOrder.rollingDuration); |
|
|
|
|
jsonWorkOrder.put("completionTime", workOrder.completionTime); |
|
|
|
|
jsonWorkOrder.put("runCompleted", workOrder.runCompleted); |
|
|
|
|
|
|
|
|
|
ArrayList<Integer[]> cookingTokens = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (Item item : workOrder.cooking) |
|
|
|
|
cookingTokens.add(new Integer[]{item.prefixToken, item.suffixToken}); |
|
|
|
|
|
|
|
|
|
jsonWorkOrder.put("cookingTokens", cookingTokens); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return jsonWorkOrder; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|