proc-gen equipment drops from monsters can be picked up
[sketchy-heroes.git] / prisma / schema.prisma
index e2b4ce01b9dae7d425224d956369489cd10d0ed1..527936f7358da54809265186aee5eadb4a81d6bc 100644 (file)
@@ -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])
@@ -58,3 +120,57 @@ model AuthToken {
   updatedAt  DateTime?   @updatedAt
 }
 
+enum MonsterType {
+  BEAST
+  FLYING
+  HUMANOID
+  GIANT
+  INSECT
+  UNDEAD
+}
+
+model Monster {
+  id String @id @default(uuid()) @db.Uuid
+  name String @unique
+  monsterType MonsterType[]
+  monsterBiomes MonsterBiome[]
+}
+
+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
+  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 {
+  id String @id @default(uuid()) @db.Uuid
+  playerId String? @db.Uuid
+  monsterId String @db.Uuid
+  name String
+  type MonsterType[]
+  level Int
+  currency Int
+  pow         Int
+  zest        Int
+  woosh       Int
+  luck        Int
+  aha         Int
+  wow         Int
+  hp          Int
+  exp          Int
+}