mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
21 lines
458 B
JavaScript
21 lines
458 B
JavaScript
import WeaponId2Sprite from '../../resources/map/WeaponId2Sprite.json' assert { type: 'json' };
|
|
|
|
/**
|
|
* @param {string} id
|
|
* @returns string
|
|
*/
|
|
export const IDToWeaponFileName = id => {
|
|
const data = WeaponId2Sprite?.[id];
|
|
return data;
|
|
};
|
|
|
|
/**
|
|
* @param {string} name
|
|
* @returns string
|
|
*/
|
|
export const weaponFileNameToID = name => {
|
|
for (const [id, data] of Object.entries(WeaponId2Sprite)) {
|
|
if (data === name) return id;
|
|
}
|
|
return null;
|
|
};
|