aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-06-28 08:08:04 +1000
committerGitHub <noreply@github.com>2023-06-28 00:08:04 +0200
commitcf5a60283caf111ca81b8add1cccd21e04ec79a5 (patch)
tree2a369e0cb1feff9e8908d0be71c03b627ea836de /src/main/java/at
parent65a4842de7a306d45bdda99788a7925443932b39 (diff)
downloadskyhanni-cf5a60283caf111ca81b8add1cccd21e04ec79a5.tar.gz
skyhanni-cf5a60283caf111ca81b8add1cccd21e04ec79a5.tar.bz2
skyhanni-cf5a60283caf111ca81b8add1cccd21e04ec79a5.zip
Merge pull request #260
* added kloon hacking solvers * Merge branch 'beta' into kloon_hacking * Code cleanup
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java32
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt131
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/KloonTerminal.kt14
4 files changed, 175 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index f05f9ce68..c1856c035 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -310,6 +310,7 @@ class SkyHanniMod {
loadModule(VoltHighlighter())
loadModule(RiftOdonata())
loadModule(RiftAgaricusCap())
+ loadModule(KloonHacking())
loadModule(EnigmaSoulWaypoints)
loadModule(DungeonLividFinder)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
index b4b8fc53c..e8e199388 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
@@ -33,6 +33,7 @@ public class RiftConfig {
@Expose
public Position timerPosition = new Position(10, 10, false, true);
+
}
@ConfigOption(name = "Crux Warnings", desc = "")
@@ -48,7 +49,6 @@ public class RiftConfig {
@ConfigEditorBoolean
public boolean shyWarning = true;
-
@Expose
@ConfigOption(name = "Volt Warning", desc = "Shows a warning while a volt is discharging lightning.")
@ConfigEditorBoolean
@@ -98,7 +98,8 @@ public class RiftConfig {
public static class OdonataConfig {
@Expose
- @ConfigOption(name = "Highlight", desc = "Highlight the small §cOdonatas §7flying around the trees while holding a §eEmpty Odonata Bottle §7in the hand.")
+ @ConfigOption(name = "Highlight", desc = "Highlight the small §cOdonatas §7flying around the trees while holding a " +
+ "§eEmpty Odonata Bottle §7in the hand.")
@ConfigEditorBoolean
public boolean highlight = true;
@@ -134,7 +135,32 @@ public class RiftConfig {
public boolean highlightGuide = true;
@Expose
- @ConfigOption(name = "Agaricus Cap", desc = "Counts down the time until §eAgaricus Cap (Mushroom) §7changes color from brown to red and is breakable.")
+ @ConfigOption(name = "Agaricus Cap", desc = "Counts down the time until §eAgaricus Cap (Mushroom) " +
+ "§7changes color from brown to red and is breakable.")
@ConfigEditorBoolean
public boolean agaricusCap = true;
+
+ @ConfigOption(name = "Kloon Hacking", desc = "")
+ @Accordion
+ @Expose
+ public KloonHacking hacking = new KloonHacking();
+
+ public static class KloonHacking {
+
+ @Expose
+ @ConfigOption(name = "Hacking Solver", desc = "Highlights the correct button to click in the hacking inventory.")
+ @ConfigEditorBoolean
+ public boolean solver = true;
+
+ @Expose
+ @ConfigOption(name = "Color Guide", desc = "Tells you which colour to pick.")
+ @ConfigEditorBoolean
+ public boolean colour = true;
+
+ @Expose
+ @ConfigOption(name = "Terminal Waypoints", desc = "While wearing the helmet, waypoints will appear at each terminal location.")
+ @ConfigEditorBoolean
+ public boolean waypoints = true;
+
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt
new file mode 100644
index 000000000..0277751ec
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/KloonHacking.kt
@@ -0,0 +1,131 @@
+package at.hannibal2.skyhanni.features.rift
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.InventoryCloseEvent
+import at.hannibal2.skyhanni.events.InventoryOpenEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import io.github.moulberry.notenoughupdates.events.SlotClickEvent
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class KloonHacking {
+ private var wearingHelmet = false
+ private var inTerminalInventory = false
+ private var inColourInventory = false
+ private val correctButtons = mutableListOf<String>()
+ private var nearestColor: String? = null
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!RiftAPI.inRift()) return
+ if (event.isMod(20)) {
+ checkHelmet()
+ }
+ }
+
+ private fun checkHelmet() {
+ wearingHelmet = InventoryUtils.getArmor()[3]?.getInternalName() == "RETRO_ENCABULATING_VISOR"
+ }
+
+ @SubscribeEvent
+ fun onInventoryOpen(event: InventoryOpenEvent) {
+ inTerminalInventory = false
+ inColourInventory = false
+ if (!RiftAPI.inRift()) return
+ if (!SkyHanniMod.feature.rift.hacking.solver) return
+ if (event.inventoryName == "Hacking" || event.inventoryName == "Hacking (As seen on CSI)") {
+ inTerminalInventory = true
+ correctButtons.clear()
+ for ((slot, stack) in event.inventoryItems) {
+ if (slot in 2..6) {
+ correctButtons.add(stack.displayName.removeColor())
+ }
+ }
+ }
+ if (event.inventoryName == "Hacked Terminal Color Picker") {
+ inColourInventory = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onInventoryClose(event: InventoryCloseEvent) {
+ inTerminalInventory = false
+ inColourInventory = false
+ nearestColor = null
+ }
+
+ @SubscribeEvent
+ fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!RiftAPI.inRift()) return
+ if (inTerminalInventory) {
+ if (!SkyHanniMod.feature.rift.hacking.solver) return
+ var i = 0
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ if (slot.slotIndex == 11 + 10 * i) {
+ val correctButton = slot.stack!!.displayName.removeColor() == correctButtons[i]
+ slot highlight if (correctButton) LorenzColor.GREEN else LorenzColor.RED
+ continue
+ }
+ if (slot.slotIndex > i * 9 + 8 && slot.slotIndex < i * 9 + 18) {
+ if (slot.stack!!.displayName.removeColor() == correctButtons[i]) {
+ slot highlight LorenzColor.YELLOW
+ }
+ }
+ if (slot.slotIndex == i * 9 + 17) {
+ i += 1
+ }
+ }
+ }
+ if (inColourInventory) {
+ if (!SkyHanniMod.feature.rift.hacking.colour) return
+ val targetColour = nearestColor ?: getNearestColour()
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ if (slot.stack.getLore().any { it.contains(targetColour) }) {
+ slot highlight LorenzColor.GREEN
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ fun onSlotClick(event: SlotClickEvent) {
+ if (!inTerminalInventory || !RiftAPI.inRift()) return
+ if (!inTerminalInventory) return
+ event.usePickblockInstead()
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: RenderWorldLastEvent) {
+ if (!RiftAPI.inRift()) return
+ if (!SkyHanniMod.feature.rift.hacking.waypoints) return
+ if (!wearingHelmet) return
+ for (terminal in KloonTerminal.values()) {
+ event.drawWaypointFilled(terminal.location, LorenzColor.DARK_RED.toColor(), true, true)
+ }
+ }
+
+ private fun getNearestColour(): String {
+ var closestTerminal = ""
+ var closestDistance = 8.0
+
+ for (terminal in KloonTerminal.values()) {
+ val distance = terminal.location.distanceToPlayer()
+ if (distance < closestDistance) {
+ closestTerminal = terminal.name
+ closestDistance = distance
+ }
+ }
+ nearestColor = closestTerminal
+ return closestTerminal
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/KloonTerminal.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/KloonTerminal.kt
new file mode 100644
index 000000000..320105f23
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/KloonTerminal.kt
@@ -0,0 +1,14 @@
+package at.hannibal2.skyhanni.features.rift
+
+import at.hannibal2.skyhanni.utils.LorenzVec
+
+enum class KloonTerminal(val location: LorenzVec) {
+ RED(LorenzVec(-69.0, 65.0, -63.0)),
+ ORANGE(LorenzVec(-44.0, 71.0, -62.0)),
+ YELLOW(LorenzVec(-39.0, 71.0, -95.0)),
+ GREEN(LorenzVec(-62.0, 71.0, -83.0)),
+ AQUA(LorenzVec(-33.0, 70.0, -134.5)),
+ BLUE(LorenzVec(-66.5, 72.0, -119.0)),
+ PURPLE(LorenzVec(-89.0, 73.0, -115.0)),
+ PINK(LorenzVec(-110.0, 73.0, -107.0))
+} \ No newline at end of file