mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
data: 添加HAKUSH数据下载/建模
This commit is contained in:
parent
d082c87809
commit
1c4798f9b8
7 changed files with 491 additions and 9 deletions
9
lib/assets/hakushurl.js
Normal file
9
lib/assets/hakushurl.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export const HAKUSH_BASE = 'https://api.hakush.in/zzz',
|
||||
HAKUSH_API = `${HAKUSH_BASE}/data/zh`;
|
||||
|
||||
export const ZZZ_CHARACTER = HAKUSH_API + '/character',
|
||||
ZZZ_WEAPON = HAKUSH_API + '/weapon';
|
||||
|
||||
export const ZZZ_NEW = `${HAKUSH_BASE}/new.json`,
|
||||
ZZZ_ALL_CHAR = `${HAKUSH_BASE}/data/character.json`,
|
||||
ZZZ_ALL_WEAPON = `${HAKUSH_BASE}/data/weapon.json`;
|
||||
7
lib/assets/mysurl.js
Normal file
7
lib/assets/mysurl.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// Resource
|
||||
export const ZZZ_RES = 'https://act-webstatic.mihoyo.com/game_record/zzz',
|
||||
ZZZ_SQUARE_AVATAR = `${ZZZ_RES}/role_square_avatar`,
|
||||
ZZZ_SQUARE_BANGBOO = `${ZZZ_RES}/bangboo_rectangle_avatar`;
|
||||
export const NEW_ZZZ_RES = 'https://act-webstatic.mihoyo.com/game_record/nap',
|
||||
NEW_ZZZ_SQUARE_AVATAR = `${NEW_ZZZ_RES}/role_square_avatar`,
|
||||
NEW_ZZZ_SQUARE_BANGBOO = `${NEW_ZZZ_RES}/bangboo_rectangle_avatar`;
|
||||
|
|
@ -2,6 +2,7 @@ import * as convert from './convert.js';
|
|||
import {
|
||||
downloadMysImage,
|
||||
downloadResourceImage,
|
||||
downloadHakushFile,
|
||||
} from './download/download.js';
|
||||
|
||||
/**
|
||||
|
|
@ -130,3 +131,33 @@ export const getSuit3DImage = async suitId => {
|
|||
);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取Hakush角色数据
|
||||
* @param {string} charId
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
export const getHakushCharacter = async charId => {
|
||||
const filename = `${charId}.json`;
|
||||
const result = await downloadHakushFile(
|
||||
'ZZZ_CHARACTER',
|
||||
'HAKUSH_CHARACTER_DATA_PATH',
|
||||
filename
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取Hakush武器数据
|
||||
* @param {string} weaponId
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
export const getHakushWeapon = async weaponId => {
|
||||
const filename = `${weaponId}.json`;
|
||||
const result = await downloadHakushFile(
|
||||
'ZZZ_WEAPON',
|
||||
'HAKUSH_WEAPON_DATA_PATH',
|
||||
filename
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,3 +16,9 @@ export const ZZZ_SQUARE_AVATAR_PATH = path.join(
|
|||
ZZZ_SUIT_3D_PATH = path.join(imageResourcesPath, 'suit_3d'),
|
||||
ZZZ_SUIT_PATH = path.join(imageResourcesPath, 'suit');
|
||||
// const ZZZ_GUIDES_PATH = path.join(imageResourcesPath, 'guides');
|
||||
|
||||
export const HAKUSH_CHARACTER_DATA_PATH = path.join(
|
||||
imageResourcesPath,
|
||||
'hakush/data/character'
|
||||
),
|
||||
HAKUSH_WEAPON_DATA_PATH = path.join(imageResourcesPath, 'hakush/data/weapon');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import path from 'path';
|
||||
import { checkFile } from './core.js';
|
||||
import { getResourceRemotePath } from '../assets.js';
|
||||
import * as MysURL from '../mysapi/api.js';
|
||||
import * as MysURL from '../assets/mysurl.js';
|
||||
import * as HakushURL from '../assets/hakushurl.js';
|
||||
import * as LocalURI from './const.js';
|
||||
/**
|
||||
* 下载米游社图片
|
||||
|
|
@ -55,3 +56,20 @@ export const downloadResourceImage = async (
|
|||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 下载Hakush文件
|
||||
* @param {keyof HakushURL} base 远程地址
|
||||
* @param {keyof LocalURI} localBase 本地地址
|
||||
* @param {string} filename 文件名
|
||||
*/
|
||||
export const downloadHakushFile = async (base, localBase, filename = '') => {
|
||||
base = HakushURL[base];
|
||||
localBase = LocalURI[localBase];
|
||||
const finalPath = path.join(localBase, filename);
|
||||
let url = base;
|
||||
if (filename) {
|
||||
url += `/${filename}`;
|
||||
}
|
||||
return checkFile(url, finalPath);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,14 +11,6 @@ export const ZZZ_API = `${NEW_URL}/event/game_record_zzz/api/zzz`,
|
|||
ZZZ_BIND_API = `${OLD_URL}/binding/api`,
|
||||
ZZZ_GAME_INFO_API = `${ZZZ_BIND_API}/getUserGameRolesByCookie?game_biz=nap_cn`;
|
||||
|
||||
// Resource
|
||||
export const ZZZ_RES = 'https://act-webstatic.mihoyo.com/game_record/zzz',
|
||||
ZZZ_SQUARE_AVATAR = `${ZZZ_RES}/role_square_avatar`,
|
||||
ZZZ_SQUARE_BANGBOO = `${ZZZ_RES}/bangboo_rectangle_avatar`;
|
||||
export const NEW_ZZZ_RES = 'https://act-webstatic.mihoyo.com/game_record/nap',
|
||||
NEW_ZZZ_SQUARE_AVATAR = `${NEW_ZZZ_RES}/role_square_avatar`,
|
||||
NEW_ZZZ_SQUARE_BANGBOO = `${NEW_ZZZ_RES}/bangboo_rectangle_avatar`;
|
||||
|
||||
export const PUBLIC_API = 'https://public-operation-nap.mihoyo.com',
|
||||
PUBILC_GACHA_LOG_API = `${PUBLIC_API}/common/gacha_record/api`,
|
||||
ZZZ_GET_GACHA_LOG_API = `${PUBILC_GACHA_LOG_API}/getGachaLog`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue