@runejs/filestore
Version:
Tools for managing the RuneJS filestore.
36 lines (35 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadXteaRegionFiles = exports.createXteaRegion = exports.XteaRegion = void 0;
const fs_1 = require("@runejs/common/fs");
class XteaRegion {
mapsquare;
key;
archive;
group;
name;
name_hash;
constructor(mapsquare, key, archive, group, name, name_hash) {
this.mapsquare = mapsquare;
this.key = key;
this.archive = archive;
this.group = group;
this.name = name;
this.name_hash = name_hash;
}
}
exports.XteaRegion = XteaRegion;
const createXteaRegion = (config) => new XteaRegion(config.mapsquare, config.key, config.archive, config.group, config.name, config.name_hash);
exports.createXteaRegion = createXteaRegion;
const loadXteaRegionFiles = async (path) => {
const regions = {};
const files = await (0, fs_1.loadConfigurationFiles)(path);
for (const file of files) {
for (const region of file) {
const xteaRegion = (0, exports.createXteaRegion)(region);
regions[xteaRegion.name] = xteaRegion;
}
}
return regions;
};
exports.loadXteaRegionFiles = loadXteaRegionFiles;