aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-10 00:24:52 +0100
committerGitHub <noreply@github.com>2024-02-10 00:24:52 +0100
commit4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 (patch)
treee72dac91d07fc84bea80548c89e13276caa68b81 /src/main/java/at/hannibal2/skyhanni/features/slayer
parentd3a7cc4ab970b457b7950489da781539e45e0dce (diff)
downloadskyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.gz
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.bz2
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.zip
Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt11
12 files changed, 39 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
index fedc9593a..0864bf658 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
@@ -18,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class SlayerItemsOnGround {
+
private val config get() = SkyHanniMod.feature.slayer.itemsOnGround
private var itemsOnGround = TimeLimitedCache<EntityItem, Pair<LorenzVec, String>>(2.seconds)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt
index 529b8b4d2..bdfc7bb00 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt
@@ -7,11 +7,11 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -24,6 +24,7 @@ import net.minecraft.entity.passive.EntityWolf
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class SlayerMiniBossFeatures {
+
private val config get() = SkyHanniMod.feature.slayer
private var miniBosses = listOf<EntityCreature>()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
index d0c374a8b..1ed123b51 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
@@ -12,8 +12,9 @@ import at.hannibal2.skyhanni.events.PurseChangeEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.SlayerChangeEvent
import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -27,6 +28,7 @@ import com.google.gson.annotations.Expose
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object SlayerProfitTracker {
+
private val config get() = SkyHanniMod.feature.slayer.itemProfitTracker
private var itemLogCategory = ""
@@ -34,6 +36,7 @@ object SlayerProfitTracker {
private val trackers = mutableMapOf<String, SkyHanniItemTracker<Data>>()
class Data : ItemTrackerData() {
+
override fun resetItems() {
slayerSpawnCost = 0
slayerCompletedCount = 0
@@ -131,7 +134,7 @@ object SlayerProfitTracker {
val amount = event.amount
if (!isAllowedItem(internalName)) {
- LorenzUtils.debug("Ignored non-slayer item pickup: '$internalName' '$itemLogCategory'")
+ ChatUtils.debug("Ignored non-slayer item pickup: '$internalName' '$itemLogCategory'")
return
}
@@ -212,14 +215,13 @@ object SlayerProfitTracker {
old
}
-
}
fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
fun clearProfitCommand(args: Array<String>) {
if (itemLogCategory == "") {
- LorenzUtils.userError(
+ ChatUtils.userError(
"No current slayer data found! " +
"§eGo to a slayer area and start the specific slayer type you want to reset the data of.",
)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
index 03beaa6fe..f28733f59 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -17,6 +18,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class SlayerQuestWarning {
+
private val config get() = SkyHanniMod.feature.slayer
private val talkToMaddoxPattern = " {3}§r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!".toPattern()
private var needSlayerQuest = false
@@ -25,7 +27,7 @@ class SlayerQuestWarning {
private var dirtySidebar = false
private var hasAutoSlayer = false
- //TODO add check if player has clicked on an item, before mobs around you gets damage
+ // TODO add check if player has clicked on an item, before mobs around you gets damage
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
@@ -33,7 +35,7 @@ class SlayerQuestWarning {
val message = event.message
- //died
+ // died
if (message == " §r§c§lSLAYER QUEST FAILED!") {
needNewQuest("The old slayer quest has failed!")
}
@@ -43,7 +45,7 @@ class SlayerQuestWarning {
dirtySidebar = true
}
- //no auto slayer
+ // no auto slayer
talkToMaddoxPattern.matchMatcher(message) {
needNewQuest("You have no Auto-Slayer active!")
}
@@ -55,7 +57,7 @@ class SlayerQuestWarning {
needSlayerQuest = false
}
- //TODO auto slayer disabled bc of no more money in bank or purse
+ // TODO auto slayer disabled bc of no more money in bank or purse
}
private fun needNewQuest(reason: String) {
@@ -132,7 +134,7 @@ class SlayerQuestWarning {
if (lastWarning + 10_000 > System.currentTimeMillis()) return
lastWarning = System.currentTimeMillis()
- LorenzUtils.chat(chatMessage)
+ ChatUtils.chat(chatMessage)
if (config.questWarningTitle) {
LorenzUtils.sendTitle("§e$titleMessage", 2.seconds)
@@ -168,5 +170,4 @@ class SlayerQuestWarning {
return slayerType.clazz.isInstance(entity)
}
-
}
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 239935368..d471ea441 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.SlayerChangeEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
@@ -25,6 +26,7 @@ import kotlin.math.ceil
import kotlin.time.Duration.Companion.seconds
class SlayerRngMeterDisplay {
+
private val config get() = SkyHanniMod.feature.slayer.rngMeterDisplay
private var display = ""
private val inventoryNamePattern = "(?<name>.*) RNG Meter".toPattern()
@@ -70,7 +72,7 @@ class SlayerRngMeterDisplay {
val item = storage.itemGoal
val hasItemSelected = item != "" && item != "?"
if (!hasItemSelected && config.warnEmpty) {
- LorenzUtils.userError("No Slayer RNG Meter Item selected!")
+ ChatUtils.userError("No Slayer RNG Meter Item selected!")
LorenzUtils.sendTitle("§cNo RNG Meter Item!", 3.seconds)
}
var blockChat = config.hideChat && hasItemSelected
@@ -86,7 +88,7 @@ class SlayerRngMeterDisplay {
var rawPercentage = old.toDouble() / storage.goalNeeded
if (rawPercentage > 1) rawPercentage = 1.0
val percentage = LorenzUtils.formatPercentage(rawPercentage)
- LorenzUtils.chat("§dRNG Meter §7dropped at §e$percentage §7XP ($from/${to}§7)")
+ ChatUtils.chat("§dRNG Meter §7dropped at §e$percentage §7XP ($from/${to}§7)")
lastItemDroppedTime = System.currentTimeMillis()
}
if (blockChat) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
index baf43b001..38022adf7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
@@ -12,6 +12,8 @@ import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
+import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen
@@ -22,8 +24,6 @@ import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
-import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
-import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
index ef4173429..821ff6a71 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
@@ -12,6 +12,7 @@ import net.minecraft.entity.projectile.EntityFireball
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BlazeSlayerClearView {
+
private var nearBlaze = false
@SubscribeEvent
@@ -60,4 +61,4 @@ class BlazeSlayerClearView {
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(3, "slayer.blazeClearView", "slayer.blazes.clearView")
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index 535bc3130..5d33ca6c6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BlazeSlayerDaggerHelper {
+
private val config get() = SkyHanniMod.feature.slayer.blazes.hellion
private val attunementPattern = "§cStrike using the §r(.+) §r§cattunement on your dagger!".toPattern()
@@ -201,7 +202,6 @@ class BlazeSlayerDaggerHelper {
val dagger = getDaggerFromStack(itemInHand)
dagger?.shields?.forEach { shield -> shield.active = !shield.active }
clientSideClicked = true
-
}
enum class Dagger(val daggerNames: List<String>, vararg val shields: HellionShield, var updated: Boolean = false) {
@@ -256,7 +256,6 @@ class BlazeSlayerDaggerHelper {
ConfigUtils.migrateIntToEnum(element, FirstDaggerEntry::class.java)
}
}
-
}
private fun HellionShield.other(): HellionShield {
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 74c15c271..81d537e35 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
@@ -13,9 +13,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class BlazeSlayerFirePitsWarning {
+
private val config get() = SkyHanniMod.feature.slayer.blazes
companion object {
+
private var lastFirePitsWarning = 0L
fun fireFirePits() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt
index 3fee1e92f..db3826d44 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt
@@ -9,9 +9,10 @@ enum class HellionShield(
val chatColor: String = color.getChatColor(),
var active: Boolean = false,
) {
+
AURIC("§e§lAURIC", "Auric", LorenzColor.YELLOW),
ASHEN("§8§lASHEN", "Ashen", LorenzColor.DARK_GRAY),
SPIRIT("§f§lSPIRIT", "Spirit", LorenzColor.WHITE),
CRYSTAL("§b§lCRYSTAL", "Crystal", LorenzColor.AQUA),
;
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt
index 105f7db3e..125893d6f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt
@@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class HellionShieldHelper {
companion object {
+
val hellionShieldMobs = mutableMapOf<EntityLiving, HellionShield>()
}
@@ -45,4 +46,4 @@ fun EntityLiving.setHellionShield(shield: HellionShield?) {
} else {
HellionShieldHelper.hellionShieldMobs.remove(this)
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
index cd0de443e..36d785d2b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
@@ -11,6 +11,8 @@ import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ServerBlockChangeEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
+import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen
import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
@@ -20,9 +22,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
-import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
@@ -39,6 +39,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class EndermanSlayerFeatures {
+
private val config get() = SkyHanniMod.feature.slayer.endermen
private val beaconConfig get() = config.beacon
private val endermenWithBeacons = mutableListOf<EntityEnderman>()
@@ -220,7 +221,11 @@ class EndermanSlayerFeatures {
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
- event.move(3, "slayer.endermanBeaconConfig.highlightBeacon", "slayer.endermen.endermanBeaconConfig.highlightBeacon")
+ event.move(
+ 3,
+ "slayer.endermanBeaconConfig.highlightBeacon",
+ "slayer.endermen.endermanBeaconConfig.highlightBeacon"
+ )
event.move(3, "slayer.endermanBeaconConfig.beaconColor", "slayer.endermen.endermanBeaconConfig.beaconColor")
event.move(3, "slayer.endermanBeaconConfig.showWarning", "slayer.endermen.endermanBeaconConfig.showWarning")
event.move(3, "slayer.endermanBeaconConfig.showLine", "slayer.endermen.endermanBeaconConfig.showLine")