🐛 Fix mihomo models update

This commit is contained in:
xtaodada 2024-02-06 22:07:07 +08:00
parent 59e33eb468
commit d8ea564ac9
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 7 additions and 8 deletions

View File

@ -61,7 +61,7 @@ class PlayerCardsFile:
data: Dict, data: Dict,
props: Dict, props: Dict,
) -> Dict: ) -> Dict:
assistAvatarDetail = "assistAvatarDetail" assistAvatarList = "assistAvatarList"
avatarId = "avatarId" avatarId = "avatarId"
avatarDetailList = "avatarDetailList" avatarDetailList = "avatarDetailList"
avatarList = "avatarList" avatarList = "avatarList"
@ -71,18 +71,17 @@ class PlayerCardsFile:
old_data = {} old_data = {}
avatars = [] avatars = []
avatar_ids = [] avatar_ids = []
assist_avatar = data.get(assistAvatarDetail, None) for avatar in data.get(assistAvatarList, []):
if assist_avatar: avatars.append(avatar)
avatars.append(assist_avatar) avatar_ids.append(avatar.get(avatarId, 0))
avatar_ids.append(assist_avatar.get(avatarId, 0))
for avatar in data.get(avatarDetailList, []): for avatar in data.get(avatarDetailList, []):
if avatar.get(avatarId, 0) in avatar_ids: if avatar.get(avatarId, 0) in avatar_ids:
continue continue
avatars.append(avatar) avatars.append(avatar)
avatar_ids.append(avatar.get(avatarId, 0)) avatar_ids.append(avatar.get(avatarId, 0))
data[avatarList] = avatars data[avatarList] = avatars
if assistAvatarDetail in data: if assistAvatarList in data:
del data[assistAvatarDetail] del data[assistAvatarList]
if avatarDetailList in data: if avatarDetailList in data:
del data[avatarDetailList] del data[avatarDetailList]
for i in old_data.get(avatarList, []): for i in old_data.get(avatarList, []):

View File

@ -368,7 +368,7 @@ class PlayerCards(Plugin):
) )
except AssetsCouldNotFound: except AssetsCouldNotFound:
logger.warning("角色 %s 的头像资源获取失败", cid) logger.warning("角色 %s 的头像资源获取失败", cid)
if idx > 3: if idx == 7:
break break
return { return {
"uid": mask_number(data.uid), "uid": mask_number(data.uid),