253 lines
8.7 KiB
Vue
253 lines
8.7 KiB
Vue
<script lang="tsx">
|
|
import { computed, defineComponent, ref } from 'vue'
|
|
import type { IEnchantingInfo } from '@/api/info/type'
|
|
import { useInfoStore, useConfigStore } from '@/stores'
|
|
import EquList from '@/components/dnf/Equipment/List/index.vue'
|
|
import { UiCheckbox } from '@/components/ui/checkbox'
|
|
import ForgeSelect, { type ForgeSelectOption } from './ForgeSelect.vue'
|
|
import ForgeSlider from './ForgeSlider.vue'
|
|
export default defineComponent({
|
|
name: 'Equip',
|
|
setup() {
|
|
const configStore = useConfigStore()
|
|
const part = ref('头肩')
|
|
const can_upgrade = computed(() => {
|
|
return !['称号', '宠物'].includes(part.value as string)
|
|
})
|
|
|
|
// const globalStore = useGlobalStore()
|
|
|
|
/** 是否可以设置秘宝精度 */
|
|
const can_set_secret = computed(() => {
|
|
return ['武器', '辅助装备', '魔法石', '耳环'].includes(part.value as string)
|
|
})
|
|
const basicInfoStore = useInfoStore()
|
|
|
|
const enchant_list = computed<IEnchantingInfo[] | undefined>(() => {
|
|
return basicInfoStore.enchants
|
|
?.filter(
|
|
(item) =>
|
|
item.position.includes(part.value) &&
|
|
!item.position.includes('武器装扮') &&
|
|
!item.position.includes('宠物装备'),
|
|
)
|
|
.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 global_change = ref(false)
|
|
|
|
const currentInfo = function <T>(name: string, defaultValue?: T) {
|
|
return computed<string | number>({
|
|
get() {
|
|
return (
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(configStore.config.equips?.[part.value] as Record<string, any>)?.[name] ??
|
|
defaultValue ??
|
|
0
|
|
)
|
|
},
|
|
set(val) {
|
|
if (val == undefined && name !== 'weaponFusion') {
|
|
return
|
|
}
|
|
// if (name == 'emblem_1' && !has_emblem_1.value) {
|
|
// // configStore.setForge(part.value, name, 0)
|
|
// return
|
|
// }
|
|
|
|
let parts: string[] = []
|
|
|
|
if (global_change.value && name !== 'weaponFusion') {
|
|
if (name === 'enchant') {
|
|
const enchant = basicInfoStore?.enchants?.find((item) => item.id == val) as
|
|
| IEnchantingInfo
|
|
| undefined
|
|
if (enchant?.position) {
|
|
parts = enchant.position
|
|
}
|
|
}
|
|
// if (['emblem_0', 'emblem_1'].includes(name)) {
|
|
// const emblem = basicInfoStore?.emblems?.find(
|
|
// (item) => item.id.toString() == val.toString(),
|
|
// ) as IEnchantingInfo | undefined
|
|
// if (emblem?.position) {
|
|
// parts = emblem.position.filter(
|
|
// (item) => !['皮肤', '武器装扮', '光环'].includes(item),
|
|
// )
|
|
// }
|
|
// }
|
|
if (['reinforceType', 'reinforce', 'adaptation'].includes(name)) {
|
|
parts = basicInfoStore.parts.filter((e) => !['称号', '宠物'].includes(e))
|
|
}
|
|
} else {
|
|
parts = [part.value]
|
|
}
|
|
for (const part of parts) {
|
|
if (!configStore.config.equips[part]) {
|
|
configStore.config.equips[part] = { ...configStore.defaultEqusConfig }
|
|
}
|
|
if (configStore.config.equips[part]) {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
;(configStore.config.equips[part] as Record<string, any>)[name] = val
|
|
}
|
|
}
|
|
},
|
|
})
|
|
}
|
|
|
|
// 附魔
|
|
const enchant = currentInfo<string | number>('enchant')
|
|
|
|
// // 镶嵌栏1
|
|
// const emblem_0 = currentInfo<string | number>('emblem_0', 0)
|
|
|
|
// // 镶嵌栏2
|
|
// const emblem_1 = currentInfo<string | number>('emblem_1')
|
|
|
|
// 增幅
|
|
const reinforce_type = currentInfo<string | number>('reinforceType', 1)
|
|
|
|
// 增幅数值
|
|
const reinforce = currentInfo<string | number>('reinforce')
|
|
|
|
// 锻造数值
|
|
const refine = currentInfo<string | number>('refine')
|
|
|
|
// 调适
|
|
const adaptation = currentInfo<string | number>('adaptation')
|
|
|
|
//精度
|
|
const precision = currentInfo<number>('precision', 0)
|
|
|
|
const reinforceTypeOptions: ForgeSelectOption[] = [
|
|
{ label: '强化', value: 0 },
|
|
{ label: '增幅', value: 1 },
|
|
]
|
|
const reinforceOptions: ForgeSelectOption[] = Array.from({ length: 31 }, (_, value) => ({
|
|
label: String(value),
|
|
value,
|
|
}))
|
|
const refineOptions: ForgeSelectOption[] = Array.from({ length: 9 }, (_, value) => ({
|
|
label: `锻造+ ${value}`,
|
|
value,
|
|
}))
|
|
const adaptationOptions: ForgeSelectOption[] = Array.from({ length: 4 }, (_, value) => ({
|
|
label: String(value),
|
|
value,
|
|
}))
|
|
const enchantOptions = computed<ForgeSelectOption[]>(() => [
|
|
{ label: '无', value: '' },
|
|
...(enchant_list.value ?? []).map((item) => ({ label: item.detail, value: item.id })),
|
|
])
|
|
|
|
// 武器融合
|
|
return () => {
|
|
return (
|
|
<>
|
|
<div class="forge-preview">
|
|
<EquList
|
|
v-model:part={part.value}
|
|
withBg={false}
|
|
withPet={false}
|
|
with-sub-weapon={useInfoStore().infos?.alter.includes('vegabond')}
|
|
/>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap equ-profile">
|
|
<div class="equ-profile-item">
|
|
<div class="row-name">当前部位</div>
|
|
<span> {part.value}</span>
|
|
{can_upgrade.value ? (
|
|
<label class="forge-checkbox" style="margin-left:auto">
|
|
<UiCheckbox v-model={global_change.value} aria-label="全局修改" />
|
|
<span>全局修改</span>
|
|
</label>
|
|
) : null}
|
|
</div>
|
|
{part.value == '副武器' ? (
|
|
<div class="equ-profile-item">
|
|
<div class="row-name">增幅</div>
|
|
<ForgeSelect
|
|
v-model={reinforce_type.value}
|
|
label="副武器强化类型"
|
|
options={reinforceTypeOptions}
|
|
/>
|
|
<ForgeSelect
|
|
v-model={reinforce.value}
|
|
label="副武器强化等级"
|
|
options={reinforceOptions}
|
|
/>
|
|
</div>
|
|
) : (
|
|
<>
|
|
{can_upgrade.value ? (
|
|
<div class="equ-profile-item">
|
|
<div class="row-name">增幅</div>
|
|
<ForgeSelect
|
|
v-model={reinforce_type.value}
|
|
label={`${part.value}强化类型`}
|
|
options={reinforceTypeOptions}
|
|
/>
|
|
<ForgeSelect
|
|
v-model={reinforce.value}
|
|
label={`${part.value}强化等级`}
|
|
options={reinforceOptions}
|
|
/>
|
|
{part.value == '武器' && (
|
|
<ForgeSelect
|
|
v-model={refine.value}
|
|
label="武器锻造等级"
|
|
options={refineOptions}
|
|
/>
|
|
)}
|
|
</div>
|
|
) : null}
|
|
|
|
<div class="equ-profile-item">
|
|
<div class="row-name">附魔</div>
|
|
<ForgeSelect
|
|
v-model={enchant.value}
|
|
label={`${part.value}附魔`}
|
|
options={enchantOptions.value}
|
|
/>
|
|
</div>
|
|
|
|
{can_upgrade.value ? (
|
|
<div class="equ-profile-item">
|
|
<div class="row-name">调适</div>
|
|
<ForgeSelect
|
|
v-model={adaptation.value}
|
|
label={`${part.value}调适`}
|
|
options={adaptationOptions}
|
|
/>
|
|
</div>
|
|
) : null}
|
|
{can_set_secret.value ? (
|
|
<div class="equ-profile-item">
|
|
<div class="row-name">精度</div>
|
|
<ForgeSlider
|
|
modelValue={precision.value}
|
|
onUpdate:modelValue={(value) => (precision.value = value)}
|
|
label={`${part.value}秘宝精度`}
|
|
min={0}
|
|
max={100}
|
|
step={1}
|
|
/>
|
|
</div>
|
|
) : null}
|
|
</>
|
|
)}
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
},
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss"></style>
|