mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
feat: 练度统计
This commit is contained in:
parent
b44c9caa47
commit
cb9c31f27c
15 changed files with 845 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue