diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt index d2b122d7f..8f996fef0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt @@ -22,7 +22,6 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector -import at.hannibal2.skyhanni.utils.LorenzUtils.get import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getNpcPrice @@ -49,6 +48,7 @@ object SlayerItemProfitTracker { private var collectedCache = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.SECONDS).build<Int, Unit>() private var itemLogCategory = "" + private var baseSlayerType = "" private var display = emptyList<List<Any>>() private val logger = LorenzLogger("slayer/item_profit_tracker") private var inventoryOpen = false @@ -92,6 +92,7 @@ object SlayerItemProfitTracker { fun onSlayerChange(event: SlayerChangeEvent) { val newSlayer = event.newSlayer itemLogCategory = newSlayer.removeColor() + baseSlayerType = itemLogCategory.substringBeforeLast(" ") update() } @@ -199,7 +200,7 @@ object SlayerItemProfitTracker { } private fun isAllowedItem(internalName: NEUInternalName): Boolean { - val allowedList = allowedItems.get { itemLogCategory.startsWith(it) } ?: return false + val allowedList = allowedItems[baseSlayerType] ?: return false return internalName in allowedList } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 5275b9196..3ad8e3fe9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -540,6 +540,4 @@ object LorenzUtils { fun <T> T.conditionalTransform(condition: Boolean, ifTrue: T.() -> Any, ifFalse: T.() -> Any) = if (condition) ifTrue(this) else ifFalse(this) - - fun <K, V> Map<K, V>.get(function: (K) -> Boolean) = entries.firstOrNull { function(it.key) }?.value } |