UNPKG

starrail-manager

Version:

The StarRail Manager is a Node.js wrapper for the MiHoMo API and StarRail Data used in Honkai: StarRail.\ **This is not an official Honkai: StarRail project.**

41 lines 1.51 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LightCone = void 0; const config_1 = require("../config"); const fs_1 = __importDefault(require("fs")); const languages = ["cht", "cn", "de", "en", "es", "fr", "id", "jp", "kr", "pt", "ru", "th", "vi"]; /** * get light cone data */ class LightCone { constructor(options = {}) { var _a; this.lang = (_a = options.lang) !== null && _a !== void 0 ? _a : "en"; if (!languages.includes(this.lang)) { throw new Error(`The Language is not supported: ${options.lang}`); } } /** * get light cone base data from StarRailRes * @param id - light cone id * @returns light cone data in json */ getData(id) { const light_cone = JSON.parse(fs_1.default.readFileSync(`${config_1.config.StarRailPath}/index_min/${this.lang}/light_cones.json`, "utf-8")); return light_cone[id]; } /** * get light cone other data from StarRailRes * @param id - light cone id * @returns light cone data in json */ getRank(id) { const light_cone = JSON.parse(fs_1.default.readFileSync(`${config_1.config.StarRailPath}/index_min/${this.lang}/light_cone_ranks.json`, "utf-8")); return light_cone[id]; } } exports.LightCone = LightCone; //# sourceMappingURL=light_cone.js.map