diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-06-13 22:21:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-13 22:21:50 +0200 |
commit | 529639fdd0683066eadffe93473a300a2177c008 (patch) | |
tree | d89cd9aa2c04b4a8a839b9c3b1a56d2058fa7956 /src/main/java/at/hannibal2/skyhanni/features/minion | |
parent | 151865bca064421d48ec19279b759134fc428443 (diff) | |
download | skyhanni-529639fdd0683066eadffe93473a300a2177c008.tar.gz skyhanni-529639fdd0683066eadffe93473a300a2177c008.tar.bz2 skyhanni-529639fdd0683066eadffe93473a300a2177c008.zip |
Backend: for each (#1725)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/minion')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index 9cf785503..a0545dc1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -82,7 +82,7 @@ object MinionXp { } return if (storage != null) { - storage.xpList.forEach { (type, amount) -> + for ((type, amount) in storage.xpList) { xpTotal.compute(type) { _, currentAmount -> (currentAmount ?: 0.0) + amount } } false @@ -96,12 +96,14 @@ object MinionXp { private fun handleItems(inventoryItems: Map<Int, ItemStack>, isMinion: Boolean): EnumMap<SkillType, Double> { val xpTotal = EnumMap<SkillType, Double>(SkillType::class.java) - inventoryItems.filter { - it.value.getLore().isNotEmpty() && (!isMinion || it.key in listWithMissingName.flatten()) - }.forEach { (_, itemStack) -> - val item = toPrimitiveItemStack(itemStack) + val list = inventoryItems.filter { + it.value.getLore().isNotEmpty() && + (!isMinion || it.key in listWithMissingName.flatten()) + }.values + .map { toPrimitiveItemStack(it) } + for (item in list) { val name = item.internalName - val xp = xpInfoMap[name] ?: return@forEach + val xp = xpInfoMap[name] ?: continue // TODO add wisdom and temporary skill exp (Events) to calculation val baseXp = xp.amount * item.amount |