This commit is contained in:
2026-06-10 12:13:24 +08:00
parent ea05b8ff43
commit 15ee762a52
2 changed files with 9 additions and 6 deletions
@@ -227,7 +227,7 @@ const setOathAdaptation = (part: string, value: string) => {
const partsToApply = oathBatchApply.value ? infoStore.oathParts : [part]; const partsToApply = oathBatchApply.value ? infoStore.oathParts : [part];
partsToApply.forEach((item) => { partsToApply.forEach((item) => {
if (!configStore.config.oaths[item]) { if (!configStore.config.oaths[item]) {
configStore.config.oaths[item] = { ...configStore.defaultOathConfig }; configStore.config.oaths[item] = configStore.createDefaultOathConfig();
} }
configStore.config.oaths[item].adaptation = Math.max(0, parsed); configStore.config.oaths[item].adaptation = Math.max(0, parsed);
}); });
@@ -488,7 +488,7 @@ const resetEquipPart = (part: string) => {
const resetOathPart = (part: string) => { const resetOathPart = (part: string) => {
configStore.config.oaths[part] = { configStore.config.oaths[part] = {
...configStore.defaultOathConfig, ...configStore.createDefaultOathConfig(),
id: configStore.config.oaths[part]?.id ?? "", id: configStore.config.oaths[part]?.id ?? "",
}; };
setNotice(`已重置誓约槽位 ${part}。`); setNotice(`已重置誓约槽位 ${part}。`);
@@ -504,7 +504,7 @@ const resetAllForge = () => {
}); });
oathParts.value.forEach((part) => { oathParts.value.forEach((part) => {
configStore.config.oaths[part] = { configStore.config.oaths[part] = {
...configStore.defaultOathConfig, ...configStore.createDefaultOathConfig(),
id: configStore.config.oaths[part]?.id ?? "", id: configStore.config.oaths[part]?.id ?? "",
}; };
}); });
+6 -3
View File
@@ -104,10 +104,12 @@ const defaultAvatarConfig = {
option: "0", option: "0",
}; };
const defaultOathConfig = { const createDefaultOathConfig = (): IConfigOath => ({
id: "", id: "",
adaptation: 0, adaptation: 0,
}; });
const defaultOathConfig = createDefaultOathConfig();
const createDefaultEmblemConfig = (): IConfigEmblem => ({ const createDefaultEmblemConfig = (): IConfigEmblem => ({
lv: 0, lv: 0,
@@ -202,7 +204,7 @@ export const useConfigStore = defineStore("configStore", () => {
// oxlint-disable-next-line no-unused-expressions // oxlint-disable-next-line no-unused-expressions
config.value && config.value &&
!config.value?.oaths.hasOwnProperty(p) && !config.value?.oaths.hasOwnProperty(p) &&
(config.value.oaths[p.toString()] = { ...defaultOathConfig }); (config.value.oaths[p.toString()] = createDefaultOathConfig());
}); });
infoStore.options.forEach((option) => { infoStore.options.forEach((option) => {
@@ -310,6 +312,7 @@ export const useConfigStore = defineStore("configStore", () => {
defaultEqusConfig, defaultEqusConfig,
defaultAvatarConfig, defaultAvatarConfig,
defaultOathConfig, defaultOathConfig,
createDefaultOathConfig,
defaultEmblemConfig, defaultEmblemConfig,
createDefaultEmblemConfig, createDefaultEmblemConfig,
changeSourceLogs, changeSourceLogs,