style: run format:apply
This commit is contained in:
+52
-32
@@ -1,57 +1,77 @@
|
||||
export type CustomizationItem = {
|
||||
id: string;
|
||||
name: string;
|
||||
iconFilePath: string;
|
||||
category: number;
|
||||
associatedCharacter: number;
|
||||
id: string;
|
||||
name: string;
|
||||
iconFilePath: string;
|
||||
category: number;
|
||||
associatedCharacter: number;
|
||||
};
|
||||
|
||||
export type Character = {
|
||||
idx: number;
|
||||
name: string;
|
||||
iconFilePath: string;
|
||||
idx: number;
|
||||
name: string;
|
||||
iconFilePath: string;
|
||||
};
|
||||
|
||||
export type Tab = 'cosmetics' | 'charms' | 'badges' | 'banners' | 'portraits';
|
||||
export type RoleFilter = 'all' | 'survivors' | 'killers';
|
||||
|
||||
export const CATEGORY_LABELS: Record<number, string> = {
|
||||
1: 'Heads', 2: 'Torsos', 3: 'Legs',
|
||||
4: 'Heads', 5: 'Bodies', 6: 'Weapons', 7: 'Outfits',
|
||||
1: 'Heads',
|
||||
2: 'Torsos',
|
||||
3: 'Legs',
|
||||
4: 'Heads',
|
||||
5: 'Bodies',
|
||||
6: 'Weapons',
|
||||
7: 'Outfits'
|
||||
};
|
||||
|
||||
export const CATEGORY_ORDER = [7, 1, 4, 2, 3, 5, 6];
|
||||
|
||||
export const TAB_CATEGORIES: Partial<Record<Tab, number>> = {
|
||||
charms: 8, badges: 9, banners: 10, portraits: 11,
|
||||
charms: 8,
|
||||
badges: 9,
|
||||
banners: 10,
|
||||
portraits: 11
|
||||
};
|
||||
|
||||
import { DB_BASE_URL } from '../../lib/db';
|
||||
|
||||
export const getCosmeticIconUrl = (
|
||||
item: CustomizationItem,
|
||||
characterMap: Map<number, string>
|
||||
item: CustomizationItem,
|
||||
characterMap: Map<number, string>
|
||||
): string => {
|
||||
const file = (item.iconFilePath.split('/').pop() ?? '').split('.')[0];
|
||||
const base = DB_BASE_URL;
|
||||
const file = (item.iconFilePath.split('/').pop() ?? '').split('.')[0];
|
||||
const base = DB_BASE_URL;
|
||||
|
||||
switch (item.category) {
|
||||
case 8: return `${base}/icons/customization/charms/${file}.png`;
|
||||
case 9: return `${base}/icons/customization/badges/${file}.png`;
|
||||
case 10: return `${base}/icons/customization/banners/${file}.png`;
|
||||
case 11: return `${base}/icons/customization/portrait-backgrounds/${file}.png`;
|
||||
}
|
||||
switch (item.category) {
|
||||
case 8:
|
||||
return `${base}/icons/customization/charms/${file}.png`;
|
||||
case 9:
|
||||
return `${base}/icons/customization/badges/${file}.png`;
|
||||
case 10:
|
||||
return `${base}/icons/customization/banners/${file}.png`;
|
||||
case 11:
|
||||
return `${base}/icons/customization/portrait-backgrounds/${file}.png`;
|
||||
}
|
||||
|
||||
const subfolder =
|
||||
item.category === 1 || item.category === 4 ? 'heads' :
|
||||
item.category === 2 ? 'torsos' :
|
||||
item.category === 3 ? 'legs' :
|
||||
item.category === 5 ? 'bodys' :
|
||||
item.category === 6 ? 'weapons' : 'outfits';
|
||||
const subfolder =
|
||||
item.category === 1 || item.category === 4
|
||||
? 'heads'
|
||||
: item.category === 2
|
||||
? 'torsos'
|
||||
: item.category === 3
|
||||
? 'legs'
|
||||
: item.category === 5
|
||||
? 'bodys'
|
||||
: item.category === 6
|
||||
? 'weapons'
|
||||
: 'outfits';
|
||||
|
||||
const charName = characterMap.get(item.associatedCharacter);
|
||||
const charFolder = (charName ?? item.associatedCharacter.toString())
|
||||
.replace(/[\\/:*?"<>|]/g, '_');
|
||||
const charName = characterMap.get(item.associatedCharacter);
|
||||
const charFolder = (charName ?? item.associatedCharacter.toString()).replace(
|
||||
/[\\/:*?"<>|]/g,
|
||||
'_'
|
||||
);
|
||||
|
||||
return `${base}/icons/customization/characters/${charFolder}/${subfolder}/${file}.png`;
|
||||
};
|
||||
return `${base}/icons/customization/characters/${charFolder}/${subfolder}/${file}.png`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user