feat: 练度统计

This commit is contained in:
bietiaop 2024-07-31 23:20:24 +08:00
parent b44c9caa47
commit cb9c31f27c
15 changed files with 845 additions and 36 deletions

View file

@ -7,6 +7,10 @@ import { char, equip, weapon } from './convert.js';
import { getResourceRemotePath } from './assets.js';
const ZZZ_SQUARE_AVATAR_PATH = path.join(imageResourcesPath, 'square_avatar');
const ZZZ_SMALL_SQUARE_AVATAR_PATH = path.join(
imageResourcesPath,
'role_general'
);
const ZZZ_SQUARE_BANGBOO_PATH = path.join(
imageResourcesPath,
'bangboo_square_avatar'
@ -65,6 +69,24 @@ export const getSquareAvatar = async charID => {
return download;
};
/**
* 获取角色头像小方形
* @param {string | number} charID
* @returns Promise<string>
* @returns {Promise<string>}
*/
export const getSmallSquareAvatar = async charID => {
const sprite = char.IDToCharSprite(charID);
if (!sprite) return null;
const filename = `IconRoleGeneral${sprite}.png`;
const avatarPath = path.join(ZZZ_SMALL_SQUARE_AVATAR_PATH, filename);
if (fs.existsSync(avatarPath)) return avatarPath;
const url = await getResourceRemotePath('role_general', filename);
const savePath = avatarPath;
const download = await downloadFile(url, savePath);
return download;
};
/**
* 获取邦布头像方形
* @param {string | number} bangbooId