Workorder and Forgemanger classes created
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
package engine.loot;
|
||||
|
||||
import engine.gameManager.ForgeManager;
|
||||
import engine.objects.NPC;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.lang.Math.toIntExact;
|
||||
|
||||
public class WorkOrder implements Delayed {
|
||||
|
||||
public int workOrder;
|
||||
public NPC vendor;
|
||||
public int slotCount;
|
||||
public int itemCount;
|
||||
public int itemBase;
|
||||
public String itemName;
|
||||
public int prefixToken;
|
||||
public int suffixToken;
|
||||
public boolean isRandom;
|
||||
public long completionTime;
|
||||
public boolean runCompleted;
|
||||
|
||||
public WorkOrder() {
|
||||
|
||||
this.workOrder = ForgeManager.workOrder.incrementAndGet();
|
||||
this.completionTime = System.currentTimeMillis() + 10000;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user