mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
🐛 修复图标资源问题
This commit is contained in:
parent
01d4e03adf
commit
41b3cc63ff
@ -6,7 +6,7 @@ from tortoise import fields
|
|||||||
from tortoise.models import Model
|
from tortoise.models import Model
|
||||||
|
|
||||||
from LittlePaimon.utils.path import JSON_DATA
|
from LittlePaimon.utils.path import JSON_DATA
|
||||||
from LittlePaimon.utils.alias import get_name_by_id
|
from LittlePaimon.utils.alias import get_name_by_id, get_weapon_icon, get_artifact_icon, get_constellation_icon
|
||||||
from LittlePaimon.utils.files import load_json
|
from LittlePaimon.utils.files import load_json
|
||||||
from LittlePaimon.utils.typing import *
|
from LittlePaimon.utils.typing import *
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ class Character(Model):
|
|||||||
character.promote_level = 0 if character.level < 20 else 1 if character.level < 40 else 2 if character.level < 50 else 3 if character.level < 60 else 4 if character.level < 70 else 5 if character.level < 80 else 6
|
character.promote_level = 0 if character.level < 20 else 1 if character.level < 40 else 2 if character.level < 50 else 3 if character.level < 60 else 4 if character.level < 70 else 5 if character.level < 80 else 6
|
||||||
character.constellation = Constellations(constellation_list=[
|
character.constellation = Constellations(constellation_list=[
|
||||||
Constellation(name=data['constellations'][i]['name'],
|
Constellation(name=data['constellations'][i]['name'],
|
||||||
icon=data['constellations'][i]['icon'].split('/')[-1].replace('.png', '')) for i in
|
icon=get_constellation_icon(data['constellations'][i]['name'])) for i in
|
||||||
range(data['actived_constellation_num'])
|
range(data['actived_constellation_num'])
|
||||||
])
|
])
|
||||||
if character.name in ['荧', '空']:
|
if character.name in ['荧', '空']:
|
||||||
@ -460,7 +460,7 @@ class Character(Model):
|
|||||||
character.weapon = Weapon(
|
character.weapon = Weapon(
|
||||||
name=data['weapon']['name'],
|
name=data['weapon']['name'],
|
||||||
type=data['weapon']['type_name'],
|
type=data['weapon']['type_name'],
|
||||||
icon=data['weapon']['icon'].split('/')[-1].replace('.png', ''),
|
icon=get_weapon_icon(data['weapon']['name']),
|
||||||
level=data['weapon']['level'],
|
level=data['weapon']['level'],
|
||||||
rarity=data['weapon']['rarity'],
|
rarity=data['weapon']['rarity'],
|
||||||
affix_level=data['weapon']['affix_level'],
|
affix_level=data['weapon']['affix_level'],
|
||||||
@ -468,7 +468,7 @@ class Character(Model):
|
|||||||
if 'reliquaries' in data:
|
if 'reliquaries' in data:
|
||||||
character.artifacts = Artifacts(artifact_list=[Artifact(
|
character.artifacts = Artifacts(artifact_list=[Artifact(
|
||||||
name=a['name'],
|
name=a['name'],
|
||||||
icon=a['icon'].split('/')[-1].replace('.png', ''),
|
icon=get_artifact_icon(a['name']),
|
||||||
level=a['level'],
|
level=a['level'],
|
||||||
rarity=a['rarity'],
|
rarity=a['rarity'],
|
||||||
suit=a['set']['name'],
|
suit=a['set']['name'],
|
||||||
|
@ -151,3 +151,18 @@ def get_chara_icon(name: Optional[str] = None, chara_id: Optional[int] = None,
|
|||||||
def get_weapon_icon(name: str) -> Optional[str]:
|
def get_weapon_icon(name: str) -> Optional[str]:
|
||||||
icon_list = load_json(JSON_DATA / 'weapon.json')['Icon']
|
icon_list = load_json(JSON_DATA / 'weapon.json')['Icon']
|
||||||
return icon_list.get(name)
|
return icon_list.get(name)
|
||||||
|
|
||||||
|
|
||||||
|
def get_artifact_icon(name: str) -> Optional[str]:
|
||||||
|
icon_list = load_json(JSON_DATA / 'artifact.json')['Icon']
|
||||||
|
for k, v in icon_list['Name'].items():
|
||||||
|
if name == v:
|
||||||
|
return k
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_constellation_icon(name: str) -> Optional[str]:
|
||||||
|
icon_list = load_json(JSON_DATA / 'role_talent.json')
|
||||||
|
for k, v in icon_list['Name'].items():
|
||||||
|
if name == v:
|
||||||
|
return icon_list['Icon'].get(k)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user