Add race and gender utility mappings
This commit is contained in:
parent
5c814b8054
commit
6b5f2b4868
2 changed files with 45 additions and 0 deletions
22
src/lib/utils/gender.ts
Normal file
22
src/lib/utils/gender.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Gender mapping utilities for Granblue Fantasy
|
||||
*/
|
||||
|
||||
export const GENDER_LABELS: Record<number, string> = {
|
||||
0: 'Unknown',
|
||||
1: 'Male',
|
||||
2: 'Female',
|
||||
3: 'Male/Female'
|
||||
}
|
||||
|
||||
export function getGenderLabel(gender?: number | null): string {
|
||||
if (gender === null || gender === undefined) return '—'
|
||||
return GENDER_LABELS[gender] || '—'
|
||||
}
|
||||
|
||||
export function getGenderIcon(gender?: number | null): string {
|
||||
const label = getGenderLabel(gender)
|
||||
if (label === '—' || label === 'Unknown') return ''
|
||||
// Gender icons may use different naming convention
|
||||
return `/images/labels/gender/Label_Gender_${label.replace('/', '_')}.png`
|
||||
}
|
||||
23
src/lib/utils/race.ts
Normal file
23
src/lib/utils/race.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Race mapping utilities for Granblue Fantasy
|
||||
*/
|
||||
|
||||
export const RACE_LABELS: Record<number, string> = {
|
||||
0: 'Unknown',
|
||||
1: 'Human',
|
||||
2: 'Erune',
|
||||
3: 'Draph',
|
||||
4: 'Harvin',
|
||||
5: 'Primal'
|
||||
}
|
||||
|
||||
export function getRaceLabel(race?: number | null): string {
|
||||
if (race === null || race === undefined) return '—'
|
||||
return RACE_LABELS[race] || '—'
|
||||
}
|
||||
|
||||
export function getRaceIcon(race?: number | null): string {
|
||||
const label = getRaceLabel(race)
|
||||
if (label === '—' || label === 'Unknown') return ''
|
||||
return `/images/labels/race/Label_Race_${label}.png`
|
||||
}
|
||||
Loading…
Reference in a new issue