Added equipment tables and columns in game & user schema

This commit is contained in:
Dennis Postma 2024-12-17 16:59:52 +01:00
parent 3b0138130b
commit 4748044ab3
3 changed files with 87 additions and 98 deletions

82
package-lock.json generated
View File

@ -972,24 +972,6 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/call-bind": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
"integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==",
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.0",
"es-define-property": "^1.0.0",
"get-intrinsic": "^1.2.4",
"set-function-length": "^1.2.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/call-bind-apply-helpers": { "node_modules/call-bind-apply-helpers": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz",
@ -1004,13 +986,13 @@
} }
}, },
"node_modules/call-bound": { "node_modules/call-bound": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.2.tgz", "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz",
"integrity": "sha512-0lk0PHFe/uz0vl527fG9CgdE9WdafjDbCXvBbs+LUv000TVt2Jjhqbs4Jwm8gz070w8xXyEAxrPOMullsxXeGg==", "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"call-bind": "^1.0.8", "call-bind-apply-helpers": "^1.0.1",
"get-intrinsic": "^1.2.5" "get-intrinsic": "^1.2.6"
}, },
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
@ -1178,23 +1160,6 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"node_modules/define-data-property": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"gopd": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/denque": { "node_modules/denque": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
@ -1255,12 +1220,12 @@
} }
}, },
"node_modules/dunder-proto": { "node_modules/dunder-proto": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==", "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"call-bind-apply-helpers": "^1.0.0", "call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0", "es-errors": "^1.3.0",
"gopd": "^1.2.0" "gopd": "^1.2.0"
}, },
@ -1585,18 +1550,6 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/has-property-descriptors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": { "node_modules/has-symbols": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
@ -2468,23 +2421,6 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
"license": "MIT",
"dependencies": {
"define-data-property": "^1.1.4",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/setprototypeof": { "node_modules/setprototypeof": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",

View File

@ -45,8 +45,30 @@ model Item {
id String @id @default(uuid()) id String @id @default(uuid())
name String name String
description String? description String?
itemType ItemType
stackable Boolean @default(false) stackable Boolean @default(false)
rarity ItemRarity @default(COMMON)
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
characters CharacterItem[] characters CharacterItem[]
equipment EquippedCharacterItem[]
}
enum ItemType {
WEAPON
HELMET
CHEST
LEGS
BOOTS
GLOVES
RING
NECKLACE
}
enum ItemRarity {
COMMON
UNCOMMON
RARE
EPIC
LEGENDARY
} }

View File

@ -50,7 +50,6 @@ model CharacterHair {
sprite Sprite? @relation(fields: [spriteId], references: [id], onDelete: Cascade) sprite Sprite? @relation(fields: [spriteId], references: [id], onDelete: Cascade)
spriteId String? spriteId String?
characters Character[] characters Character[]
// @TODO: Do we need addedAt and updatedAt?
} }
model Character { model Character {
@ -59,23 +58,36 @@ model Character {
user User @relation(fields: [userId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade)
name String @unique name String @unique
online Boolean @default(false) online Boolean @default(false)
hitpoints Int @default(100)
mana Int @default(100)
level Int @default(1)
experience Int @default(0)
alignment Int @default(50)
role String @default("player") role String @default("player")
chats Chat[]
// Position
zoneId Int @default(1)
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
positionX Int @default(0) positionX Int @default(0)
positionY Int @default(0) positionY Int @default(0)
rotation Int @default(0) rotation Int @default(0)
// Customization
characterTypeId Int? characterTypeId Int?
characterType CharacterType? @relation(fields: [characterTypeId], references: [id], onDelete: Cascade) characterType CharacterType? @relation(fields: [characterTypeId], references: [id], onDelete: Cascade)
characterHairId Int? characterHairId Int?
characterHair CharacterHair? @relation(fields: [characterHairId], references: [id], onDelete: Cascade) characterHair CharacterHair? @relation(fields: [characterHairId], references: [id], onDelete: Cascade)
zoneId Int @default(1)
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade) // Inventory
chats Chat[]
items CharacterItem[] items CharacterItem[]
equipment EquippedCharacterItem[]
// Stats
alignment Int @default(50)
hitpoints Int @default(100)
mana Int @default(100)
level Int @default(1)
experience Int @default(0)
strength Int @default(10)
dexterity Int @default(10)
intelligence Int @default(10)
wisdom Int @default(10)
} }
model CharacterItem { model CharacterItem {
@ -86,3 +98,22 @@ model CharacterItem {
item Item @relation(fields: [itemId], references: [id], onDelete: Cascade) item Item @relation(fields: [itemId], references: [id], onDelete: Cascade)
quantity Int quantity Int
} }
model EquippedCharacterItem {
id Int @id @default(autoincrement())
characterId Int
character Character @relation(fields: [characterId], references: [id], onDelete: Cascade)
itemId String
item Item @relation(fields: [itemId], references: [id], onDelete: Cascade)
quantity Int
slot EquippedCharacterItemSlotType
}
enum EquippedCharacterItemSlotType {
HEAD
BODY
ARMS
LEGS
NECK
RING
}