From 97420e85e20a7d2db3b150c4522d733bde6f5ed9 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 22 Mar 2022 00:10:08 -0700 Subject: [PATCH] Add support for Lyria element switching --- components/CharacterResult/index.tsx | 14 ++++++++++++-- components/CharacterUnit/index.tsx | 23 ++++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/components/CharacterResult/index.tsx b/components/CharacterResult/index.tsx index f2395019..582bdf2c 100644 --- a/components/CharacterResult/index.tsx +++ b/components/CharacterResult/index.tsx @@ -19,9 +19,19 @@ const CharacterResult = (props: Props) => { const character = props.data - return( + const characterUrl = () => { + let url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}chara-grid/${character.granblue_id}_01.jpg` + + if (character.granblue_id === '3030182000') { + url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}chara-grid/${character.granblue_id}_01_01.jpg` + } + + return url + } + + return (
  • - {character.name[locale]} + {character.name[locale]}
    {character.name[locale]}
    { const { t } = useTranslation('common') + const { party, grid } = useSnapshot(appState) + const router = useRouter() const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en' @@ -55,7 +60,19 @@ const CharacterUnit = (props: Props) => { else if (props.gridCharacter.uncap_level > 2) suffix = '02' - imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/chara-main/${character.granblue_id}_${suffix}.jpg` + // Special casing for Lyria (and Young Cat eventually) + if (props.gridCharacter.object.granblue_id === '3030182000') { + let element = 1 + if (grid.weapons.mainWeapon && grid.weapons.mainWeapon.element) { + element = grid.weapons.mainWeapon.element + } else if (party.element != 0) { + element = party.element + } + + suffix = `${suffix}_0${element}` + } + + imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}chara-main/${character.granblue_id}_${suffix}.jpg` } setImageUrl(imgSrc)