aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt2
4 files changed, 30 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
index f566c8d60..0fcc94bf8 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.garden.CropAccessory
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.InventoryUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import com.google.gson.JsonElement
@@ -95,10 +95,9 @@ class CropAccessoryData {
}
- private fun bestCropAccessory(items: Iterable<ItemStack>): CropAccessory {
- return items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName_old()) }
+ private fun bestCropAccessory(items: Iterable<ItemStack>) =
+ items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName()) }
.maxOrNull() ?: CropAccessory.NONE
- }
companion object {
var accessoryBagPageCount = 0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
index c4269ce2e..22d553ea4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
@@ -1,14 +1,27 @@
package at.hannibal2.skyhanni.features.garden
-enum class CropAccessory(val internalName: String, private val affectedCrops: Set<CropType>, private val fortune: Double, val upgradeCost: Pair<String, Int>?) {
- NONE("NONE", emptySet(), 0.0, null),
- CROPIE("CROPIE_TALISMAN", setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT), 10.0, Pair("CROPIE", 256)),
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
+
+enum class CropAccessory(
+ val internalName: NEUInternalName?,
+ private val affectedCrops: Set<CropType>,
+ private val fortune: Double,
+ val upgradeCost: Pair<String, Int>?
+) {
+ NONE(null, emptySet(), 0.0, null),
+ CROPIE(
+ "CROPIE_TALISMAN".asInternalName(),
+ setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT),
+ 10.0,
+ Pair("CROPIE", 256)
+ ),
SQUASH(
- "SQUASH_RING",
+ "SQUASH_RING".asInternalName(),
setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT, CropType.COCOA_BEANS, CropType.MELON, CropType.PUMPKIN),
20.0, Pair("SQUASH", 128)
),
- FERMENTO("FERMENTO_ARTIFACT", CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)),
+ FERMENTO("FERMENTO_ARTIFACT".asInternalName(), CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)),
;
fun getFortune(cropType: CropType): Double {
@@ -16,6 +29,6 @@ enum class CropAccessory(val internalName: String, private val affectedCrops: Se
}
companion object {
- fun getByName(internalName: String) = entries.firstOrNull { it.internalName == internalName }
+ fun getByName(internalName: NEUInternalName) = entries.firstOrNull { internalName == it.internalName }
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
index 2c1d66ba1..8f6a2c207 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.currentPet
import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarity
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil.addSuffix
@@ -72,8 +73,12 @@ object FortuneUpgrades {
val currentTalismanTier = CropAccessoryData.cropAccessory?.ordinal ?: return
if (currentTalismanTier < 3) {
val nextTalisman = CropAccessory.entries[currentTalismanTier + 1]
- genericUpgrades.add(FortuneUpgrade("§7Upgrade your talisman to ${nextTalisman.internalName.replace("_", " ").lowercase()}",
- null, nextTalisman.upgradeCost?.first!!, nextTalisman.upgradeCost.second, 10.0))
+ genericUpgrades.add(
+ FortuneUpgrade(
+ "§7Upgrade your talisman to ${nextTalisman.internalName?.getItemName()}",
+ null, nextTalisman.upgradeCost?.first!!, nextTalisman.upgradeCost.second, 10.0
+ )
+ )
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 0e831e486..6aa6fa28c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -137,7 +137,7 @@ object NEUItems {
.resolveInternalName()
fun getInternalNameOrNull(nbt: NBTTagCompound) =
- ItemResolutionQuery(manager).withItemNBT(nbt).resolveInternalName()
+ ItemResolutionQuery(manager).withItemNBT(nbt).resolveInternalName()?.asInternalName()
fun NEUInternalName.getPriceOrNull(useSellingPrice: Boolean = false): Double? {
val price = getPrice(useSellingPrice)