附魔导入 装备基础信息导入

This commit is contained in:
2025-04-01 10:26:32 +08:00
parent c86abe329e
commit cd0bc1da73
10 changed files with 81 additions and 49 deletions
+4 -3
View File
@@ -400,15 +400,16 @@ class Character:
} }
) )
info['skills'] = skillInfo info['skills'] = skillInfo
equInfos = get_equipment(self.equVersion)
equs = [] equs = []
suits = [] suits = []
for i in get_equipment(self.equVersion).equs: for i in equInfos.equs:
equs.append(i.__dict__) equs.append(i.__dict__)
for i in get_equipment(self.equVersion).suits: for i in equInfos.suits:
suits.append(i.__dict__) suits.append(i.__dict__)
info['equips'] = equs info['equips'] = equs
info['suits'] = suits info['suits'] = suits
enchats = [] info['enchants'] = equInfos.enchants
emblems = [] emblems = []
return info return info
+16 -2
View File
@@ -1,5 +1,5 @@
import importlib import importlib
from database.models import Session, EquData, SuitData from database.models import Session, EquData, SuitData, EnchantData
from database.connect import get_db_engine as get_engine from database.connect import get_db_engine as get_engine
from functools import cache from functools import cache
@@ -7,7 +7,6 @@ from functools import cache
def parse_to_number_list(info: str, default: list[float] = [0]) -> list[float]: def parse_to_number_list(info: str, default: list[float] = [0]) -> list[float]:
return default if not info else [float(i) for i in info.split(',')] return default if not info else [float(i) for i in info.split(',')]
class Equ: class Equ:
id: str id: str
name: str name: str
@@ -73,10 +72,12 @@ class Equipments:
self.equs: list[Equ] = [] self.equs: 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.enchants = []
self.suits: list[Suit] = [] self.suits: list[Suit] = []
self.suit_dict: dict[str, Suit] = {} self.suit_dict: dict[str, Suit] = {}
self.init_equs() self.init_equs()
self.init_suits() self.init_suits()
self.init_enchants()
self.engine.dispose() self.engine.dispose()
def init_equs(self): def init_equs(self):
@@ -111,6 +112,19 @@ class Equipments:
self.suit_dict.setdefault(str(suit.suitId), []).append(suit) self.suit_dict.setdefault(str(suit.suitId), []).append(suit)
pass pass
def init_enchants(self):
"""从数据库中获取所有附魔信息"""
with Session(self.engine) as session:
db_list = session.query(EnchantData).all()
for item in db_list:
enchant = {k: v for k, v in item.__dict__.items() if not k.startswith('_')}
enchant['position'] = [] if enchant['itemType'] is None else enchant['itemType'].split(',')
enchant['categorize'] = [] if enchant['categorize'] is None else enchant['categorize'].split(',')
del enchant['itemType']
self.enchants.append(enchant)
pass
pass
def init_func(self): def init_func(self):
"""根据装备版本加载装备效果""" """根据装备版本加载装备效果"""
try: try:
@@ -312,7 +312,7 @@ class Skill18(ActiveSkill):
cube = 3 cube = 3
cd = 30 cd = 30
mp = [800, 1680] mp = [800, 1680]
icon = '$char/超真空弹:切利.png' icon = '$char/超真空弹:切利'
data0 = [0, 246, 272, 296, 320, 347, 372, 396, 420, 447, 473, 497, 521, 546, 573, 597, 623, 647, 671, 698, 723, 747, 771, 798, 824, 848, 872, 897, 924, 948, 972, 998, 1022, 1049, 1074, 1098, 1122, 1148, 1175, 1199, 1223, 1248, 1275, 1299, 1323, 1349, 1373, 1400, 1424, 1449, 1473]# noqa: E501 data0 = [0, 246, 272, 296, 320, 347, 372, 396, 420, 447, 473, 497, 521, 546, 573, 597, 623, 647, 671, 698, 723, 747, 771, 798, 824, 848, 872, 897, 924, 948, 972, 998, 1022, 1049, 1074, 1098, 1122, 1148, 1175, 1199, 1223, 1248, 1275, 1299, 1323, 1349, 1373, 1400, 1424, 1449, 1473]# noqa: E501
hit0 = 20 hit0 = 20
Binary file not shown.
+9
View File
@@ -55,3 +55,12 @@ class EquData(Base):
Attack = Column(Text) Attack = Column(Text)
Buffer = Column(Text) Buffer = Column(Text)
suit = Column(Text) suit = Column(Text)
class EnchantData(Base):
__tablename__ = 'enchant'
id = Column(Integer, primary_key=True)
detail = Column(Text)
categorize = Column(Integer)
itemType = Column(Text)
fame = Column(Integer)
+6 -6
View File
@@ -26,7 +26,7 @@ export interface ICharacterInfo {
name: string name: string
equVersion: string equVersion: string
equips: IEquipment[] equips: IEquipment[]
enchantings: IEnchantingInfo[] enchants: IEnchantingInfo[]
emblems: IEnchantingInfo[] emblems: IEnchantingInfo[]
weapons: string[] weapons: string[]
skills: ISkill[] skills: ISkill[]
@@ -65,10 +65,10 @@ export interface ISuit {
export interface IEnchantingInfo { export interface IEnchantingInfo {
id: string | number id: string | number
maxFame: number | undefined fame: number | undefined
position: string[] position: string[]
props: string detail: string
type: string | undefined categorize: string[]
rarity: string | undefined rarity?: string
rate: number type?: string
} }
@@ -30,14 +30,14 @@ export default defineComponent({
const basicInfoStore = useInfoStore() const basicInfoStore = useInfoStore()
const enchanting_list = computed<IEnchantingInfo[] | undefined>(() => { const enchanting_list = computed<IEnchantingInfo[] | undefined>(() => {
return basicInfoStore.enchantings return basicInfoStore.enchants
?.filter( ?.filter(
(item) => (item) =>
item.position.includes(props.part) && item.position.includes(props.part) &&
!item.position.includes('武器装扮') && !item.position.includes('武器装扮') &&
!item.position.includes('宠物装备'), !item.position.includes('宠物装备'),
) )
.sort((a, b) => b.rate - a.rate) .sort((a, b) => (b.fame ?? 0) - (a.fame ?? 0))
}) })
const emblem_list = computed<IEnchantingInfo[] | undefined>(() => { const emblem_list = computed<IEnchantingInfo[] | undefined>(() => {
@@ -68,7 +68,7 @@ export default defineComponent({
if (global_change.value) { if (global_change.value) {
if (name === 'enchanting') { if (name === 'enchanting') {
const enchant = basicInfoStore?.enchantings?.find((item) => item.id == val) as const enchant = basicInfoStore?.enchants?.find((item) => item.id == val) as
| IEnchantingInfo | IEnchantingInfo
| undefined | undefined
if (enchant?.position) { if (enchant?.position) {
@@ -177,7 +177,7 @@ export default defineComponent({
<calc-select v-model={enchanting.value} class="flex-1 !h-20px"> <calc-select v-model={enchanting.value} class="flex-1 !h-20px">
<calc-option value={0}>无</calc-option> <calc-option value={0}>无</calc-option>
{renderList(enchanting_list.value ?? [], (item) => ( {renderList(enchanting_list.value ?? [], (item) => (
<calc-option value={item.id}>{item.props}</calc-option> <calc-option value={item.id}>{item.detail}</calc-option>
))} ))}
</calc-select> </calc-select>
</div> </div>
@@ -193,7 +193,7 @@ export default defineComponent({
{renderList(emblem_list.value ?? [], (item) => ( {renderList(emblem_list.value ?? [], (item) => (
<calc-option <calc-option
value={item.id} value={item.id}
>{`${item.rarity}${item.type}徽章[${item.props}]`}</calc-option> >{`${item.rarity}${item.type}徽章[${item.detail}]`}</calc-option>
))} ))}
</calc-select> </calc-select>
{has_emblem_1.value && ( {has_emblem_1.value && (
@@ -202,7 +202,7 @@ export default defineComponent({
{renderList(emblem_list.value ?? [], (item) => ( {renderList(emblem_list.value ?? [], (item) => (
<calc-option <calc-option
value={item.id} value={item.id}
>{`${item.rarity}${item.type}徽章[${item.props}]`}</calc-option> >{`${item.rarity}${item.type}徽章[${item.detail}]`}</calc-option>
))} ))}
</calc-select> </calc-select>
)} )}
@@ -71,7 +71,12 @@ export default defineComponent({
} }
} }
const renderSkill = (skill: ISkill, index: number) => ( const renderSkill = (skill: ISkill, index: number) => {
const info = lvInfo.value?.[skill.id.toString()]
let color = 'white'
if (info?.lv < skill.maxLearnLv) color = '#32E432'
if (info?.lv > skill.maxLearnLv) color = '#58E0FC'
return (
<> <>
<div class="relative w-35px h-55px"> <div class="relative w-35px h-55px">
{activeSkill.value == skill.id && renderSkillAction(skill)} {activeSkill.value == skill.id && renderSkillAction(skill)}
@@ -92,13 +97,15 @@ export default defineComponent({
class={['h-30px w-30px', skill.type === 'passive' ? 'passive' : '']} class={['h-30px w-30px', skill.type === 'passive' ? 'passive' : '']}
src={getImageURL(skill.icon)} src={getImageURL(skill.icon)}
></img> ></img>
<div class="w-30px mx-2px bg-black text-white flex items-center justify-center rounded-2px"> <div class="w-30px mx-2px bg-black flex items-center justify-center rounded-2px"
{lvInfo.value?.[skill.id.toString()]?.lv ?? 0} style={{color}}>
{info?.lv ?? 0}
</div> </div>
</div> </div>
</div> </div>
</> </>
) )
}
const renderSkillAction = (skill: ISkill) => ( const renderSkillAction = (skill: ISkill) => (
<> <>
@@ -156,7 +163,8 @@ export default defineComponent({
{lvList.map((lv, index) => ( {lvList.map((lv, index) => (
<div class="skill-tree-line flex items-center gap-10px px-10px" key={index}> <div class="skill-tree-line flex items-center gap-10px px-10px" key={index}>
{lv == 1 || lv % 10 == 0 ? ( {lv == 1 || lv % 10 == 0 ? (
<div class="w-34px h-34px flex items-center justify-center text-white">{lv}</div> <div class="w-34px h-34px flex items-center justify-center text-white"
>{lv}</div>
) : ( ) : (
<div class="w-34px h-34px"></div> <div class="w-34px h-34px"></div>
)} )}
+2 -2
View File
@@ -21,7 +21,7 @@ export interface IConfig {
id: string id: string
reinforce: number reinforce: number
reinforceType: number reinforceType: number
enchat: number enchant: number
emblem_0: string emblem_0: string
emblem_1: string emblem_1: string
upgrade: number upgrade: number
@@ -36,7 +36,7 @@ const defaultEqusConfig = {
id: '', id: '',
reinforce: 0, reinforce: 0,
reinforceType: 0, reinforceType: 0,
enchat: 0, enchant: 0,
emblem_0: "0", emblem_0: "0",
emblem_1: "0", emblem_1: "0",
upgrade: 0, upgrade: 0,
+2 -2
View File
@@ -13,7 +13,7 @@ export const useInfoStore = defineStore("infoStore", ()=>{
const suits = computed(()=>infos.value?.suits ?? []) const suits = computed(()=>infos.value?.suits ?? [])
const enchantings = computed(()=>infos.value?.enchantings?? []) const enchants = computed(()=>infos.value?.enchants ?? [])
const emblems = computed(()=>infos.value?.emblems?? []) const emblems = computed(()=>infos.value?.emblems?? [])
@@ -32,7 +32,7 @@ export const useInfoStore = defineStore("infoStore", ()=>{
equips, equips,
suits, suits,
createCharacter, createCharacter,
enchantings, enchants,
emblems, emblems,
parts parts
} }