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:

66 lines (65 loc) 2.51 kB
"use strict"; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.CharacterVoice = void 0; const Client_1 = require("../../client/Client"); const AudioAssets_1 = require("../../models/assets/AudioAssets"); /** * Class of character's voice */ class CharacterVoice { /** * Create a CharacterVoice * @param fetterId Fetter ID in the voice * @param cv CV language */ constructor(fetterId, cv) { /** * Costume IDs to hide this */ this.hideCostumeIds = []; /** * Costume IDs to show this */ this.showCostumeIds = []; this.fetterId = fetterId; this.cv = cv; const fetterVoiceJson = Client_1.Client._getJsonFromCachedExcelBinOutput('FettersExcelConfigData', fetterId); this.hideCostumeIds = fetterVoiceJson.hideCostumeIds; this.showCostumeIds = fetterVoiceJson.showCostumeIds; this.characterId = fetterVoiceJson.avatarId; this.type = fetterVoiceJson.type; this.title = Client_1.Client._cachedTextMap.get(String(fetterVoiceJson.voiceTitleTextMapHash)) || ''; this.content = Client_1.Client._cachedTextMap.get(String(fetterVoiceJson.voiceFileTextTextMapHash)) || ''; this.tips = fetterVoiceJson.tips .map((tip) => Client_1.Client._cachedTextMap.get(String(tip))) .filter((tip) => tip !== undefined); this.audio = new AudioAssets_1.AudioAssets(fetterVoiceJson.voiceFile, cv, this.characterId); } /** * Get all Fetter IDs in the voice * @returns All Fetter IDs in the voice */ static get allFetterIds() { const fetterVoicesJson = Object.values(Client_1.Client._getCachedExcelBinOutputByName('FettersExcelConfigData')); return fetterVoicesJson.map((voice) => voice.fetterId); } /** * Get all Fetter IDs in the character's voice * @param characterId Character ID * @returns All Fetter IDs in the character's voice */ static getAllFetterIdsByCharacterId(characterId) { const fetterVoicesJson = Object.values(Client_1.Client._getCachedExcelBinOutputByName('FettersExcelConfigData')); return fetterVoicesJson .filter((voice) => voice.avatarId === characterId) .map((voice) => voice.fetterId); } } exports.CharacterVoice = CharacterVoice; _a = CharacterVoice; (() => { Client_1.Client._addExcelBinOutputKeyFromClassPrototype(_a.prototype); })();