aboutsummaryrefslogtreecommitdiff
path: root/src/features/dungeonMap2/DungeonRoomStaticData.js
blob: 75d5b1ea1e578bc42111817141192120d7403177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class DungeonRoomStaticData {
    constructor() {
        this.fullRoomData = JSON.parse(FileLib.read("SoopyV2", "data/roomdata.json"))

        this.idMap = new Map()
        this.fullRoomData.forEach((d, i) => {
            d.id.forEach(id => {
                this.idMap.set(id, i)
            })
            this.idMap.set(d.index, i)
        })
    }

    getDataFromId(id) {
        return this.fullRoomData[this.idMap.get(id)]
    }
}

export default new DungeonRoomStaticData()