diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 12:12:27 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 12:12:27 +0200 |
| commit | 17ec026c19d1e203244217d599f72bd265d9aac8 (patch) | |
| tree | 28c86ae9415e11ec316741ba752a7e807a10f74c /src/main/java/at/hannibal2/skyhanni/data | |
| parent | 3bcd5b3a8afa5b322d75af1b82681fd7b1e494e5 (diff) | |
| download | skyhanni-17ec026c19d1e203244217d599f72bd265d9aac8.tar.gz skyhanni-17ec026c19d1e203244217d599f72bd265d9aac8.tar.bz2 skyhanni-17ec026c19d1e203244217d599f72bd265d9aac8.zip | |
Using NEUInternalName in slayer profit tracker
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 6b8af2941..097eb2dec 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -1,13 +1,15 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData import at.hannibal2.skyhanni.features.slayer.SlayerType -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_new import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack +import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.common.cache.CacheBuilder @@ -18,7 +20,8 @@ import java.util.concurrent.TimeUnit object SlayerAPI { private var nameCache = - CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build<Pair<String, Int>, Pair<String, Double>>() + CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES) + .build<Pair<NEUInternalName, Int>, Pair<String, Double>>() var questStartTime = 0L var isInSlayerArea = false @@ -53,7 +56,7 @@ object SlayerAPI { } fun getItemNameAndPrice(stack: ItemStack): Pair<String, Double> { - val internalName = stack.getInternalName() + val internalName = stack.getInternalName_new() val amount = stack.stackSize val key = internalName to amount nameCache.getIfPresent(key)?.let { @@ -63,8 +66,8 @@ object SlayerAPI { val amountFormat = if (amount != 1) "§7${amount}x §r" else "" val displayName = getNameWithEnchantmentFor(internalName) - val price = NEUItems.getPrice(internalName) - val npcPrice = BazaarApi.getBazaarDataByInternalName(internalName)?.npcPrice ?: 0.0 + val price = internalName.getPrice() + val npcPrice = internalName.getBazaarData()?.npcPrice ?: 0.0 val maxPrice = npcPrice.coerceAtLeast(price) val totalPrice = maxPrice * amount @@ -76,11 +79,11 @@ object SlayerAPI { return result } - fun getNameWithEnchantmentFor(internalName: String): String? { - if (internalName == "WISP_POTION") { + fun getNameWithEnchantmentFor(internalName: NEUInternalName): String? { + if (internalName.asString() == "WISP_POTION") { return "§fWisp's Ice-Flavored Water" } - return NEUItems.getItemStack(internalName).nameWithEnchantment + return internalName.getItemStack().nameWithEnchantment } @SubscribeEvent |
