From aa824493ab33aa4386eeb7fdf17c272af5c3bc63 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:26:32 +1100 Subject: Fix & Backend: fix rep helper sacks also convert rep helper to use NEUInternalName (#963) Using NEUInternalName in Reputation Helper Quest. Removed Quest Item Helper. Fixed Reputation Helper in Crimson Isle showing correct sack amount. #963 --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 - .../features/crimsonisle/CrimsonIsleConfig.java | 9 +-- .../java/at/hannibal2/skyhanni/data/SackAPI.kt | 22 +++-- .../repo/CrimsonIsleReputationJson.java | 3 +- .../skyhanni/features/nether/QuestItemHelper.kt | 47 ----------- .../dailykuudra/DailyKuudraBossHelper.kt | 16 ++-- .../reputationhelper/dailykuudra/KuudraTier.kt | 5 +- .../dailyquest/DailyQuestHelper.kt | 93 +++++++--------------- .../reputationhelper/dailyquest/quest/DojoQuest.kt | 3 +- .../dailyquest/quest/FetchQuest.kt | 5 +- .../dailyquest/quest/ProgressQuest.kt | 5 +- .../reputationhelper/dailyquest/quest/Quest.kt | 5 +- .../dailyquest/quest/RescueMissionQuest.kt | 5 +- .../dailyquest/quest/TrophyFishQuest.kt | 5 +- .../dailyquest/quest/UnknownQuest.kt | 4 +- .../reputationhelper/miniboss/CrimsonMiniBoss.kt | 5 +- .../miniboss/DailyMiniBossHelper.kt | 15 ++-- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 6 +- 18 files changed, 88 insertions(+), 167 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index a9a03eeb4..90c4a03ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -280,7 +280,6 @@ import at.hannibal2.skyhanni.features.misc.trevor.TrevorTracker import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords import at.hannibal2.skyhanni.features.nether.PabloHelper -import at.hannibal2.skyhanni.features.nether.QuestItemHelper import at.hannibal2.skyhanni.features.nether.SulphurSkitterBox import at.hannibal2.skyhanni.features.nether.VolcanoExplosivityDisplay import at.hannibal2.skyhanni.features.nether.ashfang.AshfangBlazes @@ -694,7 +693,6 @@ class SkyHanniMod { loadModule(GlowingDroppedItems()) loadModule(DungeonTeammateOutlines()) loadModule(DungeonRankTabListColor()) - loadModule(QuestItemHelper()) loadModule(VolcanoExplosivityDisplay()) loadModule(PlayerChatSymbols()) loadModule(FixNEUHeavyPearls()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java index f46126ed6..995d61528 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/CrimsonIsleConfig.java @@ -26,14 +26,7 @@ public class CrimsonIsleConfig { public SulphurSkitterBoxConfig sulphurSkitterBoxConfig = new SulphurSkitterBoxConfig(); @Expose - @ConfigOption(name = "Quest Item Helper", desc = "When you open the fetch item quest in the town board, " + - "it shows a clickable chat message that will grab the items needed from the sacks.") - @ConfigEditorBoolean - @FeatureToggle - public boolean questItemHelper = false; - - @Expose - @ConfigOption(name = "Pablo NPC Helper", desc = "Similar to Quest Item Helper, shows a clickable message that grabs the flower needed from sacks.") + @ConfigOption(name = "Pablo NPC Helper", desc = "Shows a clickable message that grabs the flower needed from your sacks.") @ConfigEditorBoolean @FeatureToggle public boolean pabloHelper = false; diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index 454074d3d..fe6dc189d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -24,6 +24,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.annotations.Expose import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -35,12 +36,19 @@ object SackAPI { var inSackInventory = false - // TODO USE SH-REPO - private val sackPattern = "^(.* Sack|Enchanted .* Sack)$".toPattern() - private val numPattern = - "(?:(?:§[0-9a-f](?I{1,3})§7:)?|(?:§7Stored:)?) (?§[0-9a-f])(?[0-9.,kKmMbB]+)§7/(?\\d+(?:[0-9.,]+)?[kKmMbB]?)".toPattern() - private val gemstonePattern = - " §[0-9a-f](?[A-z]*): §[0-9a-f](?\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?)(?: §[0-9a-f]\\(\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?\\))?".toPattern() + private val patternGroup = RepoPattern.group("data.sacks") + private val sackPattern by patternGroup.pattern( + "sack", + "^(.* Sack|Enchanted .* Sack)\$" + ) + private val numPattern by patternGroup.pattern( + "number", + "(?:(?:§[0-9a-f](?I{1,3})§7:)?|(?:§7Stored:)?) (?§[0-9a-f])(?[0-9.,kKmMbB]+)§7/(?\\d+(?:[0-9.,]+)?[kKmMbB]?)" + ) + private val gemstonePattern by patternGroup.pattern( + "gemstone", + " §[0-9a-f](?[A-z]*): §[0-9a-f](?\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?)(?: §[0-9a-f]\\(\\d+(?:\\.\\d+)?(?:(?:,\\d+)?)+[kKmM]?\\))?" + ) private var isRuneSack = false private var isGemstoneSack = false @@ -286,7 +294,7 @@ object SackAPI { return sackData[item] ?: return SackItem(0, 0, SackStatus.MISSING) } - sackData = sackData.editCopy { this[item] = SackItem(0, 0, SackStatus.OUTDATED) } + sackData = sackData.editCopy { this[item] = SackItem(0, 0, SackStatus.MISSING) } return sackData[item] ?: return SackItem(0, 0, SackStatus.MISSING) } diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CrimsonIsleReputationJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CrimsonIsleReputationJson.java index f349aef9a..0ab0e52ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CrimsonIsleReputationJson.java +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CrimsonIsleReputationJson.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo; +import at.hannibal2.skyhanni.utils.NEUInternalName; import com.google.gson.annotations.Expose; import java.util.List; @@ -26,7 +27,7 @@ public class CrimsonIsleReputationJson { public static class ReputationQuest { @Expose - public String item; + public NEUInternalName item; @Expose public List location; diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt deleted file mode 100644 index 40439571b..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt +++ /dev/null @@ -1,47 +0,0 @@ -package at.hannibal2.skyhanni.features.nether - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent -import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.SimpleTimeMark -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import kotlin.time.Duration.Companion.hours - -class QuestItemHelper { - private val config get() = SkyHanniMod.feature.crimsonIsle - - private val itemCollectionPattern = ". (?[\\w ]+) x(?\\d+)".toPattern() - private var lastSentMessage = SimpleTimeMark.farPast() - - @SubscribeEvent - fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - if (!isEnabled()) return - if (event.inventoryName != "Fetch") return - if (lastSentMessage.passedSince() < 1.hours) return - - for ((_, item) in event.inventoryItems) { - val (questItem, need) = itemCollectionPattern.matchMatcher(item.displayName.removeColor()) { - group("name") to group("amount").toInt() - } ?: continue - - val have = InventoryUtils.countItemsInLowerInventory { it.name?.contains(questItem) == true } - if (have >= need) break - - val missingAmount = need - have - LorenzUtils.clickableChat( - "Click here to grab x$missingAmount $questItem from sacks!", - "gfs $questItem $missingAmount" - ) - lastSentMessage = SimpleTimeMark.now() - break - } - } - - fun isEnabled() = IslandType.CRIMSON_ISLE.isInIsland() && config.questItemHelper -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt index d8f52a641..028e56c91 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -71,15 +71,11 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH val result = if (tier.doneToday) "§aDone" else "§bTodo" val displayName = tier.getDisplayName() val displayItem = tier.displayItem - if (displayItem == null) { - display.addAsSingletonList(" $displayName: $result") - } else { - val lineList = mutableListOf() - lineList.add(" ") - lineList.add(NEUItems.getItemStack(displayItem)) - lineList.add("$displayName: $result") - display.add(lineList) - } + val lineList = mutableListOf() + lineList.add(" ") + lineList.add(displayItem.getItemStack()) + lineList.add("$displayName: $result") + display.add(lineList) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt index 15d0086b8..6a509a391 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName class KuudraTier( val name: String, - val displayItem: String?, + val displayItem: NEUInternalName, val location: LorenzVec?, val tierNumber: Int, var doneToday: Boolean = false ) { fun getDisplayName() = "Tier $tierNumber ($name)" -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 2b2de9187..5b0dbc670 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -2,6 +2,8 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.SackAPI +import at.hannibal2.skyhanni.data.SackStatus import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -26,14 +28,14 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.CrimsonMi import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName -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.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUItems.getItemStack +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraft.client.gui.inventory.GuiChest @@ -47,7 +49,6 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { private val questLoader = QuestLoader(this) val quests = mutableListOf() - private val sacksCache = mutableMapOf() var greatSpook = false @SubscribeEvent @@ -101,38 +102,6 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } } } - if (chestName == "Sack of Sacks") { - val fetchQuest = getQuest() ?: return - if (fetchQuest.state != QuestState.ACCEPTED) return - - val fetchItem = fetchQuest.itemName - for (slot in chest.inventorySlots) { - if (slot == null) continue - if (slot.slotNumber != slot.slotIndex) continue - val stack = slot.stack ?: continue - if (stack.name!!.contains("Enchanted")) continue - - if (stack.getLore().any { it.contains(fetchItem) }) { - slot highlight LorenzColor.AQUA - } - } - } - if (chestName.contains("Nether Sack")) { - val fetchQuest = getQuest() ?: return - if (fetchQuest.state != QuestState.ACCEPTED) return - - val fetchItem = fetchQuest.itemName - for (slot in chest.inventorySlots) { - if (slot == null) continue - if (slot.slotNumber != slot.slotIndex) continue - val stack = slot.stack ?: continue - val itemName = stack.name ?: continue - - if (itemName.contains(fetchItem)) { - slot highlight LorenzColor.AQUA - } - } - } } @SubscribeEvent @@ -247,16 +216,23 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } val sacksText = if (quest is FetchQuest && quest.state != QuestState.COLLECTED) { - val name = quest.itemName.uppercase().replace(" ", "_") - val amount = sacksCache.getOrDefault(name, 0) - val needAmount = quest.needAmount - val amountFormat = LorenzUtils.formatInteger(amount) - val color = if (amount >= needAmount) { - "§a" + val sackItem = SackAPI.fetchSackItem(quest.displayItem) + val sackStatus = sackItem.getStatus() + + if (sackStatus == SackStatus.OUTDATED) { + " §7(§eSack data outdated§7)" } else { - "§c" + val amountInSacks = sackItem.amount + val needAmount = quest.needAmount + + val color = if (amountInSacks >= needAmount) { + "§a" + } else { + "§c" + } + " §7($color${amountInSacks.addSeparators()} §7in sacks)" } - " §7($color$amountFormat §7in sacks)" + } else { "" } @@ -268,32 +244,21 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } val result = mutableListOf() - val internalItemName = quest.displayItem + val item = quest.displayItem.getItemStack() val displayName = if (category == QuestCategory.FETCH || category == QuestCategory.FISHING) { - if (internalItemName != null) { - val name = NEUItems.getItemStack(internalItemName).name - if (category == QuestCategory.FISHING) { - name!!.split(" ").dropLast(1).joinToString(" ") - } else name - - } else { - quest.displayName - } + val name = item.name + if (category == QuestCategory.FISHING) { + name!!.split(" ").dropLast(1).joinToString(" ") + } else name } else quest.displayName val categoryName = category.displayName - if (internalItemName == null) { - result.add(" $stateText$categoryName: §f$displayName$progressText$sacksText") - } else { - result.add(" $stateText$categoryName: ") - try { - result.add(NEUItems.getItemStack(internalItemName)) - } catch (e: RuntimeException) { - e.printStackTrace() - } - result.add("§f$displayName$progressText$sacksText") - } + + result.add(" $stateText$categoryName: ") + result.add(item) + result.add("§f$displayName$progressText$sacksText") + return result } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt index afd7d33d4..770f636a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt @@ -2,11 +2,12 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName class DojoQuest( val dojoName: String, location: LorenzVec?, - displayItem: String?, + displayItem: NEUInternalName, dojoRankGoal: String, state: QuestState ) : diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt index 645b09fdc..4e5991c59 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName -class FetchQuest(val itemName: String, location: LorenzVec?, displayItem: String?, state: QuestState, needAmount: Int) : - ProgressQuest(displayItem, location, QuestCategory.FETCH, itemName, state, needAmount) \ No newline at end of file +class FetchQuest(val itemName: String, location: LorenzVec?, displayItem: NEUInternalName, state: QuestState, needAmount: Int) : + ProgressQuest(displayItem, location, QuestCategory.FETCH, itemName, state, needAmount) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt index 23155eebb..4f69ac986 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt @@ -1,13 +1,14 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName abstract class ProgressQuest( - displayItem: String?, + displayItem: NEUInternalName, location: LorenzVec?, questCategory: QuestCategory, displayName: String, state: QuestState, val needAmount: Int, var haveAmount: Int = 0 -) : Quest(displayItem, location, questCategory, displayName, state) \ No newline at end of file +) : Quest(displayItem, location, questCategory, displayName, state) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt index e5cd68162..4c4e7218f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName abstract class Quest( - val displayItem: String?, + val displayItem: NEUInternalName, val location: LorenzVec?, val category: QuestCategory, val internalName: String, var state: QuestState, val displayName: String = internalName -) \ No newline at end of file +) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt index fbb266296..6f1e21f48 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName -class RescueMissionQuest(displayItem: String?, location: LorenzVec?, state: QuestState) : - Quest(displayItem, location, QuestCategory.RESCUE, "Rescue Mission", state, "Rescue the NPC") \ No newline at end of file +class RescueMissionQuest(displayItem: NEUInternalName, location: LorenzVec?, state: QuestState) : + Quest(displayItem, location, QuestCategory.RESCUE, "Rescue Mission", state, "Rescue the NPC") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt index 5b8a37a54..65b90d307 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName class TrophyFishQuest( val fishName: String, location: LorenzVec?, - displayItem: String?, + displayItem: NEUInternalName, state: QuestState, needAmount: Int ) : - ProgressQuest(displayItem, location, QuestCategory.FISHING, fishName, state, needAmount) \ No newline at end of file + ProgressQuest(displayItem, location, QuestCategory.FISHING, fishName, state, needAmount) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt index 02819a28d..ae7338684 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt @@ -1,4 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest +import at.hannibal2.skyhanni.utils.NEUInternalName + class UnknownQuest(unknownName: String) : - Quest(null, null, QuestCategory.UNKNOWN, unknownName, QuestState.NOT_ACCEPTED) \ No newline at end of file + Quest(NEUInternalName.MISSING_ITEM, null, QuestCategory.UNKNOWN, unknownName, QuestState.NOT_ACCEPTED) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt index ad5255aac..f5292c9fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt @@ -1,12 +1,13 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUInternalName import java.util.regex.Pattern class CrimsonMiniBoss( val displayName: String, - val displayItem: String?, + val displayItem: NEUInternalName, val location: LorenzVec?, val pattern: Pattern, var doneToday: Boolean = false -) \ No newline at end of file +) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index a182fb0b1..86a0cf061 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -75,15 +75,12 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel val result = if (miniBoss.doneToday) "§aDone" else "§bTodo" val displayName = miniBoss.displayName val displayItem = miniBoss.displayItem - if (displayItem == null) { - display.addAsSingletonList(" $displayName: $result") - } else { - val lineList = mutableListOf() - lineList.add(" ") - lineList.add(getItemStack(displayItem)) - lineList.add("§5$displayName§7: $result") - display.add(lineList) - } + + val lineList = mutableListOf() + lineList.add(" ") + lineList.add(displayItem.getItemStack()) + lineList.add("§5$displayName§7: $result") + display.add(lineList) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index fe4725b86..9ee2c42e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -227,13 +227,13 @@ object LorenzUtils { fun formatPercentage(percentage: Double, format: String?): String = DecimalFormat(format).format(percentage * 100).replace(',', '.') + "%" - @Deprecated("old code", ReplaceWith("addSeparator()")) + @Deprecated("old code", ReplaceWith("addSeparators()")) fun formatInteger(i: Int): String = i.addSeparators() - @Deprecated("old code", ReplaceWith("addSeparator()")) + @Deprecated("old code", ReplaceWith("addSeparators()")) fun formatInteger(l: Long): String = l.addSeparators() - @Deprecated("old code", ReplaceWith("round() and addSeparator()")) + @Deprecated("old code", ReplaceWith("round() and addSeparators()")) fun formatDouble(d: Double, round: Int = 1): String { return d.round(round).addSeparators() } -- cgit