enka-network-api
Version:
Enka-network API wrapper for Genshin Impact.
25 lines (24 loc) • 1.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Element = exports.elementList = void 0;
const config_file_js_1 = require("config_file.js");
const AssetsNotFoundError_1 = require("../errors/AssetsNotFoundError");
const TextAssets_1 = require("./assets/TextAssets");
const ExcelTransformer_1 = require("../client/ExcelTransformer");
exports.elementList = [null, "Fire", "Water", "Grass", "Electric", "Ice", null, "Wind", "Rock"];
class Element {
constructor(data, enka) {
this._data = data;
this.enka = enka;
const json = new config_file_js_1.JsonReader(ExcelTransformer_1.excelJsonOptions, this._data);
this.id = json.getAsString("textMapId");
this.name = new TextAssets_1.TextAssets(json.getAsNumber("textMapContentTextMapHash"), enka);
}
static getByElementType(elementType, enka) {
const data = enka.cachedAssetsManager.getExcelData("ManualTextMapConfigData", elementType);
if (!data)
throw new AssetsNotFoundError_1.AssetsNotFoundError("Element", elementType);
return new Element(data, enka);
}
}
exports.Element = Element;
;