diff options
Diffstat (limited to 'src/main/java')
5 files changed, 29 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java index 0fb516858..a17323082 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/crimsonisle/ReputationHelperConfig.java @@ -8,6 +8,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.observer.Property; import org.lwjgl.input.Keyboard; public class ReputationHelperConfig { @@ -24,6 +25,11 @@ public class ReputationHelperConfig { public boolean useHotkey = false; @Expose + @ConfigOption(name = "Hide Completed", desc = "Hides tasks after they've been completed.") + @ConfigEditorBoolean + public Property<Boolean> hideComplete = Property.of(true); + + @Expose @ConfigOption(name = "Hotkey", desc = "Press this hotkey to show the Reputation Helper.") @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) public int hotkey = Keyboard.KEY_NONE; diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index 5ea51336b..b0ad7584f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -16,11 +16,13 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.QuestLo import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMiniBossHelper import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TabListData import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -35,6 +37,8 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { var factionType = FactionType.NONE + private var lastUpdate = SimpleTimeMark.farPast() + private var display = emptyList<List<Any>>() private var dirty = true @@ -95,6 +99,13 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { } } + @SubscribeEvent + fun onConfigInit(event: ConfigLoadEvent) { + config.hideComplete.afterChange { + updateRender() + } + } + private fun updateRender() { val newList = mutableListOf<List<Any>>() 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 8e820680e..f8979a57a 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData @@ -24,6 +25,8 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH private var kuudraLocation: LorenzVec? = null private var allKuudraDone = true + private val config get() = SkyHanniMod.feature.crimsonIsle.reputationHelper + @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!LorenzUtils.inSkyBlock) return @@ -70,6 +73,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH display.addAsSingletonList("§7Daily Kuudra (§e$done§8/§e5 killed§7)") if (done < 5) { for (tier in kuudraTiers) { + if (config.hideComplete.get() && tier.doneToday) continue val result = if (tier.doneToday) "§aDone" else "§bTodo" val displayName = tier.getDisplayName() val displayItem = tier.displayItem 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 9a700bc2b..4de3c1bb9 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.SackAPI @@ -52,6 +53,8 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { val quests = mutableListOf<Quest>() var greatSpook = false + private val config get() = SkyHanniMod.feature.crimsonIsle.reputationHelper + @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return @@ -199,7 +202,8 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { display.addAsSingletonList("") display.addAsSingletonList("§7Daily Quests (§e$done§8/§e5 collected§7)") if (done != 5) { - quests.mapTo(display) { renderQuest(it) } + val filteredQuests = quests.filter { !config.hideComplete.get() || it.state != QuestState.COLLECTED } + filteredQuests.mapTo(display) { renderQuest(it) } } } @@ -258,7 +262,6 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { 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/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index 60a7294be..5feda5c8d 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 @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.jsonobjects.repo.CrimsonIsleReputationJson.ReputationQuest @@ -23,6 +24,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) { val miniBosses = mutableListOf<CrimsonMiniBoss>() + private val config get() = SkyHanniMod.feature.crimsonIsle.reputationHelper @SubscribeEvent fun onChat(event: LorenzChatEvent) { @@ -72,6 +74,7 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel display.addAsSingletonList("§7Daily Bosses (§e$done§8/§e5 killed§7)") if (done != 5) { for (miniBoss in miniBosses) { + if (config.hideComplete.get() && miniBoss.doneToday) continue val result = if (miniBoss.doneToday) "§aDone" else "§bTodo" val displayName = miniBoss.displayName val displayItem = miniBoss.displayItem |