aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java47
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt31
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt39
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt42
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/LocationChangeEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt174
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt48
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt36
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt6
13 files changed, 374 insertions, 72 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 7bd6cd965..a1f91608c 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -32,6 +32,7 @@ import at.hannibal2.skyhanni.features.nether.ashfang.*;
import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon;
import at.hannibal2.skyhanni.features.slayer.HideMobNames;
import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniboss;
+import at.hannibal2.skyhanni.features.slayer.SlayerQuestWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerFirePitsWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerPillar;
@@ -85,6 +86,7 @@ public class SkyHanniMod {
registerEvent(new EntityMovementData());
registerEvent(new ItemClickData());
registerEvent(new MinecraftData());
+ registerEvent(new SendTitleHelper());
registerEvent(new BazaarOrderHelper());
registerEvent(new ChatFilter());
@@ -139,6 +141,7 @@ public class SkyHanniMod {
registerEvent(new BlazeSlayerFirePitsWarning());
registerEvent(new PlayerChatFilter());
registerEvent(new HideArmor());
+ registerEvent(new SlayerQuestWarning());
Commands.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
index 3f270b6b1..e2110df42 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
@@ -7,27 +7,12 @@ import com.google.gson.annotations.Expose;
public class Slayer {
@Expose
- @ConfigOption(name = "Slayer Miniboss Highlight", desc = "Highlight slayer miniboss in blue color")
- @ConfigEditorBoolean
- public boolean slayerMinibossHighlight = false;
-
- @Expose
- @ConfigOption(name = "Slayer Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)")
- @ConfigEditorBoolean
- public boolean slayerEndermanBeacon = false;
-
- @Expose
- @ConfigOption(name = "Hide Mob Names", desc = "Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.")
- @ConfigEditorBoolean
- public boolean hideMobNames = false;
-
- @Expose
@ConfigOption(name = "Blaze", desc = "")
@ConfigEditorAccordion(id = 0)
public boolean damageSplash = false;
@Expose
- @ConfigOption(name = "Pillar Display", desc = "Cooldown when the Fire Pillar from the blaze slayer will kill you.")
+ @ConfigOption(name = "Pillar Display", desc = "Cooldown when the Fire Pillar from the Blaze Slayer will kill you.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean firePillarDisplay = false;
@@ -39,27 +24,47 @@ public class Slayer {
public Position firePillarPos = new Position(10, 10, false, true);
@Expose
- @ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer for the blaze slayer.")
+ @ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer for the Blaze Slayer.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean firePillarSound = false;
@Expose
- @ConfigOption(name = "Hide Pillar", desc = "Hide sound and entities when building the Fire Pillar for the blaze slayer.")
+ @ConfigOption(name = "Hide Pillar", desc = "Hide sound and entities when building the Fire Pillar for the Blaze Slayer.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean firePillarBuildHider = false;
@Expose
- @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the blaze slayer daggers")
+ @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the Blaze Slayer daggers")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean blazeDaggers = false;
@Expose
- //TODO blaze slayer tier 4
- @ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the blaze slayer tier 3")
+ //TODO Blaze Slayer tier 4
+ @ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the Blaze Slayer tier 3")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean firePitsWarning = false;
+
+ @Expose
+ @ConfigOption(name = "Slayer Miniboss Highlight", desc = "Highlight slayer miniboss in blue color")
+ @ConfigEditorBoolean
+ public boolean slayerMinibossHighlight = false;
+
+ @Expose
+ @ConfigOption(name = "Slayer Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)")
+ @ConfigEditorBoolean
+ public boolean slayerEndermanBeacon = false;
+
+ @Expose
+ @ConfigOption(name = "Hide Mob Names", desc = "Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.")
+ @ConfigEditorBoolean
+ public boolean hideMobNames = false;
+
+ @Expose
+ @ConfigOption(name = "Quest Warning", desc = "Warning when wrong slayer quest is selected, or killing mobs for the wrong slayer.")
+ @ConfigEditorBoolean
+ public boolean questWarning = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index 929515283..fc458b6d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.data
-import at.hannibal2.skyhanni.events.LocationChangeEvent
+import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.utils.LorenzLogger
@@ -17,10 +17,21 @@ class HypixelData {
companion object {
var hypixel = false
var skyblock = false
- var skyBlockArea: String = ""
+ var skyBlockIsland: String = ""
+
+ fun readSkyBlockArea(): String {
+ for (line in ScoreboardData.sidebarLinesFormatted()) {
+ if (line.startsWith(" §7⏣ ")) {
+ return line.substring(5).removeColor()
+ }
+ }
+
+ return "invalid"
+ }
+
}
- var loggerLocationChange = LorenzLogger("debug/location_change")
+ var loggerIslandChange = LorenzLogger("debug/island_change")
@SubscribeEvent
fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) {
@@ -79,24 +90,24 @@ class HypixelData {
}
private fun checkMode() {
- var newArea = ""
+ var newIsland = ""
var guesting = false
for (line in TabListUtils.getTabList()) {
if (line.startsWith("§r§b§lArea: ")) {
- newArea = line.split(": ")[1].removeColor()
+ newIsland = line.split(": ")[1].removeColor()
}
if (line == "§r Status: §r§9Guest§r") {
guesting = true
}
}
if (guesting) {
- newArea = "$newArea guesting"
+ newIsland = "$newIsland guesting"
}
- if (skyBlockArea != newArea) {
- LocationChangeEvent(newArea, skyBlockArea).postAndCatch()
- loggerLocationChange.log(newArea)
- skyBlockArea = newArea
+ if (skyBlockIsland != newIsland) {
+ IslandChangeEvent(newIsland, skyBlockIsland).postAndCatch()
+ loggerIslandChange.log(newIsland)
+ skyBlockIsland = newIsland
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 4fe80a0ac..495deabb9 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -11,6 +11,42 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
class ScoreboardData {
companion object {
+
+ private val splitIcons = listOf(
+ "\uD83C\uDF6B",
+ "\uD83D\uDCA3",
+ "\uD83D\uDC7D",
+ "\uD83D\uDD2E",
+ "\uD83D\uDC0D",
+ "\uD83D\uDC7E",
+ "\uD83C\uDF20",
+ "\uD83C\uDF6D",
+ "⚽",
+ "\uD83C\uDFC0",
+ "\uD83D\uDC79",
+ "\uD83C\uDF81",
+ "\uD83C\uDF89",
+ "\uD83C\uDF82",
+ )
+
+ fun sidebarLinesFormatted(): List<String> {
+ val list = mutableListOf<String>()
+ for (line in sidebarLinesRaw) {
+ val seperator = splitIcons.find { line.contains(it) }!!
+ val split = line.split(seperator)
+ val start = split[0]
+ var end = split[1]
+ if (end.length >= 2) {
+ end = end.substring(2)
+ }
+
+ list.add(start+end)
+
+ }
+
+ return list
+ }
+
var sidebarLines: List<String> = emptyList()
var sidebarLinesRaw: List<String> = emptyList()
}
@@ -33,8 +69,7 @@ class ScoreboardData {
val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return emptyList()
var scores = scoreboard.getSortedScores(objective)
val list = scores.filter { input: Score? ->
- input != null && input.playerName != null && !input.playerName
- .startsWith("#")
+ input != null && input.playerName != null && !input.playerName.startsWith("#")
}
scores = if (list.size > 15) {
list.drop(15)
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt
new file mode 100644
index 000000000..eda151f97
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/SendTitleHelper.kt
@@ -0,0 +1,42 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.ScaledResolution
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class SendTitleHelper {
+
+ companion object {
+ private var textToRender = ""
+ private var endTime = 0L
+
+ fun sendTitle(text: String, duration: Int) {
+ textToRender = text
+ endTime = System.currentTimeMillis() + duration
+ }
+ }
+
+ @SubscribeEvent
+ fun renderOverlay(event: RenderGameOverlayEvent.Post) {
+ if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
+
+ if (System.currentTimeMillis() > endTime) return
+
+ val scaledResolution = ScaledResolution(Minecraft.getMinecraft())
+ val width = scaledResolution.scaledWidth
+ val height = scaledResolution.scaledHeight
+
+ GlStateManager.enableBlend()
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
+ val renderer = Minecraft.getMinecraft().fontRendererObj
+
+ GlStateManager.pushMatrix()
+ GlStateManager.translate((width / 2).toFloat(), (height / 1.8).toFloat(), 0.0f)
+ GlStateManager.scale(4.0f, 4.0f, 4.0f)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(textToRender, renderer, 0f, 0f, false, 75, 0)
+ GlStateManager.popMatrix()
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt
new file mode 100644
index 000000000..2dec9acad
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/IslandChangeEvent.kt
@@ -0,0 +1,3 @@
+package at.hannibal2.skyhanni.events
+
+class IslandChangeEvent(val newIsland: String, val oldIsland: String?) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LocationChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LocationChangeEvent.kt
deleted file mode 100644
index b8f9c0fef..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/LocationChangeEvent.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-class LocationChangeEvent(val newMode: String, val oldMode: String?) : LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
index 1c4f70a12..4335fe5ce 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
@@ -149,7 +149,7 @@ class ChatFilter {
}
private fun slayerDrop(message: String): Boolean {
- //Revenant
+ //Zombie
if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§9Revenant Viscera§r§7\\) (.*)")) return true
if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§9Foul Flesh§r§7\\) (.*)")) return true
if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§9Foul Flesh§r§7\\) (.*)")) return true
@@ -160,6 +160,15 @@ class ChatFilter {
}
if (message.matchRegex("§5§lVERY RARE DROP! §r§7\\(§r§f§r§5Revenant Catalyst§r§7\\) (.*)")) return true
if (message.matchRegex("§5§lVERY RARE DROP! §r§7\\(§r§f§r§9Undead Catalyst§r§7\\) (.*)")) return true
+ if (message.matchRegex("§5§lVERY RARE DROP! §r§7\\(§r§f§r§2◆ Pestilence Rune I§r§7\\) §r§b(.*)")) return true
+
+ //Tarantula
+ if (message.matchRegex("§6§lRARE DROP! §r§9Arachne's Keeper Fragment (.+)")) return true
+ if (message.matchRegex("§6§lRARE DROP! §r§5Travel Scroll to Spider's Den Top of Nest (.+)")) return true
+ if (message.matchRegex("§9§lVERY RARE DROP! §r§7\\(§r§f§r§a◆ Bite Rune I§r§7\\) (.+)")) return true
+ if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§7(.+)x §r§f§r§aToxic Arrow Poison§r§7\\) (.+)")) return true
+ if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§aToxic Arrow Poison§r§7\\) (.+)")) return true
+ if (message.matchRegex("§5§lVERY RARE DROP! §r§7\\(§r§9Bane of Arthropods VI§r§7\\) (.+)")) return true
//Enderman
if (message.matchRegex("§b§lRARE DROP! §r§7\\(§r§f§r§7(.*)x §r§f§r§aTwilight Arrow Poison§r§7\\) (.*)")) return true
@@ -240,6 +249,7 @@ class ChatFilter {
//§a§l+5 Kill Combo §r§8+§r§b3% §r§b? Magic Find
return when {
message.matchRegex("§.§l\\+(.*) Kill Combo §r§8\\+(.*)") -> true
+ message == "§6§l+50 Kill Combo" -> true
message.matchRegex("§cYour Kill Combo has expired! You reached a (.*) Kill Combo!") -> true
else -> false
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index 2f7203328..304306151 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -217,7 +217,7 @@ class DamageIndicatorManager {
}
@SubscribeEvent
- fun onTickEvent(event: TickEvent.ClientTickEvent) {
+ fun onTick(event: TickEvent.ClientTickEvent) {
if (!LorenzUtils.inSkyblock) return
for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) {
if (entity is EntityLivingBase) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
new file mode 100644
index 000000000..7711d6fe7
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -0,0 +1,174 @@
+package at.hannibal2.skyhanni.features.slayer
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.ScoreboardData
+import at.hannibal2.skyhanni.data.SendTitleHelper
+import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import net.minecraft.entity.EntityLivingBase
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class SlayerQuestWarning {
+
+ private var needSlayerQuest = false
+ private var lastWarning = 0L
+ private var currentReason = ""
+ private var dirtySidebar = false
+ private var tick = 0
+ private var activeSlayer: SlayerType? = null
+
+ //TODO add check if player has clicked on an item, before mobs around you gets damage
+
+ @SubscribeEvent
+ fun onChatMessage(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+
+ val message = event.message
+
+ //died
+ if (message == " §r§c§lSLAYER QUEST FAILED!") {
+ needNewQuest("The old slayer quest has failed!")
+ }
+ if (message == "§eYour unsuccessful quest has been cleared out!") {
+ needSlayerQuest = false
+ }
+
+ //no auto slayer
+ if (message.matchRegex(" §r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!")) {
+ needNewQuest("You have no Auto-Slayer active!")
+ }
+ if (message == " §r§a§lSLAYER QUEST COMPLETE!") {
+ needSlayerQuest = false
+ }
+
+ if (message == "§aYour Slayer Quest has been cancelled!") {
+ activeSlayer = null
+ }
+
+ //TODO hyp does no damage anymore
+
+ //TODO auto slayer disabled bc of no more money in bank or purse
+ }
+
+ private fun needNewQuest(reason: String) {
+ currentReason = reason
+ needSlayerQuest = true
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!isEnabled()) return
+
+ if (dirtySidebar) {
+ if (tick++ % 60 == 0) {
+ checkSidebar()
+ }
+ }
+ }
+
+ private fun checkSidebar() {
+ var loaded = false
+
+ var slayerQuest = false
+ var bossSlain = false
+ var slayBoss = false
+ var slayerTypeName = ""
+ var nextIsType = false
+ for (line in ScoreboardData.sidebarLinesFormatted()) {
+ if (nextIsType) {
+ slayerTypeName = line.removeColor()
+ nextIsType = false
+ }
+ if (line == "Slayer Quest") {
+ slayerQuest = true
+ nextIsType = true
+ }
+ if (line == "§aBoss slain!") {
+ bossSlain = true
+ }
+ if (line == "§eSlay the boss!") {
+ slayBoss = true
+ }
+ if (line == "§ewww.hypixel.net" || line == "§ewww.alpha.hypixel.net") {
+ loaded = true
+ }
+ }
+
+ activeSlayer = SlayerType.getByDisplayName(slayerTypeName)
+
+ if (loaded) {
+ dirtySidebar = false
+ if (slayerQuest && !needSlayerQuest) {
+ if (bossSlain) {
+ needNewQuest("You have no Auto-Slayer active!")
+ } else if (slayBoss) {
+ needNewQuest("You probably switched the server during an active boss and how hypixel doesn't know what to do.")
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: WorldEvent.Load) {
+ if (!SkyHanniMod.feature.slayer.questWarning) return
+
+ if (!needSlayerQuest) {
+ dirtySidebar = true
+ }
+ }
+
+ private fun tryWarn() {
+ if (!needSlayerQuest) return
+ warn("New Slayer Quest!", "Start a new slayer quest! $currentReason")
+ }
+
+ private fun warn(titleMessage: String, chatMessage: String) {
+ if (lastWarning + 10_000 > System.currentTimeMillis()) return
+
+ lastWarning = System.currentTimeMillis()
+ LorenzUtils.chat("§e[SkyHanni] $chatMessage")
+ SendTitleHelper.sendTitle("§e$titleMessage", 2_000)
+ }
+
+ @SubscribeEvent
+ fun onHealthUpdateEvent(event: EntityHealthUpdateEvent) {
+ if (!isEnabled()) return
+
+ val entity = event.entity
+ if (entity.getLorenzVec().distance(LocationUtils.playerLocation()) < 5) {
+ if (isSlayerMob(entity)) {
+ tryWarn()
+ }
+ }
+ }
+
+ private fun isSlayerMob(entity: EntityLivingBase): Boolean {
+ val area = LorenzUtils.skyBlockArea
+ val slayerType = SlayerType.getByArea(area) ?: return false
+
+ if (activeSlayer != null) {
+ val activeSlayer = activeSlayer!!
+ if (slayerType != activeSlayer) {
+ val activeSlayerName = activeSlayer.displayName
+ val slayerName = slayerType.displayName
+ warn(
+ "Wrong Slayer!",
+ "Wrong slayer selected! You have $activeSlayerName selected and are in the $slayerName area!"
+ )
+ }
+ }
+
+ return slayerType.clazz.isInstance(entity)
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.slayer.questWarning
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
new file mode 100644
index 000000000..37a879106
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
@@ -0,0 +1,48 @@
+package at.hannibal2.skyhanni.features.slayer
+
+import net.minecraft.entity.monster.EntityBlaze
+import net.minecraft.entity.monster.EntityEnderman
+import net.minecraft.entity.monster.EntitySpider
+import net.minecraft.entity.monster.EntityZombie
+import net.minecraft.entity.passive.EntityWolf
+
+enum class SlayerType(val displayName: String, val clazz: Class<*>) {
+ REVENANT("Revenant Horror", EntityZombie::class.java),
+ TARANTULA("Tarantula Broodfather", EntitySpider::class.java),
+ SVEN("Sven Packmaster", EntityWolf::class.java),
+ VOID("Voidgloom Seraph", EntityEnderman::class.java),
+ INFERNO("Inferno Demonlord", EntityBlaze::class.java),
+ ;
+
+ companion object {
+ fun getByArea(skyBlockArea: String): SlayerType? {
+ return when (skyBlockArea) {
+ "Graveyard",
+ "Coal Mine",
+ -> REVENANT
+
+ "Spiders Den",
+ -> TARANTULA
+
+ "Ruins",
+ "Howling Cave",
+ -> SVEN
+
+ "The End",
+ "Void Sepulture",
+ -> VOID
+
+ "Stronghold",
+ "The Wasteland",
+ "Smoldering Tomb",
+ -> INFERNO
+
+ else -> return null
+ }
+ }
+
+ fun getByDisplayName(text: String): SlayerType? {
+ return values().firstOrNull { text.startsWith(it.displayName) }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
index a5b7ae229..c0b5101a2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt
@@ -1,31 +1,24 @@
package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils
+import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.BossHealthChangeEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.SoundUtils.playSound
-import net.minecraft.client.Minecraft
-import net.minecraft.client.gui.ScaledResolution
-import net.minecraft.client.renderer.GlStateManager
-import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
class BlazeSlayerFirePitsWarning {
companion object {
- private var textToRender = ""
private var lastFirePitsWarning = 0L
private var nextTickIn = 0
fun fireFirePits() {
- lastFirePitsWarning = System.currentTimeMillis()
- textToRender = "§cFire Pits!"
- nextTickIn = 0
+ SendTitleHelper.sendTitle("§cFire Pits!", 2_000)
}
}
@@ -36,9 +29,7 @@ class BlazeSlayerFirePitsWarning {
val difference = System.currentTimeMillis() - lastFirePitsWarning
if (difference > 0) {
- if (difference > 2_000) {
- textToRender = ""
- } else {
+ if (difference <= 2_000) {
if (nextTickIn++ % 10 == 0) {
if (SkyHanniMod.feature.slayer.firePitsWarning) {
SoundUtils.createSound("random.orb", 0.8f).playSound()
@@ -83,25 +74,4 @@ class BlazeSlayerFirePitsWarning {
BossType.SLAYER_BLAZE_TYPHOEUS_34,
)
}
-
- @SubscribeEvent
- fun renderOverlay(event: RenderGameOverlayEvent.Post) {
- if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
- if (!isEnabled()) return
- if (!SkyHanniMod.feature.slayer.firePitsWarning) return
-
- val scaledResolution = ScaledResolution(Minecraft.getMinecraft())
- val width = scaledResolution.scaledWidth
- val height = scaledResolution.scaledHeight
-
- GlStateManager.enableBlend()
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
- val renderer = Minecraft.getMinecraft().fontRendererObj
-
- GlStateManager.pushMatrix()
- GlStateManager.translate((width / 2).toFloat(), (height / 1.8).toFloat(), 0.0f)
- GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textToRender, renderer, 0f, 0f, false, 75, 0)
- GlStateManager.popMatrix()
- }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index fa3e69cdf..90b60a7c3 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -24,7 +24,11 @@ object LorenzUtils {
get() = inSkyblock && DungeonData.inDungeon()
val skyBlockIsland: String
- get() = HypixelData.skyBlockArea
+ get() = HypixelData.skyBlockIsland
+
+ //TODO add cache
+ val skyBlockArea: String
+ get() = HypixelData.readSkyBlockArea()
val inKuudraFight: Boolean
get() = skyBlockIsland == "Instanced"