aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java48
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java106
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java46
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java90
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java6
9 files changed, 243 insertions, 111 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java
index 16abf251..770b295a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java
@@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.CoreTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.DungeonTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.EssenceTaskLevel;
+import io.github.moulberry.notenoughupdates.profileviewer.level.task.EventTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.MiscTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.SkillRelatedTaskLevel;
import io.github.moulberry.notenoughupdates.profileviewer.level.task.SlayingTaskLevel;
@@ -61,6 +62,8 @@ public class LevelPage {
private final SlayingTaskLevel slayingTaskLevel;
private final StoryTaskLevel storyTaskLevel;
+ private final EventTaskLevel eventTaskLevel;
+
private static final ResourceLocation pv_levels = new ResourceLocation("notenoughupdates:pv_levels.png");
public LevelPage(GuiProfileViewer instance, BasicPage basicPage) {
@@ -75,6 +78,7 @@ public class LevelPage {
skillRelatedTaskLevel = new SkillRelatedTaskLevel(this);
slayingTaskLevel = new SlayingTaskLevel(this);
storyTaskLevel = new StoryTaskLevel(this);
+ eventTaskLevel = new EventTaskLevel(this);
}
public void drawPage(int mouseX, int mouseY) {
@@ -97,13 +101,14 @@ public class LevelPage {
JsonObject profileInfo = profile.getProfileInformation(profileId);
drawMainBar(skyblockLevel, mouseX, mouseY, guiLeft, guiTop);
- coreTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
dungeonTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
essenceTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
miscTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
skillRelatedTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
slayingTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
storyTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
+ eventTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
+ coreTaskLevel.drawTask(profileInfo, mouseX, mouseY, guiLeft, guiTop);
}
public void renderLevelBar(
@@ -175,14 +180,12 @@ public class LevelPage {
renderLevelBar(
"Level",
BasicPage.skull,
- guiLeft + 163,
- guiTop + 30,
+ guiLeft + 163, guiTop + 30,
110,
skyblockLevel,
- (skyblockLevel - (long) skyblockLevel) * 100,
+ Math.round((skyblockLevel - (long) skyblockLevel) * 100),
100,
- mouseX,
- mouseY,
+ mouseX, mouseY,
false,
Collections.emptyList()
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
index be333359..fde43cd1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
@@ -19,8 +19,9 @@
package io.github.moulberry.notenoughupdates.profileviewer.level.task;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -80,11 +81,18 @@ public class CoreTaskLevel {
}
// mp acc
- int sbXpGainedMp = levelPage.getProfile().getMagicalPower(levelPage.getProfileId());
+ int sbXpGainedMp = 0;
+ if (object.has("accessory_bag_storage")) {
+ sbXpGainedMp = object.getAsJsonObject("accessory_bag_storage").get("highest_magical_power").getAsInt();
+ }
// pets
- int petScore = PlayerStats.getPetScore(object);
+ int petScore = 0;
+ if (object.has("leveling") && object.getAsJsonObject("leveling").has("highest_pet_score")) {
+ petScore = object.getAsJsonObject("leveling").get("highest_pet_score").getAsInt();
+
+ }
int sbXpPetScore = petScore * coreTask.get("pet_score_xp").getAsInt();
// museum is not possible
@@ -116,13 +124,32 @@ public class CoreTaskLevel {
}
}
}
+
+ int sbXpBankUpgrades = 0;
+
+ JsonArray completedTasks = object.getAsJsonObject("leveling").get("completed_tasks").getAsJsonArray();
+ JsonObject bankUpgradesXp = coreTask.getAsJsonObject("bank_upgrades_xp");
+ for (JsonElement completedTask : completedTasks) {
+ String name = completedTask.getAsString();
+ if (bankUpgradesXp.has(name)) {
+ sbXpBankUpgrades += bankUpgradesXp.get(name).getAsInt();
+ }
+ }
+
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Skill Level Up",
sbXpGainedSkillLVL, coreTask.get("skill_level_up").getAsInt(), false
));
- lore.add(levelPage.buildLore("Museum Progression",
- 0, 0, false
+
+ int totalXp = sbXpGainedSkillLVL + sbXpGainedFairy +
+ sbXpCollection + sbXpMinionTier + sbXpBankUpgrades;
+
+ lore.add(levelPage.buildLore(
+ "Museum Progression",
+ 0,
+ 0,
+ false
));
lore.add(levelPage.buildLore(
"Fairy Soul",
@@ -141,21 +168,18 @@ public class CoreTaskLevel {
sbXpMinionTier, coreTask.get("craft_minions").getAsInt(), false
));
lore.add(levelPage.buildLore("Bank Upgrade",
- 0, 0, false
+ sbXpBankUpgrades, coreTask.get("bank_upgrades").getAsInt(), false
));
levelPage.renderLevelBar(
"Core Task",
new ItemStack(Items.nether_star),
- guiLeft + 23,
- guiTop + 25,
+ guiLeft + 23, guiTop + 25,
110,
0,
- sbXpGainedSkillLVL + sbXpGainedFairy +
- sbXpCollection + sbXpMinionTier,
+ totalXp,
levelPage.getConstant().getAsJsonObject("category_xp").get("core_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java
index 6f0a029f..6900cdf3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/DungeonTaskLevel.java
@@ -44,9 +44,9 @@ public class DungeonTaskLevel {
Map<String, ProfileViewer.Level> skyblockInfo =
levelPage.getProfile().getSkyblockInfo(levelPage.getProfileId());
- double sbLevelGainedFloor = 0;
- double sbXpGainedClass = 0;
- double sbXpGainedLvl = 0;
+ int sbLevelGainedFloor = 0;
+ int sbXpGainedClass = 0;
+ int sbXpGainedLvl = 0;
int catacombsLvl = 0;
if (skyblockInfo != null && skyblockInfo.containsKey("catacombs")) {
ProfileViewer.Level catacombs = skyblockInfo.get("catacombs");
@@ -105,20 +105,20 @@ public class DungeonTaskLevel {
lore.add(levelPage.buildLore("Class Level Up", sbXpGainedClass, classLevelUp, false));
lore.add(levelPage.buildLore("Complete Dungeons", sbLevelGainedFloor, completeDungeon, false));
+ int totalSbXpGain = sbXpGainedLvl + sbXpGainedClass + sbLevelGainedFloor;
+
levelPage.renderLevelBar(
"Dungeon Task",
NotEnoughUpdates.INSTANCE.manager
.createItemResolutionQuery()
.withKnownInternalName("WITHER_RELIC")
.resolveToItemStack(),
- guiLeft + 23,
- guiTop + 55,
+ guiLeft + 23, guiTop + 55,
110,
catacombsLvl,
totalXp,
totalGainful,
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
index 11e291b0..c6df6fc1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
@@ -25,6 +25,7 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
@@ -88,10 +89,15 @@ public class EssenceTaskLevel {
for (Map.Entry<String, EssenceShop> stringEssenceShopEntry : loreMap.entrySet()) {
String key = stringEssenceShopEntry.getKey();
EssenceShop value = stringEssenceShopEntry.getValue();
- value.name = NotEnoughUpdates.INSTANCE.manager
+ JsonObject jsonObject = NotEnoughUpdates.INSTANCE.manager
.createItemResolutionQuery()
.withKnownInternalName(key)
- .resolveToItemListJson()
+ .resolveToItemListJson();
+ if (jsonObject == null){
+ Utils.showOutdatedRepoNotification();
+ continue;
+ }
+ value.name = jsonObject
.get("displayname")
.getAsString();
String name = key.toLowerCase() + "_shop";
@@ -111,14 +117,12 @@ public class EssenceTaskLevel {
NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery()
.withKnownInternalName("ESSENCE_WITHER")
.resolveToItemStack(),
- guiLeft + 299,
- guiTop + 25,
+ guiLeft + 299, guiTop + 25,
110,
total,
total,
categoryXp.get("essence_shop_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
new file mode 100644
index 00000000..04ace872
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.profileviewer.level.task;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class EventTaskLevel {
+
+ private final LevelPage levelPage;
+
+ public EventTaskLevel(LevelPage levelPage) {this.levelPage = levelPage;}
+
+ public void drawTask(JsonObject object, int mouseX, int mouseY, int guiLeft, int guiTop) {
+ List<String> lore = new ArrayList<>();
+
+ int sbXpMiningFiesta = 0;
+ int sbXpFishingFestival = 0;
+ int sbXpSpookyFestival = 0;
+ JsonObject constant = levelPage.getConstant();
+ JsonObject eventTask = constant.getAsJsonObject("event_task");
+
+ if (object.has("leveling")) {
+ JsonObject leveling = object.getAsJsonObject("leveling");
+ int miningFiestaOresMined = 0;
+ int fishingFestivalSharksKilled = 0;
+ if (leveling.has("mining_fiesta_ores_mined"))
+ miningFiestaOresMined = leveling.get("mining_fiesta_ores_mined").getAsInt();
+ if (leveling.has("fishing_festival_sharks_killed")) fishingFestivalSharksKilled = leveling.get(
+ "fishing_festival_sharks_killed").getAsInt();
+
+ sbXpMiningFiesta = getCapOrAmount(miningFiestaOresMined, 1_000_000, 5_000);
+ sbXpFishingFestival = getCapOrAmount(fishingFestivalSharksKilled, 5_000, 50);
+
+ JsonArray completedTasks = leveling.get("completed_tasks").getAsJsonArray();
+ JsonObject spookyFestivalXp = eventTask.getAsJsonObject("spooky_festival_xp");
+ for (JsonElement completedTask : completedTasks) {
+ String name = completedTask.getAsString();
+ if (spookyFestivalXp.has(name)) {
+ sbXpSpookyFestival += spookyFestivalXp.get(name).getAsInt();
+ }
+ }
+ }
+
+ lore.add(levelPage.buildLore("Mining Fiesta", sbXpMiningFiesta, eventTask.get("mining_fiesta").getAsInt(), false));
+ lore.add(levelPage.buildLore(
+ "Fishing Festival",
+ sbXpFishingFestival,
+ eventTask.get("fishing_festival").getAsInt(),
+ false
+ ));
+ lore.add(levelPage.buildLore(
+ "Spooky Festival",
+ sbXpSpookyFestival,
+ eventTask.get("spooky_festival").getAsInt(),
+ false
+ ));
+
+ int totalXp = sbXpMiningFiesta + sbXpSpookyFestival +
+ sbXpFishingFestival;
+ levelPage.renderLevelBar(
+ "Event Task",
+ new ItemStack(Items.clock),
+ guiLeft + 299, guiTop + 115,
+ 110,
+ 0,
+ totalXp,
+ levelPage.getConstant().getAsJsonObject("category_xp").get("event_task").getAsInt(),
+ mouseX, mouseY,
+ true,
+ lore
+ );
+ }
+
+ private int getCapOrAmount(int miningFiestaOresMined, int cap, int per) {
+ if (miningFiestaOresMined == 0) return 0;
+ if (miningFiestaOresMined > cap) {
+ return cap / per;
+ }
+ return miningFiestaOresMined / per;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
index e0ea89b3..8b7b9d2b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
@@ -27,12 +27,13 @@ import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
public class MiscTaskLevel {
@@ -86,24 +87,27 @@ public class MiscTaskLevel {
}
// abiphone
- if (netherIslandPlayerData.has("abiphone")) {
- JsonObject abiphone = netherIslandPlayerData.getAsJsonObject("abiphone");
- if (abiphone.has("active_contacts")) sbXpAbiphone =
- abiphone.getAsJsonArray("active_contacts").size() * miscellaneousTask.get("abiphone_contacts_xp").getAsInt();
+ JsonObject leveling = object.getAsJsonObject("leveling");
+ JsonArray completedTask = leveling.get("completed_tasks").getAsJsonArray();
+ Stream<JsonElement> stream = StreamSupport.stream(completedTask.spliterator(), true);
+ long activeContacts = stream.map(JsonElement::getAsString).filter(s -> s.startsWith("ABIPHONE_")).count();
+ JsonObject abiphone = netherIslandPlayerData.getAsJsonObject("abiphone");
+ if (abiphone.has("active_contacts")) {
+ sbXpAbiphone = (int) activeContacts * miscellaneousTask.get("abiphone_contacts_xp").getAsInt();
}
}
// harp
int sbXpGainedHarp = 0;
JsonObject harpSongsNames = miscellaneousTask.get("harp_songs_names").getAsJsonObject();
- if (object.has("harp_quest")) {
- JsonObject harpQuest = object.get("harp_quest").getAsJsonObject();
- for (Map.Entry<String, JsonElement> stringJsonElementEntry : harpSongsNames.entrySet()) {
- String key = stringJsonElementEntry.getKey();
- int value = stringJsonElementEntry.getValue().getAsInt();
- if (harpQuest.has(key)) {
- sbXpGainedHarp += value;
- }
+
+ JsonObject leveling = object.get("leveling").getAsJsonObject();
+ if (leveling.has("completed_tasks")) {
+ JsonArray completedTasks = leveling.get("completed_tasks").getAsJsonArray();
+ for (JsonElement completedTask : completedTasks) {
+ String name = completedTask.getAsString();
+ String harpName = name.substring(0, name.lastIndexOf("_"));
+ if(harpSongsNames.has(harpName))sbXpGainedHarp += harpSongsNames.get(harpName).getAsInt() / 4;
}
}
@@ -158,10 +162,10 @@ public class MiscTaskLevel {
sbXpDojo, miscellaneousTask.get("the_dojo").getAsInt(), false
));
lore.add(levelPage.buildLore(
- EnumChatFormatting.ITALIC + "Harp Songs",
+ "Harp Songs",
sbXpGainedHarp, miscellaneousTask.get("harp_songs").getAsInt(), false
));
- lore.add(levelPage.buildLore(EnumChatFormatting.ITALIC + "Abiphone Contacts",
+ lore.add(levelPage.buildLore("Abiphone Contacts",
sbXpAbiphone, miscellaneousTask.get("abiphone_contacts").getAsInt(), false
));
lore.add(levelPage.buildLore("Community Shop Upgrades",
@@ -171,22 +175,22 @@ public class MiscTaskLevel {
sbXpPersonalBank, miscellaneousTask.get("personal_bank_upgrades").getAsInt(), false
));
+ int totalXp = sbXpReaperPeppers + sbXpDojo + sbXpGainedHarp + sbXpAbiphone +
+ sbXpCommunityUpgrade + sbXpPersonalBank;
levelPage.renderLevelBar(
"Misc. Task",
new ItemStack(Items.map),
- guiLeft + 299,
- guiTop + 55,
+ guiLeft + 299, guiTop + 55,
110,
0,
- sbXpReaperPeppers + sbXpDojo + sbXpGainedHarp + sbXpAbiphone +
- sbXpCommunityUpgrade + sbXpPersonalBank,
+ totalXp,
levelPage.getConstant().getAsJsonObject("category_xp").get("miscellaneous_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
+ totalXp += sbXpAccessoryUpgrade + sbXpUnlockedPowers;
}
private int getRankIndex(int pointsTotal) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
index 4ba7951c..06ab6f8c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SkillRelatedTaskLevel.java
@@ -43,13 +43,6 @@ public class SkillRelatedTaskLevel {
JsonObject skillRelatedTask = levelPage.getConstant().get("skill_related_task").getAsJsonObject();
JsonObject miningObj = skillRelatedTask.get("mining").getAsJsonObject();
- float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_mithril"), 0);
- float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_gemstone"), 0);
- float mithril = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_mithril"), 0) +
- mithrilPowder;
- float gemstone = (Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_gemstone"), 0)) +
- gemstonePowder;
-
float hotmXp = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.experience"), 0);
ProfileViewer.Level levelObjHotm =
ProfileViewer.getLevel(
@@ -66,29 +59,31 @@ public class SkillRelatedTaskLevel {
hotmXP += hotmXpArray.get(i - 1).getAsInt();
}
- int gainByFirstMithrilThing;
- if (mithril >= 350_000) {
- gainByFirstMithrilThing = (int) (350000 / 2400d);
- mithril -= 350_000;
- } else {
- gainByFirstMithrilThing = (int) (mithril / 2400d);
- mithril = 0;
- }
+ float mithrilPowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_mithril"), 0);
+ float gemstonePowder = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_gemstone"), 0);
+ float mithril = Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_mithril"), 0) +
+ mithrilPowder;
+ float gemstone = (Utils.getElementAsFloat(Utils.getElement(object, "mining_core.powder_spent_gemstone"), 0)) +
+ gemstonePowder;
- int gainByFirstGemstoneThing;
- if (gemstone >= 350_000) {
- gainByFirstGemstoneThing = (int) (350_000 / 2500d);
- gemstone -= 350_000;
- } else {
- gainByFirstGemstoneThing = (int) (gemstone / 2500d);
- gemstone = 0;
- }
+ // PUNKT NULL
+
+ double totalMithril = mithril + mithrilPowder;
+ double totalGemstone = gemstone + gemstonePowder;
+ double mithrilUnder = Math.min(350000.0, totalMithril);
+ double mithrilOver = Math.max(0, Math.min(totalMithril, 12_500_000.0) - 350000.0);
+ double gemstoneUnder = Math.min(350000.0, totalGemstone);
+ double gemstoneOver = Math.max(0, Math.min(totalGemstone, 20_000_000.0) - 350000.0);
- int sbXpMithrilPowder = (int) powder(3.75, mithril, 12_500_000);
- int sbXpGemstonePowder = (int) powder(4.25, gemstone, 20_000_000);
+ double mithrilXP = Math.floor(mithrilUnder / 2400.0);
+ double gemstoneXP = Math.floor(gemstoneUnder / 2500.0);
+ double mithrilExcess = Math.floor(
+ 3.75 * (Math.sqrt(1 + 8 * Math.sqrt((1758267.0 / 12_500_000.0) * mithrilOver + 9)) - 3));
+ double gemstoneExcess = Math.floor(
+ 4.25 * (Math.sqrt(1 + 8 * Math.sqrt((1758267.0 / 20_000_000.0) * gemstoneOver + 9)) - 3));
double sbXpHotmTier =
- (sbXpMithrilPowder + gainByFirstMithrilThing) + (sbXpGemstonePowder + gainByFirstGemstoneThing)
+ (mithrilXP + mithrilExcess) + (gemstoneXP + gemstoneExcess)
+ hotmXP;
int sbXpPotmTier = 0;
@@ -171,6 +166,18 @@ public class SkillRelatedTaskLevel {
}
}
+ int sbXpNucleus = 0;
+ JsonObject leveling = object.get("leveling").getAsJsonObject();
+ if (leveling.has("completions") && leveling.getAsJsonObject("completions").has("NUCLEUS_RUNS")) {
+ int nucleusRuns = leveling.getAsJsonObject("completions").get("NUCLEUS_RUNS").getAsInt();
+ JsonElement nucleusXp = miningObj.get("crystal_nucleus_xp");
+ if (nucleusXp == null) {
+ Utils.showOutdatedRepoNotification();
+ } else {
+ sbXpNucleus += nucleusRuns * nucleusXp.getAsInt();
+ }
+ }
+
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Heart of the Mountain", sbXpHotmTier, miningObj.get("hotm").getAsInt(), false));
lore.add(levelPage.buildLore(
@@ -179,7 +186,7 @@ public class SkillRelatedTaskLevel {
miningObj.get("commission_milestone").getAsInt(),
false
));
- lore.add(levelPage.buildLore("Crystal Nucleus", 0, 0, false));
+ lore.add(levelPage.buildLore("Crystal Nucleus", sbXpNucleus, miningObj.get("crystal_nucleus").getAsInt(), false));
lore.add(levelPage.buildLore(
"Anita's Shop Upgrade",
sbXpGainedByAnita,
@@ -189,37 +196,22 @@ public class SkillRelatedTaskLevel {
lore.add(levelPage.buildLore("Peak of the Mountain", sbXpPotmTier, miningObj.get("potm").getAsInt(), false));
lore.add(levelPage.buildLore("Trophy Fish", sbXpTrophyFish, fishingObj.get("trophy_fish").getAsInt(), false));
lore.add(levelPage.buildLore("Rock Milestone", sbXpRockPet, miningObj.get("rock_milestone").getAsInt(), false));
- lore.add(levelPage.buildLore(
- "Dolphin Milestone",
- sbXpDolphinPet,
- fishingObj.get("dolphin_milestone").getAsInt(),
- false
- ));
+ lore.add(levelPage.buildLore("Dolphin Milestone", sbXpDolphinPet, fishingObj.get("dolphin_milestone").getAsInt(), false));
+ int totalXp =
+ (int) (sbXpHotmTier + sbXpCommissionMilestone + sbXpGainedByAnita + sbXpPotmTier + sbXpTrophyFish + sbXpRockPet +
+ sbXpDolphinPet + sbXpNucleus);
levelPage.renderLevelBar(
"Skill Related Task",
new ItemStack(Items.diamond_sword),
- guiLeft + 23,
- guiTop + 115,
+ guiLeft + 23, guiTop + 115,
110,
0,
- sbXpHotmTier + sbXpCommissionMilestone + sbXpGainedByAnita + sbXpPotmTier + sbXpTrophyFish + sbXpRockPet +
- sbXpDolphinPet,
+ totalXp,
levelPage.getConstant().getAsJsonObject("category_xp").get("skill_related_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
}
-
- private static double powder(double multiplier, float left, int CAP) {
- double cons = 1758267;
- if (left <= 0) return 0;
-
- left = Math.min(CAP, left);
-
- return multiplier * (Math.sqrt(1 + 8 * (Math.sqrt((cons / CAP) * left + 9))) - 3);
- }
-
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
index 3aded435..6b624a52 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/SlayingTaskLevel.java
@@ -233,20 +233,21 @@ public class SlayingTaskLevel {
int slayingTaskMax = levelPage.getConstant().getAsJsonObject("category_xp").get("slaying_task").getAsInt();
+ int totalXp = sbXpGainedSlayer + bossCollectionXp + mythologicalKillsXp +
+ sbXpFromDragonKills + sbXpFromSlayerDefeat + sbXpDefeatKuudra + sbXpGainedArachne;
levelPage.renderLevelBar(
"Slaying Task",
new ItemStack(Items.golden_sword),
- guiLeft + 23,
- guiTop + 85,
+ guiLeft + 23, guiTop + 85,
110,
- 0, sbXpGainedSlayer + bossCollectionXp + mythologicalKillsXp +
- sbXpFromDragonKills + sbXpFromSlayerDefeat + sbXpDefeatKuudra + sbXpGainedArachne,
+ 0,
+ totalXp,
slayingTaskMax,
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);
+ totalXp += sbXpBestiary;
}
private int loopThroughCollection(int[] array, double value, JsonArray jsonArray) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java
index 2b1b59cb..3846db5f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/StoryTaskLevel.java
@@ -61,14 +61,12 @@ public class StoryTaskLevel {
levelPage.renderLevelBar(
"Story Task",
new ItemStack(Items.map),
- guiLeft + 299,
- guiTop + 85,
+ guiLeft + 299, guiTop + 85,
110,
0,
sbXpStory,
levelPage.getConstant().getAsJsonObject("category_xp").get("story_task").getAsInt(),
- mouseX,
- mouseY,
+ mouseX, mouseY,
true,
lore
);