diff --git a/package-lock.json b/package-lock.json index b48d1b6..7b49ac7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -510,9 +510,9 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { @@ -526,9 +526,9 @@ } }, "node_modules/@prisma/client": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.16.1.tgz", - "integrity": "sha512-wM9SKQjF0qLxdnOZIVAIMKiz6Hu7vDt4FFAih85K1dk/Rr2mdahy6d3QP41K62N9O0DJJA//gUDA3Mp49xsKIg==", + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.16.2.tgz", + "integrity": "sha512-+1lmkhR9gHWcTC5oghm2ZKpWljyWdzfazCVlLKUWXVmwHSf52g81aZ8qb6Km5Bs025yBi7puLp3qSLEvktoUtw==", "hasInstallScript": true, "license": "Apache-2.0", "engines": { @@ -544,22 +544,22 @@ } }, "node_modules/@prisma/debug": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.16.1.tgz", - "integrity": "sha512-JsNgZAg6BD9RInLSrg7ZYzo11N7cVvYArq3fHGSD89HSgtN0VDdjV6bib7YddbcO6snzjchTiLfjeTqBjtArVQ==", + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.16.2.tgz", + "integrity": "sha512-ItzB4nR4O8eLzuJiuP3WwUJfoIvewMHqpGCad+64gvThcKEVOtaUza9AEJo2DPqAOa/AWkFyK54oM4WwHeew+A==", "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.16.1.tgz", - "integrity": "sha512-KkyF3eIUtBIyp5A/rJHCtwQO18OjpGgx18PzjyGcJDY/+vNgaVyuVd+TgwBgeq6NLdd1XMwRCI+58vinHsAdfA==", + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.16.2.tgz", + "integrity": "sha512-qUxwMtrwoG3byd4PbX6T7EjHJ8AUhzTuwniOGkh/hIznBfcE2QQnGakyEq4VnwNuttMqvh/GgPFapHQ3lCuRHg==", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.16.1", + "@prisma/debug": "5.16.2", "@prisma/engines-version": "5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303", - "@prisma/fetch-engine": "5.16.1", - "@prisma/get-platform": "5.16.1" + "@prisma/fetch-engine": "5.16.2", + "@prisma/get-platform": "5.16.2" } }, "node_modules/@prisma/engines-version": { @@ -569,23 +569,23 @@ "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.16.1.tgz", - "integrity": "sha512-oOkjaPU1lhcA/Rvr4GVfd1NLJBwExgNBE36Ueq7dr71kTMwy++a3U3oLd2ZwrV9dj9xoP6LjCcky799D9nEt4w==", + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.16.2.tgz", + "integrity": "sha512-sq51lfHKfH2jjYSjBtMjP+AznFqOJzXpqmq6B9auWrlTJrMgZ7lPyhWUW7VU7LsQU48/TJ+DZeIz8s9bMYvcHg==", "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.16.1", + "@prisma/debug": "5.16.2", "@prisma/engines-version": "5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303", - "@prisma/get-platform": "5.16.1" + "@prisma/get-platform": "5.16.2" } }, "node_modules/@prisma/get-platform": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.16.1.tgz", - "integrity": "sha512-R4IKnWnMkR2nUAbU5gjrPehdQYUUd7RENFD2/D+xXTNhcqczp0N+WEGQ3ViyI3+6mtVcjjNIMdnUTNyu3GxIgA==", + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.16.2.tgz", + "integrity": "sha512-cXiHPgNLNyj22vLouPVNegklpRL/iX2jxTeap5GRO3DmCoVyIHmJAV1CgUMUJhHlcol9yYy7EHvsnXTDJ/PKEA==", "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.16.1" + "@prisma/debug": "5.16.2" } }, "node_modules/@socket.io/component-emitter": { @@ -1910,13 +1910,13 @@ } }, "node_modules/prisma": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.16.1.tgz", - "integrity": "sha512-Z1Uqodk44diztImxALgJJfNl2Uisl9xDRvqybMKEBYJLNKNhDfAHf+ZIJbZyYiBhLMbKU9cYGdDVG5IIXEnL2Q==", + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.16.2.tgz", + "integrity": "sha512-rFV/xoBR2hBGGlu4LPLQd4U8WVA+tSAmYyFWGPRVfj+xg7N4kiZV4lSk38htSpF+/IuHKzlrbh4SFk8Z18cI8A==", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "5.16.1" + "@prisma/engines": "5.16.2" }, "bin": { "prisma": "build/index.js" diff --git a/prisma/migrations/20240707121012_init/migration.sql b/prisma/migrations/20240709223858_init/migration.sql similarity index 89% rename from prisma/migrations/20240707121012_init/migration.sql rename to prisma/migrations/20240709223858_init/migration.sql index d168782..bc0692c 100644 --- a/prisma/migrations/20240707121012_init/migration.sql +++ b/prisma/migrations/20240709223858_init/migration.sql @@ -87,6 +87,18 @@ CREATE TABLE `ZoneObject` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `zoneId` INTEGER NOT NULL, `objectId` VARCHAR(191) NOT NULL, + `depth` INTEGER NOT NULL, + `position_x` INTEGER NOT NULL, + `position_y` INTEGER NOT NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `ZoneEventTile` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `zoneId` INTEGER NOT NULL, + `type` ENUM('BLOCK', 'WARP', 'NPC', 'ITEM') NOT NULL, `position_x` INTEGER NOT NULL, `position_y` INTEGER NOT NULL, @@ -122,6 +134,9 @@ ALTER TABLE `ZoneObject` ADD CONSTRAINT `ZoneObject_zoneId_fkey` FOREIGN KEY (`z -- AddForeignKey ALTER TABLE `ZoneObject` ADD CONSTRAINT `ZoneObject_objectId_fkey` FOREIGN KEY (`objectId`) REFERENCES `Object`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; +-- AddForeignKey +ALTER TABLE `ZoneEventTile` ADD CONSTRAINT `ZoneEventTile_zoneId_fkey` FOREIGN KEY (`zoneId`) REFERENCES `Zone`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + -- AddForeignKey ALTER TABLE `Chat` ADD CONSTRAINT `Chat_characterId_fkey` FOREIGN KEY (`characterId`) REFERENCES `Character`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 8a93c81..cfa0898 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -85,6 +85,7 @@ model Zone { width Int height Int tiles Json + zoneEventTiles ZoneEventTile[] zoneObjects ZoneObject[] characters Character[] chats Chat[] @@ -98,6 +99,23 @@ model ZoneObject { zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade) objectId String object Object @relation(fields: [objectId], references: [id]) + depth Int + position_x Int + position_y Int +} + +enum ZoneEventTileType { + BLOCK + WARP + NPC + ITEM +} + +model ZoneEventTile { + id Int @id @default(autoincrement()) + zoneId Int + zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade) + type ZoneEventTileType position_x Int position_y Int } diff --git a/src/app/repositories/ZoneRepository.ts b/src/app/repositories/ZoneRepository.ts index 07965fe..333fe56 100644 --- a/src/app/repositories/ZoneRepository.ts +++ b/src/app/repositories/ZoneRepository.ts @@ -74,6 +74,7 @@ class ZoneRepository { // Save new zone objects create: objects.map(obj => ({ objectId: obj.objectId, + depth: obj.depth, position_x: obj.position_x, position_y: obj.position_y }))