UNPKG

enka-network-api

Version:

Enka-network API wrapper for Genshin Impact.

26 lines (25 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpgradeCost = void 0; const config_file_js_1 = require("config_file.js"); const Material_1 = require("./Material"); const ts_utils_1 = require("../../utils/ts_utils"); const ExcelTransformer_1 = require("../../client/ExcelTransformer"); class UpgradeCost { constructor(coinCost, costItems, enka) { this.enka = enka; this.coin = coinCost; const itemsJson = new config_file_js_1.JsonReader(ExcelTransformer_1.excelJsonOptions, costItems); this.items = itemsJson.mapArray((_, cost) => { const materialId = cost.getAsNumberWithDefault(0, "id"); if (materialId === 0) return null; const count = cost.getAsNumber("count"); return { material: Material_1.Material.getMaterialById(materialId, enka), count, }; }).filter(ts_utils_1.nonNullable); } } exports.UpgradeCost = UpgradeCost;