From a0db0bd93cbad9528b7d181e0e0ff1cf692003bb Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 27 Feb 2022 17:09:00 -0800 Subject: [PATCH] Implement changing images based on uncap level --- components/CharacterUnit/index.tsx | 12 +++++++++++- components/SummonUnit/index.tsx | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/components/CharacterUnit/index.tsx b/components/CharacterUnit/index.tsx index 761d4af7..e35beda9 100644 --- a/components/CharacterUnit/index.tsx +++ b/components/CharacterUnit/index.tsx @@ -37,7 +37,17 @@ const CharacterUnit = (props: Props) => { if (props.gridCharacter) { const character = props.gridCharacter.object! - imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/chara-main/${character.granblue_id}_01.jpg` + + // Change the image based on the uncap level + let suffix = '01' + if (props.gridCharacter.uncap_level == 6) + suffix = '04' + else if (props.gridCharacter.uncap_level == 5) + suffix = '03' + else if (props.gridCharacter.uncap_level > 2) + suffix = '02' + + imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/chara-main/${character.granblue_id}_${suffix}.jpg` } setImageUrl(imgSrc) diff --git a/components/SummonUnit/index.tsx b/components/SummonUnit/index.tsx index 71aa1df3..1b196ffa 100644 --- a/components/SummonUnit/index.tsx +++ b/components/SummonUnit/index.tsx @@ -39,12 +39,22 @@ const SummonUnit = (props: Props) => { let imgSrc = "" if (props.gridSummon) { const summon = props.gridSummon.object! + + const upgradedSummons = [ + '2040094000', '2040100000', '2040080000', '2040098000', + '2040090000', '2040084000', '2040003000', '2040056000' + ] + + console.log(`${summon.granblue_id} ${summon.name.en} ${props.gridSummon.uncap_level} ${upgradedSummons.indexOf(summon.granblue_id.toString())}`) + let suffix = '' + if (upgradedSummons.indexOf(summon.granblue_id.toString()) != -1 && props.gridSummon.uncap_level == 5) + suffix = '_02' // Generate the correct source for the summon if (props.unitType == 0 || props.unitType == 2) - imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-main/${summon.granblue_id}.jpg` + imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-main/${summon.granblue_id}${suffix}.jpg` else - imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${summon.granblue_id}.jpg` + imgSrc = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${summon.granblue_id}${suffix}.jpg` } setImageUrl(imgSrc)