@skullandbonestools/snbdata
Version:
Inofficial data package for the Skull and Bones game by Ubisoft.
26 lines • 1 kB
JavaScript
import factionsData from "../../data/factions.json";
import { Events } from "./events";
import { Seasons } from "./seasons";
export class Faction {
constructor(id, firstAppearingSeason, event, dateAdded, lastUpdated) {
this.id = id;
this.firstAppearingSeason = firstAppearingSeason;
this.event = event;
this.dateAdded = dateAdded;
this.lastUpdated = lastUpdated;
}
static fromRawData(rawData) {
const season = rawData.firstAppearingSeason;
const event = rawData.event;
return new Faction(rawData.id, Seasons[season], event ? Events[event] : undefined, new Date(rawData.dateAdded), new Date(rawData.lastUpdated));
}
static loadFactions() {
const factions = {};
for (const [key, value] of Object.entries(factionsData)) {
factions[key] = Faction.fromRawData(value);
}
return factions;
}
}
export const Factions = Faction.loadFactions();
//# sourceMappingURL=factions.js.map