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:
49 lines (48 loc) • 2.32 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlayerDetail = void 0;
const CharacterPreview_1 = require("../../models/enka/CharacterPreview");
const Material_1 = require("../../models/Material");
const ProfilePicture_1 = require("../../models/ProfilePicture");
/**
* Class of player obtained from EnkaNetwork
*/
class PlayerDetail {
/**
* Create a PlayerDetail
* @param data Data from EnkaNetwork
*/
constructor(data) {
var _a, _b, _c, _d;
this.nickname = data.nickname || '';
this.level = data.level;
this.signature = data.signature || '';
this.worldLevel = data.worldLevel || 0;
this.nameCard = new Material_1.Material(data.nameCardId);
this.finishAchievementNum = data.finishAchievementNum || 0;
this.towerFloorIndex = data.towerFloorIndex || 0;
this.towerLevelIndex = data.towerLevelIndex || 0;
this.towerStarIndex = data.towerStarIndex || 0;
this.characterPreviews = data.showAvatarInfoList
? data.showAvatarInfoList.map((v) => new CharacterPreview_1.CharacterPreview(v))
: [];
this.showNameCards = data.showNameCardIdList
? data.showNameCardIdList.map((id) => new Material_1.Material(id))
: [];
let profilePictureId;
if (data.profilePicture && data.profilePicture.id) {
profilePictureId = data.profilePicture.id;
}
else {
profilePictureId = ProfilePicture_1.ProfilePicture.findProfilePictureIdByUnlockParam((_d = (_b = (_a = data.profilePicture) === null || _a === void 0 ? void 0 : _a.costumeId) !== null && _b !== void 0 ? _b : (_c = data.profilePicture) === null || _c === void 0 ? void 0 : _c.avatarId) !== null && _d !== void 0 ? _d : 10000005);
}
this.profilePicture = new ProfilePicture_1.ProfilePicture(profilePictureId || 1);
this.maxFriendshipCharactersCount = data.fetterCount || 0;
this.theaterActIndex = data.theaterActIndex || 0;
this.theaterModeIndex = data.theaterModeIndex || 0;
this.theaterStarIndex = data.theaterStarIndex || 0;
this.isShowCharacterPreviewConstellation = data.isShowAvatarTalent || false;
this.data = data;
}
}
exports.PlayerDetail = PlayerDetail;