feat(loot): seed tier-1 items and the ash rat and road bandit loot tables
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { DEMO_CHARACTER_ID } from '../../demo/demo-character.constants';
|
||||
import { Character } from '../../characters/entities/character.entity';
|
||||
import { ItemDefinition } from '../../items/entities/item-definition.entity';
|
||||
import { LootTableEntry } from '../../loot/entities/loot-table-entry.entity';
|
||||
import { LootTable } from '../../loot/entities/loot-table.entity';
|
||||
import { EncounterType } from '../../monsters/entities/encounter-type.enum';
|
||||
import { LocationMonster } from '../../monsters/entities/location-monster.entity';
|
||||
import { MonsterDefinition } from '../../monsters/entities/monster-definition.entity';
|
||||
import { LocationConnection } from '../../world/entities/location-connection.entity';
|
||||
import { LocationDefinition } from '../../world/entities/location-definition.entity';
|
||||
import {
|
||||
ASH_RAT_LOOT_TABLE_ID,
|
||||
ROAD_BANDIT_LOOT_TABLE_ID,
|
||||
} from './item.constants';
|
||||
import { ITEM_DEFINITIONS, LOOT_TABLES, LOOT_TABLE_ENTRIES } from './item-content';
|
||||
import {
|
||||
ASH_RAT_MONSTER_ID,
|
||||
BURNED_ROAD_ID,
|
||||
@@ -21,6 +29,9 @@ export async function seedVisibleVerticalSlice(
|
||||
const characterRepository = dataSource.getRepository(Character);
|
||||
const monsterRepository = dataSource.getRepository(MonsterDefinition);
|
||||
const locationMonsterRepository = dataSource.getRepository(LocationMonster);
|
||||
const itemRepository = dataSource.getRepository(ItemDefinition);
|
||||
const lootTableRepository = dataSource.getRepository(LootTable);
|
||||
const lootEntryRepository = dataSource.getRepository(LootTableEntry);
|
||||
|
||||
const locations = [
|
||||
{
|
||||
@@ -95,6 +106,15 @@ export async function seedVisibleVerticalSlice(
|
||||
['fromLocationId', 'toLocationId'],
|
||||
);
|
||||
|
||||
// Content is upserted by its stable key so re-running never duplicates rows
|
||||
// and never touches player-owned character_items or combat_rewards.
|
||||
await itemRepository.upsert(ITEM_DEFINITIONS, ['key']);
|
||||
await lootTableRepository.upsert(LOOT_TABLES, ['key']);
|
||||
await lootEntryRepository.upsert(LOOT_TABLE_ENTRIES, [
|
||||
'lootTableId',
|
||||
'itemDefinitionId',
|
||||
]);
|
||||
|
||||
const monsters = [
|
||||
{
|
||||
id: ASH_RAT_MONSTER_ID,
|
||||
@@ -108,6 +128,7 @@ export async function seedVisibleVerticalSlice(
|
||||
silverMin: 4,
|
||||
silverMax: 7,
|
||||
artworkPath: '/images/monsters/ash-rat.png',
|
||||
lootTableId: ASH_RAT_LOOT_TABLE_ID,
|
||||
},
|
||||
{
|
||||
id: ROAD_BANDIT_MONSTER_ID,
|
||||
@@ -121,6 +142,7 @@ export async function seedVisibleVerticalSlice(
|
||||
silverMin: 9,
|
||||
silverMax: 15,
|
||||
artworkPath: '/images/monsters/road-bandit.png',
|
||||
lootTableId: ROAD_BANDIT_LOOT_TABLE_ID,
|
||||
},
|
||||
];
|
||||
let ashRatId = ASH_RAT_MONSTER_ID;
|
||||
@@ -176,6 +198,7 @@ export async function seedVisibleVerticalSlice(
|
||||
name: 'Aric Duskwalker',
|
||||
level: 1,
|
||||
experience: 0,
|
||||
silver: 0,
|
||||
baseHp: 100,
|
||||
baseAttack: 6,
|
||||
currentHp: 100,
|
||||
|
||||
Reference in New Issue
Block a user