UNPKG

genshin-manager

Version:

<div align="center"> <p> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https://img.shields.io/npm/v/genshin-manager.svg?maxAge=3600" alt="npm version" /></a> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https:

54 lines (53 loc) 2.16 kB
"use strict"; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.CharacterConstellation = void 0; const Client_1 = require("../../client/Client"); const ImageAssets_1 = require("../../models/assets/ImageAssets"); /** * Class of character's constellation */ class CharacterConstellation { /** * Create a Constellation * @param constellationId Constellation ID * @param locked Whether the constellation is locked */ constructor(constellationId, locked = false) { this.id = constellationId; this.locked = locked; const talentJson = Client_1.Client._getJsonFromCachedExcelBinOutput('AvatarTalentExcelConfigData', this.id); this.name = Client_1.Client._cachedTextMap.get(String(talentJson.nameTextMapHash)) || ''; this.description = Client_1.Client._cachedTextMap.get(String(talentJson.descTextMapHash)) || ''; this.icon = new ImageAssets_1.ImageAssets(talentJson.icon); } /** * Get all constellation IDs * @returns All constellation IDs */ static get allConstellationIds() { const talentDatas = Object.values(Client_1.Client._getCachedExcelBinOutputByName('AvatarTalentExcelConfigData')); return talentDatas.map((data) => data.talentId); } /** * Get constellation IDs by character ID * @param characterId Character ID * @param skillDepotId Skill depot ID * @returns Constellation IDs */ static getConstellationIdsByCharacterId(characterId, skillDepotId) { const avatarJson = Client_1.Client._getJsonFromCachedExcelBinOutput('AvatarExcelConfigData', characterId); const depotId = skillDepotId && [10000005, 10000007].includes(characterId) ? skillDepotId : avatarJson.skillDepotId; const depotJson = Client_1.Client._getJsonFromCachedExcelBinOutput('AvatarSkillDepotExcelConfigData', depotId); return depotJson.talents; } } exports.CharacterConstellation = CharacterConstellation; _a = CharacterConstellation; (() => { Client_1.Client._addExcelBinOutputKeyFromClassPrototype(_a.prototype); })();