Skip to content

Commit

Permalink
Fixed an issue with Kuudra tier detection
Browse files Browse the repository at this point in the history
Possible fix for melody solver with skipping
  • Loading branch information
odtheking committed Oct 30, 2024
1 parent 947fd68 commit 1a2bdbd
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 100 deletions.
34 changes: 17 additions & 17 deletions src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import me.odinmain.features.impl.floor7.DragonPriority.findPriority
import me.odinmain.features.impl.floor7.WitherDragonState
import me.odinmain.features.impl.floor7.WitherDragons.priorityDragon
import me.odinmain.features.impl.floor7.WitherDragonsEnum
import me.odinmain.features.impl.nether.NoPre
import me.odinmain.features.impl.render.DevPlayers.updateDevs
import me.odinmain.utils.*
import me.odinmain.utils.skyblock.*
Expand Down Expand Up @@ -103,7 +104,7 @@ val devCommand = commodore("oddev") {
|currentDungeonPlayer: ${DungeonUtils.currentDungeonPlayer.name}, ${DungeonUtils.currentDungeonPlayer.clazz}, ${DungeonUtils.currentDungeonPlayer.isDead}, ${DungeonUtils.isGhost}
|doorOpener: ${DungeonUtils.doorOpener}
|currentRoom: ${DungeonUtils.currentFullRoom?.room?.data?.name}, roomsPassed: ${DungeonUtils.passedRooms.map { it.room.data.name }}
|Teammates: ${DungeonUtils.dungeonTeammates.joinToString { "§${it.clazz.colorCode}${it.name} (${it.clazz})" }}
|Teammates: ${DungeonUtils.dungeonTeammates.joinToString { "§${it.clazz.colorCode}${it.name} (${it.clazz}[${it.clazzLvl}])" }}
|TeammatesNoSelf: ${DungeonUtils.dungeonTeammatesNoSelf.map { it.name }}
|LeapTeammates: ${DungeonUtils.leapTeammates.map { it.name }}
|Blessings: ${Blessing.entries.joinToString { "${it.name}: ${it.current}" }}
Expand All @@ -115,22 +116,21 @@ val devCommand = commodore("oddev") {
modMessage("currentarea: ${LocationUtils.currentArea}, isDungeon ${DungeonUtils.inDungeons}, inKuudra: ${KuudraUtils.inKuudra} kuudratier: ${LocationUtils.kuudraTier}, dungeonfloor: ${DungeonUtils.floorNumber}")
}

literal("kuudrainfo") {
runs {
modMessage("""
${getChatBreak()}
|inKuudra: ${KuudraUtils.inKuudra}
|kuudraTeammates: ${KuudraUtils.kuudraTeammates.joinToString { it.playerName }}
|giantZombies: ${KuudraUtils.giantZombies.joinToString { it.positionVector.toString() }}
|supplies: ${KuudraUtils.supplies.joinToString()}
|kuudraEntity: ${KuudraUtils.kuudraEntity}
|builders: ${KuudraUtils.playersBuildingAmount}
|build: ${KuudraUtils.buildDonePercentage}
|phase: ${KuudraUtils.phase}
|buildingPiles: ${KuudraUtils.buildingPiles.joinToString { it.positionVector.toString() }}
${getChatBreak()}
""".trimIndent(), "")
}
literal("kuudrainfo").runs {
modMessage("""
${getChatBreak()}
|inKuudra: ${KuudraUtils.inKuudra}, tier: ${LocationUtils.kuudraTier}, phase: ${KuudraUtils.phase}
|kuudraTeammates: ${KuudraUtils.kuudraTeammates.joinToString { it.playerName }}
|giantZombies: ${KuudraUtils.giantZombies.joinToString { it.positionVector.toString() }}
|supplies: ${KuudraUtils.supplies.joinToString()}
|kuudraEntity: ${KuudraUtils.kuudraEntity}
|builders: ${KuudraUtils.playersBuildingAmount}
|build: ${KuudraUtils.buildDonePercentage}
|buildingPiles: ${KuudraUtils.buildingPiles.joinToString { it.positionVector.toString() }}
|missing: ${NoPre.missing}
${getChatBreak()}
""".trimIndent(), "")

}
literal("simulate").runs { str: GreedyString ->
mc.thePlayer.addChatMessage(ChatComponentText(str.string))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ object KingRelics {

fun relicsOnWorldLast() {
Relic.entries.forEach {
if (it == Relic.None) return
if (currentRelic.id == it.id) Renderer.drawCustomBeacon("", it.cauldronPosition, it.color, distance = false)
if (it != Relic.None && currentRelic.id == it.id)
Renderer.drawCustomBeacon("", it.cauldronPosition, it.color, distance = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,16 @@ object InactiveWaypoints : Module(
private val lineWidth by NumberSetting("Line Width", 2f, 0.1f, 10f, 0.1f, description = "The width of the box's lines.")
private val depthCheck by BooleanSetting("Depth check", false, description = "Boxes show through walls.")

private var inactiveList = listOf<Entity>()
private var inactiveList = setOf<Entity>()

init {
execute(500) {
if (DungeonUtils.getF7Phase() != M7Phases.P3) return@execute
inactiveList = mc.theWorld?.loadedEntityList?.filter {
it is EntityArmorStand && it.name.noControlCodes.containsOneOf("Inactive", "Not Activated", "CLICK HERE", ignoreCase = true) }.orEmpty()
it is EntityArmorStand && it.name.noControlCodes.containsOneOf("Inactive", "Not Activated", "CLICK HERE", ignoreCase = true) }?.toSet().orEmpty()
}

onWorldLoad {
inactiveList = emptyList()
}
onWorldLoad { inactiveList = emptySet() }
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ object TerminalSolver : Module(
private fun solveMelody(items: List<ItemStack?>): List<Int> {
val greenPane = items.indexOfLast { it?.metadata == 5 && Item.getIdFromItem(it.item) == 160 }.takeIf { it != -1 } ?: return emptyList()
val magentaPane = items.indexOfFirst { it?.metadata == 2 && Item.getIdFromItem(it.item) == 160 }.takeIf { it != -1 } ?: return emptyList()
val greenClay = items.indexOfFirst { it?.metadata == 5 && Item.getIdFromItem(it.item) == 159 }.takeIf { it != -1 } ?: return emptyList()
val greenClay = items.indexOfLast { it?.metadata == 5 && Item.getIdFromItem(it.item) == 159 }.takeIf { it != -1 } ?: return emptyList()
return items.mapIndexedNotNull { index, item ->
when {
index == greenPane || item?.metadata == 2 && Item.getIdFromItem(item.item) == 160 -> index
Expand Down
106 changes: 54 additions & 52 deletions src/main/kotlin/me/odinmain/features/impl/nether/NoPre.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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
import me.odinmain.utils.skyblock.KuudraUtils.SupplyPickUpSpot
import me.odinmain.utils.skyblock.KuudraUtils.giantZombies
import net.minecraft.util.Vec3

Expand All @@ -18,46 +18,45 @@ object NoPre : Module(
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 preSpot = PreSpot.None
var missing = PreSpot.None
private var preSpot = SupplyPickUpSpot.None
var missing = SupplyPickUpSpot.None

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

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

onMessage(Regex("\\[NPC] Elle: Not again!")) {
if (preSpot == PreSpot.None) return@onMessage
if (preSpot == SupplyPickUpSpot.None) return@onMessage
var pre = false
var second = false
var msg = ""
giantZombies.forEach { supply ->
val supplyLoc = Vec3(supply.posX, 76.0, supply.posZ)
when {
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
preSpot == SupplyPickUpSpot.Triangle && SupplyPickUpSpot.Shop.location.distanceTo(supplyLoc) < 18 -> second = true
preSpot == SupplyPickUpSpot.X && SupplyPickUpSpot.xCannon.location.distanceTo(supplyLoc) < 16 -> second = true
preSpot == SupplyPickUpSpot.Slash && SupplyPickUpSpot.Square.location.distanceTo(supplyLoc) < 20 -> second = true
}
}
if (second && pre) return@onMessage
if (!pre && preSpot != PreSpot.None) msg = "No ${preSpot.name}!"
if (!pre && preSpot != SupplyPickUpSpot.None) msg = "No ${preSpot.name}!"
else if (!second) {
msg = when (preSpot) {
PreSpot.Triangle -> "No Shop!"
PreSpot.X -> "No xCannon!"
PreSpot.Slash -> "No Square!"
SupplyPickUpSpot.Triangle -> "No Shop!"
SupplyPickUpSpot.X -> "No xCannon!"
SupplyPickUpSpot.Slash -> "No Square!"
else -> return@onMessage
}
}
Expand All @@ -67,74 +66,77 @@ object NoPre : Module(
}

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

onWorldLoad { missing = PreSpot.None }
onWorldLoad {
preSpot = SupplyPickUpSpot.None
missing = SupplyPickUpSpot.None
}
}

fun cratePriority(missing: PreSpot): String {
fun cratePriority(missing: SupplyPickUpSpot): String {
return when (missing) {
// Shop Missing
PreSpot.Shop -> when (preSpot) {
PreSpot.Triangle, PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> if (advanced) "Go X Cannon" else "Go Shop"
PreSpot.Slash -> "Go Square"
SupplyPickUpSpot.Shop -> when (preSpot) {
SupplyPickUpSpot.Triangle, SupplyPickUpSpot.X -> "Go X Cannon"
SupplyPickUpSpot.Equals -> if (advanced) "Go X Cannon" else "Go Shop"
SupplyPickUpSpot.Slash -> "Go Square"
else -> ""
}

// Triangle Missing
PreSpot.Triangle -> when (preSpot) {
PreSpot.Triangle -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
PreSpot.X, PreSpot.Equals -> "Go X Cannon"
PreSpot.Slash -> "Go Square, place on Triangle"
SupplyPickUpSpot.Triangle -> when (preSpot) {
SupplyPickUpSpot.Triangle -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
SupplyPickUpSpot.X, SupplyPickUpSpot.Equals -> "Go X Cannon"
SupplyPickUpSpot.Slash -> "Go Square, place on Triangle"
else -> ""
}

// Equals Missing
PreSpot.Equals -> when (preSpot) {
PreSpot.Triangle -> if (advanced) "Go Shop" else "Go X Cannon"
PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
PreSpot.Slash -> "Go Square, place on Equals"
SupplyPickUpSpot.Equals -> when (preSpot) {
SupplyPickUpSpot.Triangle -> if (advanced) "Go Shop" else "Go X Cannon"
SupplyPickUpSpot.X -> "Go X Cannon"
SupplyPickUpSpot.Equals -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
SupplyPickUpSpot.Slash -> "Go Square, place on Equals"
else -> ""
}

// Slash Missing
PreSpot.Slash -> when (preSpot) {
PreSpot.Triangle -> "Go x Cannon"
PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> "Go Square, place on Slash"
PreSpot.Slash -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
SupplyPickUpSpot.Slash -> when (preSpot) {
SupplyPickUpSpot.Triangle -> "Go x Cannon"
SupplyPickUpSpot.X -> "Go X Cannon"
SupplyPickUpSpot.Equals -> "Go Square, place on Slash"
SupplyPickUpSpot.Slash -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
else -> ""
}

// Square Missing
PreSpot.Square -> when (preSpot) {
PreSpot.Triangle, PreSpot.Equals -> "Go Shop"
PreSpot.X -> "Go X Cannon"
PreSpot.Slash -> "Go X Cannon"
SupplyPickUpSpot.Square -> when (preSpot) {
SupplyPickUpSpot.Triangle, SupplyPickUpSpot.Equals -> "Go Shop"
SupplyPickUpSpot.X -> "Go X Cannon"
SupplyPickUpSpot.Slash -> "Go X Cannon"
else -> ""
}

// X Cannon Missing
PreSpot.xCannon -> when (preSpot) {
PreSpot.Triangle, PreSpot.Equals -> "Go Shop"
PreSpot.X -> "Go Square"
PreSpot.Slash -> "Go Square, place on X Cannon"
SupplyPickUpSpot.xCannon -> when (preSpot) {
SupplyPickUpSpot.Triangle, SupplyPickUpSpot.Equals -> "Go Shop"
SupplyPickUpSpot.X -> "Go Square"
SupplyPickUpSpot.Slash -> "Go Square, place on X Cannon"
else -> ""
}

// X Missing
PreSpot.X -> when (preSpot) {
PreSpot.Triangle -> "Go X Cannon"
PreSpot.X -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
PreSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
PreSpot.Slash -> "Go Square, place on X"
SupplyPickUpSpot.X -> when (preSpot) {
SupplyPickUpSpot.Triangle -> "Go X Cannon"
SupplyPickUpSpot.X -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
SupplyPickUpSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
SupplyPickUpSpot.Slash -> "Go Square, place on X"
else -> ""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.utils.render.Color
import me.odinmain.utils.render.Renderer
import me.odinmain.utils.skyblock.KuudraUtils
import me.odinmain.utils.skyblock.KuudraUtils.PreSpot
import me.odinmain.utils.skyblock.KuudraUtils.SupplyPickUpSpot
import me.odinmain.utils.toAABB
import net.minecraft.util.BlockPos
import net.minecraft.util.Vec3i
Expand Down Expand Up @@ -66,12 +66,12 @@ object PearlWaypoints : Module(
)

private val blockNameMap = hashMapOf(
PreSpot.xCannon to BlockPos(-110, 155, -106),
PreSpot.X to BlockPos(-46, 120, -150),
PreSpot.Shop to BlockPos(-46, 135, -139),
PreSpot.Triangle to BlockPos(-37, 139, -125),
PreSpot.Equals to BlockPos(-28, 128, -112),
PreSpot.Slash to BlockPos(-106, 157, -99)
SupplyPickUpSpot.xCannon to BlockPos(-110, 155, -106),
SupplyPickUpSpot.X to BlockPos(-46, 120, -150),
SupplyPickUpSpot.Shop to BlockPos(-46, 135, -139),
SupplyPickUpSpot.Triangle to BlockPos(-37, 139, -125),
SupplyPickUpSpot.Equals to BlockPos(-28, 128, -112),
SupplyPickUpSpot.Slash to BlockPos(-106, 157, -99)
)

@SubscribeEvent
Expand All @@ -85,7 +85,7 @@ object PearlWaypoints : Module(
outlineAlpha = if (!closest && hideFarWaypoints) 0.25f else 1f, fillAlpha = 0f, depth = false)
}
lineup.lineups.forEach lineupLoop@{
if (NoPre.missing == PreSpot.None || NoPre.missing == PreSpot.Square) return@lineupLoop Renderer.drawBox(aabb = it.toAABB(), color = color, outlineAlpha = 0f, fillAlpha = if (!closest && hideFarWaypoints) 0f else 3f, depth = false)
if (NoPre.missing == SupplyPickUpSpot.None || NoPre.missing == SupplyPickUpSpot.Square) return@lineupLoop Renderer.drawBox(aabb = it.toAABB(), color = color, outlineAlpha = 0f, fillAlpha = if (!closest && hideFarWaypoints) 0f else 3f, depth = false)
if (lineup.startPos == setOf(BlockPos(-141, 78, -91)) && blockNameMap[NoPre.missing] != it) return@lineupLoop

Renderer.drawBox(aabb = it.toAABB(), color = color, outlineAlpha = 0f, fillAlpha = if (!closest && hideFarWaypoints) 0f else 3f, depth = false)
Expand Down
14 changes: 7 additions & 7 deletions src/main/kotlin/me/odinmain/features/impl/nether/SupplyHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import me.odinmain.utils.formatTime
import me.odinmain.utils.render.Color
import me.odinmain.utils.render.Renderer
import me.odinmain.utils.skyblock.KuudraUtils
import me.odinmain.utils.skyblock.KuudraUtils.PreSpot
import me.odinmain.utils.skyblock.KuudraUtils.SupplyPickUpSpot
import me.odinmain.utils.skyblock.modMessage
import net.minecraft.util.Vec3
import net.minecraftforge.client.event.ClientChatReceivedEvent
Expand Down Expand Up @@ -64,12 +64,12 @@ object SupplyHelper : Module(
}

private val locations = listOf(
Pair(Vec3(-98.0, 78.0, -112.0), PreSpot.Shop),
Pair(Vec3(-98.0, 78.0, -99.0), PreSpot.Equals),
Pair(Vec3(-110.0, 78.0, -106.0), PreSpot.xCannon),
Pair(Vec3(-106.0, 78.0, -112.0), PreSpot.X ),
Pair(Vec3(-94.0, 78.0, -106.0), PreSpot.Triangle),
Pair(Vec3(-106.0, 78.0, -99.0), PreSpot.Slash),
Pair(Vec3(-98.0, 78.0, -112.0), SupplyPickUpSpot.Shop),
Pair(Vec3(-98.0, 78.0, -99.0), SupplyPickUpSpot.Equals),
Pair(Vec3(-110.0, 78.0, -106.0), SupplyPickUpSpot.xCannon),
Pair(Vec3(-106.0, 78.0, -112.0), SupplyPickUpSpot.X ),
Pair(Vec3(-94.0, 78.0, -106.0), SupplyPickUpSpot.Triangle),
Pair(Vec3(-106.0, 78.0, -99.0), SupplyPickUpSpot.Slash),
)

private fun renderDropLocations() {
Expand Down
Loading

0 comments on commit 1a2bdbd

Please sign in to comment.