This commit is contained in:
西瓜°
2026-04-19 15:47:44 +08:00
parent 97da529e35
commit dbf33477d9
12 changed files with 182 additions and 109 deletions
+6 -1
View File
@@ -1,4 +1,5 @@
from collections.abc import Mapping from collections.abc import Mapping
import sys
from typing import Any, Literal from typing import Any, Literal
from core.abstract.character import CharacterProperty from core.abstract.character import CharacterProperty
@@ -91,7 +92,7 @@ class CharacterBase(CharacterProperty):
# 唤醒的情况下的基础数据 # 唤醒的情况下的基础数据
self.AtkP = 0 + 65 self.AtkP = 0 + 65
self.AtkM = 0 + 65 self.AtkM = 0 + 65
self.AtkI = 1116 + 65 self.AtkI = 0 + 65
self.PAtkP = 1.0 self.PAtkP = 1.0
self.PAtkM = 1.0 self.PAtkM = 1.0
self.PAtkI = 1.0 self.PAtkI = 1.0
@@ -239,6 +240,10 @@ class CharacterBase(CharacterProperty):
], ],
) -> None: ) -> None:
"""设置角色属性""" """设置角色属性"""
# if kwargs.get('SkillAttack', 0) != 0:
# frame = sys._getframe(1) # 1 表示上一级调用帧
# caller_name = frame.f_code.co_name
# print(caller_name, kwargs.get('SkillAttack', 0))
self.STR += 力量 + kwargs.get('STR', 0) + 四维 + 力智 self.STR += 力量 + kwargs.get('STR', 0) + 四维 + 力智
self.INT += 智力 + kwargs.get('INT', 0) + 四维 + 力智 self.INT += 智力 + kwargs.get('INT', 0) + 四维 + 力智
self.Spirit += 精神 + kwargs.get('Spirit', 0) + 四维 + 体精 self.Spirit += 精神 + kwargs.get('Spirit', 0) + 四维 + 体精
+15 -8
View File
@@ -18,18 +18,25 @@ class CalcEquipMixin(CharacterBase):
self.charOathInfo = [] self.charOathInfo = []
self.charEmblemInfo = [] self.charEmblemInfo = []
self.bindAwake = info.get('bindAwake', 50) self.bindAwake = info.get('bindAwake', 50)
if info.get('emblems', None) is None:
info['emblems'] = {}
if info.get('oaths', None) is None:
info['oaths'] = {}
for key in info['equips']: for key in info['equips']:
self.charEquipInfo[key] = CharacterEquipInfo(info['equips'][key], self.equVersion, key) self.charEquipInfo[key] = CharacterEquipInfo(info['equips'][key], self.equVersion, key)
for key in info['oaths']: for key in info['oaths']:
# 导入誓约打造信息、誓约信息 # 导入誓约打造信息、誓约信息
self.charOathInfo.append(CharacterOathInfo(info['oaths'][key], self.equVersion, key)) self.charOathInfo.append(CharacterOathInfo(info['oaths'][key], self.equVersion, key))
# 异常处理 彩色等级自动取最小值 try:
minEmblemLv = min([info['emblems'][key]['lv'] for key in ['红色', '蓝色', '绿色', '黄色']], default=1) # 异常处理 彩色等级自动取最小值
info['emblems']['彩色']['lv'] = minEmblemLv minEmblemLv = min([info['emblems'][key]['lv'] for key in ['红色', '蓝色', '绿色', '黄色']], default=1)
for key in info['emblems']: info['emblems']['彩色']['lv'] = minEmblemLv
# 导入徽章打造信息、徽章信息 for key in info['emblems']:
info['emblems'][key]['part'] = key # 导入徽章打造信息、徽章信息
self.charEmblemInfo.append(CharacterEmblemInfo(info['emblems'][key])) info['emblems'][key]['part'] = key
self.charEmblemInfo.append(CharacterEmblemInfo(info['emblems'][key]))
pass
except Exception as e:
pass pass
self.charOathSkillId = info.get('oathSkill', 1) self.charOathSkillId = info.get('oathSkill', 1)
@@ -94,7 +101,7 @@ class CalcEquipMixin(CharacterBase):
max_point_oath_suit = max((suit for suit in oathSuitInfo if oathSuitInfo[suit]['point'] > 0), key=lambda suit: oathSuitInfo[suit]['point'], default=None) max_point_oath_suit = max((suit for suit in oathSuitInfo if oathSuitInfo[suit]['point'] > 0), key=lambda suit: oathSuitInfo[suit]['point'], default=None)
zero_point_suits = [suit for suit in suitInfo if suitInfo[suit]['point'] == 0] zero_point_suits = [suit for suit in suitInfo if suitInfo[suit]['point'] == 0]
# 套装没有到太初的时候,优先把誓约套装的点数加到装备套装上,以达到更高的套装等级 # 套装没有到太初的时候,优先把誓约套装的点数加到装备套装上,以达到更高的套装等级
if 0 < suitInfo[max_point_suit]['point'] < 2550: if 0 < suitInfo[max_point_suit]['point'] < 2550 and oathSuitInfo.get('max_point_oath_suit', None) is not None:
suitInfo[max_point_suit]['point'] += min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point']) suitInfo[max_point_suit]['point'] += min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point'])
oathSuitInfo[max_point_oath_suit]['point'] -= min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point']) oathSuitInfo[max_point_oath_suit]['point'] -= min(2550 - suitInfo[max_point_suit]['point'], oathSuitInfo[max_point_oath_suit]['point'])
pass pass
+8 -4
View File
@@ -51,18 +51,22 @@ class CharacterInfoMixin(CharacterBase):
equInfos = get_equipment(self.equVersion) equInfos = get_equipment(self.equVersion)
equs = [] equs = []
suits = [] suits = []
stones = [] oaths = []
# stones = []
for i in equInfos.equs: for i in equInfos.equs:
if i.itemType == '武器' and i.itemDetailType not in self.武器选项: if i.itemType == '武器' and i.itemDetailType not in self.武器选项:
continue continue
equs.append(i.__dict__) equs.append(i.__dict__)
for i in equInfos.suits: for i in equInfos.suits:
suits.append(i.__dict__) suits.append(i.__dict__)
for i in equInfos.stones: for i in equInfos.oaths:
stones.append(i.__dict__) oaths.append(i.__dict__)
# for i in equInfos.stones:
# stones.append(i.__dict__)
info['oaths'] = oaths
info['equips'] = equs info['equips'] = equs
info['suits'] = suits info['suits'] = suits
info['stones'] = stones # info['stones'] = stones
key = '辅助' if self.buffer else '输出' key = '辅助' if self.buffer else '输出'
info['enchants'] = list(filter(lambda x: key in x['categorize'], equInfos.enchants)) info['enchants'] = list(filter(lambda x: key in x['categorize'], equInfos.enchants))
info['emblems'] = [i for i in equInfos.emblems] info['emblems'] = [i for i in equInfos.emblems]
+29 -27
View File
@@ -80,10 +80,10 @@ class Equipments:
self.equs: list[Equ] = [] self.equs: list[Equ] = []
self.oaths: list[Oath] = [] self.oaths: list[Oath] = []
self.oath_dict: dict[str, Oath] = {} self.oath_dict: dict[str, Oath] = {}
self.stones: list[Equ] = [] # self.stones: list[Equ] = []
self.funs = self.init_func() self.funs = self.init_func()
self.equ_dict: dict[str, Equ] = {} self.equ_dict: dict[str, Equ] = {}
self.stone_dict: dict[str, Equ] = {} # self.stone_dict: dict[str, Equ] = {}
self.jades = [] self.jades = []
self.enchants = [] self.enchants = []
self.emblems = [] self.emblems = []
@@ -94,7 +94,7 @@ class Equipments:
self.init_equs() self.init_equs()
self.init_suits() self.init_suits()
self.init_enchants() self.init_enchants()
self.init_stones() # self.init_stones()
self.init_emblem() self.init_emblem()
self.init_jades() self.init_jades()
self.init_oaths() self.init_oaths()
@@ -124,27 +124,27 @@ class Equipments:
self.equs.append(equ) self.equs.append(equ)
self.equ_dict[equ.id] = equ self.equ_dict[equ.id] = equ
def init_stones(self): # def init_stones(self):
"""从数据库中获取所有装备信息""" # """从数据库中获取所有装备信息"""
with Session(self.engine) as session: # with Session(self.engine) as session:
db_list = session.query(StoneData).all() # db_list = session.query(StoneData).all()
keys = [key for key in StoneData.__dict__.keys() if key[0].isupper()] + ['suit'] # keys = [key for key in StoneData.__dict__.keys() if key[0].isupper()] + ['suit']
for item in db_list: # for item in db_list:
max_adaptation = 0 # max_adaptation = 0
item.id = str(item.id) # item.id = str(item.id)
for attr in keys: # for attr in keys:
if attr == 'suit': # if attr == 'suit':
value = parse_to_number_list(getattr(item, attr), []) # value = parse_to_number_list(getattr(item, attr), [])
value = [str(int(i)) for i in value] # value = [str(int(i)) for i in value]
else: # else:
value = parse_to_number_list(getattr(item, attr)) # value = parse_to_number_list(getattr(item, attr))
max_adaptation = max(max_adaptation, len(value) - 1) # max_adaptation = max(max_adaptation, len(value) - 1)
setattr(item, attr, value) # setattr(item, attr, value)
stone_dict = {k: v for k, v in item.__dict__.items() if not k.startswith('_')} # stone_dict = {k: v for k, v in item.__dict__.items() if not k.startswith('_')}
stone_dict['max_adaptation'] = max_adaptation # stone_dict['max_adaptation'] = max_adaptation
stone = Equ(**stone_dict) # stone = Equ(**stone_dict)
self.stones.append(stone) # self.stones.append(stone)
self.stone_dict[stone.id] = stone # self.stone_dict[stone.id] = stone
def init_suits(self): def init_suits(self):
"""从数据库中获取所有套装信息""" """从数据库中获取所有套装信息"""
@@ -188,9 +188,9 @@ class Equipments:
db_list = session.query(EmblemData).all() db_list = session.query(EmblemData).all()
for item in db_list: for item in db_list:
emblem = {k: v for k, v in item.__dict__.items() if not k.startswith('_')} 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['position'] = [] if emblem['itemType'] is None else emblem['itemType'].split(',')
emblem['categorize'] = [] if emblem['categorize'] is None else emblem['categorize'].split(',') # emblem['categorize'] = [] if emblem['categorize'] is None else emblem['categorize'].split(',')
del emblem['itemType'] # del emblem['itemType']
self.emblems.append(emblem) self.emblems.append(emblem)
pass pass
pass pass
@@ -336,6 +336,8 @@ class Oath:
Buffer: list[float] | float Buffer: list[float] | float
wearUrl: list[str] wearUrl: list[str]
max_adaptation: int max_adaptation: int
itemType: str
itemDetailType: str
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
Binary file not shown.
+9 -4
View File
@@ -104,11 +104,12 @@ class EmblemData(Base):
__tablename__ = 'emblem' __tablename__ = 'emblem'
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
detail = Column(Text) rarityId = Column(Integer)
categorize = Column(Integer)
itemType = Column(Text)
fame = Column(Integer)
rarity = Column(Text) rarity = Column(Text)
typeId = Column(Integer)
type = Column(Text)
value = Column(Text)
fame = Column(Integer)
class JadeData(Base): class JadeData(Base):
@@ -135,6 +136,8 @@ class OathData(Base):
rarity = Column(Text) rarity = Column(Text)
position = Column(Text) position = Column(Text)
Point = Column(Integer) Point = Column(Integer)
itemType = Column(Text)
itemDetailType = Column(Text)
categorize = Column(Text) categorize = Column(Text)
imageUrl = Column(Text) imageUrl = Column(Text)
detail = Column(Text) detail = Column(Text)
@@ -165,6 +168,8 @@ class PrimerData(Base):
name = Column(Text) name = Column(Text)
rarity = Column(Text) rarity = Column(Text)
position = Column(Text) position = Column(Text)
itemType = Column(Text)
itemDetailType = Column(Text)
Point = Column(Integer) Point = Column(Integer)
categorize = Column(Text) categorize = Column(Text)
imageUrl = Column(Text) imageUrl = Column(Text)
+7 -1
View File
@@ -31,6 +31,7 @@ export interface ICharacterInfo {
stones: IEquipment[] stones: IEquipment[]
enchants: IEnchantingInfo[] enchants: IEnchantingInfo[]
emblems: IEnchantingInfo[] emblems: IEnchantingInfo[]
oaths: IEquipment[]
weapons: string[] weapons: string[]
subweapons: string[] subweapons: string[]
skills: ISkill[] skills: ISkill[]
@@ -73,6 +74,11 @@ export interface IEquipment {
bufferDetail: string bufferDetail: string
} }
export interface IOathInfo extends IEquipment {
position: string[]
wearUrl: string[]
}
export interface ISkill { export interface ISkill {
icon: string icon: string
name: string name: string
@@ -91,7 +97,7 @@ export interface ISkill {
desc: string desc: string
}[] }[]
uuid: string uuid: string
upType:'damage' |'heal' upType: 'damage' | 'heal'
} }
export interface ISuit { export interface ISuit {
@@ -16,9 +16,9 @@
{{ partName(part) }} {{ partName(part) }}
</template> </template>
</div> </div>
<div v-if="detail?.[part]?.fusion" class="pos-absolute" :style="fusionStyle(part)"> <!-- <div v-if="detail?.[part]?.fusion" class="pos-absolute" :style="fusionStyle(part)">
<EquipmentIcon :equipment="stones(detail[part].fusion)" /> <EquipmentIcon :equipment="oaths(detail[part].fusion)" />
</div> </div> -->
</template> </template>
<div <div
v-if="props.withSubWeapon" v-if="props.withSubWeapon"
@@ -69,7 +69,7 @@ const props = defineProps({
avatar: { avatar: {
type: String, type: String,
default: '', default: '',
} },
}) })
const partModelValue = useVModel(props, 'part') const partModelValue = useVModel(props, 'part')
const infoStore = useInfoStore() const infoStore = useInfoStore()
@@ -90,9 +90,9 @@ const equ = (id: string) => {
return infoStore.equips.find((e) => e.id == id) return infoStore.equips.find((e) => e.id == id)
} }
const stones = (id: string) => { // const oaths = (id: string) => {
return infoStore.stones.find((e) => e.id == id) // return infoStore.oaths.find((e) => e.id == id)
} // }
const infoStyle = (part: string) => { const infoStyle = (part: string) => {
let x = 10 let x = 10
@@ -117,30 +117,30 @@ const infoStyle = (part: string) => {
return style return style
} }
const fusionStyle = (part: string) => { // const fusionStyle = (part: string) => {
let x = 0 // let x = 0
let y = 15 // let y = 15
let index = infoStore.parts.findIndex((p) => p == part) // let index = infoStore.parts.findIndex((p) => p == part)
if (index >= 5 && index <= 12) { // if (index >= 5 && index <= 12) {
x += 179 // x += 179
index -= 5 // index -= 5
} // }
if (index == 13) { // if (index == 13) {
index = 5 // index = 5
} // }
x += (index % 2) * 39 // x += (index % 2) * 39
y += Math.floor(index / 2) * 34 // y += Math.floor(index / 2) * 34
return { // return {
left: `${x}px`, // left: `${x}px`,
top: `${y}px`, // top: `${y}px`,
zIndex: 7, // zIndex: 7,
transform: 'scale(0.6)', // transform: 'scale(0.6)',
} // }
} // }
const choosePart = (part: string) => { const choosePart = (part: string) => {
partModelValue.value = part partModelValue.value = part
} }
@@ -18,7 +18,7 @@
<Suit v-show="equTab === 0"></Suit> <Suit v-show="equTab === 0"></Suit>
<Universal v-show="equTab === 1"></Universal> <Universal v-show="equTab === 1"></Universal>
</calc-collapse> </calc-collapse>
<calc-collapse title="融合石"> <calc-collapse title="誓约">
<calc-tabs v-model="stoneTab" class="!mb-2"> <calc-tabs v-model="stoneTab" class="!mb-2">
<calc-tab :value="0">套装</calc-tab> <calc-tab :value="0">套装</calc-tab>
<calc-tab :value="1">通宝</calc-tab> <calc-tab :value="1">通宝</calc-tab>
@@ -15,10 +15,10 @@
<div class="w-auto text-18px flex items-center justify-center !font-normal">|</div> <div class="w-auto text-18px flex items-center justify-center !font-normal">|</div>
<div <div
class="flex-1 text-15px flex items-center justify-center" class="flex-1 text-15px flex items-center justify-center"
@click="chooseCategory('stone')" @click="chooseCategory('oath')"
:class="{ active: type === 'stone' }" :class="{ active: type === 'oath' }"
> >
融合石 誓约
</div> </div>
</div> </div>
<div <div
@@ -126,11 +126,11 @@ import PartSelect from '@/components/dnf/Equipment/PartSelect/index.vue'
import EquipmentRaritySelect from '@/components/dnf/Equipment/RaritySelect/index.vue' import EquipmentRaritySelect from '@/components/dnf/Equipment/RaritySelect/index.vue'
import { getImageURL } from '@/utils/images' import { getImageURL } from '@/utils/images'
import { rarityClass } from '@/utils' import { rarityClass } from '@/utils'
import type { IEquipment } from '@/api/info/type' import type { IEquipment, IOathInfo } from '@/api/info/type'
import EquipmentIcon from '@/components/dnf/Equipment/Icon/index.vue' import EquipmentIcon from '@/components/dnf/Equipment/Icon/index.vue'
import Info from '@/components/dnf/Equipment/Info/index.vue' import Info from '@/components/dnf/Equipment/Info/index.vue'
import SuitInfo from '@/components/dnf/Equipment/SuitInfo/index.vue' import SuitInfo from '@/components/dnf/Equipment/SuitInfo/index.vue'
import { formatEqu, formatStone } from './formatData' import { formatEqu, formatOath } from './formatData'
import options from './components/options.vue' import options from './components/options.vue'
// const props = defineProps<{ // const props = defineProps<{
@@ -197,7 +197,7 @@ const curEquInfo = computed(() => {
if (type.value == 'equ') { if (type.value == 'equ') {
return infoStore.equips.find((a) => a.id == curEquId.value) return infoStore.equips.find((a) => a.id == curEquId.value)
} else { } else {
return infoStore.stones.find((a) => a.id == curEquId.value) return infoStore.oaths.find((a) => a.id == curEquId.value)
} }
}) })
@@ -215,7 +215,7 @@ const curSuitInfo = computed(() => {
const chooseCategory = (cat: string) => { const chooseCategory = (cat: string) => {
type.value = cat type.value = cat
if (type.value == 'stone' && curSuit.value == -1) { if (type.value == 'oath' && curSuit.value == -1) {
curSuit.value = 16203 curSuit.value = 16203
} }
} }
@@ -240,14 +240,14 @@ const suitList = computed(() => {
const equs = computed(() => { const equs = computed(() => {
// 筛选出装备 // 筛选出装备
const total = (type.value == 'equ' ? infoStore.equips : infoStore.stones).filter( const total = (type.value == 'equ' ? infoStore.equips : infoStore.oaths).filter(
(a) => (a) =>
(!curRarity.value || a.rarity === curRarity.value) && (!curRarity.value || a.rarity === curRarity.value) &&
(choose_part.value.length === 0 || (choose_part.value.length === 0 ||
choose_part.value.includes(a.itemDetailType || a.itemType)) && choose_part.value.includes(a.itemDetailType || a.itemType)) &&
(a.suit.length == 0 || (a.suit.length == 0 ||
(curSuit.value == -1 && a.suit.length > 1 && type.value == 'equ') || (curSuit.value == -1 && a.suit.length > 1 && type.value == 'equ') ||
(a.suit.length > 1 && type.value == 'stone') || (a.suit.length > 1 && type.value == 'oath') ||
(a.suit.includes(curSuit.value.toString()) && a.suit.length === 1)), (a.suit.includes(curSuit.value.toString()) && a.suit.length === 1)),
) )
@@ -258,7 +258,10 @@ const equs = computed(() => {
suitList.value.find((a) => a.value == curSuit.value)?.name, suitList.value.find((a) => a.value == curSuit.value)?.name,
) )
} else { } else {
return formatStone(total, suitList.value.find((a) => a.value == curSuit.value)?.name) return formatOath(
total as unknown as IOathInfo[],
suitList.value.find((a) => a.value == curSuit.value),
)
} }
}) })
@@ -272,7 +275,7 @@ const isActive = computed(() => {
return configStore.config.equips[item.itemDetailType].id == item.id return configStore.config.equips[item.itemDetailType].id == item.id
} }
} else { } else {
return configStore.config.equips[item.itemDetailType].fusion == item.id // return configStore.config.equips[item.itemDetailType].fusion == item.id
} }
} }
}) })
@@ -1,4 +1,4 @@
import type { IEquipment } from '@/api/info/type' import type { IEquipment, IOathInfo } from '@/api/info/type'
export const rowCount = 10 export const rowCount = 10
@@ -7,23 +7,25 @@ export const formatEqu = (total: IEquipment[], subweapons?: string[], curSuit?:
const item_weapon = total.filter((a) => a.itemType == '武器') ?? [] const item_weapon = total.filter((a) => a.itemType == '武器') ?? []
const weapons: (IEquipment | undefined)[] = [] const weapons: (IEquipment | undefined)[] = []
if (item_weapon.length > 0) { if (item_weapon.length > 0) {
Array.from(new Set(item_weapon.map((item) => item.rarity))).filter(a=>!['稀有','神器'].includes(a)).forEach((rarity) => { Array.from(new Set(item_weapon.map((item) => item.rarity)))
const weapon = item_weapon .filter((a) => !['稀有', '神器'].includes(a))
.filter((item) => item.rarity === rarity) .forEach((rarity) => {
.sort((a, b) => { const weapon = item_weapon
if (a.categorize == b.categorize) { .filter((item) => item.rarity === rarity)
return a.itemDetailType.localeCompare(b.itemDetailType) .sort((a, b) => {
} if (a.categorize == b.categorize) {
return b.categorize.localeCompare(a.categorize) return a.itemDetailType.localeCompare(b.itemDetailType)
}) }
weapons.push( return b.categorize.localeCompare(a.categorize)
...weapon.filter((a) => !['传世武器升级', '狄瑞吉传世武器'].includes(a.categorize)), })
) weapons.push(
const remind = weapons.length % rowCount ...weapon.filter((a) => !['传世武器升级', '狄瑞吉传世武器'].includes(a.categorize)),
if (remind > 0) { )
weapons.push(...Array(rowCount - remind).fill(undefined)) const remind = weapons.length % rowCount
} if (remind > 0) {
}) weapons.push(...Array(rowCount - remind).fill(undefined))
}
})
if (item_weapon.some((a) => a.categorize === '传世武器升级')) { if (item_weapon.some((a) => a.categorize === '传世武器升级')) {
const length = item_weapon.filter((a) => a.categorize === '传世武器升级').length const length = item_weapon.filter((a) => a.categorize === '传世武器升级').length
weapons.push(...Array(length).fill(undefined)) weapons.push(...Array(length).fill(undefined))
@@ -88,9 +90,13 @@ export const formatEqu = (total: IEquipment[], subweapons?: string[], curSuit?:
(equip) => equip.categorize.includes('套装') || equip.categorize.includes('通宝'), (equip) => equip.categorize.includes('套装') || equip.categorize.includes('通宝'),
) )
const suits: (IEquipment | undefined)[] = [] const suits: (IEquipment | undefined)[] = []
const raritiyList = Array.from(new Set(item_suits.map((item) => item.rarity))).filter(a=>!['稀有','神器'].includes(a)) const raritiyList = Array.from(new Set(item_suits.map((item) => item.rarity))).filter(
(a) => !['稀有', '神器'].includes(a),
)
raritiyList.forEach((rarity) => { raritiyList.forEach((rarity) => {
const armor = item_suits.filter((item) => item.rarity === rarity && item.itemType === '防具' && !item.name.includes("侵蚀")) const armor = item_suits.filter(
(item) => item.rarity === rarity && item.itemType === '防具' && !item.name.includes('侵蚀'),
)
if (armor.length > 0) { if (armor.length > 0) {
suits.push(...armor, undefined) suits.push(...armor, undefined)
} }
@@ -119,7 +125,9 @@ export const formatEqu = (total: IEquipment[], subweapons?: string[], curSuit?:
suits.push(...Array(rowCount - (suits.length % rowCount)).fill(undefined)) suits.push(...Array(rowCount - (suits.length % rowCount)).fill(undefined))
} }
const armorUpgrade = item_suits.filter((item) => item.rarity === rarity && item.itemType === '防具' && item.name.includes("侵蚀")) const armorUpgrade = item_suits.filter(
(item) => item.rarity === rarity && item.itemType === '防具' && item.name.includes('侵蚀'),
)
if (armorUpgrade.length > 0) { if (armorUpgrade.length > 0) {
suits.push(...armorUpgrade) suits.push(...armorUpgrade)
} }
@@ -283,3 +291,32 @@ export const formatStone = (total: IEquipment[], curSuit?: string) => {
// }, // },
] ]
} }
export const formatOath = (
total: IOathInfo[],
curSuit?: { name: string; value: number; imageUrl: string },
) => {
// oath
const oath = total.filter((equip) => equip.itemDetailType == '誓约')
oath.push(...Array(rowCount - (oath.length % rowCount)).fill(undefined))
// primer
const primer = []
const primerItem = total.filter((equip) => equip.itemDetailType == '星蕴石')
for (let i = 0; i < 11; i++) {
const temp = primerItem.filter((a) => a.position.includes(i.toString()))
primer.push(
...temp,
...Array(temp.length == 0 ? rowCount : rowCount - (temp.length % rowCount)).fill(undefined),
)
}
return [
{
name: `${curSuit?.name} 誓约`,
equs: oath,
},
{
name: `${curSuit?.name} 星蕴石`,
equs: primer,
},
]
}
+8 -4
View File
@@ -18,7 +18,7 @@ export const useInfoStore = defineStore('infoStore', () => {
const emblems = computed(() => infos.value?.emblems ?? []) const emblems = computed(() => infos.value?.emblems ?? [])
const stones = computed(() => infos.value?.stones ?? []) // const stones = computed(() => infos.value?.stones ?? [])
const avatars = computed(() => infos.value?.avatar ?? {}) const avatars = computed(() => infos.value?.avatar ?? {})
@@ -28,6 +28,8 @@ export const useInfoStore = defineStore('infoStore', () => {
const options = computed(() => infos.value?.options ?? []) const options = computed(() => infos.value?.options ?? [])
const oaths = computed(() => infos.value?.oaths ?? [])
const standardUUID = ref<string>() const standardUUID = ref<string>()
const setStandard = ( const setStandard = (
@@ -39,7 +41,9 @@ export const useInfoStore = defineStore('infoStore', () => {
}[], }[],
) => { ) => {
if (!result) { if (!result) {
!!standardUUID.value && sessionStorage.removeItem(standardUUID.value) if (!!standardUUID.value) {
sessionStorage.removeItem(standardUUID.value)
}
standardUUID.value = undefined standardUUID.value = undefined
} else { } else {
standardUUID.value = result.uuid standardUUID.value = result.uuid
@@ -106,13 +110,13 @@ export const useInfoStore = defineStore('infoStore', () => {
enchants, enchants,
emblems, emblems,
parts, parts,
stones, oaths,
avatarParts, avatarParts,
avatars, avatars,
jades, jades,
setStandard, setStandard,
standard, standard,
sundries, sundries,
options options,
} }
}) })