aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Misc.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt50
2 files changed, 52 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
index a4f608824..f47478ef5 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
@@ -73,6 +73,12 @@ public class Misc {
public boolean damageIndicatorHideDamageSplash = false;
@Expose
+ @ConfigOption(name = "Damage Over Time", desc = "Show damage over time below the damage indicator")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean damageIndicatorShowDamageOverTime = false;
+
+ @Expose
@ConfigOption(name = "Pet Display", desc = "Show the currently active pet.")
@ConfigEditorBoolean
public boolean petDisplay = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt
index 4f372bee8..aafbd6a7b 100644
--- a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt
@@ -65,6 +65,7 @@ class BossDamageIndicator {
}
for (data in data.values) {
+ tickDamage(data.damageCounter)
if (!data.ignoreBlocks) {
if (!player.canEntityBeSeen(data.entity)) continue
}
@@ -114,11 +115,43 @@ class BossDamageIndicator {
}
RenderUtils.drawLabel(location, bossName, partialTicks, true, 3.9f, -9.0f)
+
+ if (SkyHanniMod.feature.misc.damageIndicatorShowDamageOverTime) {
+ var diff = 13f
+ val currentDamage = data.damageCounter.currentDamage
+ if (currentDamage != 0L) {
+ val format = "§c" + NumberUtil.format(currentDamage)
+ RenderUtils.drawLabel(location, format, partialTicks, true, 3.9f, diff)
+ diff += 9f
+ }
+ for (damage in data.damageCounter.oldDamages) {
+ val format = "§c" + NumberUtil.format(damage.damage) + "/s"
+ RenderUtils.drawLabel(location, format, partialTicks, true, 3.9f, diff)
+ diff += 9f
+ }
+ }
+
}
GlStateManager.enableDepth()
GlStateManager.enableCull()
}
+ private fun tickDamage(damageCounter: DamageCounter) {
+ val now = System.currentTimeMillis()
+ if (damageCounter.currentDamage != 0L) {
+ if (damageCounter.firstTick == 0L) {
+ damageCounter.firstTick = now
+ }
+
+ if (now > damageCounter.firstTick + 1_000) {
+ damageCounter.oldDamages.add(OldDamage(now, damageCounter.currentDamage))
+ damageCounter.firstTick = 0L
+ damageCounter.currentDamage = 0
+ }
+ }
+ damageCounter.oldDamages.removeIf { now > it.time + 5_000 }
+ }
+
private fun formatDelay(delay: Long): String {
val color = when {
delay < 1_000 -> LorenzColor.DARK_PURPLE
@@ -360,12 +393,13 @@ class BossDamageIndicator {
entityData.dead = true
}
- if (SkyHanniMod.feature.misc.damageIndicatorHealingMessage) {
- if (data.containsKey(entity.uniqueID)) {
- val lastHealth = data[entity.uniqueID]!!.lastHealth
- val bossType = entityData.bossType
+ if (data.containsKey(entity.uniqueID)) {
+ val lastHealth = data[entity.uniqueID]!!.lastHealth
+ val bossType = entityData.bossType
+ if (SkyHanniMod.feature.misc.damageIndicatorHealingMessage) {
checkHealed(health, lastHealth, bossType)
}
+ checkDamage(entityData, health, lastHealth, bossType)
}
entityData.lastHealth = health
@@ -383,6 +417,14 @@ class BossDamageIndicator {
}
}
+ private fun checkDamage(entityData: EntityData, health: Int, lastHealth: Int, bossType: BossType) {
+ val damage = lastHealth - health
+ if (damage <= 0) return
+
+ val damageCounter = entityData.damageCounter
+ damageCounter.currentDamage += damage
+ }
+
private fun percentageColor(
have: Int,
max: Int,