update character unit to use new image function

This commit is contained in:
Justin Edmund 2025-09-24 03:29:53 -07:00
parent bb3aa1a252
commit 89daa8e565

View file

@ -6,7 +6,7 @@
import ContextMenu from '$lib/components/ui/ContextMenu.svelte' import ContextMenu from '$lib/components/ui/ContextMenu.svelte'
import { ContextMenu as ContextMenuBase } from 'bits-ui' import { ContextMenu as ContextMenuBase } from 'bits-ui'
import UncapIndicator from '$lib/components/uncap/UncapIndicator.svelte' import UncapIndicator from '$lib/components/uncap/UncapIndicator.svelte'
import { getCharacterImage } from '$lib/features/database/detail/image' import { getCharacterImageWithPose } from '$lib/utils/images'
import { openDetailsSidebar } from '$lib/features/details/openDetailsSidebar.svelte' import { openDetailsSidebar } from '$lib/features/details/openDetailsSidebar.svelte'
interface Props { interface Props {
@ -39,24 +39,17 @@
let imageUrl = $derived.by(() => { let imageUrl = $derived.by(() => {
// If no item or no character with granblueId, return placeholder // If no item or no character with granblueId, return placeholder
if (!item || !item.character?.granblueId) { if (!item || !item.character?.granblueId) {
return getCharacterImage(null, undefined, 'main') return getCharacterImageWithPose(null, 'main', 0, 0)
} }
const id = item.character.granblueId return getCharacterImageWithPose(
const uncap = item?.uncapLevel ?? 0 item.character.granblueId,
const transStep = item?.transcendenceStep ?? 0 'main',
let pose = '01' item?.uncapLevel ?? 0,
if (transStep > 0) pose = '04' item?.transcendenceStep ?? 0,
else if (uncap >= 5) pose = '03' mainWeaponElement,
else if (uncap > 2) pose = '02' partyElement
)
// Special handling for Gran/Djeeta (3030182000) - element-specific poses
if (String(id) === '3030182000') {
let element = mainWeaponElement || partyElement || 1
pose = `${pose}_0${element}`
}
return getCharacterImage(id, pose, 'main')
}) })
async function remove() { async function remove() {