-import {Biome, MonsterType} from '@prisma/client';
-import { prisma } from '../src/lib/db';
+import * as monster from './seed/monsters';
+import * as equipment from './seed/equipment';
-const monsterList = [
- {
- name: "Rat",
- monster_type: [MonsterType.BEAST],
- availability: [
- {
- type: Biome.FIELDS,
- weight: 0.5,
- time: [{min: 0, max: 24}]
- },
- {
- type: Biome.WOODLAND,
- weight: 0.6,
- time: [{min: 0, max: 24}]
- }
- ]
- },
- {
- name: "Bat",
- monster_type: [MonsterType.FLYING],
- availability: [
- {
- type: Biome.FIELDS,
- weight: 0.2,
- time: [{min: 0, max: 4}, {min: 20, max: 24}]
- },
- {
- type: Biome.WOODLAND,
- weight: 0.4,
- time: [{min: 0, max: 4}, {min: 20, max: 24}]
- },
- {
- type: Biome.FOREST,
- weight: 0.4,
- time: [{min: 0, max: 4}, {min: 20, max: 24}]
- }
- ]
- },
- {
- name: "Wild Boar",
- monster_type: [MonsterType.BEAST],
- availability: [
- {
- type: Biome.FIELDS,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- },
- {
- type: Biome.WOODLAND,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- }
- ]
- },
- {
- name: "Bandit",
- monster_type: [MonsterType.HUMANOID],
- availability: [
- {
- type: Biome.FIELDS,
- weight: 0.3,
- time: [{min: 0, max: 5}, {min: 16, max: 24}]
- },
- {
- type: Biome.WOODLAND,
- weight: 0.3,
- time: [{min: 0, max: 5}, {min: 16, max: 24}]
- },
- {
- type: Biome.FOREST,
- weight: 0.1,
- time: [{min: 0, max: 5}, {min: 16, max: 24}]
- }
- ]
- },
- {
- name: "Thief",
- monster_type: [MonsterType.HUMANOID],
- availability: [
- {
- type: Biome.FIELDS,
- weight: 0.3,
- time: [{min: 0, max: 5}, {min: 18, max: 24}]
- },
- {
- type: Biome.WOODLAND,
- weight: 0.3,
- time: [{min: 0, max: 5}, {min: 16, max: 24}]
- },
- {
- type: Biome.FOREST,
- weight: 0.1,
- time: [{min: 0, max: 5}, {min: 16, max: 24}]
- }
- ]
- },
- {
- name: "Sunstrider",
- monster_type: [MonsterType.INSECT],
- availability: [
- {
- type: Biome.FIELDS,
- weight: 0.15,
- time: [{min: 8, max: 15}]
- },
- {
- type: Biome.PLAINS,
- weight: 0.3,
- time: [{min: 8, max: 17}]
- }
- ]
- },
- {
- name: "Lich",
- monster_type: [MonsterType.UNDEAD],
- availability: [
- {
- type: Biome.FOREST,
- weight: 0.15,
- time: [{min: 19, max: 24}, {min: 0, max: 3}]
- },
- {
- type: Biome.WOODLAND,
- weight: 0.05,
- time: [{min: 19, max: 24}, {min: 0, max: 3}]
- }
- ]
- },
- {
- name: "Centaur",
- monster_type: [MonsterType.HUMANOID, MonsterType.BEAST],
- availability: [
- {
- type: Biome.WOODLAND,
- weight: 0.2,
- time: [{min: 0, max: 24}]
- }
- ]
- },
- {
- name: "Giant Scorpion",
- monster_type: [MonsterType.INSECT, MonsterType.GIANT],
- availability: [
- {
- type: Biome.DESERT,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- }
- ]
- },
- {
- name: "Wolf",
- onster_type: [MonsterType.BEAST],
- availability: [
- {
- type: Biome.MOUNTAIN,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- },
- {
- type: Biome.FOREST,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- }
- ]
- },
- {
- name: "Bear",
- monster_type: [MonsterType.BEAST],
- availability: [
- {
- type: Biome.MOUNTAIN,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- },
- {
- type: Biome.FOREST,
- weight: 0.3,
- time: [{min: 0, max: 24}]
- }
- ]
- },
- {
- name: "Troll",
- monster_type: [MonsterType.HUMANOID],
- availability: [
- {
- type: Biome.MOUNTAIN,
- weight: 0.3,
- time: [{min: 0, max: 4}, {min: 20, max: 24}]
- },
- {
- type: Biome.FOREST,
- weight: 0.3,
- time: [{min: 0, max: 4}, {min: 20, max: 24}]
- }
- ]
- }
-];
-
-monsterList.forEach(async monster => {
- const createdMonster = await prisma.monster.create({
- data: {
- name: monster.name,
- monsterType: monster.monster_type
- }
- });
-
- await prisma.monsterBiome.createMany({
- data: monster.availability.map(availability => {
- return {
- biome: availability.type,
- monsterId: createdMonster.id,
- weight: availability.weight,
- time: availability.time
- }
- })
- });
-});
-
+equipment.down()
+ .then(() => equipment.up())
+ .then(() => monster.down())
+ .then(() => monster.up())