aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonsRaceGuideConfig.java34
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/DungeonHubRacesJson.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt91
5 files changed, 139 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 0ef928e65..9a6453c6d 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -122,6 +122,7 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay
import at.hannibal2.skyhanni.features.dungeon.DungeonRankTabListColor
import at.hannibal2.skyhanni.features.dungeon.DungeonShadowAssassinNotification
import at.hannibal2.skyhanni.features.dungeon.DungeonTeammateOutlines
+import at.hannibal2.skyhanni.features.dungeon.DungeonsRaceGuide
import at.hannibal2.skyhanni.features.dungeon.HighlightDungeonDeathmite
import at.hannibal2.skyhanni.features.dungeon.TerracottaPhase
import at.hannibal2.skyhanni.features.event.UniqueGiftingOpportunitiesFeatures
@@ -528,6 +529,7 @@ class SkyHanniMod {
loadModule(ItemAddManager())
loadModule(BingoCardReader())
loadModule(DeepCavernsGuide())
+ loadModule(DungeonsRaceGuide())
loadModule(GardenBestCropTime())
loadModule(ActionBarData)
loadModule(TrackerManager)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
index 1f3c688db..2e1999509 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
@@ -128,4 +128,9 @@ public class DungeonConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean shadowAssassinJumpNotifier = false;
+
+ @Expose
+ @ConfigOption(name = "Dungeon Races Guide", desc = "")
+ @Accordion
+ public DungeonsRaceGuideConfig dungeonsRaceGuide = new DungeonsRaceGuideConfig();
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonsRaceGuideConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonsRaceGuideConfig.java
new file mode 100644
index 000000000..d1508790f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonsRaceGuideConfig.java
@@ -0,0 +1,34 @@
+package at.hannibal2.skyhanni.config.features.dungeon;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+import io.github.notenoughupdates.moulconfig.observer.Property;
+
+public class DungeonsRaceGuideConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Shows a guide for each of the Dungeon Hub races. " +
+ "§eCurrently only works with No Return; Nothing at all races.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = true;
+
+ @Expose
+ @ConfigOption(name = "Look Ahead", desc = "Change how many waypoints should be shown in front of you.")
+ @ConfigEditorSlider(minStep = 1, maxValue = 30, minValue = 1)
+ public Property<Integer> lookAhead = Property.of(3);
+
+ @Expose
+ @ConfigOption(name = "Rainbow Color", desc = "Show the rainbow color effect instead of a boring monochrome.")
+ @ConfigEditorBoolean
+ public Property<Boolean> rainbowColor = Property.of(true);
+
+ @Expose
+ @ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the guide waypoints.")
+ @ConfigEditorColour
+ public Property<String> monochromeColor = Property.of("0:60:0:0:255");
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/DungeonHubRacesJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/DungeonHubRacesJson.kt
new file mode 100644
index 000000000..6dc4b51b7
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/DungeonHubRacesJson.kt
@@ -0,0 +1,7 @@
+package at.hannibal2.skyhanni.data.jsonobjects.repo
+
+import com.google.gson.annotations.Expose
+
+data class DungeonHubRacesJson(
+ @Expose val data: Map<String, Map<String, ParkourJson>>,
+)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt
new file mode 100644
index 000000000..670a6ebea
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonsRaceGuide.kt
@@ -0,0 +1,91 @@
+package at.hannibal2.skyhanni.features.dungeon
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.data.jsonobjects.repo.DungeonHubRacesJson
+import at.hannibal2.skyhanni.events.ActionBarUpdateEvent
+import at.hannibal2.skyhanni.events.ConfigLoadEvent
+import at.hannibal2.skyhanni.events.IslandChangeEvent
+import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
+import at.hannibal2.skyhanni.utils.ConditionalUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
+import at.hannibal2.skyhanni.utils.ParkourHelper
+import at.hannibal2.skyhanni.utils.StringUtils.findMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class DungeonsRaceGuide {
+
+ private val config get() = SkyHanniMod.feature.dungeon.dungeonsRaceGuide
+ private val raceActivePattern by RepoPattern.pattern(
+ "dungeon.race.active",
+ "§.§.(?<race>[\\w ]+) RACE §.[\\d:.]+"
+ )
+
+ private val parkourHelpers: MutableMap<String, ParkourHelper> = mutableMapOf()
+
+ private var currentRace: String? = null
+
+ @SubscribeEvent
+ fun onIslandChange(event: IslandChangeEvent) {
+ parkourHelpers.forEach { it.value.reset() }
+ currentRace = null
+ }
+
+ @SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ val data = event.getConstant<DungeonHubRacesJson>("DungeonHubRaces")
+ data.data.forEach {
+ val nothingNoReturn = it.value["nothing:no_return"]
+ parkourHelpers[it.key] = ParkourHelper(
+ nothingNoReturn?.locations ?: listOf(),
+ nothingNoReturn?.shortCuts ?: listOf(),
+ platformSize = 1.0,
+ detectionRange = 7.0,
+ depth = false,
+ )
+ }
+ updateConfig()
+ }
+
+ @SubscribeEvent
+ fun onConfigLoad(event: ConfigLoadEvent) {
+ ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) {
+ updateConfig()
+ }
+ }
+
+ @SubscribeEvent
+ fun onActionBarUpdate(event: ActionBarUpdateEvent) {
+ if (!isEnabled()) return
+ currentRace = null
+ raceActivePattern.findMatcher(event.actionBar) {
+ currentRace = group("race").replace(" ", "_").lowercase()
+ }
+ if (currentRace == null) {
+ parkourHelpers.forEach {
+ it.value.reset()
+ }
+ }
+ }
+
+ private fun updateConfig() {
+ parkourHelpers.forEach {
+ it.value.rainbowColor = config.rainbowColor.get()
+ it.value.monochromeColor = config.monochromeColor.get().toChromaColor()
+ it.value.lookAhead = config.lookAhead.get() + 1
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: LorenzRenderWorldEvent) {
+ if (!isEnabled()) return
+ if (currentRace == null) return
+
+ parkourHelpers[currentRace]?.render(event)
+ }
+
+ fun isEnabled() = IslandType.DUNGEON_HUB.isInIsland() && config.enabled
+}