From 29883f9da7d79af34d5c4513678d75d626a7709b Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 28 Apr 2021 18:17:46 +0900 Subject: ok done --- .../kr/syeyoung/dungeonsguide/utils/XPUtils.java | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/utils') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java index 9ac8ef09..ed23cd7e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java @@ -160,8 +160,13 @@ public class XPUtils { public static XPCalcResult getCataXp(double totalXp) { Map.Entry totalXpEn = catacombXp.floorEntry(totalXp); XPCalcResult xpCalcResult = new XPCalcResult(); - xpCalcResult.level = totalXpEn.getValue(); - xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + if (totalXpEn == null) { + xpCalcResult.setLevel(0); + xpCalcResult.remainingXp = totalXp; + } else { + xpCalcResult.level = totalXpEn.getValue(); + xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + } Map.Entry asdasd = catacombXp.ceilingEntry(totalXp); xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey(); return xpCalcResult; @@ -171,17 +176,27 @@ public class XPUtils { case RUNECRAFTING: Map.Entry totalXpEn = skillXp2.floorEntry(totalXp); XPCalcResult xpCalcResult = new XPCalcResult(); - xpCalcResult.level = totalXpEn.getValue(); - xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); - Map.Entry asdasd = skillXp2.ceilingEntry(totalXp); + if (totalXpEn == null) { + xpCalcResult.setLevel(0); + xpCalcResult.remainingXp = totalXp; + } else { + xpCalcResult.level = totalXpEn.getValue(); + xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + } + Map.Entry asdasd = catacombXp.ceilingEntry(totalXp); xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey(); return xpCalcResult; default: totalXpEn = skillXp.floorEntry(totalXp); xpCalcResult = new XPCalcResult(); - xpCalcResult.level = totalXpEn.getValue(); - xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); - asdasd = skillXp.ceilingEntry(totalXp); + if (totalXpEn == null) { + xpCalcResult.setLevel(0); + xpCalcResult.remainingXp = totalXp; + } else { + xpCalcResult.level = totalXpEn.getValue(); + xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + } + asdasd = catacombXp.ceilingEntry(totalXp); xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey(); return xpCalcResult; } -- cgit