Skip to content

Commit 876c0af

Browse files
authored
Global Option to hide SQ in the AP Recharge (#1785)
Co-authored-by: arthur <16458204+ArthurKun021@users.noreply.github.com>
1 parent d33cbc0 commit 876c0af

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

app/src/main/java/io/github/fate_grand_automata/ui/launcher/BattleLauncher.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,19 @@ fun battleLauncher(
7575

7676
var refillResources by remember { mutableStateOf(perServerConfigPref.resources.toSet()) }
7777

78+
val hideSQInAPResources by remember { mutableStateOf(prefs.hideSQInAPResources) }
79+
if (hideSQInAPResources) {
80+
refillResources = refillResources.minus(RefillResourceEnum.SQ)
81+
}
82+
7883
//TODO remove
7984
if (refillResources.size > 1) {
8085
refillResources = setOf(refillResources.first())
8186
}
87+
8288
val availableRefills = RefillResourceEnum.entries
89+
.filterNot { it == RefillResourceEnum.SQ && hideSQInAPResources }
90+
8391

8492
var copperApple by remember { mutableIntStateOf(perServerConfigPref.copperApple) }
8593
var blueApple by remember { mutableIntStateOf(perServerConfigPref.blueApple) }

app/src/main/java/io/github/fate_grand_automata/ui/more/BattleGroup.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ fun LazyListScope.battleGroup(
8686
)
8787
}
8888

89+
item {
90+
prefs.hideSQInAPResources.SwitchPreference(
91+
title = stringResource(R.string.p_hide_sq_in_resource),
92+
summary = stringResource(R.string.p_hide_sq_in_resource_summary),
93+
icon = icon(R.drawable.ic_apple)
94+
)
95+
}
96+
8997
item {
9098
prefs.boostItemSelectionMode.SingleSelectChipPreference(
9199
title = stringResource(R.string.p_boost_item),

app/src/main/res/values/localized.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ After pressing on the button, switch the app filter from \"Not optimized\" to \"
395395

396396
<string name="p_screenshot_bond">"Screenshot Bond"</string>
397397
<string name="p_screenshot_bond_summary">"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."</string>
398+
<string name="p_hide_sq_in_resource">Hide SQ in AP Resources</string>
399+
<string name="p_hide_sq_in_resource_summary">Enable this option to hide the SQ in order to not accidentally click the SQ</string>
400+
398401
<string name="bond_level_up">Bond Level up!</string>
399402

400403
<string name="servant_enhancement">Servant Enhancement</string>

prefs/src/main/java/io/github/fate_grand_automata/prefs/Preferences.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class PreferencesImpl @Inject constructor(
8787

8888
override var hidePlayButton by prefs.hidePlayButton
8989

90+
override val hideSQInAPResources by prefs.hideSQInAPResources
91+
9092
override val stageCounterSimilarity by prefs.stageCounterSimilarity.map { it / 100.0 }
9193

9294
override val stageCounterNew by prefs.stageCounterNew

prefs/src/main/java/io/github/fate_grand_automata/prefs/core/PrefsCore.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class PrefsCore @Inject constructor(
4949
val debugMode = maker.bool("debug_mode")
5050
val autoStartService = maker.bool("auto_start_service")
5151

52+
val hideSQInAPResources = maker.bool("hide_sq_in_ap_resources")
53+
5254
val shouldLimitFP = maker.bool("should_fp_limit")
5355
val limitFP = maker.int("fp_limit", 1)
5456
val receiveEmbersWhenGiftBoxFull = maker.bool("receive_embers_when_gift_box_full")

scripts/src/main/java/io/github/fate_grand_automata/scripts/prefs/IPreferences.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ interface IPreferences {
2525
val screenshotDropsUnmodified: Boolean
2626
val screenshotBond: Boolean
2727
var hidePlayButton: Boolean
28+
val hideSQInAPResources: Boolean
29+
2830
var maxGoldEmberStackSize: Int
2931
var maxGoldEmberTotalCount: Int
3032
var stopAfterThisRun: Boolean

0 commit comments

Comments
 (0)