Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
cahnges
Browse files Browse the repository at this point in the history
Signed-off-by: TomJuri <[email protected]>
  • Loading branch information
TomJuri committed Sep 25, 2023
1 parent baf3057 commit 68f5e46
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/macrohq/swiftslayer/SwiftSlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class SwiftSlayer {
if (response.body() != null) {
val decoded: String = AuthUtil.rsaDecrypt(response.body()!!.string(), privateKey)
val split = decoded.split("\\|".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
if ("success" == split[0] && AuthUtil.getHWID() == split[1] && mc.session.playerID.equals(split[2]) && System.currentTimeMillis() - split[3].toLong() < 20000) {
if ("success" == split[0] && AuthUtil.getHWID() == split[1] && mc.session.playerID.equals(split[2]) && System.currentTimeMillis() - split[3].toLong() < 25000) {
config = SwiftSlayerConfig()
pathExecutor = PathExecutor()
mobKiller = MobKiller()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ class SwiftSlayerConfig : Config(Mod("SwiftSlayer", ModType.SKYBLOCK), "swiftsla
var debugMode = false

@Switch(
name = "Use Batphone",
name = "Autoslayer",
category = "General",
subcategory = "Slayer"
)
var useBatphone = false
var autoSlayer = false

@Switch(
name = "Ungrab Mouse",
Expand Down
34 changes: 23 additions & 11 deletions src/main/kotlin/dev/macrohq/swiftslayer/feature/SupportItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,12 @@ class SupportItem {
@SubscribeEvent
fun onTick(event: ClientTickEvent) {
if (!macroManager.enabled) return
if (config.useTuba && tubaTimer.isDone && macroManager.state == MacroManager.State.KILL_BOSS) {
val previousItem = player.inventory.currentItem
if (InventoryUtil.holdItem("Tuba")) {
Logger.info("Using Weird Tuba.")
KeyBindUtil.rightClick()
tubaTimer = Timer(21000)
player.inventory.currentItem = previousItem
} else {
Logger.error("No Weird Tuba found in hotbar!")
}
}
healing()
tuba()
orb()
}

private fun healing() {
if (config.useHealing) {
if (health == -1 || maxHealth == -1) return
val healthPercent = health.toFloat() / maxHealth.toFloat()
Expand All @@ -50,6 +45,23 @@ class SupportItem {
Logger.error("No Wand of Healing found in hotbar!")
}
}
}

private fun tuba() {
if (config.useTuba && tubaTimer.isDone && macroManager.state == MacroManager.State.KILL_BOSS) {
val previousItem = player.inventory.currentItem
if (InventoryUtil.holdItem("Tuba")) {
Logger.info("Using Weird Tuba.")
KeyBindUtil.rightClick()
tubaTimer = Timer(21000)
player.inventory.currentItem = previousItem
} else {
Logger.error("No Weird Tuba found in hotbar!")
}
}
}

private fun orb() {
if (config.deployOrb && SlayerUtil.getState() == SlayerUtil.SlayerState.BOSS_ALIVE && orbTimer.isDone) {
val previousItem = player.inventory.currentItem
if (InventoryUtil.holdItem("Flux")) {
Expand Down
12 changes: 8 additions & 4 deletions src/main/kotlin/dev/macrohq/swiftslayer/macro/MacroManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ class MacroManager {
if (!enabled || autoBatphone.enabled || mobKiller.enabled || genericBossKiller.enabled || endermanBossKiller.enabled) return
when (state) {
State.ACTIVATE_QUEST -> {
if (SlayerUtil.getActive() == null || SlayerUtil.getActive()!!.first.name != SlayerUtil.getSlayerName()!!.uppercase()
.replace(" ", "_") || SlayerUtil.getActive()!!.second.name != SlayerUtil.getTier() || SlayerUtil.getState() == SlayerUtil.SlayerState.BOSS_DEAD
)
autoBatphone.enable()
if (SlayerUtil.getActive() == null ||
SlayerUtil.getActive()!!.first.name != SlayerUtil.getSlayerName()!!.uppercase().replace(" ", "_") ||
SlayerUtil.getActive()!!.second.name != SlayerUtil.getTier() ||
SlayerUtil.getState() == SlayerUtil.SlayerState.BOSS_DEAD
) {
if (!config.autoSlayer)
autoBatphone.enable()
}
}
State.KILL_MOBS -> mobKiller.enable()
State.KILL_BOSS -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ class PathExecutor {

val rotation = RotationUtil.Rotation(AngleUtil.getAngles(next!!.toVec3Top()).yaw, 20f)
directionYaw = rotation.yaw
if (player.rotationYaw in abs(directionYaw) - 45..abs(directionYaw) + 45) {
gameSettings.keyBindSprint.setPressed(true)
} else {
gameSettings.keyBindSprint.setPressed(false)
}
gameSettings.keyBindSprint.setPressed(AngleUtil.yawTo360(player.rotationYaw) in AngleUtil.yawTo360(player.rotationYaw) - 45..AngleUtil.yawTo360(player.rotationYaw) + 45)
gameSettings.keyBindForward.setPressed(true)
gameSettings.keyBindJump.setPressed(shouldJump())
}
Expand All @@ -99,7 +95,6 @@ class PathExecutor {
}

fun disable() {
// RotationUtil.stop()
enabled = false
gameSettings.keyBindSprint.setPressed(false)
gameSettings.keyBindForward.setPressed(false)
Expand Down
15 changes: 8 additions & 7 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/EntityUtil.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package dev.macrohq.swiftslayer.util

import net.minecraft.entity.EntityLiving
import net.minecraft.entity.monster.EntityCaveSpider
import net.minecraft.init.Blocks

object EntityUtil {
fun getMobs(entityClass: Class<out EntityLiving>): List<EntityLiving> {
val entities = world.getLoadedEntityList().asSequence()
.filterIsInstance(entityClass)
.filter { it.maxHealth > 100 }
.filter { it !is EntityCaveSpider }
.filter { it.maxHealth > 250 }
.filter { world.getBlockState(it.getStandingOnCeil()).block != Blocks.air }
.filter { AngleUtil.getAngles(it).pitch < 60 && AngleUtil.getAngles(it).pitch > -60 }
.filter { !SlayerUtil.isBoss(it) }
.filter { !SlayerUtil.isMiniBoss(it) }
.toList().sortedBy { it.getDistanceToEntity(player) }
if (config.ignoreMiniBosses) return entities
val newEntities = mutableListOf<EntityLiving>()
if (SlayerUtil.getMiniBoss() != null) newEntities.add(SlayerUtil.getMiniBoss()!!)
newEntities.addAll(entities.sortedBy { it.getDistanceToEntity(player) })
return newEntities
.sortedBy { it.getDistanceToEntity(player) }
.toMutableList()
if (!config.ignoreMiniBosses && SlayerUtil.getMiniBoss() != null)
entities.add(0, SlayerUtil.getMiniBoss()!!)
return entities
}
}
2 changes: 2 additions & 0 deletions src/main/kotlin/dev/macrohq/swiftslayer/util/RenderUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import kotlin.math.sqrt
object RenderUtil {
var markers = mutableListOf<BlockPos>()
var filledBox = mutableListOf<BlockPos>()

@Volatile
var lines = mutableListOf<Vec3>()
var entites = mutableListOf<EntityLiving>()
var points = mutableListOf<Vec3>()
Expand Down

0 comments on commit 68f5e46

Please sign in to comment.