summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/fishing
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-12 19:28:42 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-12 19:28:42 +0200
commit0a9c63b5f5f0ff9eca991c93f12afa2ae03cf3ae (patch)
tree7dd07b2deb2f3212863d05fdbcde121ad6ad9c2c /src/main/java/at/hannibal2/skyhanni/features/fishing
parent5ff579652ef80207a780a80399be376c345342b0 (diff)
downloadskyhanni-0a9c63b5f5f0ff9eca991c93f12afa2ae03cf3ae.tar.gz
skyhanni-0a9c63b5f5f0ff9eca991c93f12afa2ae03cf3ae.tar.bz2
skyhanni-0a9c63b5f5f0ff9eca991c93f12afa2ae03cf3ae.zip
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt30
1 files changed, 9 insertions, 21 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 d26ec6b90..ee9c4b44b 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
@@ -5,10 +5,11 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
-import at.hannibal2.skyhanni.features.fishing.FishingAPI.isFishingRod
+import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.InventoryUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.ItemCategory
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
@@ -20,33 +21,20 @@ class OdgerWaypoint {
private val config get() = SkyHanniMod.feature.fishing.trophyFishing
private val location = LorenzVec(-373, 207, -808)
- private var hasLavaRodInHand = false
- private var trophyFishInInv = false
+ private var trophyFishInInventory = false
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
- if (!isEnabled()) return
-
- if (event.isMod(10)) {
- hasLavaRodInHand = isLavaFishingRod()
-
- trophyFishInInv = InventoryUtils.getItemsInOwnInventory().map { it.getLore() }
- .any { it.isNotEmpty() && it.last().endsWith("TROPHY FISH") }
- }
- }
-
- private fun isLavaFishingRod(): Boolean {
- val heldItem = InventoryUtils.getItemInHand() ?: return false
- if (!heldItem.isFishingRod()) return false
-
- return heldItem.getLore().any { it.contains("Lava Rod") }
+ if (!isEnabled() || !event.isMod(10)) return
+ trophyFishInInventory = InventoryUtils.getItemsInOwnInventory()
+ .any { it.getItemCategoryOrNull() == ItemCategory.TROPHY_FISH }
}
@SubscribeEvent
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!isEnabled()) return
- if (hasLavaRodInHand) return
- if (!trophyFishInInv) return
+ if (FishingAPI.holdingLavaRod) return
+ if (!trophyFishInInventory) return
event.drawWaypointFilled(location, LorenzColor.WHITE.toColor())
event.drawDynamicText(location, "Odger", 1.5)