New rolling duration method moved to manager singleton.
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static engine.math.FastMath.acos;
|
||||
|
||||
@@ -530,4 +531,25 @@ public enum NPCManager {
|
||||
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public static long calcRollingDuration(NPC vendor, int templateID) {
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||
float rollingDuration;
|
||||
|
||||
if (template == null)
|
||||
return 0;
|
||||
|
||||
if (template.item_bane_rank > 0)
|
||||
return (long) (template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||
|
||||
if (vendor.building == null)
|
||||
return 600;
|
||||
|
||||
rollingDuration = vendor.getBuilding().getRank() * -5L + 40;
|
||||
rollingDuration = TimeUnit.MINUTES.toMillis((long) rollingDuration);
|
||||
rollingDuration *= Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
return (long) rollingDuration;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user