1
0
forked from Hay1tsme/artemis

Merge pull request 'chuni: userbox ui and read cleanup' (#206) from daydensteve/artemis-develop-chuni-userbox-ui-fix:develop into develop

Reviewed-on: Hay1tsme/artemis#206
This commit is contained in:
2025-04-08 03:14:57 +00:00
3 changed files with 11 additions and 8 deletions

View File

@ -457,7 +457,7 @@ class ChuniFrontend(FE_Base):
user_characters = [] user_characters = []
if not force_unlocked: if not force_unlocked:
user_characters = await self.data.item.get_characters(profile.user) user_characters = await self.data.item.get_characters(profile.user)
user_characters = [chara["characterId"] for chara in user_characters] + [profile.characterId, profile.charaIllustId] user_characters = [chara["characterId"] for chara in user_characters] + [profile.characterId]
for row in rows: for row in rows:
if force_unlocked or row["defaultHave"] or row["characterId"] in user_characters: if force_unlocked or row["defaultHave"] or row["characterId"] in user_characters:

View File

@ -305,7 +305,7 @@ class ChuniReader(BaseReader):
for name in xml_root.findall("name"): for name in xml_root.findall("name"):
id = name.find("id").text id = name.find("id").text
name = name.find("str").text name = name.find("str").text
sortName = xml_root.find("sortName").text sortName = name if xml_root.find("sortName") is None else xml_root.find("sortName").text
defaultHave = xml_root.find("defaultHave").text == 'true' defaultHave = xml_root.find("defaultHave").text == 'true'
disableFlag = xml_root.find("disableFlag") # may not exist in older data disableFlag = xml_root.find("disableFlag") # may not exist in older data
is_enabled = True if (disableFlag is None or disableFlag.text == "false") else False is_enabled = True if (disableFlag is None or disableFlag.text == "false") else False
@ -354,12 +354,15 @@ class ChuniReader(BaseReader):
if path.exists(f"{root}/{dir}/Chara.xml"): if path.exists(f"{root}/{dir}/Chara.xml"):
with open(f"{root}/{dir}/Chara.xml", "r", encoding='utf-8') as fp: with open(f"{root}/{dir}/Chara.xml", "r", encoding='utf-8') as fp:
strdata = fp.read() strdata = fp.read()
# ET may choke if there is a & symbol (which is present in some character xml)
if "&" in strdata:
strdata = strdata.replace("&", "&")
xml_root = ET.fromstring(strdata) xml_root = ET.fromstring(strdata)
for name in xml_root.findall("name"): for name in xml_root.findall("name"):
id = name.find("id").text id = name.find("id").text
name = name.find("str").text name = name.find("str").text
sortName = xml_root.find("sortName").text sortName = name if xml_root.find("sortName") is None else xml_root.find("sortName").text
for work in xml_root.findall("works"): for work in xml_root.findall("works"):
worksName = work.find("str").text worksName = work.find("str").text
rareType = xml_root.find("rareType").text rareType = xml_root.find("rareType").text
@ -403,7 +406,7 @@ class ChuniReader(BaseReader):
for name in xml_root.findall("name"): for name in xml_root.findall("name"):
id = name.find("id").text id = name.find("id").text
name = name.find("str").text name = name.find("str").text
sortName = xml_root.find("sortName").text sortName = name if xml_root.find("sortName") is None else xml_root.find("sortName").text
for image in xml_root.findall("image"): for image in xml_root.findall("image"):
iconPath = image.find("path").text iconPath = image.find("path").text
self.copy_image(iconPath, f"{root}/{dir}", "titles/chuni/img/mapIcon/") self.copy_image(iconPath, f"{root}/{dir}", "titles/chuni/img/mapIcon/")
@ -431,7 +434,7 @@ class ChuniReader(BaseReader):
for name in xml_root.findall("name"): for name in xml_root.findall("name"):
id = name.find("id").text id = name.find("id").text
name = name.find("str").text name = name.find("str").text
sortName = xml_root.find("sortName").text sortName = name if xml_root.find("sortName") is None else xml_root.find("sortName").text
for image in xml_root.findall("image"): for image in xml_root.findall("image"):
imagePath = image.find("path").text imagePath = image.find("path").text
self.copy_image(imagePath, f"{root}/{dir}", "titles/chuni/img/systemVoice/") self.copy_image(imagePath, f"{root}/{dir}", "titles/chuni/img/systemVoice/")

View File

@ -118,9 +118,9 @@ userbox_components = {
"{{ nameplates[profile.nameplateId]["texturePath"] }}", "", "", ""], "{{ nameplates[profile.nameplateId]["texturePath"] }}", "", "", ""],
"character":["{{ characters|length }}", "character":["{{ characters|length }}",
"{{ profile.charaIllustId }}", "{{ profile.characterId }}",
"{{ characters[profile.charaIllustId]["name"] }}", "{{ characters[profile.characterId]["name"] }}",
"{{ characters[profile.charaIllustId]["iconPath"] }}", "", "", ""] "{{ characters[profile.characterId]["iconPath"] }}", "", "", ""]
}; };
types = Object.keys(userbox_components); types = Object.keys(userbox_components);
orig_trophy = curr_trophy = "{{ profile.trophyId }}"; orig_trophy = curr_trophy = "{{ profile.trophyId }}";