Display keys on Draconic Weapons Providence
Also refactors image methods
This commit is contained in:
parent
b08dad0be4
commit
fd8f958546
1 changed files with 40 additions and 69 deletions
|
|
@ -238,23 +238,22 @@ const WeaponUnit = ({
|
||||||
|
|
||||||
function telumaImage(index: number) {
|
function telumaImage(index: number) {
|
||||||
const baseUrl = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-keys/`
|
const baseUrl = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-keys/`
|
||||||
let filename = ''
|
|
||||||
let altText = ''
|
|
||||||
|
|
||||||
// If there is a grid weapon, it is a Draconic Weapon and it has keys
|
// If there is a grid weapon, it is a Draconic Weapon and it has keys
|
||||||
if (
|
if (
|
||||||
gridWeapon &&
|
gridWeapon &&
|
||||||
gridWeapon.object.series === 3 &&
|
(gridWeapon.object.series === 3 || gridWeapon.object.series == 34) &&
|
||||||
gridWeapon.weapon_keys
|
gridWeapon.weapon_keys
|
||||||
) {
|
) {
|
||||||
if (index === 0 && gridWeapon.weapon_keys[0]) {
|
const weaponKey = gridWeapon.weapon_keys[index]
|
||||||
altText = `${gridWeapon.weapon_keys[0].name[locale]}`
|
const altText = weaponKey.name[locale]
|
||||||
filename = `${gridWeapon.weapon_keys[0].slug}.png`
|
let filename = `${weaponKey.slug}`
|
||||||
} else if (index === 1 && gridWeapon.weapon_keys[1]) {
|
|
||||||
altText = `${gridWeapon.weapon_keys[1].name[locale]}`
|
|
||||||
|
|
||||||
const element = gridWeapon.object.element
|
if (
|
||||||
filename = `${gridWeapon.weapon_keys[1].slug}-${element}.png`
|
index === 1 ||
|
||||||
|
(index === 2 && parseInt(weaponKey.granblue_id) === 15008)
|
||||||
|
) {
|
||||||
|
filename += `-${gridWeapon.object.element}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -262,7 +261,7 @@ const WeaponUnit = ({
|
||||||
alt={altText}
|
alt={altText}
|
||||||
key={altText}
|
key={altText}
|
||||||
className={styles.skill}
|
className={styles.skill}
|
||||||
src={`${baseUrl}${filename}`}
|
src={`${baseUrl}${filename}.png`}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -272,7 +271,7 @@ const WeaponUnit = ({
|
||||||
let images: JSX.Element[] = []
|
let images: JSX.Element[] = []
|
||||||
if (
|
if (
|
||||||
gridWeapon &&
|
gridWeapon &&
|
||||||
gridWeapon.object.series === 3 &&
|
(gridWeapon.object.series === 3 || gridWeapon.object.series === 34) &&
|
||||||
gridWeapon.weapon_keys &&
|
gridWeapon.weapon_keys &&
|
||||||
gridWeapon.weapon_keys.length > 0
|
gridWeapon.weapon_keys.length > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -287,8 +286,6 @@ const WeaponUnit = ({
|
||||||
|
|
||||||
function ultimaImage(index: number) {
|
function ultimaImage(index: number) {
|
||||||
const baseUrl = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-keys/`
|
const baseUrl = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-keys/`
|
||||||
let filename = ''
|
|
||||||
let altText = ''
|
|
||||||
|
|
||||||
// If there is a grid weapon, it is a Dark Opus Weapon and it has keys
|
// If there is a grid weapon, it is a Dark Opus Weapon and it has keys
|
||||||
if (
|
if (
|
||||||
|
|
@ -296,34 +293,23 @@ const WeaponUnit = ({
|
||||||
gridWeapon.object.series === 17 &&
|
gridWeapon.object.series === 17 &&
|
||||||
gridWeapon.weapon_keys
|
gridWeapon.weapon_keys
|
||||||
) {
|
) {
|
||||||
if (
|
const weaponKey = gridWeapon.weapon_keys[index]
|
||||||
gridWeapon.weapon_keys[index] &&
|
const altText = weaponKey.name[locale]
|
||||||
(gridWeapon.weapon_keys[index].slot === 1 ||
|
let filename = weaponKey.slug
|
||||||
gridWeapon.weapon_keys[index].slot === 2)
|
|
||||||
) {
|
|
||||||
altText = `${gridWeapon.weapon_keys[index].name[locale]}`
|
|
||||||
filename = `${gridWeapon.weapon_keys[index].slug}.png`
|
|
||||||
} else if (
|
|
||||||
gridWeapon.weapon_keys[index] &&
|
|
||||||
gridWeapon.weapon_keys[index].slot === 0
|
|
||||||
) {
|
|
||||||
altText = `${gridWeapon.weapon_keys[index].name[locale]}`
|
|
||||||
|
|
||||||
const weapon = gridWeapon.object.proficiency
|
if (weaponKey.slot === 0) {
|
||||||
|
filename += `-${gridWeapon.object.proficiency}`
|
||||||
const suffix = `${weapon}`
|
|
||||||
filename = `${gridWeapon.weapon_keys[index].slug}-${suffix}.png`
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
alt={altText}
|
alt={altText}
|
||||||
key={altText}
|
key={altText}
|
||||||
className={styles.skill}
|
className={styles.skill}
|
||||||
src={`${baseUrl}${filename}`}
|
src={`${baseUrl}${filename}.png`}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ultimaImages() {
|
function ultimaImages() {
|
||||||
|
|
@ -345,8 +331,6 @@ const WeaponUnit = ({
|
||||||
|
|
||||||
function opusImage(index: number) {
|
function opusImage(index: number) {
|
||||||
const baseUrl = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-keys/`
|
const baseUrl = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-keys/`
|
||||||
let filename = ''
|
|
||||||
let altText = ''
|
|
||||||
|
|
||||||
// If there is a grid weapon, it is a Dark Opus Weapon and it has keys
|
// If there is a grid weapon, it is a Dark Opus Weapon and it has keys
|
||||||
if (
|
if (
|
||||||
|
|
@ -354,39 +338,26 @@ const WeaponUnit = ({
|
||||||
gridWeapon.object.series === 2 &&
|
gridWeapon.object.series === 2 &&
|
||||||
gridWeapon.weapon_keys
|
gridWeapon.weapon_keys
|
||||||
) {
|
) {
|
||||||
if (
|
const weaponKey = gridWeapon.weapon_keys[index]
|
||||||
gridWeapon.weapon_keys[index] &&
|
const altText = weaponKey.name[locale]
|
||||||
gridWeapon.weapon_keys[index].slot === 0
|
let filename = weaponKey.slug
|
||||||
) {
|
|
||||||
altText = `${gridWeapon.weapon_keys[index].name[locale]}`
|
|
||||||
filename = `${gridWeapon.weapon_keys[index].slug}.png`
|
|
||||||
} else if (
|
|
||||||
gridWeapon.weapon_keys[index] &&
|
|
||||||
gridWeapon.weapon_keys[index].slot === 1
|
|
||||||
) {
|
|
||||||
altText = `${gridWeapon.weapon_keys[index].name[locale]}`
|
|
||||||
|
|
||||||
|
if (weaponKey.slot === 1) {
|
||||||
const element = gridWeapon.object.element
|
const element = gridWeapon.object.element
|
||||||
const mod = gridWeapon.object.name.en.includes('Repudiation')
|
const mod = gridWeapon.object.name.en.includes('Repudiation')
|
||||||
? 'primal'
|
? 'primal'
|
||||||
: 'magna'
|
: 'magna'
|
||||||
|
const suffixes = [
|
||||||
|
'pendulum-strength',
|
||||||
|
'pendulum-zeal',
|
||||||
|
'pendulum-strife',
|
||||||
|
'chain-temperament',
|
||||||
|
'chain-restoration',
|
||||||
|
'chain-glorification',
|
||||||
|
]
|
||||||
|
|
||||||
const suffix = `${mod}-${element}`
|
if (suffixes.includes(weaponKey.slug)) {
|
||||||
const weaponKey = gridWeapon.weapon_keys[index]
|
filename += `-${mod}-${element}`
|
||||||
|
|
||||||
if (
|
|
||||||
[
|
|
||||||
'pendulum-strength',
|
|
||||||
'pendulum-zeal',
|
|
||||||
'pendulum-strife',
|
|
||||||
'chain-temperament',
|
|
||||||
'chain-restoration',
|
|
||||||
'chain-glorification',
|
|
||||||
].includes(weaponKey.slug)
|
|
||||||
) {
|
|
||||||
filename = `${gridWeapon.weapon_keys[index].slug}-${suffix}.png`
|
|
||||||
} else {
|
|
||||||
filename = `${gridWeapon.weapon_keys[index].slug}.png`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -395,7 +366,7 @@ const WeaponUnit = ({
|
||||||
alt={altText}
|
alt={altText}
|
||||||
key={altText}
|
key={altText}
|
||||||
className={styles.skill}
|
className={styles.skill}
|
||||||
src={`${baseUrl}${filename}`}
|
src={`${baseUrl}${filename}.png`}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue