From 592db92180c57325e0b4d297ffb9e5683beffcbf Mon Sep 17 00:00:00 2001 From: Harry282 Date: Wed, 17 Jan 2024 15:32:46 -0500 Subject: [PATCH 1/2] Remove shiny from item names for chest profit --- .../gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt index d5a4bfbd7..48b031464 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt @@ -136,7 +136,7 @@ object ChestProfit { val enchant = name.substring(name.indexOf("(") + 1, name.indexOf(")")) return enchantNameToID(enchant) } else { - val unformatted = name.stripControlCodes() + val unformatted = name.stripControlCodes().replace("Shiny ", "") ItemFeatures.itemIdToNameLookup.entries.find { it.value == unformatted && !it.value.contains("STARRED") }?.key From 8c58d8f52f5e28ea7507a53c248e1b68d6ebb314 Mon Sep 17 00:00:00 2001 From: Harry282 Date: Wed, 17 Jan 2024 15:35:46 -0500 Subject: [PATCH 2/2] Highlight and hide croesus chests --- .../gg/skytils/skytilsmod/core/Config.kt | 15 ++++++++++ .../features/impl/dungeons/ChestProfit.kt | 28 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt index cb07eab5f..02cb713f0 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt @@ -217,6 +217,20 @@ object Config : Vigilant( ) var dungeonChestProfitIncludesEssence = true + @Property( + type = PropertyType.SWITCH, name = "Highlight Unopened Croesus Chests", + description = "Highlight runs in Croesus based on how many more chests can be opened.", + category = "Dungeons", subcategory = "Miscellaneous" + ) + var croesusChestHighlight = false + + @Property( + type = PropertyType.SWITCH, name = "Hide Opened Croesus Chests", + description = "Hide runs in Croesus if no more chests can be opened.", + category = "Dungeons", subcategory = "Miscellaneous" + ) + var croesusHideOpened = false + @Property( type = PropertyType.SWITCH, name = "Dungeon Map", description = "Displays the vanilla map on your screen using vanilla rendering code.", @@ -2918,6 +2932,7 @@ object Config : Vigilant( } addDependency("dungeonChestProfitIncludesEssence", "dungeonChestProfit") + addDependency("croesusHideOpened", "croesusChestHighlight") addDependency("kismetRerollThreshold", "dungeonChestProfit") addDependency("message270Score", "sendMessageOn270Score") diff --git a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt index 48b031464..c0bad7654 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/ChestProfit.kt @@ -20,23 +20,27 @@ package gg.skytils.skytilsmod.features.impl.dungeons import gg.essential.api.EssentialAPI import gg.essential.universal.UResolution import gg.skytils.skytilsmod.Skytils +import gg.skytils.skytilsmod.Skytils.Companion.mc import gg.skytils.skytilsmod.core.structure.GuiElement import gg.skytils.skytilsmod.events.impl.GuiContainerEvent import gg.skytils.skytilsmod.features.impl.handlers.AuctionData import gg.skytils.skytilsmod.features.impl.misc.ItemFeatures import gg.skytils.skytilsmod.utils.* import gg.skytils.skytilsmod.utils.NumberUtil.romanToDecimal +import gg.skytils.skytilsmod.utils.RenderUtil.highlight import gg.skytils.skytilsmod.utils.graphics.ScreenRenderer import gg.skytils.skytilsmod.utils.graphics.SmartFontRenderer import gg.skytils.skytilsmod.utils.graphics.SmartFontRenderer.TextAlignment import gg.skytils.skytilsmod.utils.graphics.colors.CommonColors import gg.skytils.skytilsmod.utils.graphics.colors.CustomColor import net.minecraft.client.renderer.GlStateManager +import net.minecraft.init.Items import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color /** @@ -110,6 +114,30 @@ object ChestProfit { } } + @SubscribeEvent + fun onDrawSlot(event: GuiContainerEvent.DrawSlotEvent.Pre) { + if (!Skytils.config.croesusChestHighlight) return + if (SBInfo.mode != SkyblockIsland.DungeonHub.mode) return + if (event.container !is ContainerChest || event.slot.inventory == mc.thePlayer.inventory) return + val stack = event.slot.stack ?: return + if (stack.item == Items.skull) { + val name = stack.displayName + if (!(name == "§cThe Catacombs" || name == "§cMaster Mode Catacombs")) return + val lore = ItemUtil.getItemLore(stack) + event.slot highlight when { + lore.any { line -> line == "§aNo more Chests to open!" } -> { + if (Skytils.config.croesusHideOpened) { + event.isCanceled = true + return + } else Color(255, 0, 0, 100) + } + lore.any { line -> line == "§8No Chests Opened!" } -> Color(0, 255, 0, 100) + lore.any { line -> line.startsWith("§8Opened Chest: ") } -> Color(255, 255, 0, 100) + else -> return + } + } + } + private fun getChestPrice(lore: List): Double { lore.forEach { val line = it.stripControlCodes()