Add element and proficiency utility mappings
This commit is contained in:
parent
76bad64ece
commit
2cf3c2067e
3 changed files with 73 additions and 0 deletions
27
src/lib/utils/element.ts
Normal file
27
src/lib/utils/element.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
export const ELEMENT_LABELS: Record<number, string> = {
|
||||
1: 'Wind',
|
||||
2: 'Fire',
|
||||
3: 'Water',
|
||||
4: 'Earth',
|
||||
5: 'Dark',
|
||||
6: 'Light'
|
||||
}
|
||||
|
||||
export function getElementLabel(element?: number): string {
|
||||
if (element === undefined || element === null) return '—'
|
||||
return ELEMENT_LABELS[element] || '—'
|
||||
}
|
||||
|
||||
export function getElementClass(element?: number): string {
|
||||
if (element === undefined || element === null) return ''
|
||||
const label = ELEMENT_LABELS[element]
|
||||
return label ? `element-${label.toLowerCase()}` : ''
|
||||
}
|
||||
|
||||
export function getElementIcon(element?: number): string {
|
||||
const label = getElementLabel(element)
|
||||
if (label === '—') return ''
|
||||
// Capitalize first letter for filename
|
||||
const capitalizedLabel = label.charAt(0).toUpperCase() + label.slice(1)
|
||||
return `/images/labels/element/Label_Element_${capitalizedLabel}.png`
|
||||
}
|
||||
24
src/lib/utils/proficiency.ts
Normal file
24
src/lib/utils/proficiency.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export const PROFICIENCY_LABELS: Record<number, string> = {
|
||||
1: 'Sabre',
|
||||
2: 'Dagger',
|
||||
3: 'Axe',
|
||||
4: 'Spear',
|
||||
5: 'Bow',
|
||||
6: 'Staff',
|
||||
7: 'Melee',
|
||||
8: 'Harp',
|
||||
9: 'Gun',
|
||||
10: 'Katana'
|
||||
}
|
||||
|
||||
export function getProficiencyLabel(proficiency: number): string {
|
||||
return PROFICIENCY_LABELS[proficiency] || '—'
|
||||
}
|
||||
|
||||
export function getProficiencyIcon(proficiency: number): string {
|
||||
const label = PROFICIENCY_LABELS[proficiency]
|
||||
if (!label) return ''
|
||||
// Capitalize first letter for filename
|
||||
const capitalizedLabel = label.charAt(0).toUpperCase() + label.slice(1)
|
||||
return `/images/labels/proficiency/Label_Weapon_${capitalizedLabel}.png`
|
||||
}
|
||||
22
src/lib/utils/rarity.ts
Normal file
22
src/lib/utils/rarity.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export const RARITY_LABELS: Record<number, string> = {
|
||||
1: 'R',
|
||||
2: 'SR',
|
||||
3: 'SSR'
|
||||
}
|
||||
|
||||
export function getRarityLabel(rarity: number): string {
|
||||
return RARITY_LABELS[rarity] || '—'
|
||||
}
|
||||
|
||||
export function getRarityClass(rarity: number): string {
|
||||
switch (rarity) {
|
||||
case 1:
|
||||
return 'rarity-r'
|
||||
case 2:
|
||||
return 'rarity-sr'
|
||||
case 3:
|
||||
return 'rarity-ssr'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue