aboutsummaryrefslogtreecommitdiff
path: root/src/features/dungeonMap2/DungeonRoomStaticData.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/dungeonMap2/DungeonRoomStaticData.js')
-rw-r--r--src/features/dungeonMap2/DungeonRoomStaticData.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/features/dungeonMap2/DungeonRoomStaticData.js b/src/features/dungeonMap2/DungeonRoomStaticData.js
new file mode 100644
index 0000000..75d5b1e
--- /dev/null
+++ b/src/features/dungeonMap2/DungeonRoomStaticData.js
@@ -0,0 +1,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() \ No newline at end of file