-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed blessing display, fixed hud editor bugs
- Loading branch information
Showing
9 changed files
with
105 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 32 additions & 25 deletions
57
src/main/kotlin/me/odinmain/features/impl/dungeon/BlessingDisplay.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,64 @@ | ||
package me.odinmain.features.impl.dungeon | ||
|
||
import com.github.stivais.aurora.color.Color | ||
import com.github.stivais.aurora.dsl.at | ||
import com.github.stivais.aurora.utils.loop | ||
import me.odinmain.features.Module | ||
import me.odinmain.features.huds.HUD.Companion.needs | ||
import me.odinmain.features.huds.HUD.Companion.preview | ||
import me.odinmain.features.settings.Setting.Companion.withDependency | ||
import me.odinmain.features.settings.impl.BooleanSetting | ||
import me.odinmain.features.settings.impl.ColorSetting | ||
import me.odinmain.utils.skyblock.dungeon.Blessing | ||
import me.odinmain.utils.skyblock.dungeon.DungeonUtils | ||
import me.odinmain.utils.ui.Colors | ||
import me.odinmain.utils.ui.TextHUD | ||
import me.odinmain.utils.ui.buildText | ||
import me.odinmain.utils.ui.getFont | ||
import me.odinmain.utils.ui.makeFontSetting | ||
|
||
object BlessingDisplay : Module( | ||
name = "Blessing Display", | ||
description = "Displays the current blessings of the dungeon." | ||
) { | ||
private val power by BooleanSetting("Power Blessing", true, description = "Displays the power blessing.") | ||
// general settings | ||
private val textColor by ColorSetting("Text Color", Color.WHITE, allowAlpha = false, description = "The color of the text.") | ||
private val font by makeFontSetting() | ||
private val shadow by BooleanSetting("Shadow", true, description = "Whether to display a shadow behind the text.") | ||
|
||
private var power by BooleanSetting("Power Blessing", true, description = "Displays the power blessing.") | ||
private val powerColor by ColorSetting("Power Color", Colors.MINECRAFT_DARK_RED, allowAlpha = false, description = "The color of the power blessing.").withDependency { power } | ||
private val time by BooleanSetting("Time Blessing", true, description = "Displays the time blessing.") | ||
private val timeColor by ColorSetting("Time Color", Colors.MINECRAFT_DARK_PURPLE, allowAlpha = false, description = "The color of the time blessing.").withDependency { time } | ||
private val stone by BooleanSetting("Stone Blessing", false, description = "Displays the stone blessing.") | ||
private val stoneColor by ColorSetting("Stone Color", Colors.MINECRAFT_GRAY, allowAlpha = false, description = "The color of the stone blessing.").withDependency { stone } | ||
private val life by BooleanSetting("Life Blessing", false, description = "Displays the life blessing.") | ||
private val lifeColor by ColorSetting("Life Color", Color.RED, allowAlpha = false, description = "The color of the life blessing.").withDependency { life } | ||
private val wisdom by BooleanSetting("Wisdom Blessing", false, description = "Displays the wisdom blessing.") | ||
private val wisdomColor by ColorSetting("Wisdom Color", Colors.MINECRAFT_BLUE, allowAlpha = false, description = "The color of the wisdom blessing.").withDependency { wisdom } | ||
|
||
private val wisdomColor by ColorSetting("Wisdom Color", Colors.MINECRAFT_BLUE, true, description = "The color of the wisdom blessing.").withDependency { wisdom } | ||
private val powerColor by ColorSetting("Power Color", Colors.MINECRAFT_DARK_RED, true, description = "The color of the power blessing.").withDependency { power } | ||
private val timeColor by ColorSetting("Time Color", Colors.MINECRAFT_DARK_PURPLE, true, description = "The color of the time blessing.").withDependency { time } | ||
private val stoneColor by ColorSetting("Stone Color", Colors.MINECRAFT_GRAY, true, description = "The color of the stone blessing.").withDependency { stone } | ||
private val lifeColor by ColorSetting("Life Color", Color.RED, true, description = "The color of the life blessing.").withDependency { life } | ||
|
||
private data class BlessingData(val type: Blessing, val enabled: () -> Boolean, val color: () -> Color) | ||
private val blessings = listOf( | ||
private val blessings = arrayListOf( | ||
BlessingData(Blessing.POWER, { power }, { powerColor }), | ||
BlessingData(Blessing.TIME, { time }, { timeColor }), | ||
BlessingData(Blessing.STONE, { stone }, { stoneColor }), | ||
BlessingData(Blessing.LIFE, { life }, { lifeColor }), | ||
BlessingData(Blessing.WISDOM, { wisdom }, { wisdomColor }) | ||
) | ||
|
||
private val HUD by TextHUD("Blessings HUD") { color, font, shadow -> | ||
needs { DungeonUtils.inDungeons && blessings.none { it.enabled.invoke()} } | ||
column(at()) { | ||
(0..5).reduce { acc, index -> | ||
val blessing = blessings[index - 1].takeIf { it.enabled.invoke() } ?: return@reduce acc | ||
val level = if (preview) 19 else if (blessing.type.current > 0) blessing.type.current else return@reduce acc | ||
private val HUD by HUD("Blessings HUD") { | ||
needs { DungeonUtils.inDungeons } | ||
column { | ||
blessings.loop { (blessing, enabled, color) -> | ||
if (!enabled()) return@loop | ||
buildText( | ||
string = blessing.type.displayString, | ||
supplier = { level }, | ||
font, blessing.color.invoke(), color, shadow | ||
) | ||
acc + 1 | ||
string = blessing.displayString, | ||
supplier = { if (preview) 19 else blessing.current }, | ||
font = getFont(font), | ||
color1 = color(), color2 = textColor, | ||
shadow | ||
).needs { blessing.current != 0 } | ||
} | ||
} | ||
}.setting(description = "Displays the current active blessings in the dungeon.") | ||
}.registerSettings( | ||
::textColor, ::font, ::shadow, | ||
::power, ::powerColor, ::time, ::timeColor, ::stone, ::stoneColor, ::life, ::lifeColor, ::wisdom, ::wisdomColor | ||
).setting(description = "Displays the current active blessings in the dungeon.") | ||
|
||
private data class BlessingData(val type: Blessing, val enabled: () -> Boolean, val color: () -> Color) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters