summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-04-12 19:11:02 +0200
committerGitHub <noreply@github.com>2024-04-12 19:11:02 +0200
commit5ff579652ef80207a780a80399be376c345342b0 (patch)
tree6f80311a35d8fd6bb41d63b8ce2758891146d128 /src/main/java/at/hannibal2/skyhanni/features/slayer
parent7960d2ad27ac68ea9dcfaf848bd611b13db0af87 (diff)
downloadskyhanni-5ff579652ef80207a780a80399be376c345342b0.tar.gz
skyhanni-5ff579652ef80207a780a80399be376c345342b0.tar.bz2
skyhanni-5ff579652ef80207a780a80399be376c345342b0.zip
Backend: Remove Neu Constant (#1191)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
index 386fbf98a..ccbe7282e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
@@ -4,16 +4,20 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.data.SlayerAPI
+import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuRNGScore
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.events.SlayerChangeEvent
+import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
@@ -21,7 +25,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.removeWordsAtEnd
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
-import io.github.moulberry.notenoughupdates.util.Constants
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.ceil
import kotlin.time.Duration.Companion.seconds
@@ -47,6 +50,8 @@ class SlayerRngMeterDisplay {
private var display = ""
private var lastItemDroppedTime = 0L
+ var rngScore = mapOf<String, Map<NEUInternalName, Long>>()
+
@SubscribeEvent
fun onSecondPassed(event: SecondPassedEvent) {
if (!isEnabled()) return
@@ -137,12 +142,23 @@ class SlayerRngMeterDisplay {
storage.goalNeeded = -1
} else {
storage.itemGoal = selectedItem.itemName
- val jsonObject = Constants.RNGSCORE["slayer"].asJsonObject.get(getCurrentSlayer()).asJsonObject
- storage.goalNeeded = jsonObject.get(selectedItem.getInternalName().asString()).asLong
+ storage.goalNeeded = rngScore[getCurrentSlayer()]?.get(selectedItem.getInternalName())
+ ?: ErrorManager.skyHanniError(
+ "RNG Meter goal setting failed",
+ "selectedItem" to selectedItem,
+ "selectedItemInternalName" to selectedItem.getInternalName(),
+ "currentSlayer" to getCurrentSlayer(),
+ "repo" to rngScore
+ )
}
update()
}
+ @SubscribeEvent
+ fun onNeuRepoReload(event: NeuRepositoryReloadEvent) {
+ rngScore = event.readConstant<NeuRNGScore>("rngscore").slayer
+ }
+
private fun update() {
display = drawDisplay()
}