This commit is contained in:
2025-04-03 17:57:45 +08:00
parent d56afd0695
commit e2099aa047
15 changed files with 744 additions and 42 deletions
+30 -11
View File
@@ -244,17 +244,18 @@ class Character:
光强=0,
暗强=0,
全属抗=0,
火抗=0,
冰抗=0,
光抗=0,
暗抗=0,
火属性抗性=0,
冰属性抗性=0,
光属性抗性=0,
暗属性抗性=0,
火属性攻击=False,
冰属性攻击=False,
光属性攻击=False,
暗属性攻击=False,
移速=0,
攻速=0,
施放=0,
移动速度=0,
攻击速度=0,
施放速度=0,
三速=0,
命中=0,
命中率=0,
物暴=0,
@@ -321,9 +322,9 @@ class Character:
self.CriticalM += kwargs.get('CriticalM', 0) + 魔暴
self.CriticalP += kwargs.get('CriticalP', 0) + 物暴
self.SkillAttack *= (1 + 技攻) * (1 + kwargs.get('SkillAttack', 0))
self.SpeedA += 攻速 + kwargs.get('SpeedA', 0)
self.SpeedM += 移速 + kwargs.get('SpeedM', 0)
self.SpeedR += 施放 + kwargs.get('SpeedR', 0)
self.SpeedA += 攻击速度 + kwargs.get('SpeedA', 0) + 三速
self.SpeedM += 移动速度 + kwargs.get('SpeedM', 0) + 三速
self.SpeedR += 施放速度 + kwargs.get('SpeedR', 0) + 三速
self.HitP += 命中率 + kwargs.get('HitP', 0)
self.Hit += 命中 + kwargs.get('Hit', 0)
self.Attack += 攻击强化 + kwargs.get('Attack', 0)
@@ -415,7 +416,15 @@ class Character:
info['name'] = self.nameCN
info['weapons'] = self.武器选项
skillInfo = []
skill_clothes = []
platinum = []
for skill in self.skills:
# 白金
if 15 <= skill.learnLv <= 70 and skill.learnLv not in [48,50]:
platinum.append(skill.name)
# 时装
if skill.learnLv <= 95:
skill_clothes.append(skill.name)
skillInfo.append(
{
'id': skill.id,
@@ -448,7 +457,17 @@ class Character:
info['suits'] = suits
info['stones'] = stones
info['enchants'] = equInfos.enchants
emblems = []
info['emblems'] = equInfos.emblems
info["avatar"] = equInfos.funs.get_dress_list(skill_clothes)
for skill in platinum:
info['emblems'].append({
'id': skill,
'fame':232,
'position':["辅助装备", "魔法石"],
"detail": skill + " Lv+1" + " 四维 + 8",
"categorize": ["技能"],
"rarity": "白金",
})
return info
def getBasicInos(self):
+16 -1
View File
@@ -1,5 +1,5 @@
import importlib
from database.models import Session, EquData, StoneData, SuitData, EnchantData
from database.models import EmblemData, Session, EquData, StoneData, SuitData, EnchantData
from database.connect import get_db_engine as get_engine
from functools import cache
@@ -75,12 +75,14 @@ class Equipments:
self.equ_dict: dict[str, Equ] = {}
self.stone_dict: dict[str, Equ] = {}
self.enchants = []
self.emblems = []
self.suits: list[Suit] = []
self.suit_dict: dict[str, Suit] = {}
self.init_equs()
self.init_suits()
self.init_enchants()
self.init_stones()
self.init_emblem()
self.engine.dispose()
def init_equs(self):
@@ -150,6 +152,19 @@ class Equipments:
pass
pass
def init_emblem(self):
"""从数据库中获取所有徽章信息"""
with Session(self.engine) as session:
db_list = session.query(EmblemData).all()
for item in db_list:
emblem = {k: v for k, v in item.__dict__.items() if not k.startswith('_')}
emblem['position'] = [] if emblem['itemType'] is None else emblem['itemType'].split(',')
emblem['categorize'] = [] if emblem['categorize'] is None else emblem['categorize'].split(',')
del emblem['itemType']
self.emblems.append(emblem)
pass
pass
def init_func(self):
"""根据装备版本加载装备效果"""
try:
+1
View File
@@ -33,6 +33,7 @@ class CharacterEquipInfo:
"""贴膜信息"""
def __init__(self, info={}, equVerison=0, part='') -> None:
info["fusion"] = info.get("fusion", None)
self.__dict__.update(info)
equ = get_equipment(equVerison).equ_dict.get(self.id, None)
fusion = get_equipment(equVerison).stone_dict.get(self.fusion, None)
+1 -1
View File
@@ -1,7 +1,7 @@
from .suit import suit_func_list
from .jade import jade_func_list
from .equ import equ_func_list
from .avatar import get_dress_list
options = [
{'id': 1, 'name': '龙战八荒,', 'options': ['BUFF OFF', 'BUFF ON', '期望']},
{'id': 2, 'name': '混沌净化', 'options': ['净化', '堕落']},
+359
View File
@@ -0,0 +1,359 @@
装扮选项属性 = {
"神器": {
"智力": 65,
"体力": 65,
"精神": 65,
"力量": 65,
"施放速度": 0.14,
"移动速度": 0.07,
"攻击速度": 0.07,
"火属性抗性": 45,
"光属性抗性": 45,
"冰属性抗性": 45,
"暗属性抗性": 45,
"所有异常抗性": 0.042
},
"稀有": {
"智力": 55,
"体力": 55,
"精神": 55,
"力量": 55,
"施放速度": 0.12,
"移动速度": 0.06,
"攻击速度": 0.06,
"火属性抗性": 35,
"光属性抗性": 35,
"冰属性抗性": 35,
"暗属性抗性": 35,
"所有异常抗性": 0.036
},
"高级": {
"智力": 45,
"体力": 45,
"精神": 45,
"力量": 45,
"施放速度": 0.12,
"移动速度": 0.05,
"攻击速度": 0.05,
"火属性抗性": 25,
"光属性抗性": 25,
"冰属性抗性": 25,
"暗属性抗性": 25,
"所有异常抗性": 0.03
}
}
class 装扮:
部位: str
品质: str
套装: str
选项集合: tuple[str]
def 效果(self, 角色, 选项: str):
if 选项 in self.选项集合:
数值 = 装扮选项属性[self.品质][选项]
角色.SetStatus(**{选项: 数值})
elif str(选项) == '0':
pass
else:
角色.单技能加成(名称=选项, lv=1)
class 神器装扮头发(装扮):
部位 = "头发"
品质 = "神器"
套装 = "神器装扮"
id = 1
选项集合 = ("智力", "精神", "施放速度")
class 神器装扮帽子(装扮):
部位 = "帽子"
品质 = "神器"
套装 = "神器装扮"
选项集合 = ("智力", "精神", "施放速度")
class 神器装扮脸部(装扮):
部位 = "脸部"
品质 = "神器"
套装 = "神器装扮"
# 逗号不能删
选项集合 = ("攻击速度", "所有异常抗性")
class 神器装扮胸部(装扮):
部位 = "胸部"
品质 = "神器"
套装 = "神器装扮"
选项集合 = ("攻击速度", "所有异常抗性")
class 神器装扮上衣(装扮):
部位 = "上衣"
品质 = "神器"
套装 = "神器装扮"
选项集合 = ()
class 神器装扮腰带(装扮):
部位 = "腰带"
品质 = "神器"
套装 = "神器装扮"
选项集合 = ("力量", "体力", "火属性抗性", "光属性抗性", "冰属性抗性", "暗属性抗性")
class 神器装扮下装(装扮):
部位 = "下装"
品质 = "神器"
套装 = "神器装扮"
选项集合 = ()
class 神器装扮鞋(装扮):
部位 = "鞋"
品质 = "神器"
套装 = "神器装扮"
选项集合 = ("力量", "体力", "移动速度")
class 稀有装扮头发(装扮):
部位 = "头发"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ("智力", "精神", "施放速度")
class 稀有装扮帽子(装扮):
部位 = "帽子"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ("智力", "精神", "施放速度")
class 稀有装扮脸部(装扮):
部位 = "脸部"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ("攻击速度", "所有异常抗性")
class 稀有装扮胸部(装扮):
部位 = "胸部"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ("攻击速度", "所有异常抗性")
class 稀有装扮上衣(装扮):
部位 = "上衣"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ()
class 稀有装扮腰带(装扮):
部位 = "腰带"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ("力量", "体力", "火属性抗性", "光属性抗性", "冰属性抗性", "暗属性抗性")
class 稀有装扮下装(装扮):
部位 = "下装"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ()
class 稀有装扮鞋(装扮):
部位 = "鞋"
品质 = "稀有"
套装 = "稀有装扮"
选项集合 = ("力量", "体力", "移动速度")
class 高级装扮头发(装扮):
部位 = "头发"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ("智力", "精神", "施放速度")
class 高级装扮帽子(装扮):
部位 = "帽子"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ("智力", "精神", "施放速度")
class 高级装扮脸部(装扮):
部位 = "脸部"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ("攻击速度", "所有异常抗性")
class 高级装扮胸部(装扮):
部位 = "胸部"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ("攻击速度", "所有异常抗性")
class 高级装扮上衣(装扮):
部位 = "上衣"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ()
class 高级装扮腰带(装扮):
部位 = "腰带"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ("力量", "体力", "火属性抗性", "光属性抗性", "冰属性抗性", "暗属性抗性")
class 高级装扮下装(装扮):
部位 = "下装"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ()
class 高级装扮鞋(装扮):
部位 = "鞋"
品质 = "高级"
套装 = "高级装扮"
选项集合 = ("力量", "体力", "移动速度")
神器装扮集合 = (神器装扮头发, 神器装扮帽子, 神器装扮脸部, 神器装扮胸部,
神器装扮上衣, 神器装扮腰带, 神器装扮下装, 神器装扮鞋)
稀有装扮集合 = (稀有装扮头发, 稀有装扮帽子, 稀有装扮脸部, 稀有装扮胸部,
稀有装扮上衣, 稀有装扮腰带, 稀有装扮下装, 稀有装扮鞋)
高级装扮集合 = (高级装扮头发, 高级装扮帽子, 高级装扮脸部, 高级装扮胸部,
高级装扮上衣, 高级装扮腰带, 高级装扮下装, 高级装扮鞋)
装扮集合 = tuple(map(lambda x: x(), (神器装扮集合 + 稀有装扮集合 + 高级装扮集合)))
class 装扮套装:
名称: str
兼容于: str = None
所需数量: int
def 效果(self, 属性):
pass
class 神器装扮3(装扮套装):
名称 = "神器装扮"
兼容于 = "稀有装扮"
所需数量 = 3
def 效果(self, 属性):
# print("effect unique suit 3")
属性.SetStatus(四维=50, 三速=0.03)
class 神器装扮8(装扮套装):
名称 = "神器装扮"
兼容于 = "稀有装扮"
所需数量 = 8
def 效果(self, 属性):
# print("effect unique suit 8")
属性.SetStatus(四维=50, 三速=0.03)
属性.AddElementDB('火',10)
属性.AddElementDB('光',10)
属性.AddElementDB('冰',10)
属性.AddElementDB('暗',10)
# 属性.所有属性强化加成(10)
# 属性.所有属性抗性加成(15)
class 稀有装扮3(装扮套装):
名称 = "稀有装扮"
所需数量 = 3
def 效果(self, 属性):
# print("effect rare suit 3")
属性.SetStatus(四维=40, 三速=0.02)
class 稀有装扮8(装扮套装):
名称 = "稀有装扮"
所需数量 = 8
def 效果(self, 属性):
# print("effect rare suit 8")
属性.SetStatus(四维=40, 三速=0.02)
属性.AddElementDB('火',6)
属性.AddElementDB('光',6)
属性.AddElementDB('冰',6)
属性.AddElementDB('暗',6)
class 节日装扮8(装扮套装):
名称 = "节日装扮"
所需数量 = 8
def 效果(self, 属性):
属性.SetStatus(四维=25, 三速=0.02)
class 高级装扮3(装扮套装):
名称 = "高级装扮"
所需数量 = 3
def 效果(self, 属性):
# print("effect uncommon suit 3")
属性.SetStatus(四维=10)
class 高级装扮8(装扮套装):
名称 = "高级装扮"
所需数量 = 8
def 效果(self, 属性):
# print("effect uncommon suit 8")
属性.SetStatus(四维=10, 三速=0.01)
装扮套装集合 = tuple(
map(lambda x: x(), (神器装扮3, 神器装扮8, 稀有装扮3, 稀有装扮8, 节日装扮8, 高级装扮3, 高级装扮8)))
def get_dress_list(skills_coat:list[str] = [],skills_pants:list[str] = []) -> dict:
"""
获取装扮列表
:param info: 装扮信息
:return: 装扮列表
"""
dress_list = {}
for dress in 装扮集合:
部位 = dress.部位
if 部位 not in dress_list:
dress_list[部位] = []
选项集合 = dress.选项集合
if dress.部位 == "上衣":
选项集合 = 选项集合 + tuple(skills_coat)
elif dress.部位 == "下装":
选项集合 = 选项集合 + tuple(skills_pants)
data = {}
data["id"] = len(dress_list[部位])
data["options"] = 选项集合
data["part"] = 部位
data["rarity"] = dress.品质
data["suit"] = dress.套装
data["name"] = f"{dress.品质}装扮{dress.部位}"
dress_list[部位].append(data)
return dress_list
Binary file not shown.
Binary file not shown.
+11
View File
@@ -94,3 +94,14 @@ class EnchantData(Base):
categorize = Column(Integer)
itemType = Column(Text)
fame = Column(Integer)
rarity = Column(Text)
class EmblemData(Base):
__tablename__ = 'emblem'
id = Column(Integer, primary_key=True)
detail = Column(Text)
categorize = Column(Integer)
itemType = Column(Text)
fame = Column(Integer)
rarity = Column(Text)
+13 -4
View File
@@ -21,7 +21,7 @@ export interface IAlterInfo {
}
export interface ICharacterInfo {
role:string
role: string
alter: string
name: string
equVersion: string
@@ -32,6 +32,7 @@ export interface ICharacterInfo {
weapons: string[]
skills: ISkill[]
suits: ISuit[]
avatar: Record<string, IAvatarInfo[]>
}
export interface IEquipment {
@@ -40,9 +41,9 @@ export interface IEquipment {
itemType: string
itemDetailType: string
name: string
categorize:string
categorize: string
suit: string[]
rarity:string
rarity: string
}
export interface ISkill {
@@ -63,7 +64,6 @@ export interface ISuit {
suitId: number
}
export interface IEnchantingInfo {
id: string | number
fame: number | undefined
@@ -73,3 +73,12 @@ export interface IEnchantingInfo {
rarity?: string
type?: string
}
export interface IAvatarInfo {
id: number
options: string[]
part: string
rarity: string
suit?: string
name: string
}
@@ -0,0 +1,73 @@
<template>
<div class="pos-relative w-300px h-full">
<template v-for="part in infoStore.avatarParts" :key="part">
<div
class="pos-absolute text-white/50 w-26px h-26px border-1px border-solid border-#7a7a7a/50 flex items-center justify-center"
:style="infoStyle(part)"
@click="choosePart(part)"
>
{{ partName(part) }}
</div>
</template>
</div>
</template>
<script lang="ts" setup name="EquList">
import { getImageURL } from '@/utils/images'
import { useVModel } from '@vueuse/core'
import { useInfoStore, useConfigStore } from '@/stores'
const props = defineProps({
part: {
type: String,
default: '',
},
})
const partModelValue = useVModel(props, 'part')
const infoStore = useInfoStore()
const infoStyle = (part: string) => {
let x = 15
let y = 5
let index = infoStore.avatarParts.findIndex((p) => p == part)
if (index > 7) {
index += 1
}
// if (index == 13) {
// index -= 7
// } else if (index >= 5 && index <= 12) {
// x += 179
// index -= 5
// }
if(part == '宠物'){
x+= 5*39
y+= 1*40
}
else if (part.includes('宠物装备')) {
x += 6 * 39
y += (index - infoStore.avatarParts.findIndex((p) => p == '宠物装备-红') - 1) * 40
} else {
x += (index % 4) * 39
y += Math.floor(index / 4) * 40
}
const style = {
left: `${x}px`,
top: `${y}px`,
zIndex: 6,
// fontWeight: 900,
}
return style
}
const choosePart = (part: string) => {
partModelValue.value = part
}
const partName = (part: string) => {
if (part == '武器装扮') return '武器'
return part.replace('宠物装备-', '')
}
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,159 @@
<script lang="tsx">
import { computed, defineComponent, ref, renderList } from 'vue'
import type { IEnchantingInfo } from '@/api/info/type'
import { useInfoStore, useConfigStore } from '@/stores'
import ClothList from '@/components/dnf/Avatar/List/index.vue'
export default defineComponent({
name: 'Clothes',
setup(props) {
const configStore = useConfigStore()
const part = ref('武器装扮')
// const globalStore = useGlobalStore()
/** 是否有徽章 */
const has_socket = computed(() => ['武器装扮', '光环', '皮肤'].includes(part.value as string))
const basicInfoStore = useInfoStore()
const has_enchant = computed(() => {
return !['头发', '帽子', '脸部', '胸部', '上衣', '腰带', '下装', '鞋'].includes(
part.value as string,
)
})
const enchanting_list = computed<IEnchantingInfo[] | undefined>(() => {
return basicInfoStore.enchants
?.filter((item) => item.position.includes(part.value))
.sort((a, b) => (b.fame ?? 0) - (a.fame ?? 0))
})
const emblem_list = computed<IEnchantingInfo[] | undefined>(() => {
return basicInfoStore.emblems.filter((item) => item.position.includes(part.value))
})
const currentInfo = function <T>(name: string, defaultValue?: T) {
return computed<string | number>({
get() {
let key: 'avatar' | 'equips' = 'avatar'
if (part.value == '宠物') key = 'equips'
return (
(configStore.config[key]?.[part.value] as Record<string, any>)?.[name] ??
defaultValue ??
0
)
},
set(val) {
if (val == undefined) {
return
}
let key: 'avatar' | 'equips' = 'avatar'
if (part.value == '宠物') key = 'equips'
if (configStore.config[key][part.value]) {
;(configStore.config[key][part.value] as Record<string, any>)[name] = val
}
},
})
}
// 附魔
const enchanting = currentInfo<string | number>('enchanting')
// 镶嵌栏1
const emblem_0 = currentInfo<string | number>('emblem_0', 0)
// 镶嵌栏2
const emblem_1 = currentInfo<string | number>('emblem_1')
// 品级
const id = currentInfo<string | number>('id')
// 属性
const option = currentInfo<string | number>('option')
/**
* 同步徽章1到徽章2
* @param val
*/
function changeSocket(val: number) {
emblem_1.value = val
}
return () => {
return (
<>
<div class="h-120px flex justify-center items-center">
<ClothList v-model:part={part.value} />
</div>
<div class="flex flex-wrap equ-profile">
<div class="equ-profile-item">
<div class="mr-10px row-name">当前部位</div>
<span> {part.value}</span>
</div>
{has_enchant.value ? (
<div class="equ-profile-item">
<div class="row-name">{part.value == '宠物' ? '附魔' : '属性'}</div>
<calc-select v-model={enchanting.value} class="flex-1 !h-20px">
<calc-option value={0}>无</calc-option>
{renderList(enchanting_list.value ?? [], (item) => (
<calc-option value={item.id}>{item.detail}</calc-option>
))}
</calc-select>
</div>
) : (
<>
<div class="equ-profile-item">
<div class="row-name">品级</div>
<calc-select v-model={id.value} class="flex-1 !h-20px">
{renderList(basicInfoStore.avatars[part.value] ?? [], (item) => (
<calc-option value={item.id}>{item.suit}</calc-option>
))}
</calc-select>
</div>
<div class="equ-profile-item">
<div class="row-name">属性</div>
<calc-select v-model={option.value} class="flex-1 !h-20px">
<calc-option value={0}>无</calc-option>
{renderList(basicInfoStore.avatars[part.value].find(a=>a.id == id.value)?.options ?? [], (item) => (
<calc-option value={item}>{item}</calc-option>
))}
</calc-select>
</div>
</>
)}
{has_socket.value ? (
<div class="equ-profile-item">
<div class="row-name">徽章</div>
<calc-select
onChange={changeSocket}
v-model={emblem_0.value}
class="flex-1 !h-20px"
>
<calc-option value={0}>无</calc-option>
{renderList(emblem_list.value ?? [], (item) => (
<calc-option
value={item.id}
>{`${item.rarity}${item.categorize}徽章[${item.detail}]`}</calc-option>
))}
</calc-select>
<calc-select v-model={emblem_1.value} class="flex-1 !h-20px">
<calc-option value={0}>无</calc-option>
{renderList(emblem_list.value ?? [], (item) => (
<calc-option
value={item.id}
>{`${item.rarity}${item.categorize}徽章[${item.detail}]`}</calc-option>
))}
</calc-select>
)
</div>
) : (
<div></div>
)}
</div>
</>
)
}
},
})
</script>
<style lang="scss"></style>
@@ -129,7 +129,7 @@ export default defineComponent({
return () => {
return (
<>
<div class="h-180px flex justify-center items-center">
<div class="h-150px flex justify-center items-center">
<EquList v-model:part={part.value}/></div>
<div class="flex flex-wrap equ-profile">
@@ -172,7 +172,7 @@ export default defineComponent({
<div class="equ-profile-item">
<div class="row-name">附魔</div>
<calc-select v-model={enchanting.value} class="flex-1 !h-20px">
<calc-option value={0}>无</calc-option>
<calc-option value={""}>无</calc-option>
{renderList(enchanting_list.value ?? [], (item) => (
<calc-option value={item.id}>{item.detail}</calc-option>
))}
@@ -186,20 +186,20 @@ export default defineComponent({
v-model={emblem_0.value}
class="flex-1 !h-20px"
>
<calc-option value={0}>无</calc-option>
<calc-option value={""}>无</calc-option>
{renderList(emblem_list.value ?? [], (item) => (
<calc-option
value={item.id}
>{`${item.rarity}${item.type}徽章[${item.detail}]`}</calc-option>
>{`${item.rarity}${item.categorize}徽章[${item.detail}]`}</calc-option>
))}
</calc-select>
{has_emblem_1.value && (
<calc-select v-model={emblem_1.value} class="flex-1 !h-20px">
<calc-option value={0}>无</calc-option>
<calc-option value={""}>无</calc-option>
{renderList(emblem_list.value ?? [], (item) => (
<calc-option
value={item.id}
>{`${item.rarity}${item.type}徽章[${item.detail}]`}</calc-option>
>{`${item.rarity}${item.categorize}徽章[${item.detail}]`}</calc-option>
))}
</calc-select>
)}
+9 -2
View File
@@ -1,12 +1,19 @@
<template>
<div class="w-400px">
<calc-collapse class="w-100%" title="装备打造(点击人物部位切换)">
<equipment />
<calc-collapse class="w-100%" title="装备/时装打造(点击部位切换)">
<calc-tabs v-model="partTab" class="!mb-2">
<calc-tab :value="0">装备栏</calc-tab>
<calc-tab :value="1">时装栏</calc-tab>
</calc-tabs>
<equipment v-if="partTab === 0"></equipment>
<clothes v-if="partTab === 1"></clothes>
</calc-collapse>
</div>
</template>
<script setup lang="ts">
import equipment from './components/equipment.vue'
import clothes from './components/avatar.vue';
const partTab = ref(0)
</script>
<style lang="scss">
+43 -15
View File
@@ -22,7 +22,7 @@ export interface IConfig {
id: string
reinforce: number
reinforceType: number
enchant: number
enchant: string
emblem_0: string
emblem_1: string
upgrade: number
@@ -32,26 +32,45 @@ export interface IConfig {
}
>
jades: Record<string, number>
avatar: Record<
string,
{
id: string
enchant: string
emblem_0: string
emblem_1: string
option: string
}
>
}
const defaultEqusConfig = {
id: '',
reinforce: 0,
reinforceType: 0,
enchant: 0,
emblem_0: "0",
emblem_1: "0",
enchant: '',
emblem_0: '',
emblem_1: '',
upgrade: 0,
refine: 0,
adaptation: 0,
fusion: '',
}
const defaultAvatarConfig = {
id: '',
enchant: '',
emblem_0: '',
emblem_1: '',
option: '0',
}
export const useConfigStore = defineStore('configStore', () => {
const config = ref<IConfig>({
skills: {},
equips: {},
jades: {},
avatar: {},
})
const loadConfig = () => {
@@ -69,12 +88,17 @@ export const useConfigStore = defineStore('configStore', () => {
skills: {},
equips: {},
jades: {},
avatar: {},
}
if (!config.value?.equips) config.value.equips = {}
if (!config.value?.skills) config.value.skills = {}
if (!config.value?.jades) config.value.jades = {}
if (!config.value?.avatar) config.value.avatar = {}
const part = infoStore.parts.filter((a) => !config.value?.equips.hasOwnProperty(a))
const part = [...infoStore.parts, '宠物'].filter((a) => !config.value?.equips.hasOwnProperty(a))
const avatarPart = infoStore.avatarParts
.filter((a) => a != '宠物')
.filter((a) => !config.value?.avatar.hasOwnProperty(a))
const skillIDs = infoStore.skills
.map((skill) => skill.id.toString())
@@ -84,6 +108,10 @@ export const useConfigStore = defineStore('configStore', () => {
config.value && (config.value.equips[p] = { ...defaultEqusConfig })
})
avatarPart.forEach((p) => {
config.value && (config.value.avatar[p] = { ...defaultAvatarConfig })
})
skillIDs.forEach((id) => {
config.value &&
(config.value.skills[id] = {
@@ -101,39 +129,39 @@ export const useConfigStore = defineStore('configStore', () => {
}
const calc = async () => {
if(!useInfoStore().infos?.alter) return undefined
if (!useInfoStore().infos?.alter) return undefined
return await api.calc(config.value)
}
const chooseEqu = async(equip: IEquipment | undefined,isFusion:boolean = false) => {
if (equip && config.value.equips[equip.itemDetailType]) {
const chooseEqu = async (equip: IEquipment | undefined, isFusion: boolean = false) => {
if (!equip) return
const part = equip?.itemType == '武器' ? '武器' : equip?.itemDetailType
if (equip && config.value.equips[part]) {
const key = isFusion ? 'fusion' : 'id'
if (config.value.equips[equip.itemDetailType][key] == equip.id) {
config.value.equips[equip.itemDetailType][key] = ""
if (config.value.equips[part][key] == equip.id) {
config.value.equips[part][key] = ''
} else {
config.value.equips[equip.itemDetailType][key] = equip.id
config.value.equips[part][key] = equip.id
}
}
}
const result = useAsyncState(
() => {
return calc()
},
{
skills:[]
skills: [],
},
{ resetOnExecute: false },
)
return {
config,
loadConfig,
saveConfig,
calc,
result,
chooseEqu
chooseEqu,
}
})
+23 -2
View File
@@ -18,6 +18,8 @@ export const useInfoStore = defineStore('infoStore', () => {
const stones = computed(() => infos.value?.stones ?? [])
const avatars = computed(() => infos.value?.avatar ?? {})
const parts = [
'头肩',
'上衣',
@@ -31,8 +33,25 @@ export const useInfoStore = defineStore('infoStore', () => {
'辅助装备',
'戒指',
'耳环',
'魔法石',
'魔法石'
]
const avatarParts = [
'武器装扮',
'头发',
'帽子',
'脸部',
'光环',
'胸部',
'上衣',
'皮肤',
'腰带',
'下装',
'鞋',
'宠物',
'宠物装备-红',
'宠物装备-绿',
'宠物装备-蓝'
]
const createCharacter = async (alter: string, equVersion?: string) => {
@@ -51,6 +70,8 @@ export const useInfoStore = defineStore('infoStore', () => {
enchants,
emblems,
parts,
stones
stones,
avatarParts,
avatars,
}
})