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:
55 lines (54 loc) • 2.19 kB
JavaScript
;
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CharacterStory = void 0;
const Client_1 = require("../../client/Client");
/**
* Class of character's story
*/
class CharacterStory {
/**
* Create a CharacterStories
* @param fetterId Fetter ID in the story
*/
constructor(fetterId) {
this.fetterId = fetterId;
const fetterStoryJson = Client_1.Client._getJsonFromCachedExcelBinOutput('FetterStoryExcelConfigData', fetterId);
this.characterId = fetterStoryJson.avatarId;
this.title =
Client_1.Client._cachedTextMap.get(String(fetterStoryJson.storyTitleTextMapHash)) ||
Client_1.Client._cachedTextMap.get(String(fetterStoryJson.storyTitle2TextMapHash)) ||
'';
this.content =
Client_1.Client._cachedTextMap.get(String(fetterStoryJson.storyContextTextMapHash)) ||
Client_1.Client._cachedTextMap.get(String(fetterStoryJson.storyContext2TextMapHash)) ||
'';
this.tips = fetterStoryJson.tips
.map((tip) => Client_1.Client._cachedTextMap.get(String(tip)))
.filter((tip) => tip !== undefined);
}
/**
* Get all Fetter IDs in the story
* @returns All Fetter IDs in the story
*/
static get allFetterIds() {
const fetterStoriesJson = Object.values(Client_1.Client._getCachedExcelBinOutputByName('FetterStoryExcelConfigData'));
return fetterStoriesJson.map((story) => story.fetterId);
}
/**
* Get all Fetter IDs in the character's story
* @param characterId Character ID
* @returns All fetter IDs in the character's story
*/
static getAllFetterIdsByCharacterId(characterId) {
const fetterStoriesJson = Object.values(Client_1.Client._getCachedExcelBinOutputByName('FetterStoryExcelConfigData'));
return fetterStoriesJson
.filter((story) => story.avatarId === characterId)
.map((story) => story.fetterId);
}
}
exports.CharacterStory = CharacterStory;
_a = CharacterStory;
(() => {
Client_1.Client._addExcelBinOutputKeyFromClassPrototype(_a.prototype);
})();