enkanetwork
Version:
API wrapper for enka.network written on TypeScript which provides localization, caching and convenience
29 lines (28 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfilePicture = void 0;
class ProfilePicture {
// The id sent by the game: a ProfilePictureExcelConfigData id (modern) or a character id (legacy).
id;
// Name in the selected language
name;
// Icon
icon;
constructor(assets, language, profilePicture) {
// Modern accounts send `{ id }` (a ProfilePictureExcelConfigData id);
// legacy accounts send `{ avatarId }` (a character id).
if (profilePicture.id !== undefined) {
const asset = assets.profilePictures.getById(profilePicture.id);
this.id = profilePicture.id;
this.name = assets.profilePictures.getName(asset, language);
this.icon = assets.getAssetPath(asset.iconName);
}
else {
const character = assets.characters.getById(profilePicture.avatarId);
this.id = profilePicture.avatarId;
this.name = assets.characters.getName(character, language);
this.icon = assets.getAssetPath(character.iconName);
}
}
}
exports.ProfilePicture = ProfilePicture;