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:

65 lines (64 loc) 2.66 kB
"use strict"; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProfilePicture = void 0; const Client_1 = require("../client/Client"); const ImageAssets_1 = require("../models/assets/ImageAssets"); const CharacterCostume_1 = require("../models/character/CharacterCostume"); const CharacterInfo_1 = require("../models/character/CharacterInfo"); /** * Class of character's profile picture */ class ProfilePicture { /** * Create a ProfilePicture * @param profilePictureId Profile picture ID */ constructor(profilePictureId) { this.id = profilePictureId; const profilePictureJson = Client_1.Client._getJsonFromCachedExcelBinOutput('ProfilePictureExcelConfigData', this.id); const unlockParam = profilePictureJson.unlockParam; switch (profilePictureJson.type) { case 'PROFILE_PICTURE_UNLOCK_BY_AVATAR': this.characterId = unlockParam; this.costumeId = new CharacterInfo_1.CharacterInfo(unlockParam).defaultCostumeId; break; case 'PROFILE_PICTURE_UNLOCK_BY_COSTUME': this.costumeId = unlockParam; this.characterId = new CharacterCostume_1.CharacterCostume(unlockParam).characterId; break; case 'PROFILE_PICTURE_UNLOCK_BY_ITEM': this.materialId = unlockParam; break; case 'PROFILE_PICTURE_UNLOCK_BY_PARENT_QUEST': this.questId = unlockParam; break; } this.icon = new ImageAssets_1.ImageAssets(profilePictureJson.iconPath); this.type = profilePictureJson.type; } /** * Get all profile picture IDs * @returns Profile picture IDs */ static get allProfilePictureIds() { return Object.keys(Client_1.Client._getCachedExcelBinOutputByName('ProfilePictureExcelConfigData')).map((id) => Number(id)); } /** * Find profile picture ID by info ID * @param unlockParam Costume ID or Character ID or Material ID or Quest ID * @returns Profile picture ID */ static findProfilePictureIdByUnlockParam(unlockParam) { const profilePictureDatas = Object.values(Client_1.Client._getCachedExcelBinOutputByName('ProfilePictureExcelConfigData')); const profilePictureData = profilePictureDatas.find((data) => data.unlockParam === unlockParam); if (!profilePictureData) return; return profilePictureData.id; } } exports.ProfilePicture = ProfilePicture; _a = ProfilePicture; (() => { Client_1.Client._addExcelBinOutputKeyFromClassPrototype(_a.prototype); })();