aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Misc.java29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/IslandType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/Relay.kt48
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt145
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt62
6 files changed, 290 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index af12bb09c..02e9493ed 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -27,6 +27,8 @@ import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles;
import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown;
import at.hannibal2.skyhanni.features.minion.MinionFeatures;
import at.hannibal2.skyhanni.features.misc.*;
+import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayHelper;
+import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayWaypoints;
import at.hannibal2.skyhanni.features.nether.MilleniaAgedBlazeColor;
import at.hannibal2.skyhanni.features.nether.ashfang.*;
import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper;
@@ -174,6 +176,8 @@ public class SkyHanniMod {
loadModule(new CrimsonIsleReputationHelper(this));
loadModule(new SharkFishCounter());
loadModule(new OdgerWaypoint());
+ loadModule(new TiaRelayHelper());
+ loadModule(new TiaRelayWaypoints());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
index 40ecb5f8a..ff3e248be 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
@@ -144,6 +144,35 @@ public class Misc {
public boolean crimsonIsleReputationLocation = false;
@Expose
+ @ConfigOption(name = "Tia Relay", desc = "")
+ @ConfigEditorAccordion(id = 7)
+ public boolean tiaRelay = false;
+
+ @Expose
+ @ConfigOption(name = "Tia Relay Waypoint", desc = "Show the next Relay waypoint for Tia The Fairy, where maintenance for the abiphone network needs to be done.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean tiaRelayNextWaypoint = true;
+
+ @Expose
+ @ConfigOption(name = "Tia Relay All", desc = "Show all relay waypoints at once.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean tiaRelayAllWaypoints = false;
+
+ @Expose
+ @ConfigOption(name = "Tia Relay Helper", desc = "Helps with solving the sound puzzle.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean tiaRelayHelper = true;
+
+ @Expose
+ @ConfigOption(name = "Tia Relay Mute", desc = "Mutes the sound when close to the Relay.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean tiaRelayMute = true;
+
+ @Expose
@ConfigOption(name = "Exp Bottles", desc = "Hides all the experience bottles lying on the ground.")
@ConfigEditorBoolean
public boolean hideExpBottles = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
index 527cce548..e2e99970c 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/IslandType.kt
@@ -6,6 +6,8 @@ enum class IslandType(val displayName: String) {
THE_END("The End"),
KUUDRA_ARENA("Instanced"),
CRIMSON_ISLE("Crimson Isle"),
+ DWARVEN_MINES("Dwarven Mines"),
+ DUNGEON_HUB("Dungeon Hub"),
HUB("Hub"),
THE_FARMING_ISLANDS("The Farming Islands"),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/Relay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/Relay.kt
new file mode 100644
index 000000000..14804bfd9
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/Relay.kt
@@ -0,0 +1,48 @@
+package at.hannibal2.skyhanni.features.misc.tiarelay
+
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.utils.LorenzVec
+
+enum class Relay(
+ val relayName: String,
+ val waypoint: LorenzVec,
+ val island: IslandType,
+ val chatMessage: String
+) {
+ RELAY_1(
+ "1st Relay", LorenzVec(143.5, 108.0, 93.0), IslandType.HUB,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe first relay is on a branch of the large tree on the north-east of the fairy pond."
+ ),
+ RELAY_2(
+ "2nd Relay", LorenzVec(-246.5, 123.0, 55.5), IslandType.HUB,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is in the castle ruins!"
+ ),
+ RELAY_3(
+ "3rd Relay", LorenzVec(128.5, 232.0, 200.5), IslandType.DWARVEN_MINES,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is in the §bRoyal Palace §rwithin the Dwarven Mines."
+ ),
+ RELAY_4(
+ "4th Relay", LorenzVec(-560, 164, -287), IslandType.THE_END,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on the highest spike of §dThe End§r."
+ ),
+ RELAY_5(
+ "5th Relay", LorenzVec(-375, 207, -799), IslandType.CRIMSON_ISLE,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay was placed by our consultant, Odger."
+ ),
+ RELAY_6(
+ "6th Relay", LorenzVec(-69, 157, -879), IslandType.CRIMSON_ISLE,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rScarleton itself has one of the most robust connection to the 9f™ Network."
+ ),
+ RELAY_7(
+ "7th Relay", LorenzVec(93, 86, 187), IslandType.HUB,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on top of the shack next to the shady inn right here close to the pond."
+ ),
+ RELAY_8(
+ "8th Relay", LorenzVec(0, 146, -75), IslandType.DUNGEON_HUB,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on top of a statue in the dungeon hub."
+ ),
+ RELAY_9(
+ "9th Relay", LorenzVec(-19.0, 88.5, -91.0), IslandType.HUB,
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on top of the Auction House."
+ ),
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
new file mode 100644
index 000000000..d846ac42b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
@@ -0,0 +1,145 @@
+package at.hannibal2.skyhanni.features.misc.tiarelay
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.PlaySoundEvent
+import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class TiaRelayHelper {
+
+ private var tick = 0
+ private var inInventory = false
+
+ private var lastClickSlot = 0
+ private var lastClickTime = 0L
+ private var sounds = mutableMapOf<Int, Sound>()
+
+ private var resultDisplay = mutableMapOf<Int, Int>()
+
+ @SubscribeEvent
+ fun onSoundPlay(event: PlaySoundEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ val soundName = event.soundName
+
+ if (SkyHanniMod.feature.misc.tiaRelayMute) {
+ if (soundName == "mob.wolf.whine") {
+ event.isCanceled = true
+ }
+ }
+
+ if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!inInventory) return
+
+ val location = event.location
+ val distance = location.distance(LocationUtils.playerLocation())
+ if (distance >= 2) return
+
+ if (lastClickSlot == 0) return
+ val duration = System.currentTimeMillis() - lastClickTime
+ if (duration > 1_000) return
+ if (sounds.contains(lastClickSlot)) return
+
+ sounds[lastClickSlot] = Sound(soundName, event.pitch)
+
+ lastClickSlot = 0
+
+ tryResult()
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (event.phase != TickEvent.Phase.START) return
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+
+ tick++
+
+ if (tick % 20 == 0) {
+ if (InventoryUtils.openInventoryName().contains("Network Relay")) {
+ inInventory = true
+ } else {
+ inInventory = false
+ sounds.clear()
+ resultDisplay.clear()
+ }
+ }
+ }
+
+ private fun tryResult() {
+ if (sounds.size < 4) return
+
+ val name = sounds.values.first().name
+ for (sound in sounds.toMutableMap()) {
+ if (sound.value.name != name) {
+ LorenzUtils.chat("§c[SkyHanni] Tia Relay Helper error: Too much background noise! Please try again.")
+ sounds.clear()
+ return
+ }
+ }
+
+ val pitchMap = mutableMapOf<Int, Float>()
+ for (sound in sounds) {
+ pitchMap[sound.key] = sound.value.pitch
+ }
+ sounds.clear()
+ resultDisplay.clear()
+
+ var i = 1
+ for (entry in pitchMap.toList().sortedBy { (_, value) -> value }.toMap()) {
+ resultDisplay[entry.key] = i
+ i++
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderItemTip(event: RenderInventoryItemTipEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!inInventory) return
+
+ val slot = event.slot
+ val stack = slot.stack
+
+ val slotNumber = slot.slotNumber
+
+ val position = resultDisplay.getOrDefault(slotNumber, null)
+ if (position != null) {
+ if (stack.getLore().any { it.contains("Done!") }) {
+ resultDisplay.clear()
+ return
+ }
+ event.stackTip = "#$position"
+ return
+ }
+
+ if (!sounds.contains(slotNumber)) {
+ if (stack.getLore().any { it.contains("Hear!") }) {
+ event.stackTip = "Hear!"
+ event.offsetX = 5
+ event.offsetY = -5
+ return
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!inInventory) return
+
+ // only listen to right clicks
+ if (event.clickedButton != 1) return
+
+ lastClickSlot = event.slotId
+ lastClickTime = System.currentTimeMillis()
+ }
+
+ class Sound(val name: String, val pitch: Float)
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt
new file mode 100644
index 000000000..10c6612bd
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt
@@ -0,0 +1,62 @@
+package at.hannibal2.skyhanni.features.misc.tiarelay
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class TiaRelayWaypoints {
+ private var waypoint: LorenzVec? = null
+ private var waypointName: String? = null
+ private var island = IslandType.NONE
+
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return
+
+ val message = event.message
+ for (relay in Relay.values()) {
+ if (relay.chatMessage == message) {
+ waypoint = relay.waypoint
+ waypointName = relay.relayName
+ island = relay.island
+ return
+ }
+ }
+
+ if (message == "§aYou completed the maintenance on the relay!") {
+ waypoint = null
+ island = IslandType.NONE
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: RenderWorldLastEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+
+ if (SkyHanniMod.feature.misc.tiaRelayAllWaypoints) {
+ for (relay in Relay.values()) {
+ if (relay.island == LorenzUtils.skyBlockIsland) {
+ event.drawWaypointFilled(relay.waypoint, LorenzColor.LIGHT_PURPLE.toColor())
+ event.drawDynamicText(relay.waypoint, "§d" + relay.relayName, 1.5)
+ }
+ }
+ return
+ }
+
+ if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return
+ if (LorenzUtils.skyBlockIsland != island) return
+
+ waypoint?.let {
+ event.drawWaypointFilled(it, LorenzColor.LIGHT_PURPLE.toColor())
+ event.drawDynamicText(it, "§d" + waypointName!!, 1.5)
+ }
+ }
+} \ No newline at end of file