aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Storage.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/fishing/FishingProfitTracker.kt)70
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingTrackerCategoryManager.kt72
6 files changed, 82 insertions, 69 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 569e22167..58d499439 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -112,7 +112,6 @@ import at.hannibal2.skyhanni.features.fishing.ChumBucketHider
import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.features.fishing.FishingBaitWarnings
import at.hannibal2.skyhanni.features.fishing.FishingHookDisplay
-import at.hannibal2.skyhanni.features.fishing.FishingProfitTracker
import at.hannibal2.skyhanni.features.fishing.FishingTimer
import at.hannibal2.skyhanni.features.fishing.SeaCreatureFeatures
import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager
@@ -120,6 +119,8 @@ import at.hannibal2.skyhanni.features.fishing.SeaCreatureMessageShortener
import at.hannibal2.skyhanni.features.fishing.SharkFishCounter
import at.hannibal2.skyhanni.features.fishing.ShowFishingItemName
import at.hannibal2.skyhanni.features.fishing.ThunderSparksHighlight
+import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker
+import at.hannibal2.skyhanni.features.fishing.tracker.FishingTrackerCategoryManager
import at.hannibal2.skyhanni.features.fishing.trophy.OdgerWaypoint
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishFillet
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager
@@ -566,6 +567,7 @@ class SkyHanniMod {
loadModule(GetFromSacksTabComplete)
loadModule(SlayerProfitTracker)
loadModule(FishingProfitTracker)
+ loadModule(FishingTrackerCategoryManager)
loadModule(SlayerItemsOnGround())
loadModule(RestorePieceOfWizardPortalLore())
loadModule(QuickModMenuSwitch)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
index 162f804e4..d85b02651 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
@@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker;
import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostData;
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI;
import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker;
-import at.hannibal2.skyhanni.features.fishing.FishingProfitTracker;
+import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker;
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity;
import at.hannibal2.skyhanni.features.garden.CropAccessory;
import at.hannibal2.skyhanni.features.garden.CropType;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index 8bf1be499..5555992d9 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare
import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker
import at.hannibal2.skyhanni.features.fame.AccountUpgradeReminder
import at.hannibal2.skyhanni.features.fame.CityProjectFeatures
-import at.hannibal2.skyhanni.features.fishing.FishingProfitTracker
+import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.GardenCropTimeCommand
import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
index ce48f2585..027a4b6d0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.fishing
import at.hannibal2.skyhanni.events.FishingBobberCastEvent
import at.hannibal2.skyhanni.events.ItemInHandChangeEvent
import at.hannibal2.skyhanni.events.SkillExpGainEvent
+import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
index 67762542f..5c5212937 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.features.fishing
+package at.hannibal2.skyhanni.features.fishing.tracker
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.EntityMoveEvent
@@ -6,10 +6,10 @@ import at.hannibal2.skyhanni.events.FishingBobberCastEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
-import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.SackChangeEvent
import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData
+import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.test.PriceSource
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
@@ -29,12 +29,10 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import at.hannibal2.skyhanni.utils.jsonobjects.FishingProfitItemsJson
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
import com.google.gson.annotations.Expose
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.milliseconds
@@ -262,68 +260,8 @@ object FishingProfitTracker {
addItem(internalName, amount)
}
- private var itemCategories = mapOf<String, List<NEUInternalName>>()
-
- private var shItemCategories = mapOf<String, List<NEUInternalName>>()
- private var neuItemCategories = mapOf<String, List<NEUInternalName>>()
-
- @SubscribeEvent
- fun onRepoReload(event: RepositoryReloadEvent) {
- shItemCategories = event.getConstant<FishingProfitItemsJson>("FishingProfitItems").categories
- updateItemCategories()
- }
-
- private fun updateItemCategories() {
- itemCategories = shItemCategories + neuItemCategories
- }
-
- @SubscribeEvent
- fun onNeuRepoReload(event: io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent) {
- val totalDrops = mutableListOf<String>()
- val dropCategories = mutableMapOf<String, MutableList<NEUInternalName>>()
- for ((seaCreature, data) in NotEnoughUpdates.INSTANCE.manager.itemInformation.filter { it.key.endsWith("_SC") }) {
- val asJsonObject = data.getAsJsonArray("recipes")[0].asJsonObject
- val drops = asJsonObject.getAsJsonArray("drops")
- .map { it.asJsonObject.get("id").asString }.map { it.split(":").first() }
- val asJsonArray = asJsonObject.get("extra")
- val extra = asJsonArray?.let {
- asJsonArray.asJsonArray.toList()
- .map { it.toString() }
- .filter { !it.contains("Fishing Skill") && !it.contains("Requirements:") && !it.contains("Fished from water") }
- .joinToString(" + ")
- } ?: "null"
- val category = if (extra.contains("Fishing Festival")) {
- "Fishing Festival"
- } else if (extra.contains("Spooky Festival")) {
- "Spooky Festival"
- } else if (extra.contains("Jerry's Workshop")) {
- "Jerry's Workshop"
- } else if (extra.contains("Oasis")) {
- "Oasis"
- } else if (extra.contains("Magma Fields") || extra.contains("Precursor Remnants") ||
- extra.contains("Goblin Holdout")
- ) {
- "Crystal Hollows"
- } else if (extra.contains("Crimson Isle Lava")) {
- "Crimson Isle Lava"
- } else {
- if (extra.isNotEmpty()) {
- println("unknown extra: $extra = $seaCreature ($drops)")
- }
- "Water"
- } + " Sea Creatures"
- for (drop in drops) {
- if (drop !in totalDrops) {
- totalDrops.add(drop)
- dropCategories.getOrPut(category) { mutableListOf() }.add(drop.asInternalName())
- }
- }
- }
- neuItemCategories = dropCategories
- updateItemCategories()
- }
-
- private fun isAllowedItem(internalName: NEUInternalName) = itemCategories.any { internalName in it.value }
+ private fun isAllowedItem(internalName: NEUInternalName) =
+ FishingTrackerCategoryManager.itemCategories.any { internalName in it.value }
private fun getPrice(internalName: NEUInternalName) = when (config.priceFrom) {
0 -> internalName.getBazaarData()?.sellPrice ?: internalName.getPriceOrNull() ?: 0.0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingTrackerCategoryManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingTrackerCategoryManager.kt
new file mode 100644
index 000000000..a1a1067ed
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingTrackerCategoryManager.kt
@@ -0,0 +1,72 @@
+package at.hannibal2.skyhanni.features.fishing.tracker
+
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
+import at.hannibal2.skyhanni.utils.jsonobjects.FishingProfitItemsJson
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object FishingTrackerCategoryManager {
+
+ var itemCategories = mapOf<String, List<NEUInternalName>>()
+
+ private var shItemCategories = mapOf<String, List<NEUInternalName>>()
+ private var neuItemCategories = mapOf<String, List<NEUInternalName>>()
+
+ @SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ shItemCategories = event.getConstant<FishingProfitItemsJson>("FishingProfitItems").categories
+ updateItemCategories()
+ }
+
+ private fun updateItemCategories() {
+ itemCategories = shItemCategories + neuItemCategories
+ }
+
+ @SubscribeEvent
+ fun onNeuRepoReload(event: io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent) {
+ val totalDrops = mutableListOf<String>()
+ val dropCategories = mutableMapOf<String, MutableList<NEUInternalName>>()
+ for ((seaCreature, data) in NotEnoughUpdates.INSTANCE.manager.itemInformation.filter { it.key.endsWith("_SC") }) {
+ val asJsonObject = data.getAsJsonArray("recipes")[0].asJsonObject
+ val drops = asJsonObject.getAsJsonArray("drops")
+ .map { it.asJsonObject.get("id").asString }.map { it.split(":").first() }
+ val asJsonArray = asJsonObject.get("extra")
+ val extra = asJsonArray?.let {
+ asJsonArray.asJsonArray.toList()
+ .map { it.toString() }
+ .filter { !it.contains("Fishing Skill") && !it.contains("Requirements:") && !it.contains("Fished from water") }
+ .joinToString(" + ")
+ } ?: "null"
+ val category = if (extra.contains("Fishing Festival")) {
+ "Fishing Festival"
+ } else if (extra.contains("Spooky Festival")) {
+ "Spooky Festival"
+ } else if (extra.contains("Jerry's Workshop")) {
+ "Jerry's Workshop"
+ } else if (extra.contains("Oasis")) {
+ "Oasis"
+ } else if (extra.contains("Magma Fields") || extra.contains("Precursor Remnants") ||
+ extra.contains("Goblin Holdout")
+ ) {
+ "Crystal Hollows"
+ } else if (extra.contains("Crimson Isle Lava")) {
+ "Crimson Isle Lava"
+ } else {
+ if (extra.isNotEmpty()) {
+ println("unknown extra: $extra = $seaCreature ($drops)")
+ }
+ "Water"
+ } + " Sea Creatures"
+ for (drop in drops) {
+ if (drop !in totalDrops) {
+ totalDrops.add(drop)
+ dropCategories.getOrPut(category) { mutableListOf() }.add(drop.asInternalName())
+ }
+ }
+ }
+ neuItemCategories = dropCategories
+ updateItemCategories()
+ }
+}