enkanetwork
Version:
API wrapper for enka.network written on TypeScript which provides localization, caching and convenience
21 lines (20 loc) • 836 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeaponFinder = void 0;
const errors_1 = require("../../errors");
class WeaponFinder {
localization;
constructor(localization) {
this.localization = localization;
}
getName(nameTextMapHash, language) {
const nameLocalizations = this.localization[nameTextMapHash];
if (!nameLocalizations)
throw new errors_1.NoLocalizationAssetsFound(`There is no localization for weapon with nameTextMapHash = ${nameTextMapHash}! (check the actuality of assets)`);
const name = nameLocalizations[language];
if (!name)
throw new errors_1.NoLanguageFound("This language is not downloaded! Check the AssetsUpdater settings");
return name;
}
}
exports.WeaponFinder = WeaponFinder;