This commit is contained in:
2026-04-21 02:30:17 +08:00
parent c6c9f960da
commit 720a27cca3
13 changed files with 404 additions and 24 deletions
+15 -1
View File
@@ -36,6 +36,11 @@ export interface IConfigOath {
adaptation: number
}
export interface IConfigEmblem {
lv: number
items: string[]
}
export interface IConfig {
skills: Record<string, { lv: number; vp: number; up: number }>
equips: Record<string, IConfigEquip>
@@ -65,6 +70,7 @@ export interface IConfig {
BUFF: boolean
options: Record<string, number>
avatarLink: string
emblems: Record<string, IConfigEmblem>
}
const defaultEqusConfig = {
@@ -95,6 +101,11 @@ const defaultOathConfig = {
adaptation: 0,
}
const defaultEmblemConfig = {
lv: 0,
items: ['', '', '', '', '', ''],
}
export const useConfigStore = defineStore('configStore', () => {
const config = ref<IConfig>({
skills: {},
@@ -108,6 +119,7 @@ export const useConfigStore = defineStore('configStore', () => {
BUFF: false,
options: {},
avatarLink: '',
emblems: {},
})
const skillCountConfig = ref<IResultSkillCount[]>([])
@@ -139,6 +151,7 @@ export const useConfigStore = defineStore('configStore', () => {
BUFF: false,
options: {},
avatarLink: '',
emblems: {},
}
}
if (!config.value?.equips) config.value.equips = {}
@@ -149,7 +162,7 @@ export const useConfigStore = defineStore('configStore', () => {
if (!config.value?.bindAwake) config.value.bindAwake = 50
if (!config.value?.options) config.value.options = {}
if (!config.value?.oaths) config.value.oaths = {}
console.log(config.value.oaths)
if (!config.value?.emblems) config.value.emblems = {}
const part = [...infoStore.parts, '宠物', '副武器'].filter(
(a) => !config.value?.equips.hasOwnProperty(a),
@@ -262,5 +275,6 @@ export const useConfigStore = defineStore('configStore', () => {
defaultEqusConfig,
defaultAvatarConfig,
defaultOathConfig,
defaultEmblemConfig,
}
})
+28 -2
View File
@@ -1,5 +1,5 @@
import api from '@/api'
import type { ICharacterInfo, IEquipment } from '@/api/info/type'
import type { ICharacterInfo, IEquipment, ISuit } from '@/api/info/type'
import { defineStore } from 'pinia'
import { useConfigStore } from './config'
import type { IResult, IResultSkill, IResultSkillCount } from '@/api/calc/type'
@@ -8,6 +8,15 @@ export const useInfoStore = defineStore('infoStore', () => {
const alter_token = ref<string>('')
const infos = ref<ICharacterInfo | null>(null)
const oathCache = ref<
{
suitId: string
skillId: string
rarity: string
data: ISuit
}[]
>([])
const skills = computed(() => infos.value?.skills ?? [])
const equips = computed(() => infos.value?.equips ?? [])
@@ -45,6 +54,22 @@ export const useInfoStore = defineStore('infoStore', () => {
return result
})
const getOathInfo = async (suitId: string, skillId: string, rarity: string) => {
const res = oathCache.value.find(
(o) => o.suitId === suitId && o.skillId === skillId && o.rarity === rarity,
)
if (res) {
return {
...res.data,
}
}
const data: ISuit = await api.getOathInfo(suitId, skillId, rarity)
oathCache.value.push({ suitId, skillId, rarity, data })
return {
...data,
}
}
const oathSkills = computed(() => {
const origin = infos.value?.oaths_skills
if (!origin) return origin
@@ -133,7 +158,7 @@ export const useInfoStore = defineStore('infoStore', () => {
const oathParts = Array.from({ length: 12 }, (_, i) => i.toString())
const emblemParts = ['彩色', '红色', '蓝色', '绿色', '黄色']
const emblemParts = ['彩色', '红色', '蓝色', '绿色', '黄色', '白金']
const createCharacter = async (alter: string, equVersion?: string) => {
const time = new Date().getTime()
@@ -163,5 +188,6 @@ export const useInfoStore = defineStore('infoStore', () => {
sundries,
options,
oathSkills,
getOathInfo,
}
})