diff --git a/backend/core/basic/character.py b/backend/core/basic/character.py index c62962d7..59598778 100644 --- a/backend/core/basic/character.py +++ b/backend/core/basic/character.py @@ -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 diff --git a/backend/core/basic/equipment.py b/backend/core/basic/equipment.py index 006e2dac..0414366b 100644 --- a/backend/core/basic/equipment.py +++ b/backend/core/basic/equipment.py @@ -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: diff --git a/backend/core/character/GF/gunner_female/spitfire_female.py b/backend/core/character/GF/gunner_female/spitfire_female.py index 359d2be4..012e506d 100644 --- a/backend/core/character/GF/gunner_female/spitfire_female.py +++ b/backend/core/character/GF/gunner_female/spitfire_female.py @@ -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 diff --git a/backend/dataFiles/dcalc_0.db b/backend/dataFiles/dcalc_0.db index 459eb74e..5262a90f 100644 Binary files a/backend/dataFiles/dcalc_0.db and b/backend/dataFiles/dcalc_0.db differ diff --git a/backend/database/models.py b/backend/database/models.py index 01fdc34e..97424c4d 100644 --- a/backend/database/models.py +++ b/backend/database/models.py @@ -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) diff --git a/frontend/src/api/info/type.ts b/frontend/src/api/info/type.ts index fd53222e..c541b6ea 100644 --- a/frontend/src/api/info/type.ts +++ b/frontend/src/api/info/type.ts @@ -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 } diff --git a/frontend/src/pages/Character/Forge/components/equipment.vue b/frontend/src/pages/Character/Forge/components/equipment.vue index 02f93bf6..abd4c308 100644 --- a/frontend/src/pages/Character/Forge/components/equipment.vue +++ b/frontend/src/pages/Character/Forge/components/equipment.vue @@ -30,14 +30,14 @@ export default defineComponent({ const basicInfoStore = useInfoStore() const enchanting_list = computed(() => { - 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(() => { @@ -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({ 无 {renderList(enchanting_list.value ?? [], (item) => ( - {item.props} + {item.detail} ))} @@ -193,7 +193,7 @@ export default defineComponent({ {renderList(emblem_list.value ?? [], (item) => ( {`${item.rarity}${item.type}徽章[${item.props}]`} + >{`${item.rarity}${item.type}徽章[${item.detail}]`} ))} {has_emblem_1.value && ( @@ -202,7 +202,7 @@ export default defineComponent({ {renderList(emblem_list.value ?? [], (item) => ( {`${item.rarity}${item.type}徽章[${item.props}]`} + >{`${item.rarity}${item.type}徽章[${item.detail}]`} ))} )} diff --git a/frontend/src/pages/Character/Skill/components/SkillTree/index.tsx b/frontend/src/pages/Character/Skill/components/SkillTree/index.tsx index b23c6b17..850af9fe 100644 --- a/frontend/src/pages/Character/Skill/components/SkillTree/index.tsx +++ b/frontend/src/pages/Character/Skill/components/SkillTree/index.tsx @@ -71,34 +71,41 @@ export default defineComponent({ } } - const renderSkill = (skill: ISkill, index: number) => ( - <> -
- {activeSkill.value == skill.id && renderSkillAction(skill)} -
{ - e.stopPropagation() - chooseSkill(skill) - }} - onContextmenu={(e) => { - e.stopPropagation() - e.preventDefault() - chooseSkill(skill, 'sub') - }} - key={index} - > - -
- {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 ( + <> +
+ {activeSkill.value == skill.id && renderSkillAction(skill)} +
{ + e.stopPropagation() + chooseSkill(skill) + }} + onContextmenu={(e) => { + e.stopPropagation() + e.preventDefault() + chooseSkill(skill, 'sub') + }} + key={index} + > + +
+ {info?.lv ?? 0} +
-
- - ) + + ) + } const renderSkillAction = (skill: ISkill) => ( <> @@ -156,7 +163,8 @@ export default defineComponent({ {lvList.map((lv, index) => (
{lv == 1 || lv % 10 == 0 ? ( -
{lv}
+
{lv}
) : (
)} diff --git a/frontend/src/stores/config.ts b/frontend/src/stores/config.ts index 19a848c4..578e8cc1 100644 --- a/frontend/src/stores/config.ts +++ b/frontend/src/stores/config.ts @@ -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, diff --git a/frontend/src/stores/info.ts b/frontend/src/stores/info.ts index f64da7b6..4344f4bd 100644 --- a/frontend/src/stores/info.ts +++ b/frontend/src/stores/info.ts @@ -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 }