fix character rep image urls
This commit is contained in:
parent
89daa8e565
commit
506d33bf57
1 changed files with 15 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Party, GridWeapon, GridCharacter } from '$lib/types/api/party'
|
import type { Party, GridWeapon, GridCharacter } from '$lib/types/api/party'
|
||||||
import { getElementClass } from '$lib/types/enums'
|
import { getElementClass } from '$lib/types/enums'
|
||||||
import { getCharacterImage } from '$lib/features/database/detail/image'
|
import { getCharacterImageWithPose } from '$lib/utils/images'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
party?: Party
|
party?: Party
|
||||||
|
|
@ -35,21 +35,24 @@
|
||||||
function characterImageUrl(c?: GridCharacter): string {
|
function characterImageUrl(c?: GridCharacter): string {
|
||||||
const id = c?.character?.granblueId
|
const id = c?.character?.granblueId
|
||||||
if (!id) return ''
|
if (!id) return ''
|
||||||
const uncap = c?.uncapLevel ?? 0
|
|
||||||
const trans = c?.transcendenceStep ?? 0
|
// Get mainhand weapon element for Gran/Djeeta
|
||||||
let suffix = '01'
|
let mainWeaponElement: number | undefined
|
||||||
if (trans > 0) suffix = '04'
|
if (party) {
|
||||||
else if (uncap >= 5) suffix = '03'
|
|
||||||
else if (uncap > 2) suffix = '02'
|
|
||||||
if (String(id) === '3030182000' && party) {
|
|
||||||
const main: GridWeapon | undefined = (party.weapons || []).find(
|
const main: GridWeapon | undefined = (party.weapons || []).find(
|
||||||
(w: GridWeapon) => w?.mainhand || w?.position === -1
|
(w: GridWeapon) => w?.mainhand || w?.position === -1
|
||||||
)
|
)
|
||||||
const el = main?.element ?? main?.weapon?.element ?? 1
|
mainWeaponElement = main?.element ?? main?.weapon?.element
|
||||||
suffix = `${suffix}_0${el}`
|
|
||||||
return `/images/character-main/${id}_${suffix}.jpg`
|
|
||||||
}
|
}
|
||||||
return getCharacterImage(id, suffix, 'main')
|
|
||||||
|
return getCharacterImageWithPose(
|
||||||
|
id,
|
||||||
|
'main',
|
||||||
|
c?.uncapLevel ?? 0,
|
||||||
|
c?.transcendenceStep ?? 0,
|
||||||
|
mainWeaponElement,
|
||||||
|
undefined // partyElement not used here
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue