feat: 角色天赋图鉴(支持自定义等级)

This commit is contained in:
bietiaop 2024-09-02 16:22:23 +08:00
parent 4f02e6b2ce
commit 15b14eece4
23 changed files with 937 additions and 124 deletions

19
lib/hakush.js Normal file
View file

@ -0,0 +1,19 @@
import { Character } from '../model/hakush/character.js';
import * as convert from './convert.js';
import { getHakushCharacter } from './download.js';
export const getHakushCharacterData = async alias => {
const name = convert.char.aliasToName(alias);
const id = convert.char.charNameToID(name);
if (!id) return null;
const data = await getHakushCharacter(id);
if (!data) return null;
const result = new Character(data);
return result;
};
export const isSkillLevelLegal = (key, level) => {
if (key === 'CoreLevel') {
return !!level && level >= 0 && level <= 6;
}
return !!level && level >= 1 && level <= 12;
};