From aa14f20e2e07bccd26e2e162648f97b4281e3f25 Mon Sep 17 00:00:00 2001 From: HiZe_ Date: Sat, 2 Sep 2023 11:40:38 +0200 Subject: Powder Grinding Tracker (#409) powder tracker overlay #409 --- .../misc/powdertracker/PowderChestReward.kt | 64 ++++ .../features/misc/powdertracker/PowderTracker.kt | 350 +++++++++++++++++++++ 2 files changed, 414 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderChestReward.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderTracker.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderChestReward.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderChestReward.kt new file mode 100644 index 000000000..8a6fce7d5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderChestReward.kt @@ -0,0 +1,64 @@ +package at.hannibal2.skyhanni.features.misc.powdertracker + +import java.util.regex.Pattern + +enum class PowderChestReward(val displayName: String, val pattern: Pattern) { + + + MITHRIL_POWDER("§aMithril Powder", "§aYou received §r§b[+](?.*) §r§aMithril Powder.".toPattern()), + GEMSTONE_POWDER("§dGemstone Powder", "§aYou received §r§b[+](?.*) §r§aGemstone Powder.".toPattern()), + + ROUGH_RUBY_GEMSTONE("§fRough Ruby Gemstone", "§aYou received §r§f(?.*) §r§f❤ §r§fRough Ruby Gemstone§r§a.".toPattern()), + FLAWED_RUBY_GEMSTONE("§aFlawed Sapphire Gemstone", "§aYou received §r§f(?.*) §r§a❤ §r§aFlawed RubyGemstone§r§a.".toPattern()), + FINE_RUBY_GEMSTONE("§9Fine Ruby Gemstone", "§aYou received §r§f(?.*) §r§9❤ §r§9Fine Ruby Gemstone§r§a.".toPattern()), + FLAWLESS_RUBY_GEMSTONE("§5Flawless Ruby Gemstone", "§aYou received §r§f(?.*) §r§9❤ §r§5Flawless Ruby Gemstone§r§a.".toPattern()), + + ROUGH_SAPPHIRE_GEMSTONE("§fRough Sapphire Gemstone", "§aYou received §r§f(?.*) §r§f✎ §r§fRough Sapphire Gemstone§r§a.".toPattern()), + FLAWED_SAPPHIRE_GEMSTONE("§aFlawed Sapphire Gemstone", "§aYou received §r§f(?.*) §r§a✎ §r§aFlawed Sapphire Gemstone§r§a.".toPattern()), + FINE_SAPPHIRE_GEMSTONE("§9Fine Sapphire Gemstone", "§aYou received §r§f(?.*) §r§9✎ §r§9Fine Sapphire Gemstone§r§a.".toPattern()), + FLAWLESS_SAPPHIRE_GEMSTONE("§5Flawless Sapphire Gemstone", "§aYou received §r§f(?.*) §r§9✎ §r§5Flawless Sapphire Gemstone§r§a.".toPattern()), + + ROUGH_AMBER_GEMSTONE("§fRough Amber Gemstone", "§aYou received §r§f(?.*) §r§f⸕ §r§fRough Amber Gemstone§r§a.".toPattern()), + FLAWED_AMBER_GEMSTONE("§aFlawed Amber Gemstone", "§aYou received §r§f(?.*) §r§a⸕ §r§aFlawed Amber Gemstone§r§a.".toPattern()), + FINE_AMBER_GEMSTONE("§9Fine Amber Gemstone", "§aYou received §r§f(?.*) §r§9⸕ §r§9Fine Amber Gemstone§r§a.".toPattern()), + FLAWLESS_AMBER_GEMSTONE("§5Flawless Amber Gemstone", "§aYou received §r§f(?.*) §r§9⸕ §r§5Flawless Amber Gemstone§r§a.".toPattern()), + + ROUGH_AMETHYST_GEMSTONE("§fRough Amethyst Gemstone", "§aYou received §r§f(?.*) §r§f❈ §r§fRough Amethyst Gemstone§r§a.".toPattern()), + FLAWED_AMETHYST_GEMSTONE("§aFlawed Amethyst Gemstone", "§aYou received §r§f(?.*) §r§a❈ §r§aFlawed Amethyst Gemstone§r§a.".toPattern()), + FINE_AMETHYST_GEMSTONE("§9Fine Amethyst Gemstone", "§aYou received §r§f(?.*) §r§9❈ §r§9Fine Amethyst Gemstone§r§a.".toPattern()), + FLAWLESS_AMETHYST_GEMSTONE("§5Flawless Amethyst Gemstone", "§aYou received §r§f(?.*) §r§9❈ §r§5Flawless Amethyst Gemstone§r§a.".toPattern()), + + ROUGH_JADE_GEMSTONE("§fRough Jade Gemstone", "§aYou received §r§f(?.*) §r§f☘ §r§fRough Jade Gemstone§r§a.".toPattern()), + FLAWED_JADE_GEMSTONE("§aFlawed Jade Gemstone", "§aYou received §r§f(?.*) §r§a☘ §r§aFlawed Jade Gemstone§r§a.".toPattern()), + FINE_JADE_GEMSTONE("§9Fine Jade Gemstone", "§aYou received §r§f(?.*) §r§9☘ §r§9Fine Jade Gemstone§r§a.".toPattern()), + FLAWLESS_JADE_GEMSTONE("§5Flawless Jade Gemstone", "§aYou received §r§f(?.*) §r§9☘ §r§5Flawless Jade Gemstone§r§a.".toPattern()), + + ROUGH_TOPAZ_GEMSTONE("§fRough Topaz Gemstone", "§aYou received §r§f(?.*) §r§f✧ §r§fRough Topaz Gemstone§r§a.".toPattern()), + FLAWED_TOPAZ_GEMSTONE("§aFlawed Topaz Gemstone", "§aYou received §r§f(?.*) §r§a✧ §r§aFlawed Topaz Gemstone§r§a.".toPattern()), + FINE_TOPAZ_GEMSTONE("§9Fine Topaz Gemstone", "§aYou received §r§f(?.*) §r§9✧ §r§9Fine Topaz Gemstone§r§a.".toPattern()), + FLAWLESS_TOPAZ_GEMSTONE("§5Flawless Topaz Gemstone", "§aYou received §r§f(?.*) §r§9✧ §r§5Flawless Topaz Gemstone§r§a.".toPattern()), + + FTX_3070("§9FTX 3070", "§aYou received §r§f(?.*) §r§9FTX 3070§r§a.".toPattern()), + ELECTRON_TRANSIMTTER("§9Electron Transmitter", "§aYou received §r§f(?.*) §r§9Electron Transmitter§r§a.".toPattern()), + ROBOTRON_REFLECTOR("§9Robotron Reflector", "§aYou received §r§f(?.*) §r§9Robotron Reflector§r§a.".toPattern()), + SUPERLITE_MOTOR("§9Superlite Motor", "§aYou received §r§f(?.*) §r§9Superlite Motor§r§a.".toPattern()), + CONTROL_SWITCH("§9Control Switch", "§aYou received §r§f(?.*) §r§9Control Switch§r§a.".toPattern()), + SYNTHETIC_HEART("§9Synthetic Heart", "§aYou received §r§f(?.*) §r§9Synthetic Heart§r§a.".toPattern()), + + GOBLIN_EGG("§9Goblin Egg", "§aYou received §r§f(?.*) §r§9Goblin Egg§r§a.".toPattern()), + GREEN_GOBLIN_EGG("§aGreen Goblin Egg", "§aYou received §r§f(?.*) §r§a§r§aGreen Goblin Egg§r§a.".toPattern()), + RED_GOBLIN_EGG("§cRed Goblin Egg", "§aYou received §r§f(?.*) §r§9§r§cRed Goblin Egg§r§a.".toPattern()), + YELLOW_GOBLIN_EGG("§eYellow Goblin Egg", "§aYou received §r§f(?.*) §r§9§r§eYellow Goblin Egg§r§a.".toPattern()), + BLUE_GOBLIN_EGG("§3Blue Goblin Egg", "§aYou received §r§f(?.*) §r§9§r§3Blue Goblin Egg§r§a.".toPattern()), + + WISHING_COMPASS("§aWishing Compass", "§aYou received §r§f(?.*) §r§aWishing Compass§r§a.".toPattern()), + + SLUDGE_JUICE("§aSludge Juice", "§aYou received §r§f(?.*) §r§aSludge Juice§r§a.".toPattern()), + ASCENSION_ROPE("§9Ascension Rope", "§aYou received §r§f(?.*) §r§9Ascension Rope§r§a.".toPattern()), + TREASURITE("§5Treasurite", "§aYou received §r§f(?.*) §r§5Treasurite§r§a.".toPattern()), + JUNGLE_HEART("§6Jungle Heart", "§aYou received §r§f(?.*) §r§6Jungle Heart§r§a.".toPattern()), + PICKONIMBUS_2000("§5Pickonimbus 2000", "§aYou received §r§f(?.*) §r§5Pickonimbus 2000§r§a.".toPattern()), + YOGGIE("§aYoggie", "§aYou received §r§f(?.*) §r§aYoggie§r§a.".toPattern()), + PREHISTORIC_EGG("§fPrehistoric Egg", "§aYou received §r§f(?.*) §r§fPrehistoric Egg§r§a.".toPattern()), + OIL_BARREL("§aOil Barrel", "§aYou received §r§f(?.*) §r§aOil Barrel§r§a.".toPattern()), +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderTracker.kt new file mode 100644 index 000000000..3dfb082ad --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/powdertracker/PowderTracker.kt @@ -0,0 +1,350 @@ +package at.hannibal2.skyhanni.features.misc.powdertracker + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.Storage +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector +import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiInventory +import net.minecraft.entity.boss.BossStatus +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.concurrent.fixedRateTimer + +class PowderTracker { + + private val config get() = SkyHanniMod.feature.misc.powderTrackerConfig + private var display = emptyList>() + private val picked = "§6You have successfully picked the lock on this chest!".toPattern() + private val uncovered = "§aYou uncovered a treasure chest!".toPattern() + private val powderEvent = ".*§r§b§l2X POWDER STARTED!.*".toPattern() + private val powderEnded = ".*§r§b§l2X POWDER ENDED!.*".toPattern() + private val powderBossBar = "§e§lPASSIVE EVENT §b§l2X POWDER §e§lRUNNING FOR §a§l(?