diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-28 12:13:10 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-28 12:13:10 +0200 |
commit | f7441f5d4404d52299b37a84ff0ec1e14ac7fa92 (patch) | |
tree | 56810f234a4f244d4d9434a25cd3e088467b98b2 | |
parent | a38f1a3f6fac894f62ed6f80a332a167a030ea4c (diff) | |
download | skyhanni-f7441f5d4404d52299b37a84ff0ec1e14ac7fa92.tar.gz skyhanni-f7441f5d4404d52299b37a84ff0ec1e14ac7fa92.tar.bz2 skyhanni-f7441f5d4404d52299b37a84ff0ec1e14ac7fa92.zip |
stats tuning
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | FEATURES.md | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java | 28 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt | 170 |
5 files changed, 212 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fd7800ef5..e3f2af159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,17 @@ + Added blaze slayer phase display + Added toggle for blaze slayer colored mobs +### Stats Tuning ++ Show the tuning stats in the Thaumaturgy inventory. ++ Show the amount of selected tuning points in the stats tuning inventory. ++ Highlight the selected template in the stats tuning inventory. ++ Show the type of stats for the tuning point templates. + ### Misc -+ Added Lord Jawbus to damage indicator. ++ Added Lord Jawbus to damage indicator ### Changes -~ Showing Thunder Sparks under lava ++ Showing Thunder Sparks under lava ## Version 0.10 - Slayer diff --git a/FEATURES.md b/FEATURES.md index c6a62149d..f35f48e9c 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -45,6 +45,10 @@ - Anvil Combine Helper (When putting an enchanted book into the first slot of the anvil, all items with the same enchantment are highlighted in the inventory) - Added compact star counter on all items (not only on items with dungeon stars and master stars but also on crimson armors, cloaks and fishing rods) - RNG meter features (in the catacombs RNG meter inventory show the dungeon floor number and highlight floors without a drop selected and highlighting the selected drop in the RNG meter inventory for slayer or catacombs) ++ Show the tuning stats in the Thaumaturgy inventory. ++ Show the amount of selected tuning points in the stats tuning inventory. ++ Highlight the selected template in the stats tuning inventory. ++ Show the type of stats for the tuning point templates. ## Item Abilities - Show the cooldown of items in the inventory. diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index 7d70c156d..1456a78f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -21,10 +21,7 @@ import at.hannibal2.skyhanni.features.end.VoidlingExtremistColor; import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager; import at.hannibal2.skyhanni.features.fishing.SeaCreatureMessageShortener; import at.hannibal2.skyhanni.features.fishing.TrophyFishMessages; -import at.hannibal2.skyhanni.features.inventory.HideNotClickableItems; -import at.hannibal2.skyhanni.features.inventory.ItemDisplayOverlayFeatures; -import at.hannibal2.skyhanni.features.inventory.ItemStars; -import at.hannibal2.skyhanni.features.inventory.RngMeterInventory; +import at.hannibal2.skyhanni.features.inventory.*; import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles; import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown; import at.hannibal2.skyhanni.features.minion.MinionFeatures; @@ -152,6 +149,7 @@ public class SkyHanniMod { registerEvent(new PlayerChatFilter()); registerEvent(new HideArmor()); registerEvent(new SlayerQuestWarning()); + registerEvent(new StatsTuning()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java index ad0a32b74..7e7b35bf5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -87,4 +87,32 @@ public class Inventory { @ConfigEditorBoolean @ConfigAccordionId(id = 1) public boolean rngMeterSelectedDrop = false; + + @ConfigOption(name = "Stats Tuning", desc = "") + @ConfigEditorAccordion(id = 2) + public boolean statsTuning = false; + + @Expose + @ConfigOption(name = "Selected Stats", desc = "Show the tuning stats in the Thaumaturgy inventory.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean statsTuningSelectedStats = false; + + @Expose + @ConfigOption(name = "Tuning Points", desc = "Show the amount of selected tuning points in the stats tuning inventory.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean statsTuningPoints = false; + + @Expose + @ConfigOption(name = "Selected Template", desc = "Highlight the selected template in the stats tuning inventory.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean statsTuningSelectedTemplate = false; + + @Expose + @ConfigOption(name = "Template Stats", desc = "Show the type of stats for the tuning point templates.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean statsTuningTemplateStats = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt new file mode 100644 index 000000000..95b323719 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -0,0 +1,170 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.GuiRenderItemEvent +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.inventory.ContainerChest +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class StatsTuning { + + private val patternStatPoints = Pattern.compile("§7Stat has: §e(\\d+) point(s)?") + + @SubscribeEvent + fun onRenderTemplates(event: GuiRenderItemEvent.RenderOverlayEvent.Post) { + if (!LorenzUtils.inSkyblock) return + + val screen = Minecraft.getMinecraft().currentScreen + if (screen !is GuiChest) return + val chest = screen.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + var stackTip = "" + var offsetX = 0 + + val stack = event.stack ?: return + if (SkyHanniMod.feature.inventory.statsTuningTemplateStats) { + if (chestName == "Stats Tuning") { + val name = stack.name ?: return + if (name == "§aLoad") { + var grab = false + val list = mutableListOf<String>() + for (line in stack.getLore()) { + if (line == "§7You are loading:") { + grab = true + continue + } + if (grab) { + if (line == "") { + grab = false + continue + } + val text = line.split(":")[0] + list.add(text) + } + } + if (list.isNotEmpty()) { + stackTip = list.joinToString(" + ") + offsetX = 20 + } + } + } + } + if (SkyHanniMod.feature.inventory.statsTuningSelectedStats) { + if (chestName == "Accessory Bag Thaumaturgy") { + val name = stack.name ?: return + if (name == "§aStats Tuning") { + var grab = false + val list = mutableListOf<String>() + for (line in stack.getLore()) { + if (line == "§7Your tuning:") { + grab = true + continue + } + if (grab) { + if (line == "") { + grab = false + continue + } + val text = line.split(":")[0].split(" ")[0] + "§7" + list.add(text) + } + } + if (list.isNotEmpty()) { + stackTip = list.joinToString(" + ") + offsetX = 3 + } + } + } + } + + + if (stackTip.isNotEmpty()) { + GlStateManager.disableLighting() + GlStateManager.disableDepth() + GlStateManager.disableBlend() + event.fontRenderer.drawStringWithShadow( + stackTip, + (event.x + 17 + offsetX).toFloat(), + (event.y + 9 + -5).toFloat(), + 16777215 + ) + GlStateManager.enableLighting() + GlStateManager.enableDepth() + } + } + + @SubscribeEvent + fun onRenderTuningPoints(event: GuiRenderItemEvent.RenderOverlayEvent.Post) { + if (!LorenzUtils.inSkyblock) return + + val screen = Minecraft.getMinecraft().currentScreen + if (screen !is GuiChest) return + val chest = screen.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + var stackTip = "" + + val stack = event.stack ?: return + if (SkyHanniMod.feature.inventory.statsTuningPoints) { + if (chestName == "Stats Tuning") { + for (line in stack.getLore()) { + val matcher = patternStatPoints.matcher(line) + if (matcher.matches()) { + val points = matcher.group(1) + stackTip = points + } + } + } + } + + + if (stackTip.isNotEmpty()) { + GlStateManager.disableLighting() + GlStateManager.disableDepth() + GlStateManager.disableBlend() + event.fontRenderer.drawStringWithShadow( + stackTip, + (event.x + 17 - event.fontRenderer.getStringWidth(stackTip)).toFloat(), + (event.y + 9).toFloat(), + 16777215 + ) + GlStateManager.enableLighting() + GlStateManager.enableDepth() + } + } + + @SubscribeEvent(priority = EventPriority.LOW) + fun onDrawSelectedTemplate(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyblock) return + + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + + if (SkyHanniMod.feature.inventory.statsTuningSelectedTemplate) { + if (chestName == "Stats Tuning") { + for (slot in InventoryUtils.getItemsInOpenChest()) { + val stack = slot.stack + val lore = stack.getLore() + + if (lore.any { it == "§aCurrently selected!" }) { + slot highlight LorenzColor.GREEN + } + } + } + } + } +}
\ No newline at end of file |