aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-25 17:15:01 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-25 17:15:01 +0200
commitb2fb4746a3c7116ba7536c89979f0ea78cb363fb (patch)
treeaaacfe68fb16cd9439a89b9566904ff8cfe723e2 /src/main/java/at/hannibal2/skyhanni
parentd87d94c143ccad84e9680dc889051a90e99c9cb0 (diff)
downloadskyhanni-b2fb4746a3c7116ba7536c89979f0ea78cb363fb.tar.gz
skyhanni-b2fb4746a3c7116ba7536c89979f0ea78cb363fb.tar.bz2
skyhanni-b2fb4746a3c7116ba7536c89979f0ea78cb363fb.zip
more slayer stuff
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java52
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt109
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt33
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/DaggerMode.kt)2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt42
7 files changed, 171 insertions, 73 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 2005fe4bc..e0f4f6ac4 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -36,6 +36,7 @@ import at.hannibal2.skyhanni.features.slayer.SlayerQuestWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerFirePitsWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerPillar;
+import at.hannibal2.skyhanni.features.slayer.blaze.HellionShieldHelper;
import at.hannibal2.skyhanni.features.summonings.SummoningMobManager;
import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName;
import at.hannibal2.skyhanni.test.LorenzTest;
@@ -138,6 +139,7 @@ public class SkyHanniMod {
registerEvent(new ThunderSparksHighlight());
registerEvent(new BlazeSlayerPillar());
registerEvent(new BlazeSlayerDaggerHelper());
+ registerEvent(new HellionShieldHelper());
registerEvent(new BlazeSlayerFirePitsWarning());
registerEvent(new PlayerChatFilter());
registerEvent(new HideArmor());
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
index bc584cbdb..a108e6c8c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
@@ -7,55 +7,79 @@ import com.google.gson.annotations.Expose;
public class Slayer {
@Expose
- @ConfigOption(name = "Blaze", desc = "")
+ @ConfigOption(name = "Enderman", desc = "")
@ConfigEditorAccordion(id = 0)
- public boolean damageSplash = false;
+ public boolean enderman = false;
@Expose
- @ConfigOption(name = "Pillar Display", desc = "Cooldown when the Fire Pillar from the Blaze Slayer will kill you.")
+ @ConfigOption(name = "Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color. (supports beacon in hand and beacon flying)")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean slayerEndermanBeacon = false;
+
+ @Expose
+ @ConfigOption(name = "Phase Display", desc = "Show the current phase of the enderman slayer.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ public boolean endermanPhaseDisplay = false;
+
+ @Expose
+ @ConfigOption(name = "Blaze", desc = "")
+ @ConfigEditorAccordion(id = 1)
+ public boolean blaze = false;
+
+ @Expose
+ @ConfigOption(name = "Pillar Display", desc = "Cooldown when the Fire Pillar from the Blaze Slayer will kill you.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
public boolean firePillarDisplay = false;
@Expose
@ConfigOption(name = "Pillar Display Position", desc = "")
@ConfigEditorButton(runnableId = "firePillar", buttonText = "Edit")
- @ConfigAccordionId(id = 0)
+ @ConfigAccordionId(id = 1)
public Position firePillarPos = new Position(10, 10, false, true);
@Expose
@ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer for the Blaze Slayer.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
+ @ConfigAccordionId(id = 1)
public boolean firePillarSound = false;
@Expose
@ConfigOption(name = "Hide Pillar", desc = "Hide sound and entities when building the Fire Pillar for the Blaze Slayer.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
+ @ConfigAccordionId(id = 1)
public boolean firePillarBuildHider = false;
@Expose
- @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the Blaze Slayer daggers")
+ @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the Blaze Slayer daggers.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
+ @ConfigAccordionId(id = 1)
public boolean blazeDaggers = false;
@Expose
- @ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the Blaze Slayer tier 3 and 4")
+ @ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the Blaze Slayer tier 3 and 4.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
+ @ConfigAccordionId(id = 1)
public boolean firePitsWarning = false;
@Expose
- @ConfigOption(name = "Miniboss Highlight", desc = "Highlight slayer miniboss in blue color")
+ @ConfigOption(name = "Phase Display", desc = "Show the current phase of the blaze slayer.")
@ConfigEditorBoolean
- public boolean slayerMinibossHighlight = false;
+ @ConfigAccordionId(id = 1)
+ public boolean blazePhaseDisplay = false;
@Expose
- @ConfigOption(name = "Enderman Beacon", desc = "Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying)")
+ @ConfigOption(name = "Colored Mobs", desc = "Color the blaze slayer boss and the demons in the right hellion shield color.")
@ConfigEditorBoolean
- public boolean slayerEndermanBeacon = false;
+ @ConfigAccordionId(id = 1)
+ public boolean blazeColoredMobs = false;
+
+ @Expose
+ @ConfigOption(name = "Miniboss Highlight", desc = "Highlight slayer miniboss in blue color")
+ @ConfigEditorBoolean
+ public boolean slayerMinibossHighlight = false;
@Expose
@ConfigOption(name = "Hide Mob Names", desc = "Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index aa3da328e..6cdcc6eb2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -2,9 +2,12 @@ package at.hannibal2.skyhanni.features.damageindicator
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ScoreboardData
-import at.hannibal2.skyhanni.events.*
+import at.hannibal2.skyhanni.events.BossHealthChangeEvent
+import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonData
-import at.hannibal2.skyhanni.features.slayer.blaze.DaggerMode
+import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield
+import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield
import at.hannibal2.skyhanni.test.LorenzTest
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith
@@ -86,8 +89,10 @@ class DamageIndicatorManager {
val player = Minecraft.getMinecraft().thePlayer
//TODO config to define between 100ms and 5 sec
- for (uuid in data.filter { (System.currentTimeMillis() > it.value.timeLastTick + if (it.value.dead && !noDeathDisplay(it.value.bossType)) 4_000 else 100) ||
- (it.value.dead && noDeathDisplay(it.value.bossType)) }
+ for (uuid in data.filter {
+ (System.currentTimeMillis() > it.value.timeLastTick + if (it.value.dead && !noDeathDisplay(it.value.bossType)) 4_000 else 100) ||
+ (it.value.dead && noDeathDisplay(it.value.bossType))
+ }
.map { it.key }) {
data.remove(uuid)
}
@@ -146,6 +151,12 @@ class DamageIndicatorManager {
bossName += data.nameSuffix
}
//TODO fix scaling problem
+
+ if (data.nameAbove.isNotEmpty()) {
+// RenderUtils.drawLabel(location, data.nameAbove, partialTicks, true, 3.9f, -9.0f)
+ RenderUtils.drawLabel(location, data.nameAbove, partialTicks, true, 3.9f, -18.0f)
+ }
+
// val debug = Minecraft.getMinecraft().thePlayer.isSneaking
// RenderUtils.drawLabel(location, bossName, partialTicks, true, 3.9f, -9.0f, debug = debug)
RenderUtils.drawLabel(location, bossName, partialTicks, true, 3.9f, -9.0f)
@@ -199,7 +210,7 @@ class DamageIndicatorManager {
BossType.SLAYER_BLAZE_QUAZII_4,
//TODO f3/m3 4 guardians, f2/m2 4 boss room fighters
- -> true
+ -> true
else -> false
}
@@ -265,7 +276,7 @@ class DamageIndicatorManager {
entityData.namePrefix = ""
entityData.nameSuffix = ""
- entityData.color = null
+ entityData.nameAbove = ""
val customHealthText = if (health == 0L) {
entityData.dead = true
"§cDead"
@@ -313,6 +324,7 @@ class DamageIndicatorManager {
return checkEnderSlayer(entity as EntityEnderman, entityData, health.toInt(), maxHealth.toInt())
}
+ BossType.SLAYER_BLAZE_1,
BossType.SLAYER_BLAZE_2,
BossType.SLAYER_BLAZE_3,
BossType.SLAYER_BLAZE_4,
@@ -323,7 +335,7 @@ class DamageIndicatorManager {
BossType.SLAYER_BLAZE_TYPHOEUS_3,
BossType.SLAYER_BLAZE_TYPHOEUS_4,
-> {
- return checkBlazeSlayer(entity as EntityLiving, entityData)
+ return checkBlazeSlayer(entity as EntityLiving, entityData, health.toInt(), maxHealth.toInt())
}
BossType.NETHER_MAGMA_BOSS -> {
@@ -360,16 +372,55 @@ class DamageIndicatorManager {
return ""
}
- private fun checkBlazeSlayer(entity: EntityLiving, entityData: EntityData): String {
- for (swordMode in DaggerMode.values()) {
- if (entity.hasNameTagWith(3, swordMode.name)) {
- entityData.namePrefix = swordMode.formattedName + " "
- entityData.color = swordMode.color
- return ""
+ private fun checkBlazeSlayer(entity: EntityLiving, entityData: EntityData, health: Int, maxHealth: Int): String? {
+ val shield = HellionShield.values().firstOrNull { entity.hasNameTagWith(3, it.name) }
+ entity.setHellionShield(shield)
+ if (shield != null) {
+ entityData.nameAbove = shield.formattedName
+ }
+
+ if (!SkyHanniMod.feature.slayer.blazePhaseDisplay) return ""
+
+ var calcHealth = health
+ val calcMaxHealth: Int
+ entityData.namePrefix = when (entityData.bossType) {
+ BossType.SLAYER_BLAZE_1,
+ BossType.SLAYER_BLAZE_2,
+ -> {
+ val step = maxHealth / 2
+ calcMaxHealth = step
+ if (health > step) {
+ calcHealth -= step
+ "§c1/2 "
+ } else {
+ calcHealth = health
+ "§a2/2 "
+ }
+ }
+
+ BossType.SLAYER_BLAZE_3,
+ BossType.SLAYER_BLAZE_4,
+ -> {
+ val step = maxHealth / 3
+ calcMaxHealth = step
+ if (health > step * 2) {
+ calcHealth -= step * 2
+ "§c1/3 "
+ } else if (health > step) {
+ calcHealth -= step
+ "§e2/3 "
+ } else {
+ calcHealth = health
+ "§a3/3 "
+ }
}
+
+ else -> return ""
}
- return ""
+ return NumberUtil.percentageColor(
+ calcHealth.toLong(), calcMaxHealth.toLong()
+ ).getChatColor() + NumberUtil.format(calcHealth)
}
private fun checkMagmaCube(
@@ -480,10 +531,15 @@ class DamageIndicatorManager {
else -> return null
}
- val result = NumberUtil.percentageColor(
+ var result = NumberUtil.percentageColor(
calcHealth.toLong(), calcMaxHealth.toLong()
).getChatColor() + NumberUtil.format(calcHealth)
+ if (!SkyHanniMod.feature.slayer.endermanPhaseDisplay) {
+ result = ""
+ entityData.namePrefix = ""
+ }
+
//Hit phase
val armorStandHits = entity.getNameTagWith(3, " Hit")
@@ -650,29 +706,6 @@ class DamageIndicatorManager {
}
}
- @SubscribeEvent
- fun onRenderMobColored(event: RenderMobColoredEvent) {
- if (!isEnabled()) return
- val entity = event.entity
-
- data.values
- .filter { it.entity == entity }
- .forEach { data ->
- data.color?.let {
- event.color = it.toColor().withAlpha(80)
- }
- }
- }
-
- @SubscribeEvent
- fun onResetEntityHurtTime(event: ResetEntityHurtEvent) {
- if (!isEnabled()) return
- val entity = event.entity
- if (data.values.any { it.entity == entity && it.color != null }) {
- event.shouldReset = true
- }
- }
-
fun isEnabled(): Boolean {
return LorenzUtils.inSkyblock && SkyHanniMod.feature.damageIndicator.enabled
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
index 4212b4521..2c7acc54b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/EntityData.kt
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.features.damageindicator
-import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzVec
import net.minecraft.entity.EntityLivingBase
@@ -15,10 +14,9 @@ class EntityData(
var lastHealth: Long = 0L,
var healthText: String = "",
var timeLastTick: Long = 0,
-// var healthLineHidden: Boolean = false,
var namePrefix: String = "",
var nameSuffix: String = "",
- var color: LorenzColor? = null,
+ var nameAbove: String = "",
var dead: Boolean = false,
var deathLocation: LorenzVec? = null,
) \ 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 2ca68c954..3864f8ee8 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
@@ -52,16 +52,15 @@ class BlazeSlayerDaggerHelper {
private fun getDaggerText(dagger: Dagger): String {
var activeAbility = ""
var inactiveAbility = ""
- for (mode in dagger.modes) {
- if (mode.active) {
- activeAbility = mode.chatColor + "§l" + mode
+ for (shield in dagger.shields) {
+ if (shield.active) {
+ activeAbility = shield.chatColor + "§l" + shield
} else {
- inactiveAbility = " §7/ " + mode.chatColor + mode.toString().lowercase()
+ inactiveAbility = " §7/ " + shield.chatColor + shield.toString().lowercase()
}
}
if (activeAbility == "") return ""
return "$activeAbility$inactiveAbility"
-
}
private fun getName(player: EntityPlayerSP): String {
@@ -70,7 +69,7 @@ class BlazeSlayerDaggerHelper {
}
@SubscribeEvent
- fun onReceiveCurrentMode(event: PacketEvent.ReceiveEvent) {
+ fun onReceiveCurrentShield(event: PacketEvent.ReceiveEvent) {
if (!isEnabled()) return
val packet = event.packet
@@ -79,12 +78,12 @@ class BlazeSlayerDaggerHelper {
val message = packet.message ?: return
val formattedText = message.formattedText
- for (mode in DaggerMode.values()) {
- if (mode.formattedName + "§r" == formattedText) {
- Dagger.values().filter { mode in it.modes }.forEach {
- it.modes.forEach { mode -> mode.active = false }
+ for (shield in HellionShield.values()) {
+ if (shield.formattedName + "§r" == formattedText) {
+ Dagger.values().filter { shield in it.shields }.forEach {
+ it.shields.forEach { shield -> shield.active = false }
}
- mode.active = true
+ shield.active = true
event.isCanceled = true
clientSideClicked = false
return
@@ -108,22 +107,22 @@ class BlazeSlayerDaggerHelper {
val status = packet.status
if (status == C07PacketPlayerDigging.Action.RELEASE_USE_ITEM) {
val dagger = getDaggerInHand()
- dagger?.modes?.forEach { mode -> mode.active = !mode.active }
+ dagger?.shields?.forEach { shield -> shield.active = !shield.active }
clientSideClicked = true
}
}
}
- enum class Dagger(val daggerNames: List<String>, vararg val modes: DaggerMode) {
+ enum class Dagger(val daggerNames: List<String>, vararg val shields: HellionShield) {
TWILIGHT(
listOf("Twilight Dagger", "Mawdredge Dagger", "Deathripper Dagger"),
- DaggerMode.SPIRIT,
- DaggerMode.CRYSTAL
+ HellionShield.SPIRIT,
+ HellionShield.CRYSTAL
),
FIREDUST(
listOf("Firedust Dagger", "Kindlebane Dagger", "Pyrochaos Dagger"),
- DaggerMode.ASHEN,
- DaggerMode.AURIC
+ HellionShield.ASHEN,
+ HellionShield.AURIC
),
;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/DaggerMode.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt
index d6a8ab711..454d1b65f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/DaggerMode.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShield.kt
@@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.utils.LorenzColor
-enum class DaggerMode(val formattedName: String, val color: LorenzColor, val chatColor: String = color.getChatColor(), var active: Boolean = false) {
+enum class HellionShield(val formattedName: String, val color: LorenzColor, val chatColor: String = color.getChatColor(), var active: Boolean = false) {
AURIC("§e§lAURIC", LorenzColor.YELLOW),
ASHEN("§8§lASHEN", LorenzColor.DARK_GRAY),
SPIRIT("§f§lSPIRIT", LorenzColor.WHITE),
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
new file mode 100644
index 000000000..c09419533
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt
@@ -0,0 +1,42 @@
+package at.hannibal2.skyhanni.features.slayer.blaze
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.RenderMobColoredEvent
+import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
+import at.hannibal2.skyhanni.events.withAlpha
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.entity.EntityLiving
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class HellionShieldHelper {
+
+ companion object {
+ val hellionShieldMobs = mutableMapOf<EntityLiving, HellionShield>()
+ }
+
+ @SubscribeEvent
+ fun onRenderMobColored(event: RenderMobColoredEvent) {
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return
+
+ val shield = hellionShieldMobs.getOrDefault(event.entity, null) ?: return
+ event.color = shield.color.toColor().withAlpha(80)
+ }
+
+ @SubscribeEvent
+ fun onResetEntityHurtTime(event: ResetEntityHurtEvent) {
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return
+
+ hellionShieldMobs.getOrDefault(event.entity, null) ?: return
+ event.shouldReset = true
+ }
+}
+
+fun EntityLiving.setHellionShield(shield: HellionShield?) {
+ if (shield != null) {
+ HellionShieldHelper.hellionShieldMobs[this] = shield
+ } else {
+ HellionShieldHelper.hellionShieldMobs.remove(this)
+ }
+} \ No newline at end of file