aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/dungeon
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-05-05 00:20:55 -0400
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-05-20 16:52:25 -0400
commit73c447e8fe535e857fc330d1823b6c9aac663b5c (patch)
treefb63de2c2cd98cc4da1974388526e45357b58f63 /src/main/java/de/hysky/skyblocker/skyblock/dungeon
parent610c64758fc8d0b8bea0145c33881b60c0747bd7 (diff)
downloadSkyblocker-73c447e8fe535e857fc330d1823b6c9aac663b5c.tar.gz
Skyblocker-73c447e8fe535e857fc330d1823b6c9aac663b5c.tar.bz2
Skyblocker-73c447e8fe535e857fc330d1823b6c9aac663b5c.zip
Add coins per hour and refactor item price calculations
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dungeon')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java
index 70e785cb..0f459c9d 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CroesusProfit.java
@@ -35,13 +35,13 @@ public class CroesusProfit extends ContainerSolver {
protected List<ColorHighlight> getColors(String[] groups, Int2ObjectMap<ItemStack> slots) {
List<ColorHighlight> highlights = new ArrayList<>();
ItemStack bestChest = null, secondBestChest = null;
- long bestValue = 0, secondBestValue = 0; // If negative value of chest - it is out of the question
- long dungeonKeyPriceData = getItemPrice("DUNGEON_CHEST_KEY") * 2; // lesser ones don't worth the hassle
+ double bestValue = 0, secondBestValue = 0; // If negative value of chest - it is out of the question
+ double dungeonKeyPriceData = getItemPrice("DUNGEON_CHEST_KEY") * 2; // lesser ones don't worth the hassle
for (Int2ObjectMap.Entry<ItemStack> entry : slots.int2ObjectEntrySet()) {
ItemStack stack = entry.getValue();
if (stack.getName().getString().contains("Chest")) {
- long value = valueChest(stack);
+ double value = valueChest(stack);
if (value > bestValue) {
secondBestChest = bestChest;
secondBestValue = bestValue;
@@ -68,8 +68,8 @@ public class CroesusProfit extends ContainerSolver {
}
- private long valueChest(@NotNull ItemStack chest) {
- long chestValue = 0;
+ private double valueChest(@NotNull ItemStack chest) {
+ double chestValue = 0;
int chestPrice = 0;
List<String> chestItems = new ArrayList<>();
@@ -107,22 +107,8 @@ public class CroesusProfit extends ContainerSolver {
}
- private long getItemPrice(String itemDisplayName) {
- JsonObject bazaarPrices = TooltipInfoType.BAZAAR.getData();
- JsonObject lbinPrices = TooltipInfoType.LOWEST_BINS.getData();
- long itemValue = 0;
- String id = dungeonDropsNameToId.get(itemDisplayName);
-
- if (bazaarPrices == null || lbinPrices == null) return 0;
-
- if (bazaarPrices.has(id)) {
- JsonObject item = bazaarPrices.get(id).getAsJsonObject();
- boolean isPriceNull = item.get("sellPrice").isJsonNull();
- return (isPriceNull ? 0L : item.get("sellPrice").getAsLong());
- } else if (lbinPrices.has(id)) {
- return lbinPrices.get(id).getAsLong();
- }
- return itemValue;
+ private double getItemPrice(String itemDisplayName) {
+ return ItemUtils.getItemPrice(dungeonDropsNameToId.get(itemDisplayName)).leftDouble();
}