aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/fishing
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-16 21:12:04 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-16 21:12:04 +0200
commite2b9f9d9c556ff54bbe0f3b8009efebefec2f798 (patch)
tree12804e2999b72f54e05bf17352c2e155173ee472 /src/main/java/at/hannibal2/skyhanni/features/fishing
parente05c91c7b7ed1ae2587ae4ac9b90caae9adceff5 (diff)
downloadskyhanni-e2b9f9d9c556ff54bbe0f3b8009efebefec2f798.tar.gz
skyhanni-e2b9f9d9c556ff54bbe0f3b8009efebefec2f798.tar.bz2
skyhanni-e2b9f9d9c556ff54bbe0f3b8009efebefec2f798.zip
migrate trophy fishing config to use @Accordion
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt30
3 files changed, 37 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
index 4202d2600..2e7439cbf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
@@ -8,13 +9,14 @@ 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.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class OdgerWaypoint {
+ private val config get() = SkyHanniMod.feature.fishing.trophyFishing
private val location = LorenzVec(-373, 207, -808)
private var hasLavaRodInHand = false
@@ -50,6 +52,10 @@ class OdgerWaypoint {
event.drawDynamicText(location, "Odger", 1.5)
}
- fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.odgerLocation &&
- LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "fishing.odgerLocation", "fishing.trophyFishing.odgerLocation")
+ }
+
+ fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && config.odgerLocation
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
index edb9d9fd1..2c0d78c7b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -29,6 +30,11 @@ class TrophyFishFillet {
event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${NumberUtil.format(filletPrice)}§7)")
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.trophyFilletTooltip
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "fishing.trophyFilletTooltip", "fishing.trophyFishing.filletTooltip")
+ }
+
+ private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.trophyFishing.filletTooltip
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
index 4a0b6080e..e6087a5b5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.Companion.fishes
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -16,7 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class TrophyFishMessages {
private val trophyFishPattern =
Regex("§6§lTROPHY FISH! §r§bYou caught an? §r(?<displayName>§[0-9a-f](?:§k)?[\\w -]+)§r§r§r §r§l§r(?<displayRarity>§[0-9a-f]§l\\w+)§r§b\\.")
- private val config get() = SkyHanniMod.feature.fishing
+ private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages
@SubscribeEvent
fun onStatusBar(event: LorenzChatEvent) {
@@ -36,21 +37,21 @@ class TrophyFishMessages {
val amount = trophyFishCounts.addOrPut(rarity, 1)
event.blockedReason = "trophy_fish"
- if (config.trophyCounter && config.trophyDesign == 0 && amount == 1) {
+ if (config.enabled && config.design == 0 && amount == 1) {
LorenzUtils.chat("§6§lTROPHY FISH! §c§lFIRST §r$displayRarity $displayName")
return
}
- if (config.trophyFishBronzeHider && rarity == TrophyRarity.BRONZE && amount != 1) return
- if (config.trophyFishSilverHider && rarity == TrophyRarity.SILVER && amount != 1) return
- val totalText = if (config.trophyFishTotalAmount) {
+ if (config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1) return
+ if (config.silverHider && rarity == TrophyRarity.SILVER && amount != 1) return
+ val totalText = if (config.totalAmount) {
val total = trophyFishCounts.sumAllValues()
" §7(${total.addSeparators()}. total)"
} else ""
val component = ChatComponentText(
- if (config.trophyCounter) {
- "§6§lTROPHY FISH! " + when (config.trophyDesign) {
+ if (config.enabled) {
+ "§6§lTROPHY FISH! " + when (config.design) {
0 -> "§7$amount. §r$displayRarity $displayName$totalText"
1 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})$totalText"
else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b.$totalText"
@@ -58,14 +59,25 @@ class TrophyFishMessages {
} else event.message
)
- if (config.trophyFishTooltip) {
+ if (config.tooltip) {
TrophyFishManager.getInfo(internalName)?.let {
component.chatStyle = it.getTooltip(trophyFishCounts)
}
}
Minecraft.getMinecraft().ingameGUI.chatGUI.printChatMessageWithOptionalDeletion(
- component, if (config.trophyFishDuplicateHider) (internalName + rarity).hashCode() else 0
+ component, if (config.duplicateHider) (internalName + rarity).hashCode() else 0
)
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "fishing.trophyCounter", "fishing.trophyFishing.chatMessages.enabled")
+ event.move(2, "fishing.trophyDesign", "fishing.trophyFishing.chatMessages.design")
+ event.move(2, "fishing.trophyFishTotalAmount", "fishing.trophyFishing.chatMessages.totalAmount")
+ event.move(2, "fishing.trophyFishTooltip", "fishing.trophyFishing.chatMessages.tooltip")
+ event.move(2, "fishing.trophyFishDuplicateHider", "fishing.trophyFishing.chatMessages.duplicateHider")
+ event.move(2, "fishing.trophyFishBronzeHider", "fishing.trophyFishing.chatMessages.bronzeHider")
+ event.move(2, "fishing.trophyFishSilverHider", "fishing.trophyFishing.chatMessages.silverHider")
+ }
}