X-Git-Url: https://git.xangelo.ca/?p=sketchy-heroes.git;a=blobdiff_plain;f=prisma%2Fschema.prisma;fp=prisma%2Fschema.prisma;h=527936f7358da54809265186aee5eadb4a81d6bc;hp=8cf0df23b6ffd09abeb664c7873253bb27d4dba6;hb=b5d3cc37fddebff8dcdf1ef0cdd3a626811f14d3;hpb=20dc560a75cfd6ddc8a66956315a30001779ec24 diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 8cf0df2..527936f 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -47,9 +47,71 @@ model Player { zoneBiome ZoneBiomes @relation(fields: [zoneBiomeId], references: [id]) zoneBiomeId String @db.Uuid authToken AuthToken? + inventory Inventory[] + activeDrops WorldDrop[] steps Int @default(0) } +enum InventoryType { + HELM + R_SHOULDER + L_SHOULDER + TORSO + R_ARM + L_ARM + BOTH_ARMS + LEGS + L_FOOT + R_FOOT + WEAPON + SHIELD + ARMOUR +} + +enum Rarity { + COMMON + UNCOMMON + RARE +} + +model Item { + id String @id @default(uuid()) @db.Uuid + name String @unique + type InventoryType[] + durability Int @default(0) + minLevelDrop Int @default(1) + rarityDropRates Json + statModifiers Json + instances Inventory[] // a list of all inventories of a particular item + lootTable LootTable[] + worldDrops WorldDrop[] // a list of all active world drops +} + +model WorldDrop { + id String @id @default(uuid()) @db.Uuid + baseItem Item @relation(fields: [itemId], references: [id]) + itemId String @db.Uuid + dropDate DateTime @default(now()) + droppedBy Player @relation(fields: [droppedById], references: [id]) + droppedById String @db.Uuid +} + +model Inventory { + id String @id @default(uuid()) @db.Uuid + player Player @relation(fields: [playerId], references: [id]) + playerId String @db.Uuid + baseItem Item @relation(fields: [itemId], references: [id]) + itemId String @db.Uuid + discovered Boolean @default(false) + usesUntilDiscovery Int @default(40) + maxDurability Int @default(1) // this is set to 1 to handle things like potions + currentDurability Int @default(1) + rarity Rarity + type InventoryType[] + statModifiers Json + stackable Boolean @default(false) // if an item is "stackable" then the durability is the total number of items in that stack +} + model AuthToken { token String @id @default(uuid()) @db.Uuid player Player @relation(fields: [playerId], references: [id]) @@ -75,12 +137,24 @@ model Monster { } model MonsterBiome { + id String @id @default(uuid()) @db.Uuid monster Monster @relation(fields: [monsterId], references: [id]) monsterId String @db.Uuid biome Biome weight Decimal + dropRate Decimal @default(0.1) time Json - @@id([monsterId, biome]) + lootTable LootTable[] + @@unique([monsterId, biome]) +} + +model LootTable { + monsterBiome MonsterBiome @relation(fields: [monsterBiomeId], references: [id]) + monsterBiomeId String @db.Uuid + item Item @relation(fields: [itemId], references: [id]) + itemId String @db.Uuid + dropRate Decimal + @@id([monsterBiomeId, itemId]) } model Fight {