forked from MagicBane/Server
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							74 lines
						
					
					
						
							2.8 KiB
						
					
					
				
			
		
		
	
	
							74 lines
						
					
					
						
							2.8 KiB
						
					
					
				// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ . | 
						|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· | 
						|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ | 
						|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ | 
						|
// ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀ | 
						|
//      Magicbane Emulator Project © 2013 - 2022 | 
						|
//                www.magicbane.com | 
						|
 | 
						|
package engine.loot; | 
						|
 | 
						|
import engine.objects.Item; | 
						|
import engine.objects.NPC; | 
						|
import org.jetbrains.annotations.NotNull; | 
						|
 | 
						|
import java.util.ArrayList; | 
						|
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 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<Item> 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() { | 
						|
        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: " + this.rollingDuration + "\r\n" + | 
						|
                "completionTime: " + this.completionTime + "\r\n" + | 
						|
                "runCompleted: " + this.runCompleted + "\r\n" + | 
						|
                "runCanceled: " + this.runCanceled + "\r\n"; | 
						|
 | 
						|
        return outSTring; | 
						|
    } | 
						|
 | 
						|
}
 | 
						|
 |