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

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
equInfos = get_equipment(self.equVersion)
equs = []
suits = []
for i in get_equipment(self.equVersion).equs:
for i in equInfos.equs:
equs.append(i.__dict__)
for i in get_equipment(self.equVersion).suits:
for i in equInfos.suits:
suits.append(i.__dict__)
info['equips'] = equs
info['suits'] = suits
enchats = []
info['enchants'] = equInfos.enchants
emblems = []
return info
+16 -2
View File
@@ -1,5 +1,5 @@
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 functools import cache
@@ -7,7 +7,6 @@ from functools import cache
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(',')]
class Equ:
id: str
name: str
@@ -73,10 +72,12 @@ class Equipments:
self.equs: list[Equ] = []
self.funs = self.init_func()
self.equ_dict: dict[str, Equ] = {}
self.enchants = []
self.suits: list[Suit] = []
self.suit_dict: dict[str, Suit] = {}
self.init_equs()
self.init_suits()
self.init_enchants()
self.engine.dispose()
def init_equs(self):
@@ -111,6 +112,19 @@ class Equipments:
self.suit_dict.setdefault(str(suit.suitId), []).append(suit)
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):
"""根据装备版本加载装备效果"""
try:
@@ -312,7 +312,7 @@ class Skill18(ActiveSkill):
cube = 3
cd = 30
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
hit0 = 20
Binary file not shown.
+9
View File
@@ -55,3 +55,12 @@ class EquData(Base):
Attack = Column(Text)
Buffer = 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
equVersion: string
equips: IEquipment[]
enchantings: IEnchantingInfo[]
enchants: IEnchantingInfo[]
emblems: IEnchantingInfo[]
weapons: string[]
skills: ISkill[]
@@ -65,10 +65,10 @@ export interface ISuit {
export interface IEnchantingInfo {
id: string | number
maxFame: number | undefined
fame: number | undefined
position: string[]
props: string
type: string | undefined
rarity: string | undefined
rate: number
detail: string
categorize: string[]
rarity?: string
type?: string
}
@@ -30,14 +30,14 @@ export default defineComponent({
const basicInfoStore = useInfoStore()
const enchanting_list = computed<IEnchantingInfo[] | undefined>(() => {
return basicInfoStore.enchantings
return basicInfoStore.enchants
?.filter(
(item) =>
item.position.includes(props.part) &&
!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>(() => {
@@ -68,7 +68,7 @@ export default defineComponent({
if (global_change.value) {
if (name === 'enchanting') {
const enchant = basicInfoStore?.enchantings?.find((item) => item.id == val) as
const enchant = basicInfoStore?.enchants?.find((item) => item.id == val) as
| IEnchantingInfo
| undefined
if (enchant?.position) {
@@ -177,7 +177,7 @@ export default defineComponent({
<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.props}</calc-option>
<calc-option value={item.id}>{item.detail}</calc-option>
))}
</calc-select>
</div>
@@ -193,7 +193,7 @@ export default defineComponent({
{renderList(emblem_list.value ?? [], (item) => (
<calc-option
value={item.id}
>{`${item.rarity}${item.type}徽章[${item.props}]`}</calc-option>
>{`${item.rarity}${item.type}徽章[${item.detail}]`}</calc-option>
))}
</calc-select>
{has_emblem_1.value && (
@@ -202,7 +202,7 @@ export default defineComponent({
{renderList(emblem_list.value ?? [], (item) => (
<calc-option
value={item.id}
>{`${item.rarity}${item.type}徽章[${item.props}]`}</calc-option>
>{`${item.rarity}${item.type}徽章[${item.detail}]`}</calc-option>
))}
</calc-select>
)}
@@ -71,34 +71,41 @@ export default defineComponent({
}
}
const renderSkill = (skill: ISkill, index: number) => (
<>
<div class="relative w-35px h-55px">
{activeSkill.value == skill.id && renderSkillAction(skill)}
<div
class="w-34px absolute h-auto flex flex-col gap-2px py-2px items-center bg-#2c2d2c rounded-2px z-2 top-1px left-1px"
onClick={(e) => {
e.stopPropagation()
chooseSkill(skill)
}}
onContextmenu={(e) => {
e.stopPropagation()
e.preventDefault()
chooseSkill(skill, 'sub')
}}
key={index}
>
<img
class={['h-30px w-30px', skill.type === 'passive' ? 'passive' : '']}
src={getImageURL(skill.icon)}
></img>
<div class="w-30px mx-2px bg-black text-white flex items-center justify-center rounded-2px">
{lvInfo.value?.[skill.id.toString()]?.lv ?? 0}
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">
{activeSkill.value == skill.id && renderSkillAction(skill)}
<div
class="w-34px absolute h-auto flex flex-col gap-2px py-2px items-center bg-#2c2d2c rounded-2px z-2 top-1px left-1px"
onClick={(e) => {
e.stopPropagation()
chooseSkill(skill)
}}
onContextmenu={(e) => {
e.stopPropagation()
e.preventDefault()
chooseSkill(skill, 'sub')
}}
key={index}
>
<img
class={['h-30px w-30px', skill.type === 'passive' ? 'passive' : '']}
src={getImageURL(skill.icon)}
></img>
<div class="w-30px mx-2px bg-black flex items-center justify-center rounded-2px"
style={{color}}>
{info?.lv ?? 0}
</div>
</div>
</div>
</div>
</>
)
</>
)
}
const renderSkillAction = (skill: ISkill) => (
<>
@@ -156,7 +163,8 @@ export default defineComponent({
{lvList.map((lv, index) => (
<div class="skill-tree-line flex items-center gap-10px px-10px" key={index}>
{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>
)}
+2 -2
View File
@@ -21,7 +21,7 @@ export interface IConfig {
id: string
reinforce: number
reinforceType: number
enchat: number
enchant: number
emblem_0: string
emblem_1: string
upgrade: number
@@ -36,7 +36,7 @@ const defaultEqusConfig = {
id: '',
reinforce: 0,
reinforceType: 0,
enchat: 0,
enchant: 0,
emblem_0: "0",
emblem_1: "0",
upgrade: 0,
+2 -2
View File
@@ -13,7 +13,7 @@ export const useInfoStore = defineStore("infoStore", ()=>{
const suits = computed(()=>infos.value?.suits ?? [])
const enchantings = computed(()=>infos.value?.enchantings?? [])
const enchants = computed(()=>infos.value?.enchants ?? [])
const emblems = computed(()=>infos.value?.emblems?? [])
@@ -32,7 +32,7 @@ export const useInfoStore = defineStore("infoStore", ()=>{
equips,
suits,
createCharacter,
enchantings,
enchants,
emblems,
parts
}