aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/minion
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-30 12:04:24 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-30 12:04:24 +0100
commitd17941f261b027f325615dc985b498380f1450c1 (patch)
tree85a9cb208ab204d992f03f8e7a2ee21f33eddcf0 /src/main/java/at/hannibal2/skyhanni/features/minion
parent73541f85a6c5f507124e7e7fb95244239c3f52b1 (diff)
downloadskyhanni-d17941f261b027f325615dc985b498380f1450c1.tar.gz
skyhanni-d17941f261b027f325615dc985b498380f1450c1.tar.bz2
skyhanni-d17941f261b027f325615dc985b498380f1450c1.zip
Clearing internal minion xp data on every inventory close.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/minion')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt30
2 files changed, 14 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index bd1a5e468..a0f123a7f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -180,7 +180,6 @@ class MinionFeatures {
if (location !in minions) {
minions[location]!!.lastClicked = 0
}
- MinionXp.onMinionClose()
}
@SubscribeEvent
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 3b2108648..110413323 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.minion
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.jsonobjects.repo.MinionXPJson
+import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.MinionOpenEvent
import at.hannibal2.skyhanni.events.MinionStorageOpenEvent
@@ -26,6 +27,15 @@ class MinionXp {
private val config get() = SkyHanniMod.feature.minions
+ private val xpItemMap: MutableMap<PrimitiveItemStack, String> = mutableMapOf()
+ private val collectItemXpList: MutableList<String> = mutableListOf()
+
+ private var collectItem: Item? = null
+
+ private val minionStorages = mutableListOf<MinionStorage>()
+
+ private var xpInfoMap: Map<NEUInternalName, XpInfo> = hashMapOf()
+
data class XpInfo(val type: XpType, val amount: Double)
private data class MinionStorage(val position: LorenzVec, val xpList: EnumMap<XpType, Double>) {
@@ -49,10 +59,6 @@ class MinionXp {
Alchemy
}
- private var collectItem: Item? = null
-
- private val minionStorages = mutableListOf<MinionStorage>()
-
@SubscribeEvent
fun onMinionOpen(event: MinionOpenEvent) {
if (!config.xpDisplay) return
@@ -174,13 +180,10 @@ class MinionXp {
collectItemXpList.clear()
}
- companion object {
- private val xpItemMap: MutableMap<PrimitiveItemStack, String> = mutableMapOf()
- private val collectItemXpList: MutableList<String> = mutableListOf()
- fun onMinionClose() {
- xpItemMap.clear()
- collectItemXpList.clear()
- }
+ @SubscribeEvent
+ fun onInventoryClose(event: InventoryCloseEvent) {
+ xpItemMap.clear()
+ collectItemXpList.clear()
}
@SubscribeEvent
@@ -189,9 +192,4 @@ class MinionXp {
xpType.value.mapNotNull { it.key.asInternalName() to XpInfo(XpType.valueOf(xpType.key), it.value) }
}.flatten().toMap()
}
-
- private var xpInfoMap: Map<NEUInternalName, XpInfo> = hashMapOf()
}
-
-/* it.key.asInternalName() to
- XpInfo(XpType.valueOf(it.value.type), it.value.value) */