This commit is contained in:
2025-05-15 23:15:57 +08:00
parent 723ceb5f6f
commit 900d8e8560
86 changed files with 2350 additions and 1905 deletions
+17 -5
View File
@@ -54,9 +54,10 @@ export interface IConfig {
sundry: Record<string, any>
bindAwake: number
/** 系统奶 */
DSB : boolean
DSB: boolean
/** 奶 */
BUFF : boolean
BUFF: boolean
options: Record<string, number>
}
const defaultEqusConfig = {
@@ -92,6 +93,7 @@ export const useConfigStore = defineStore('configStore', () => {
bindAwake: 50,
DSB: false,
BUFF: false,
options:{}
})
const skillCountConfig = ref<IResultSkillCount[]>([])
@@ -120,6 +122,7 @@ export const useConfigStore = defineStore('configStore', () => {
bindAwake: 50,
DSB: false,
BUFF: false,
options:{}
}
if (!config.value?.equips) config.value.equips = {}
if (!config.value?.skills) config.value.skills = {}
@@ -127,6 +130,7 @@ export const useConfigStore = defineStore('configStore', () => {
if (!config.value?.avatar) config.value.avatar = {}
if (!config.value?.sundry) config.value.sundry = {}
if (!config.value?.bindAwake) config.value.bindAwake = 50
if (!config.value?.options) config.value.options = {}
const part = [...infoStore.parts, '宠物', '副武器'].filter(
(a) => !config.value?.equips.hasOwnProperty(a),
@@ -147,6 +151,11 @@ export const useConfigStore = defineStore('configStore', () => {
config.value && (config.value.avatar[p] = { ...defaultAvatarConfig })
})
infoStore.options.forEach((option) => {
if(Object.keys(config.value.options).includes(option.id.toString())) return
config.value.options[option.id.toString()] = 0
})
skillIDs.forEach((id) => {
config.value &&
(config.value.skills[id] = {
@@ -168,7 +177,10 @@ export const useConfigStore = defineStore('configStore', () => {
const alter = infoStore.infos?.alter
if (alter) {
localStorage.setItem(`dcalc/${alter}/config`, JSON.stringify(config.value))
localStorage.setItem(`dcalc/${alter}/config/skillCount`, JSON.stringify(skillCountConfig.value))
localStorage.setItem(
`dcalc/${alter}/config/skillCount`,
JSON.stringify(skillCountConfig.value),
)
}
}
@@ -203,7 +215,7 @@ export const useConfigStore = defineStore('configStore', () => {
skills: [],
info: [],
suits: [],
buffer:false
buffer: false,
},
{ resetOnExecute: false },
)
@@ -215,6 +227,6 @@ export const useConfigStore = defineStore('configStore', () => {
calc,
result,
chooseEqu,
skillCountConfig
skillCountConfig,
}
})
+3 -3
View File
@@ -1,6 +1,6 @@
import { createPinia } from "pinia"
import { createPinia } from 'pinia'
export * from "./info"
export * from "./config"
export * from './info'
export * from './config'
export const pinia = createPinia()
+16 -10
View File
@@ -26,26 +26,31 @@ export const useInfoStore = defineStore('infoStore', () => {
const sundries = computed(() => infos.value?.sundry ?? {})
const options = computed(() => infos.value?.options ?? [])
const standardUUID = ref<string>()
const setStandard = (result?: IResult,skillCount?:{
count: number;
mode: string;
name: string;
}[]) => {
const setStandard = (
result?: IResult,
skillCount?: {
count: number
mode: string
name: string
}[],
) => {
if (!result) {
!!standardUUID.value && sessionStorage.removeItem(standardUUID.value)
standardUUID.value = undefined
} else {
standardUUID.value = result.uuid
sessionStorage.setItem(result.uuid, JSON.stringify({skills:result.skills,skillCount}))
sessionStorage.setItem(result.uuid, JSON.stringify({ skills: result.skills, skillCount }))
}
}
const standard = computed(()=>{
const standard = computed(() => {
const value = sessionStorage.getItem(standardUUID.value ?? '')
if(!value) return undefined
else return JSON.parse(value) as {skills:IResultSkill[],skillCount:IResultSkillCount[]}
if (!value) return undefined
else return JSON.parse(value) as { skills: IResultSkill[]; skillCount: IResultSkillCount[] }
})
const parts = [
@@ -107,6 +112,7 @@ export const useInfoStore = defineStore('infoStore', () => {
jades,
setStandard,
standard,
sundries
sundries,
options
}
})