158 lines
3.7 KiB
Plaintext
158 lines
3.7 KiB
Plaintext
|
|
generator client {
|
||
|
|
provider = "prisma-client-js"
|
||
|
|
}
|
||
|
|
|
||
|
|
datasource db {
|
||
|
|
provider = "postgresql"
|
||
|
|
url = env("DATABASE_URL")
|
||
|
|
}
|
||
|
|
|
||
|
|
enum MissionStatus {
|
||
|
|
STARTED
|
||
|
|
COMPLETED
|
||
|
|
FAILED
|
||
|
|
}
|
||
|
|
|
||
|
|
enum MissionType {
|
||
|
|
DELIVERY
|
||
|
|
THEFT
|
||
|
|
SMUGGLING
|
||
|
|
INTEL
|
||
|
|
}
|
||
|
|
|
||
|
|
enum EventType {
|
||
|
|
MARKET_BOOM
|
||
|
|
POLICE_RAID
|
||
|
|
SHORTAGE
|
||
|
|
BLACKOUT
|
||
|
|
}
|
||
|
|
|
||
|
|
model User {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
email String @unique
|
||
|
|
passwordHash String
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
updatedAt DateTime @updatedAt
|
||
|
|
player Player?
|
||
|
|
}
|
||
|
|
|
||
|
|
model Player {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
userId String @unique
|
||
|
|
displayName String @unique
|
||
|
|
money Int @default(1000)
|
||
|
|
reputation Int @default(0)
|
||
|
|
level Int @default(1)
|
||
|
|
experience Int @default(0)
|
||
|
|
currentCityId String
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
updatedAt DateTime @updatedAt
|
||
|
|
|
||
|
|
user User @relation(fields: [userId], references: [id])
|
||
|
|
currentCity City @relation(fields: [currentCityId], references: [id])
|
||
|
|
inventory InventoryItem[]
|
||
|
|
missions PlayerMission[]
|
||
|
|
}
|
||
|
|
|
||
|
|
model City {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
name String @unique
|
||
|
|
riskLevel Int
|
||
|
|
policePressure Float @default(1.0)
|
||
|
|
economyModifier Float @default(1.0)
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
|
||
|
|
players Player[]
|
||
|
|
prices MarketPrice[]
|
||
|
|
missions Mission[]
|
||
|
|
events WorldEvent[]
|
||
|
|
}
|
||
|
|
|
||
|
|
model Item {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
name String @unique
|
||
|
|
basePrice Int
|
||
|
|
rarity Int
|
||
|
|
illegalLevel Int
|
||
|
|
weight Int @default(1)
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
|
||
|
|
inventory InventoryItem[]
|
||
|
|
prices MarketPrice[]
|
||
|
|
missions Mission[]
|
||
|
|
}
|
||
|
|
|
||
|
|
model InventoryItem {
|
||
|
|
playerId String
|
||
|
|
itemId String
|
||
|
|
quantity Int
|
||
|
|
|
||
|
|
player Player @relation(fields: [playerId], references: [id])
|
||
|
|
item Item @relation(fields: [itemId], references: [id])
|
||
|
|
|
||
|
|
@@id([playerId, itemId])
|
||
|
|
}
|
||
|
|
|
||
|
|
model MarketPrice {
|
||
|
|
cityId String
|
||
|
|
itemId String
|
||
|
|
buyPrice Int
|
||
|
|
sellPrice Int
|
||
|
|
demand Float @default(1.0)
|
||
|
|
supply Float @default(1.0)
|
||
|
|
updatedAt DateTime @updatedAt
|
||
|
|
|
||
|
|
city City @relation(fields: [cityId], references: [id])
|
||
|
|
item Item @relation(fields: [itemId], references: [id])
|
||
|
|
|
||
|
|
@@id([cityId, itemId])
|
||
|
|
}
|
||
|
|
|
||
|
|
model Mission {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
cityId String
|
||
|
|
title String
|
||
|
|
type MissionType
|
||
|
|
difficulty Int
|
||
|
|
durationSeconds Int
|
||
|
|
rewardMoney Int
|
||
|
|
rewardXp Int
|
||
|
|
risk Float
|
||
|
|
requiredItemId String?
|
||
|
|
requiredItemQuantity Int?
|
||
|
|
expiresAt DateTime
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
|
||
|
|
city City @relation(fields: [cityId], references: [id])
|
||
|
|
requiredItem Item? @relation(fields: [requiredItemId], references: [id])
|
||
|
|
playerMissions PlayerMission[]
|
||
|
|
}
|
||
|
|
|
||
|
|
model PlayerMission {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
playerId String
|
||
|
|
missionId String
|
||
|
|
status MissionStatus @default(STARTED)
|
||
|
|
startedAt DateTime @default(now())
|
||
|
|
completesAt DateTime
|
||
|
|
resolvedAt DateTime?
|
||
|
|
|
||
|
|
player Player @relation(fields: [playerId], references: [id])
|
||
|
|
mission Mission @relation(fields: [missionId], references: [id])
|
||
|
|
}
|
||
|
|
|
||
|
|
model WorldEvent {
|
||
|
|
id String @id @default(uuid())
|
||
|
|
title String
|
||
|
|
description String
|
||
|
|
type EventType
|
||
|
|
cityId String?
|
||
|
|
priceModifier Float @default(1.0)
|
||
|
|
policeModifier Float @default(1.0)
|
||
|
|
startsAt DateTime
|
||
|
|
endsAt DateTime
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
|
||
|
|
city City? @relation(fields: [cityId], references: [id])
|
||
|
|
}
|