aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt5
3 files changed, 25 insertions, 13 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 180bd0a69..93d1a414d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.events.SlayerChangeEvent
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter
+import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
@@ -21,11 +22,12 @@ 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
+import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.removeWordsAtEnd
+import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.ceil
@@ -53,7 +55,7 @@ class SlayerRngMeterDisplay {
"§aYou set your §r.* RNG Meter §r§ato drop §r.*§a!"
)
- private var display = ""
+ private var display = emptyList<Renderable>()
private var lastItemDroppedTime = 0L
var rngScore = mapOf<String, Map<NEUInternalName, Long>>()
@@ -186,10 +188,15 @@ class SlayerRngMeterDisplay {
}
private fun update() {
- display = drawDisplay()
+ display = listOf(makeLink(drawDisplay()))
}
- private fun drawDisplay(): String {
+ private fun makeLink(text: String) =
+ Renderable.clickAndHover(text, listOf("§eClick to open RNG Meter Inventory."), onClick = {
+ HypixelCommands.showRng("slayer", SlayerAPI.getActiveSlayer()?.rngName)
+ })
+
+ fun drawDisplay(): String {
val storage = getStorage() ?: return ""
if (SlayerAPI.latestSlayerCategory.let {
@@ -221,12 +228,12 @@ class SlayerRngMeterDisplay {
}
@SubscribeEvent
- fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
+ fun onRenderOverlay(event: GuiRenderEvent) {
if (!isEnabled()) return
if (!SlayerAPI.isInCorrectArea) return
if (!SlayerAPI.hasActiveSlayerQuest()) return
- config.pos.renderString(display, posLabel = "RNG Meter Display")
+ config.pos.renderRenderables(display, posLabel = "RNG Meter Display")
}
fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
index 6d692e5da..c7a1f2fde 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt
@@ -6,12 +6,12 @@ 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),
- VAMPIRE("Riftstalker Bloodfiend", EntityZombie::class.java)
+enum class SlayerType(val displayName: String, val rngName: String, val clazz: Class<*>) {
+ REVENANT("Revenant Horror", "revenant", EntityZombie::class.java),
+ TARANTULA("Tarantula Broodfather", "tarantula", EntitySpider::class.java),
+ SVEN("Sven Packmaster", "sven", EntityWolf::class.java),
+ VOID("Voidgloom Seraph", "voidgloom", EntityEnderman::class.java),
+ INFERNO("Inferno Demonlord", "inferno", EntityBlaze::class.java),
+ VAMPIRE("Riftstalker Bloodfiend", "vampire", EntityZombie::class.java)
;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt
index c09c77395..a2328297d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt
@@ -62,6 +62,11 @@ object HypixelCommands {
send("ac $message")
}
+ fun showRng(major: String? = null, minor: String? = null) = when {
+ major == null || minor == null -> send("rng")
+ else -> send("rng $major $minor")
+ }
+
private fun send(command: String) {
@Suppress("DEPRECATION")
// TODO rename function