Skip to content

Commit

Permalink
Added offset option for SpringBoots
Browse files Browse the repository at this point in the history
Made last end split message be sent later
Added crate priority
  • Loading branch information
odtheking committed Oct 23, 2024
1 parent 639d05c commit b71023b
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import net.minecraft.util.Vec3
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.Locale
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.CopyOnWriteArraySet

object TerracottaTimer : Module(
name = "Terracotta Timer",
description = "Displays the time until the terracotta respawns.",
category = Category.DUNGEON
) {
private var terracottaSpawning = CopyOnWriteArrayList<Terracotta>()
private var terracottaSpawning = CopyOnWriteArraySet<Terracotta>()
private data class Terracotta(val pos: Vec3, var time: Double)

@SubscribeEvent
Expand Down
67 changes: 58 additions & 9 deletions odinmain/src/main/kotlin/me/odinmain/features/impl/nether/NoPre.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.odinmain.features.impl.nether

import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.utils.skyblock.*
import me.odinmain.utils.skyblock.KuudraUtils.PreSpot
Expand All @@ -14,23 +15,25 @@ object NoPre : Module(
category = Category.NETHER
) {
private val showAlert by BooleanSetting("Show Alert", false, description = "Shows an alert when you miss a pre spot.")
private val showCratePriority by BooleanSetting("Show Crate Priority", false, description = "Shows the crate priority alert.")
private val advanced by BooleanSetting("Advanced Mode", false, description = "Enables pro mode for the crate priority alert.").withDependency { showCratePriority }

private var preLocation = PreSpot.None
private var preSpot = PreSpot.None
var missing = PreSpot.None

private val partyChatRegex = Regex("^Party > (\\[[^]]*?])? ?(\\w{1,16}): No ?(Triangle|X|Equals|Slash)!\$")

init {
onMessage("[NPC] Elle: Head over to the main platform, I will join you when I get a bite!", false) {
val playerLocation = mc.thePlayer?.positionVector ?: return@onMessage
preLocation = when {
preSpot = when {
PreSpot.Triangle.location.distanceTo(playerLocation) < 15 -> PreSpot.Triangle
PreSpot.X.location.distanceTo(playerLocation) < 30 -> PreSpot.X
PreSpot.Equals.location.distanceTo(playerLocation) < 15 -> PreSpot.Equals
PreSpot.Slash.location.distanceTo(playerLocation) < 15 -> PreSpot.Slash
else -> PreSpot.None
}
modMessage("Pre-spot: ${if (preLocation == PreSpot.None) "§cDidn't register your pre-spot because you didn't get there in time." else preLocation.name}")
modMessage("Pre-spot: ${if (preSpot == PreSpot.None) "§cDidn't register your pre-spot because you didn't get there in time." else preSpot.name}")
}

onMessage("[NPC] Elle: Not again!", false) {
Expand All @@ -40,16 +43,16 @@ object NoPre : Module(
giantZombies.forEach { supply ->
val supplyLoc = Vec3(supply.posX, 76.0, supply.posZ)
when {
preLocation.location.distanceTo(supplyLoc) < 18 -> pre = true
preLocation == PreSpot.Triangle && PreSpot.Shop.location.distanceTo(supplyLoc) < 18 -> second = true
preLocation == PreSpot.X && PreSpot.xCannon.location.distanceTo(supplyLoc) < 16 -> second = true
preLocation == PreSpot.Slash && PreSpot.Square.location.distanceTo(supplyLoc) < 20 -> second = true
preSpot.location.distanceTo(supplyLoc) < 18 -> pre = true
preSpot == PreSpot.Triangle && PreSpot.Shop.location.distanceTo(supplyLoc) < 18 -> second = true
preSpot == PreSpot.X && PreSpot.xCannon.location.distanceTo(supplyLoc) < 16 -> second = true
preSpot == PreSpot.Slash && PreSpot.Square.location.distanceTo(supplyLoc) < 20 -> second = true
}
}
if (second && pre) return@onMessage
if (!pre && preLocation != PreSpot.None) msg = "No ${preLocation.name}!"
if (!pre && preSpot != PreSpot.None) msg = "No ${preSpot.name}!"
else if (!second) {
msg = when (preLocation) {
msg = when (preSpot) {
PreSpot.Triangle -> "No Shop!"
PreSpot.X -> "No X Cannon!"
PreSpot.Slash -> "No Square!"
Expand All @@ -63,8 +66,54 @@ object NoPre : Module(

onMessage(partyChatRegex) {
missing = PreSpot.valueOf(partyChatRegex.find(it)?.groupValues?.lastOrNull() ?: return@onMessage)
if (!showCratePriority) return@onMessage
val cratePriority = cratePriority().ifEmpty { return@onMessage }
PlayerUtils.alert(cratePriority, time = 15)
modMessage("Crate Priority: $cratePriority")
}

onWorldLoad { missing = PreSpot.None }
}

fun cratePriority(): String {
return when {
// Shop Missing
missing == PreSpot.Shop && (preSpot == PreSpot.Triangle || preSpot == PreSpot.X) -> "Go X Cannon"
missing == PreSpot.Shop && (preSpot == PreSpot.Equals || preSpot == PreSpot.Slash) -> "Go Square"

// Triangle Missing
missing == PreSpot.Triangle && preSpot == PreSpot.Triangle -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.Triangle && preSpot == PreSpot.X -> "Go X Cannon"
missing == PreSpot.Triangle && preSpot == PreSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
missing == PreSpot.Triangle && preSpot == PreSpot.Slash -> "Go Square"

// Equals Missing
missing == PreSpot.Equals && preSpot == PreSpot.Triangle -> if (advanced) "Go Shop" else "Go X Cannon"
missing == PreSpot.Equals && preSpot == PreSpot.X -> "Go X Cannon"
missing == PreSpot.Equals && preSpot == PreSpot.Equals -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.Equals && preSpot == PreSpot.Slash -> "Go Square"

// Slash Missing
missing == PreSpot.Slash && preSpot == PreSpot.Triangle -> "Go Square"
missing == PreSpot.Slash && preSpot == PreSpot.X -> "Go X Cannon"
missing == PreSpot.Slash && preSpot == PreSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
missing == PreSpot.Slash && preSpot == PreSpot.Slash -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"

// Square Missing
missing == PreSpot.Square && (preSpot == PreSpot.Triangle || preSpot == PreSpot.Equals) -> "Go Shop"
missing == PreSpot.Square && (preSpot == PreSpot.X || preSpot == PreSpot.Slash) -> "Go X Cannon"

// X Cannon Missing
missing == PreSpot.xCannon && (preSpot == PreSpot.Triangle || preSpot == PreSpot.Equals) -> "Go Shop"
missing == PreSpot.xCannon && (preSpot == PreSpot.X || preSpot == PreSpot.Slash) -> "Go Square"

// X Missing
missing == PreSpot.X && preSpot == PreSpot.Triangle -> "Go X Cannon"
missing == PreSpot.X && preSpot == PreSpot.X -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.X && preSpot == PreSpot.Equals -> if (advanced) "Go Shop" else "X Cannon"
missing == PreSpot.X && preSpot == PreSpot.Slash -> "Go Square"

else -> ""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import me.odinmain.features.Module
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.settings.impl.ColorSetting
import me.odinmain.features.settings.impl.HudSetting
import me.odinmain.features.settings.impl.NumberSetting
import me.odinmain.utils.addVec
import me.odinmain.utils.equalsOneOf
import me.odinmain.utils.getSafe
Expand Down Expand Up @@ -39,6 +40,7 @@ object SpringBoots : Module(
}
private val renderGoal by BooleanSetting("Render Goal", true, description = "Render the goal block.")
private val goalColor by ColorSetting("Goal Color", Color.GREEN, description = "Color of the goal block.")
private val offset by NumberSetting("Offset", 0.0, -10.0, 10.0, 0.1, description = "The offset of the goal block.")

private val blocksList: List<Double> = listOf(
0.0, 3.0, 6.5, 9.0, 11.5, 13.5, 16.0, 18.0, 19.0,
Expand Down Expand Up @@ -70,7 +72,7 @@ object SpringBoots : Module(
fun onTick(event: TickEvent.ClientTickEvent) {
if (event.phase != TickEvent.Phase.END || !LocationUtils.inSkyblock) return
if (mc.thePlayer?.getCurrentArmor(0)?.skyblockID != "SPRING_BOOTS" || mc.thePlayer?.isSneaking == false) pitchCounts.fill(0)
blocksList.getSafe(pitchCounts.sum())?.let { blockPos = if (it != 0.0) mc.thePlayer?.positionVector?.addVec(x = -0.5, y = it, z = -0.5) else null }
blocksList.getSafe(pitchCounts.sum())?.let { blockPos = if (it != 0.0) mc.thePlayer?.positionVector?.addVec(x = -0.5 + offset, y = it, z = -0.5) else null }
}

@SubscribeEvent
Expand Down
7 changes: 3 additions & 4 deletions odinmain/src/main/kotlin/me/odinmain/utils/SplitsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ object SplitsManager {
val index = currentSplits.splits.indexOf(currentSplit).takeIf { it != 0 } ?: return
val currentSplitTime = (currentSplit.time - currentSplits.splits[index - 1].time) / 1000.0

currentSplits.personalBest?.time(index - 1, currentSplitTime, "s§7!", "§6${currentSplits.splits[index - 1].name} §7took §6", addPBString = true, addOldPBString = true, alwaysSendPB = true, sendOnlyPB = Splits.sendOnlyPB, sendMessage = Splits.enabled)

if (index == currentSplits.splits.size - 1) {
val (times, _) = getAndUpdateSplitsTimes(currentSplits)
currentSplits.personalBest?.time(index, times.last() / 1000.0, "s§7!", "§6Total time §7took §6", addPBString = true, addOldPBString = true, alwaysSendPB = true, sendOnlyPB = Splits.sendOnlyPB, sendMessage = Splits.enabled)
runIn(10) {
currentSplits.personalBest?.time(index - 1, currentSplitTime, "s§7!", "§6${currentSplits.splits[index - 1].name} §7took §6", addPBString = true, addOldPBString = true, alwaysSendPB = true, sendOnlyPB = Splits.sendOnlyPB, sendMessage = Splits.enabled)
currentSplits.personalBest?.time(index, times.last() / 1000.0, "s§7!", "§6Total time §7took §6", addPBString = true, addOldPBString = true, alwaysSendPB = true, sendOnlyPB = Splits.sendOnlyPB, sendMessage = Splits.enabled)
times.forEachIndexed { i, it ->
val name = if (i == currentSplits.splits.size - 1) "Total" else currentSplits.splits.getSafe(i)?.name
if (sendSplits && Splits.enabled) modMessage("§6$name §7took §6${formatTime(it)} §7to complete.")
}
}
}
} else currentSplits.personalBest?.time(index - 1, currentSplitTime, "s§7!", "§6${currentSplits.splits[index - 1].name} §7took §6", addPBString = true, addOldPBString = true, alwaysSendPB = true, sendOnlyPB = Splits.sendOnlyPB, sendMessage = Splits.enabled)
}

@SubscribeEvent
Expand Down

0 comments on commit b71023b

Please sign in to comment.