generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } enum Biome { PLAINS FIELDS WOODLAND FOREST SWAMP TUNDRA MOUNTAIN CAVE DESERT } model ZoneBiomes { id String @id @default(uuid()) @db.Uuid players Player? playerId String? @db.Uuid biome Biome maxSteps Int @default(500) } model Player { id String @id @default(uuid()) @db.Uuid username String @unique password String level Int @default(1) currency Int @default(0) pow Int zest Int woosh Int luck Int aha Int wow Int stamina Int hp Int statPoints Int @default(0) exp Int @default(0) 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]) playerId String @db.Uuid createdAt DateTime @default(now()) 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 }