aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/utils
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-04-28 18:17:46 +0900
committersyeyoung <cyong06@naver.com>2021-04-28 18:17:46 +0900
commit29883f9da7d79af34d5c4513678d75d626a7709b (patch)
treeb42b251585e14e6b9a25bbc7d4bbf49f3de38309 /src/main/java/kr/syeyoung/dungeonsguide/utils
parent3b4d4a96f7b246ee3d07f82a78c1e9cf5de91300 (diff)
downloadSkyblock-Dungeons-Guide-29883f9da7d79af34d5c4513678d75d626a7709b.tar.gz
Skyblock-Dungeons-Guide-29883f9da7d79af34d5c4513678d75d626a7709b.tar.bz2
Skyblock-Dungeons-Guide-29883f9da7d79af34d5c4513678d75d626a7709b.zip
ok done
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/utils')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java31
1 files changed, 23 insertions, 8 deletions
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<Double, Integer> 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<Double, Integer> asdasd = catacombXp.ceilingEntry(totalXp);
xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey();
return xpCalcResult;
@@ -171,17 +176,27 @@ public class XPUtils {
case RUNECRAFTING:
Map.Entry<Double, Integer> totalXpEn = skillXp2.floorEntry(totalXp);
XPCalcResult xpCalcResult = new XPCalcResult();
- xpCalcResult.level = totalXpEn.getValue();
- xpCalcResult.remainingXp = totalXp - totalXpEn.getKey();
- Map.Entry<Double, Integer> 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<Double, Integer> 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;
}