public static int getMaxLevel() { if (max == -1) { LevelTier tier = values()[values().length - 1]; max = getNumber(tier, tier.getSub()); } return max; }
public static int getSubFromNumber(int num) { for (LevelTier tier : values()) { if (tier.getSub() < num) { num -= tier.getSub(); continue; } return num; } return -1; }
public static LevelTier getTierFromNumber(int num) { for (LevelTier tier : values()) { if (tier.getSub() < num) { num -= tier.getSub(); continue; } return tier; } return null; }
public static int getNumber(LevelTier tier, int sub) { int ret = 0; for (int i = 0; i < tier.ordinal(); i++) { ret += values()[i].getSub(); } ret += sub; return ret; }