enkanetwork
Version:
API wrapper for enka.network written on TypeScript which provides localization, caching and convenience
33 lines (32 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CharacterWeapon = void 0;
class CharacterWeapon {
id;
level;
elevations;
improvement;
rarity;
mainStat;
subStat;
icon;
// The "awakened"/ascended art (`{icon}_Awaken`). Exposed so renderers don't have
// to string-derive it — and so it is cacheable by the FileSystemAdapter.
awakenIcon;
name;
constructor(assets, language, equipment) {
this.id = equipment.itemId;
this.name = assets.weapons.getName(+equipment.flat.nameTextMapHash, language);
this.icon = assets.getAssetPath(equipment.flat.icon);
this.awakenIcon = assets.getAssetPath(`${equipment.flat.icon}_Awaken`);
this.level = equipment.weapon.level;
this.elevations = equipment.weapon.promoteLevel || 0;
this.improvement = equipment.weapon.affixMap
? equipment.weapon.affixMap[Object.keys(equipment.weapon.affixMap)[0]] + 1
: 1;
this.rarity = equipment.flat.rankLevel;
this.mainStat = equipment.flat.weaponStats[0];
this.subStat = equipment.flat.weaponStats[1] || null;
}
}
exports.CharacterWeapon = CharacterWeapon;