@skullandbonestools/snbdata
Version:
Inofficial data package for the Skull and Bones game by Ubisoft.
25 lines • 905 B
JavaScript
import worldEventsData from '../../data/worldEvents.json';
import { Events } from './events';
import { Factions } from './factions';
export class WorldEvent {
constructor(id, type, faction, event) {
this.id = id;
this.type = type;
this.faction = faction;
this.event = event;
}
static fromRawData(rawData) {
const faction = rawData.faction;
const event = rawData.event;
return new WorldEvent(rawData.id, rawData.type, faction ? Factions[faction] : undefined, event ? Events[event] : undefined);
}
static loadWorldEvents() {
const worldEvents = {};
for (const [key, value] of Object.entries(worldEventsData)) {
worldEvents[key] = WorldEvent.fromRawData(value);
}
return worldEvents;
}
}
export const WorldEvents = WorldEvent.loadWorldEvents();
//# sourceMappingURL=worldEvents.js.map