From 876c0afb2522ca44cc4c741400c3d03ec8ed49f4 Mon Sep 17 00:00:00 2001 From: ArthurKun <16458204+ArthurKun21@users.noreply.github.com> Date: Mon, 3 Jun 2024 03:53:19 +0800 Subject: [PATCH] Global Option to hide SQ in the AP Recharge (#1785) Co-authored-by: arthur <16458204+ArthurKun021@users.noreply.github.com> --- .../fate_grand_automata/ui/launcher/BattleLauncher.kt | 8 ++++++++ .../io/github/fate_grand_automata/ui/more/BattleGroup.kt | 8 ++++++++ app/src/main/res/values/localized.xml | 3 +++ .../io/github/fate_grand_automata/prefs/Preferences.kt | 2 ++ .../io/github/fate_grand_automata/prefs/core/PrefsCore.kt | 2 ++ .../fate_grand_automata/scripts/prefs/IPreferences.kt | 2 ++ 6 files changed, 25 insertions(+) diff --git a/app/src/main/java/io/github/fate_grand_automata/ui/launcher/BattleLauncher.kt b/app/src/main/java/io/github/fate_grand_automata/ui/launcher/BattleLauncher.kt index efce483ee..9838d712f 100644 --- a/app/src/main/java/io/github/fate_grand_automata/ui/launcher/BattleLauncher.kt +++ b/app/src/main/java/io/github/fate_grand_automata/ui/launcher/BattleLauncher.kt @@ -75,11 +75,19 @@ fun battleLauncher( var refillResources by remember { mutableStateOf(perServerConfigPref.resources.toSet()) } + val hideSQInAPResources by remember { mutableStateOf(prefs.hideSQInAPResources) } + if (hideSQInAPResources) { + refillResources = refillResources.minus(RefillResourceEnum.SQ) + } + //TODO remove if (refillResources.size > 1) { refillResources = setOf(refillResources.first()) } + val availableRefills = RefillResourceEnum.entries + .filterNot { it == RefillResourceEnum.SQ && hideSQInAPResources } + var copperApple by remember { mutableIntStateOf(perServerConfigPref.copperApple) } var blueApple by remember { mutableIntStateOf(perServerConfigPref.blueApple) } diff --git a/app/src/main/java/io/github/fate_grand_automata/ui/more/BattleGroup.kt b/app/src/main/java/io/github/fate_grand_automata/ui/more/BattleGroup.kt index 92d6b54b3..e7ecc4c7a 100644 --- a/app/src/main/java/io/github/fate_grand_automata/ui/more/BattleGroup.kt +++ b/app/src/main/java/io/github/fate_grand_automata/ui/more/BattleGroup.kt @@ -86,6 +86,14 @@ fun LazyListScope.battleGroup( ) } + item { + prefs.hideSQInAPResources.SwitchPreference( + title = stringResource(R.string.p_hide_sq_in_resource), + summary = stringResource(R.string.p_hide_sq_in_resource_summary), + icon = icon(R.drawable.ic_apple) + ) + } + item { prefs.boostItemSelectionMode.SingleSelectChipPreference( title = stringResource(R.string.p_boost_item), diff --git a/app/src/main/res/values/localized.xml b/app/src/main/res/values/localized.xml index 68bd2167b..0b5e61d0c 100644 --- a/app/src/main/res/values/localized.xml +++ b/app/src/main/res/values/localized.xml @@ -395,6 +395,9 @@ After pressing on the button, switch the app filter from \"Not optimized\" to \" "Screenshot Bond" "Experimental screenshot of bond level up regardless of level to 'bond' folder\nNote: Auto-click on another results screen might cause occasional missed screenshots, potentially skipping the bond level-up." + Hide SQ in AP Resources + Enable this option to hide the SQ in order to not accidentally click the SQ + Bond Level up! Servant Enhancement diff --git a/prefs/src/main/java/io/github/fate_grand_automata/prefs/Preferences.kt b/prefs/src/main/java/io/github/fate_grand_automata/prefs/Preferences.kt index 313ec0e2c..bcee9eecd 100644 --- a/prefs/src/main/java/io/github/fate_grand_automata/prefs/Preferences.kt +++ b/prefs/src/main/java/io/github/fate_grand_automata/prefs/Preferences.kt @@ -87,6 +87,8 @@ class PreferencesImpl @Inject constructor( override var hidePlayButton by prefs.hidePlayButton + override val hideSQInAPResources by prefs.hideSQInAPResources + override val stageCounterSimilarity by prefs.stageCounterSimilarity.map { it / 100.0 } override val stageCounterNew by prefs.stageCounterNew diff --git a/prefs/src/main/java/io/github/fate_grand_automata/prefs/core/PrefsCore.kt b/prefs/src/main/java/io/github/fate_grand_automata/prefs/core/PrefsCore.kt index 65e910565..98be008d1 100644 --- a/prefs/src/main/java/io/github/fate_grand_automata/prefs/core/PrefsCore.kt +++ b/prefs/src/main/java/io/github/fate_grand_automata/prefs/core/PrefsCore.kt @@ -49,6 +49,8 @@ class PrefsCore @Inject constructor( val debugMode = maker.bool("debug_mode") val autoStartService = maker.bool("auto_start_service") + val hideSQInAPResources = maker.bool("hide_sq_in_ap_resources") + val shouldLimitFP = maker.bool("should_fp_limit") val limitFP = maker.int("fp_limit", 1) val receiveEmbersWhenGiftBoxFull = maker.bool("receive_embers_when_gift_box_full") diff --git a/scripts/src/main/java/io/github/fate_grand_automata/scripts/prefs/IPreferences.kt b/scripts/src/main/java/io/github/fate_grand_automata/scripts/prefs/IPreferences.kt index 5a4fb1b4a..46df78165 100644 --- a/scripts/src/main/java/io/github/fate_grand_automata/scripts/prefs/IPreferences.kt +++ b/scripts/src/main/java/io/github/fate_grand_automata/scripts/prefs/IPreferences.kt @@ -25,6 +25,8 @@ interface IPreferences { val screenshotDropsUnmodified: Boolean val screenshotBond: Boolean var hidePlayButton: Boolean + val hideSQInAPResources: Boolean + var maxGoldEmberStackSize: Int var maxGoldEmberTotalCount: Int var stopAfterThisRun: Boolean