| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -23,7 +23,10 @@ import org.pmw.tinylog.Logger; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.ArrayList; | 
					 | 
					 | 
					 | 
					import java.util.ArrayList; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.HashMap; | 
					 | 
					 | 
					 | 
					import java.util.HashMap; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.concurrent.*; | 
					 | 
					 | 
					 | 
					import java.util.concurrent.BlockingQueue; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.concurrent.ConcurrentHashMap; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.concurrent.DelayQueue; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.concurrent.ThreadLocalRandom; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.concurrent.atomic.AtomicInteger; | 
					 | 
					 | 
					 | 
					import java.util.concurrent.atomic.AtomicInteger; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					public enum ForgeManager implements Runnable { | 
					 | 
					 | 
					 | 
					public enum ForgeManager implements Runnable { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -146,7 +149,7 @@ public enum ForgeManager implements Runnable { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        try { | 
					 | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            workOrder.workOrderID = workOrderCounter.incrementAndGet(); | 
					 | 
					 | 
					 | 
					            workOrder.workOrderID = workOrderCounter.incrementAndGet(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder); | 
					 | 
					 | 
					 | 
					            workOrder.rollingDuration = NPCManager.calcRollingDuration(workOrder.vendor, workOrder.templateID); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; | 
					 | 
					 | 
					 | 
					            workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            workOrder.slots_used.set(calcAvailableSlots(workOrder)); | 
					 | 
					 | 
					 | 
					            workOrder.slots_used.set(calcAvailableSlots(workOrder)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -197,24 +200,6 @@ public enum ForgeManager implements Runnable { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return validation_result; | 
					 | 
					 | 
					 | 
					        return validation_result; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public static long calcRollingDuration(WorkOrder workOrder) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        float rollingDuration; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        rollingDuration = workOrder.vendor.getBuilding().getRank() * -5L + 40; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        rollingDuration = TimeUnit.MINUTES.toMillis((long) rollingDuration); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        rollingDuration *= Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Bane circle special case
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (template.item_bane_rank > 0) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            rollingDuration = (long) template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return (long) rollingDuration; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public static int calcAvailableSlots(WorkOrder workOrder) { | 
					 | 
					 | 
					 | 
					    public static int calcAvailableSlots(WorkOrder workOrder) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Slots available in a forge are based on the npc rank
 | 
					 | 
					 | 
					 | 
					        // Slots available in a forge are based on the npc rank
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |