diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-06 13:21:48 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-06 13:21:48 +0200 |
commit | 5f2f88ac52502cb5da0a48f2a61a4977e005917c (patch) | |
tree | 65cd43650a5f0ad53c5d272915f1e51478346ffd /src/main/java/at/hannibal2 | |
parent | 0ecc9092a8d98f05d29a1854770eb911edd9e2f6 (diff) | |
download | skyhanni-5f2f88ac52502cb5da0a48f2a61a4977e005917c.tar.gz skyhanni-5f2f88ac52502cb5da0a48f2a61a4977e005917c.tar.bz2 skyhanni-5f2f88ac52502cb5da0a48f2a61a4977e005917c.zip |
add ashfang freeze cooldown
Diffstat (limited to 'src/main/java/at/hannibal2')
8 files changed, 83 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index a1cc397f5..9dcc13add 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.config.gui.commands.Commands; import at.hannibal2.skyhanni.diana.GriffinBurrowFinder; import at.hannibal2.skyhanni.dungeon.*; import at.hannibal2.skyhanni.dungeon.damageindicator.DungeonBossDamageIndicator; +import at.hannibal2.skyhanni.features.abilities.AshfangFreezeCooldown; import at.hannibal2.skyhanni.fishing.SeaCreatureManager; import at.hannibal2.skyhanni.fishing.SeaCreatureMessageShortener; import at.hannibal2.skyhanni.fishing.TrophyFishMessages; @@ -81,6 +82,7 @@ public class SkyHanniMod { MinecraftForge.EVENT_BUS.register(new AnvilCombineHelper()); MinecraftForge.EVENT_BUS.register(new SeaCreatureMessageShortener()); MinecraftForge.EVENT_BUS.register(new GriffinBurrowFinder()); + MinecraftForge.EVENT_BUS.register(new AshfangFreezeCooldown()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 8b4b66524..00eaa6074 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -51,6 +51,11 @@ public class Features { editOverlay(activeConfigCategory, 200, 16, bazaar.bestSellMethodPos); return; } + + if (runnableId.equals("ashfangFreezeCooldown")) { + editOverlay(activeConfigCategory, 200, 16, abilities.ashfangFreezeCooldownPos); + return; + } } @Expose @@ -66,6 +71,10 @@ public class Features { public Inventory inventory = new Inventory(); @Expose + @Category(name = "Abilitiies", desc = "Stuff about abilities") + public Abilities abilities = new Abilities(); + + @Expose @Category(name = "Bazaar", desc = "Bazaar settings.") public Bazaar bazaar = new Bazaar(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java b/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java new file mode 100644 index 000000000..c5776087c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Abilities.java @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.config.features; + +import at.hannibal2.skyhanni.config.gui.core.config.Position; +import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigEditorBoolean; +import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigEditorButton; +import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigOption; +import com.google.gson.annotations.Expose; + +public class Abilities { + + @Expose + @ConfigOption(name = "Ability Cooldown", desc = "Show the cooldown of item abilities.") + @ConfigEditorBoolean + public boolean itemAbilityCooldown = false; + + @Expose + @ConfigOption(name = "Ashfang Freeze", desc = "Show the cooldown how long Ashfang blocks all your abilities.") + @ConfigEditorBoolean + public boolean ashfangFreezeCooldown = false; + + @Expose + @ConfigOption(name = "Ashfang Freeze Position", desc = "") + @ConfigEditorButton(runnableId = "ashfangFreezeCooldown", buttonText = "Edit") + public Position ashfangFreezeCooldownPos = new Position(10, 10, false, true); +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java index 466192e72..8217c71a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java @@ -9,7 +9,7 @@ import com.google.gson.annotations.Expose; public class Dungeon { @Expose - @ConfigOption(name = "Clicked Blocks", desc = "Highlight the following blocks when clicked in dungeon: Lever, Chest, Wither Essence") + @ConfigOption(name = "Clicked Blocks", desc = "Highlight the following blocks when clicked in dungeon: Lever, Chest, Wither Essence.") @ConfigEditorBoolean public boolean highlightClickedBlocks = false; diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java index 18adebc90..384a28075 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java @@ -17,7 +17,7 @@ public class Fishing { public boolean trophyFishBronzeHider = false; @Expose - @ConfigOption(name = "Shorten Fishing Message", desc = "Shorten the message what type of sea creature you have fished") + @ConfigOption(name = "Shorten Fishing Message", desc = "Shorten the message what type of sea creature you have fished.") @ConfigEditorBoolean public boolean shortenFishingMessage = false; }
\ No newline at end of file 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 eddb9fe15..884f245ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -9,7 +9,7 @@ import com.google.gson.annotations.Expose; public class Inventory { @Expose - @ConfigOption(name = "Not Clickable Items", desc = "Hide items that are not clickable in " + "the current inventory: ah, bz, accessory bag, etc") + @ConfigOption(name = "Not Clickable Items", desc = "Hide items that are not clickable in " + "the current inventory: ah, bz, accessory bag, etc.") @ConfigEditorBoolean public boolean hideNotClickableItems = false; @@ -60,11 +60,6 @@ public class Inventory { public boolean displaySackName = false; @Expose - @ConfigOption(name = "Ability Cooldown", desc = "Show the cooldown of item abilities.") - @ConfigEditorBoolean - public boolean itemAbilityCooldown = false; - - @Expose @ConfigOption(name = "Anvil Combine Helper", desc = "Suggests the same item in the inventory when trying to combine two items in the anvil.") @ConfigEditorBoolean public boolean anvilCombineHelper = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt new file mode 100644 index 000000000..5a5bdac0d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/abilities/AshfangFreezeCooldown.kt @@ -0,0 +1,43 @@ +package at.hannibal2.skyhanni.features.abilities + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.GuiRender.renderString +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.text.DecimalFormat + +class AshfangFreezeCooldown { + + var lastHit = 0L + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + + val message = event.message + if (message.matchRegex("§cAshfang Follower's Cryogenic Blast hit you for (.*) damage!")) { + lastHit = System.currentTimeMillis() + } + } + + @SubscribeEvent + fun renderOverlay(event: RenderGameOverlayEvent.Post) { + if (!isEnabled()) return + val duration = System.currentTimeMillis() - lastHit + val maxDuration = 3_000 + + val remainingLong = maxDuration - duration + if (remainingLong > 0) { + val remaining = (remainingLong.toFloat() / 1000) + val format = DecimalFormat("0.0").format(remaining + 0.1) + SkyHanniMod.feature.abilities.ashfangFreezeCooldownPos.renderString("§cAshfang Freeze: §a${format}s") + } + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.ashfangFreezeCooldown + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt index 90ef95d4d..c3358965e 100644 --- a/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/ItemAbilityCooldown.kt @@ -53,7 +53,7 @@ class ItemAbilityCooldown { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyblock && SkyHanniMod.feature.inventory.itemAbilityCooldown + return LorenzUtils.inSkyblock && SkyHanniMod.feature.abilities.itemAbilityCooldown } private fun click(ability: Ability) { |