aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt13
2 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
index 741021d87..6b841f5a4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
@@ -10,10 +10,10 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
-import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NEUItems.isVanillaItem
@@ -26,7 +26,6 @@ import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
-import io.github.moulberry.notenoughupdates.recipes.NeuRecipe
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.floor
@@ -85,7 +84,7 @@ object CraftableItemList {
pricePer: MutableMap<NEUInternalName, Double>,
internalName: NEUInternalName,
): Renderable? {
- val neededItems = neededItems(recipe)
+ val neededItems = ItemUtils.neededItems(recipe)
// Just a fail save, should not happen normally
if (neededItems.isEmpty()) return null
@@ -142,16 +141,6 @@ object CraftableItemList {
return canCraftTotal.min()
}
- private fun neededItems(recipe: NeuRecipe): MutableMap<NEUInternalName, Int> {
- val neededItems = mutableMapOf<NEUInternalName, Int>()
- for (ingredient in recipe.ingredients) {
- val material = ingredient.internalItemId.asInternalName()
- val amount = ingredient.count.toInt()
- neededItems.addOrPut(material, amount)
- }
- return neededItems
- }
-
private fun readItems(): Map<NEUInternalName, Long> {
val materials = mutableMapOf<NEUInternalName, Long>()
for (stack in InventoryUtils.getItemsInOwnInventory()) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
index 05d53fa65..1d6b21d2e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
@@ -16,8 +16,10 @@ import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
+import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
+import at.hannibal2.skyhanni.utils.NEUItems.getRawCraftCostOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls
@@ -538,6 +540,17 @@ object EstimatedItemValueCalculator {
price = 0.0
}
+ // If craft cost price is greater than npc price, and there is no ah/bz price, use craft cost instead
+ internalName.getNpcPriceOrNull()?.let { npcPrice ->
+ if (price == npcPrice) {
+ internalName.getRawCraftCostOrNull()?.let { rawCraftPrice ->
+ if (rawCraftPrice > npcPrice) {
+ price = rawCraftPrice
+ }
+ }
+ }
+ }
+
val name = internalName.itemName
if (internalName.startsWith("ENCHANTED_BOOK_BUNDLE_")) {
list.add("ยง7Base item: $name")