Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BetterMap-style dungeon score estimate #486

Open
wants to merge 5 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ plugins {
signing
}

version = "1.9.7"
version = "1.9.8"
group = "gg.skytils"

repositories {
Expand Down Expand Up @@ -73,11 +73,12 @@ loom {
programArgs("--tweakClass", "gg.skytils.skytilsmod.tweaker.SkytilsTweaker")
programArgs("--mixin", "mixins.skytils.json")
programArgs("--mixin", "mixins.skytils-events.json")
programArgs("--mixin", "mixins.skytils-init.json")
}
remove(getByName("server"))
}
forge {
mixinConfig("mixins.skytils.json", "mixins.skytils-events.json")
mixinConfig("mixins.skytils.json", "mixins.skytils-events.json", "mixins.skytils-init.json")
}
mixin {
defaultRefmapName = "mixins.skytils.refmap.json"
Expand Down Expand Up @@ -184,7 +185,7 @@ tasks {
"FMLCorePlugin" to "gg.skytils.skytilsmod.tweaker.SkytilsLoadingPlugin",
"FMLCorePluginContainsFMLMod" to true,
"ForceLoadAsMod" to true,
"MixinConfigs" to "mixins.skytils.json,mixins.skytils-events.json",
"MixinConfigs" to "mixins.skytils.json,mixins.skytils-events.json,mixins.skytils-init.json",
"ModSide" to "CLIENT",
"ModType" to "FML",
"TweakClass" to "gg.skytils.skytilsmod.tweaker.SkytilsTweaker",
Expand Down
19 changes: 15 additions & 4 deletions src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,25 @@ object Config : Vigilant(
var showScoreCalculation = false

@Property(
type = PropertyType.SWITCH, name = "Minimized Dungeon Score Estimate",
description = "Only shows the dungeon score.",
type = PropertyType.SELECTOR, name = "Dungeon Score Estimate Style",
description = "Change the style of the Score Estimate",
category = "Dungeons", subcategory = "Score Calculation",
i18nName = "skytils.config.dungeons.score_calculation.minimized_dungeon_score_estimate",
options = ["Standard", "Minimized", "Bettermap"],
i18nName = "skytils.config.dungeons.score_calculation.dungeon_score_estimate_style",
i18nCategory = "skytils.config.dungeons",
i18nSubcategory = "skytils.config.dungeons.score_calculation"
)
var minimizedScoreCalculation = false
var scoreCalculationStyle = 0

@Property(
type = PropertyType.SWITCH, name = "Hide Score Estimate In Boss",
description = "Hides the score estimate when in a dungeon boss room",
category = "Dungeons", subcategory = "Score Calculation",
i18nName = "skytils.config.dungeons.score_calculation.hide_score_estimate_in_boss",
i18nCategory = "skytils.config.dungeons",
i18nSubcategory = "skytils.config.dungeons.score_calculation"
)
var hideScoreEstimateBoss = false

@Property(
type = PropertyType.SWITCH, name = "Score Calculation Party Assist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,48 +260,62 @@ object ScoreCalculation {
Utils.checkThreadAndQueue {
ScoreCalculationElement.text.clear()
if (!Utils.inDungeons) return@checkThreadAndQueue
if (Skytils.config.minimizedScoreCalculation) {
val color = when {
score < 270 -> 'c'
score < 300 -> 'e'
else -> 'a'
}
ScoreCalculationElement.text.add("§eScore: §$color$score §7($rank§7)")
} else {
ScoreCalculationElement.text.add("§9Dungeon Status")
ScoreCalculationElement.text.add("§f• §eDeaths:§c ${deaths.get()} ${if (firstDeathHadSpirit.get()) "§7(§6Spirit§7)" else ""}")
ScoreCalculationElement.text.add("§f• §eMissing Puzzles:§c ${missingPuzzles.get()}")
ScoreCalculationElement.text.add("§f• §eFailed Puzzles:§c ${failedPuzzles.get()}")
if (foundSecrets.get() > 0) ScoreCalculationElement.text.add(
"§f• §eSecrets: ${if (foundSecrets.get() >= totalSecretsNeeded.get()) "§a" else "§c"}${foundSecrets.get()}§7/§a${totalSecretsNeeded.get()} " +
if (floorReq.get().secretPercentage != 1.0) "§7(§6Total: ${totalSecrets.get()}§7)" else ""
)
ScoreCalculationElement.text.add("§f• §eCrypts:§a ${crypts.get()}")
if (dungeonFloorNumber?.let { it >= 6 } == true) {
ScoreCalculationElement.text.add("§f• §eMimic:§l${if (mimicKilled.get()) "§a ✔" else "§c ✘"}")

when (Skytils.config.scoreCalculationStyle) {
2 -> { // bm style
val scoreColor = when {
totalScore.get() < 270 -> "§c"
totalScore.get() < 300 -> "§e"
else -> "§a"
}

val cryptColor = if (crypts.get() >= 5) "§a" else "§c"

ScoreCalculationElement.text.add("$scoreColor${totalScore.get()} $cryptColor${crypts.get()}c ${if (mimicKilled.get()) "§a✔" else "§c✘"}")
}
ScoreCalculationElement.text.add("")
ScoreCalculationElement.text.add("§6Score")
if (DungeonFeatures.dungeonFloor == "E")
ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(14, 70)}")
else
ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(20, 100)}")
ScoreCalculationElement.text.add(
"§f• §eExplore Score:§a ${discoveryScore.get()} §7(§e${
roomClearScore.get().toInt()
} §7+ §6${secretScore.get().toInt()}§7)"
)
ScoreCalculationElement.text.add("§f• §eSpeed Score:§a ${speedScore.get()}")

if (DungeonFeatures.dungeonFloor == "E") {
ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${(bonusScore.get() * 0.7).toInt()}")
ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+7§7)" else "")
} else {
ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${bonusScore.get()}")
ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+10§7)" else "")
1 -> { // minimized style
val color = when {
score < 270 -> 'c'
score < 300 -> 'e'
else -> 'a'
}
ScoreCalculationElement.text.add("§eScore: §$color$score §7($rank§7)")
}
ScoreCalculationElement.text.add("§f• §eRank: $rank")
else -> { // standard style
ScoreCalculationElement.text.add("§9Dungeon Status")
ScoreCalculationElement.text.add("§f• §eDeaths:§c ${deaths.get()} ${if (firstDeathHadSpirit.get()) "§7(§6Spirit§7)" else ""}")
ScoreCalculationElement.text.add("§f• §eMissing Puzzles:§c ${missingPuzzles.get()}")
ScoreCalculationElement.text.add("§f• §eFailed Puzzles:§c ${failedPuzzles.get()}")
if (foundSecrets.get() > 0) ScoreCalculationElement.text.add(
"§f• §eSecrets: ${if (foundSecrets.get() >= totalSecretsNeeded.get()) "§a" else "§c"}${foundSecrets.get()}§7/§a${totalSecretsNeeded.get()} " +
if (floorReq.get().secretPercentage != 1.0) "§7(§6Total: ${totalSecrets.get()}§7)" else ""
)
ScoreCalculationElement.text.add("§f• §eCrypts:§a ${crypts.get()}")
if (dungeonFloorNumber?.let { it >= 6 } == true) {
ScoreCalculationElement.text.add("§f• §eMimic:§l${if (mimicKilled.get()) "§a ✔" else "§c ✘"}")
}
ScoreCalculationElement.text.add("")
ScoreCalculationElement.text.add("§6Score")
if (DungeonFeatures.dungeonFloor == "E")
ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(14, 70)}")
else
ScoreCalculationElement.text.add("§f• §eSkill Score:§a ${skillScore.get().coerceIn(20, 100)}")
ScoreCalculationElement.text.add(
"§f• §eExplore Score:§a ${discoveryScore.get()} §7(§e${
roomClearScore.get().toInt()
} §7+ §6${secretScore.get().toInt()}§7)"
)
ScoreCalculationElement.text.add("§f• §eSpeed Score:§a ${speedScore.get()}")

if (DungeonFeatures.dungeonFloor == "E") {
ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${(bonusScore.get() * 0.7).toInt()}")
ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+7§7)" else "")
} else {
ScoreCalculationElement.text.add("§f• §eBonus Score:§a ${bonusScore.get()}")
ScoreCalculationElement.text.add("§f• §eTotal Score:§a $score" + if (isPaul.get()) " §7(§6+10§7)" else "")
}
ScoreCalculationElement.text.add("§f• §eRank: $rank")
}
}
}
}
Expand Down Expand Up @@ -533,16 +547,18 @@ object ScoreCalculation {
class ScoreCalculationElement : GuiElement("Dungeon Score Estimate", x = 200, y = 100) {
override fun render() {
if (toggled && Utils.inDungeons) {
if (Skytils.config.hideScoreEstimateBoss && DungeonTimer.bossEntryTime != -1L) return // don't render in boss (config)
RenderUtil.drawAllInList(this, text)
}
}

override fun demoRender() {
if (Skytils.config.minimizedScoreCalculation) {
RenderUtil.drawAllInList(this, demoMin)
} else {
RenderUtil.drawAllInList(this, demoText)
val scoreStyle = when (Skytils.config.scoreCalculationStyle) {
2 -> demoBM
1 -> demoMin
else -> demoText
}
RenderUtil.drawAllInList(this, scoreStyle)
}

companion object {
Expand All @@ -564,13 +580,21 @@ object ScoreCalculation {
"§f• §eRank: §6§lS+"
)
private val demoMin = listOf("§eScore: §e300 §7(§6§lS+§7)")
private val demoBM = listOf("§a301 §c4c §a✔")
val text = ArrayList<String>()
}

override val height: Int
get() = if (Skytils.config.minimizedScoreCalculation) ScreenRenderer.fontRenderer.FONT_HEIGHT else ScreenRenderer.fontRenderer.FONT_HEIGHT * demoText.size
get() = ScreenRenderer.fontRenderer.FONT_HEIGHT * when (Skytils.config.scoreCalculationStyle) {
0 -> demoText.size
else -> 1 // if demo is more than 1 line multiply by its size, otherwise multiply by 1
}
override val width: Int
get() = demoText.maxOf { ScreenRenderer.fontRenderer.getStringWidth(it) }
get() = (when (Skytils.config.scoreCalculationStyle) {
2 -> demoBM
1 -> demoMin
else -> demoText
}).maxOf { ScreenRenderer.fontRenderer.getStringWidth(it) }

override val toggled: Boolean
get() = Skytils.config.showScoreCalculation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,22 +280,21 @@ object MiningFeatures {
@SubscribeEvent
fun onDrawSlot(event: GuiContainerEvent.DrawSlotEvent.Pre) {
if (!Utils.inSkyblock || event.container !is ContainerChest) return
if (event.slot.hasStack) {
if (!event.slot.hasStack) return
if (Skytils.config.highlightDisabledHOTMPerks && SBInfo.lastOpenContainerName == "Heart of the Mountain") {
if (ItemUtil.getItemLore(event.slot.stack).any { it == "§c§lDISABLED" }) {
event.slot highlight Color(255, 0, 0)
}
}
if (Skytils.config.highlightCompletedCommissions && SBInfo.lastOpenContainerName.equals("Commissions")) {
val item = event.slot.stack
if (Skytils.config.highlightDisabledHOTMPerks && SBInfo.lastOpenContainerName == "Heart of the Mountain") {
if (ItemUtil.getItemLore(item).any { it == "§c§lDISABLED" }) {
if (item.displayName.startsWith("§6Commission #") && item.item == Items.writable_book) {
if (ItemUtil.getItemLore(item).any {
it == "§eClick to claim rewards!"
}) {
event.slot highlight Color(255, 0, 0)
}
}
if (Skytils.config.highlightCompletedCommissions && SBInfo.lastOpenContainerName.equals("Commissions")) {
if (item.displayName.startsWith("§6Commission #") && item.item == Items.writable_book) {
if (ItemUtil.getItemLore(item).any {
it == "§eClick to claim rewards!"
}) {
event.slot highlight Color(255, 0, 0)
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2024 Skytils
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package gg.skytils.skytilsmod.mixins

import com.llamalad7.mixinextras.MixinExtrasBootstrap

class SkytilsMixinInitPlugin : SkytilsMixinPlugin() {
override val mixinPackage = "gg.skytils.skytilsmod.mixins.transformers.init"

override fun onLoad(mixinPackage: String) {
MixinExtrasBootstrap.init()
super.onLoad(mixinPackage)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

package gg.skytils.skytilsmod.mixins

import com.llamalad7.mixinextras.MixinExtrasBootstrap
import net.minecraft.launchwrapper.Launch
import org.objectweb.asm.tree.ClassNode
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin
import org.spongepowered.asm.mixin.extensibility.IMixinInfo

class SkytilsMixinPlugin : IMixinConfigPlugin {
val mixinPackage = "gg.skytils.skytilsmod.mixins.transformers"
open class SkytilsMixinPlugin : IMixinConfigPlugin {
open val mixinPackage = "gg.skytils.skytilsmod.mixins.transformers"
val eventsPackage = "gg.skytils.events.mixins"
var deobfEnvironment = false

Expand All @@ -34,7 +33,6 @@ class SkytilsMixinPlugin : IMixinConfigPlugin {
if (deobfEnvironment) {
println("We are in a deobfuscated environment, loading compatibility mixins.")
}
MixinExtrasBootstrap.init()
}

override fun getRefMapperConfig(): String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable

fun markTerminalItems(slot: Slot, cir: CallbackInfoReturnable<ItemStack?>) {
if (!Utils.inSkyblock) return
val item: ItemStack = (slot.inventory.getStackInSlot(slot.slotIndex) ?: return).copy()
if (!item.isItemEnchanted && (SelectAllColorSolver.shouldClick.contains(slot.slotNumber) || StartsWithSequenceSolver.shouldClick.contains(
slot.slotNumber
))
val original = slot.inventory.getStackInSlot(slot.slotIndex) ?: return
if (!original.isItemEnchanted && (SelectAllColorSolver.shouldClick.contains(slot.slotNumber) ||
StartsWithSequenceSolver.shouldClick.contains(slot.slotNumber))
) {
val item = original.copy()
if (item.tagCompound == null) {
item.tagCompound = NBTTagCompound()
}
Expand Down
Loading
Loading