feat(web): add local location contracts, shared fixtures and content glyphs
Mirrors the extended current-location payload and the interaction endpoint in the web API client. Replaces the per-spec CurrentLocationResponse literals with one shared fixture factory, so a contract change is answered in a single place. Adds the drawn glyph set used by hotspots, actions and reward previews. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
190
apps/web/src/app/features/world/current-location.fixture.ts
Normal file
190
apps/web/src/app/features/world/current-location.fixture.ts
Normal file
@@ -0,0 +1,190 @@
|
||||
import type {
|
||||
CurrentLocationResponse,
|
||||
LocationPointOfInterest,
|
||||
LocationPrimaryAction,
|
||||
} from '../../core/api/game-api.models';
|
||||
|
||||
/**
|
||||
* Test fixtures for `GET /api/world/current-location`.
|
||||
*
|
||||
* Shared rather than re-declared per spec: the payload backs the map, the
|
||||
* hunt screen and the local location view, so a field added to the contract
|
||||
* needs to be answered in exactly one place.
|
||||
*/
|
||||
|
||||
export const BURNED_ROAD_POIS: LocationPointOfInterest[] = [
|
||||
{
|
||||
key: 'hunt-area',
|
||||
title: 'Jagdgebiet',
|
||||
actionLabel: 'Jagd beginnen',
|
||||
type: 'HUNT',
|
||||
iconKey: 'hunt',
|
||||
xPercent: 52,
|
||||
yPercent: 44,
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
key: 'wounded-scout',
|
||||
title: 'Verwundeter Kundschafter',
|
||||
actionLabel: 'Sprechen',
|
||||
type: 'NPC',
|
||||
iconKey: 'speak',
|
||||
xPercent: 20,
|
||||
yPercent: 60,
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
key: 'inspect-tracks',
|
||||
title: 'Verdächtige Spuren',
|
||||
actionLabel: 'Untersuchen',
|
||||
type: 'INVESTIGATE',
|
||||
iconKey: 'investigate',
|
||||
xPercent: 32,
|
||||
yPercent: 78,
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
key: 'search-abandoned-wagon',
|
||||
title: 'Verlassener Wagen',
|
||||
actionLabel: 'Durchsuchen',
|
||||
type: 'SEARCH',
|
||||
iconKey: 'search',
|
||||
xPercent: 80,
|
||||
yPercent: 68,
|
||||
enabled: true,
|
||||
},
|
||||
];
|
||||
|
||||
export const BURNED_ROAD_ACTIONS: LocationPrimaryAction[] = [
|
||||
{
|
||||
key: 'start-hunt',
|
||||
label: 'Jagd beginnen',
|
||||
description: 'Im Gebiet jagen',
|
||||
type: 'HUNT',
|
||||
iconKey: 'hunt',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
key: 'investigate-tracks',
|
||||
label: 'Spuren untersuchen',
|
||||
description: 'Hinweise finden',
|
||||
type: 'INVESTIGATE',
|
||||
iconKey: 'investigate',
|
||||
enabled: true,
|
||||
poiKey: 'inspect-tracks',
|
||||
},
|
||||
{
|
||||
key: 'search-surroundings',
|
||||
label: 'Umgebung durchsuchen',
|
||||
description: 'Beute finden',
|
||||
type: 'SEARCH',
|
||||
iconKey: 'search',
|
||||
enabled: true,
|
||||
poiKey: 'search-abandoned-wagon',
|
||||
},
|
||||
{
|
||||
key: 'open-map',
|
||||
label: 'Zur Karte',
|
||||
description: 'Gebiet wechseln',
|
||||
type: 'MAP',
|
||||
iconKey: 'map',
|
||||
enabled: true,
|
||||
},
|
||||
];
|
||||
|
||||
export function southGateFixture(
|
||||
overrides: Partial<CurrentLocationResponse> = {},
|
||||
): CurrentLocationResponse {
|
||||
return {
|
||||
id: 'south-gate-id',
|
||||
key: 'south-gate',
|
||||
name: 'Südtor von Graufurt',
|
||||
description: 'Der letzte sichere Schritt vor den Aschenfeldern.',
|
||||
regionKey: 'ashen-fields',
|
||||
minRecommendedLevel: 1,
|
||||
maxRecommendedLevel: 1,
|
||||
dangerLevel: 0,
|
||||
isSafe: true,
|
||||
huntingEnabled: false,
|
||||
artworkPath: '/images/backgrounds/Suedtor.png',
|
||||
regionName: 'Aschenfelder',
|
||||
regionTierLabel: 'Gebiet 1',
|
||||
locationType: 'TRANSITION',
|
||||
localDescription: 'Hinter den Wachtfeuern beginnen die Aschenfelder.',
|
||||
localArtworkPath: '/images/backgrounds/Suedtor.png',
|
||||
dangerRating: null,
|
||||
recommendationLabel: '1',
|
||||
pointsOfInterest: [],
|
||||
primaryActions: [],
|
||||
encounterPreview: [],
|
||||
rewardPreview: [],
|
||||
connections: [
|
||||
{
|
||||
targetLocation: {
|
||||
id: 'burned-road-id',
|
||||
key: 'burned-road',
|
||||
name: 'Verbrannte Straße',
|
||||
},
|
||||
travelDurationSeconds: 10,
|
||||
danger: 'LOW',
|
||||
},
|
||||
],
|
||||
possibleMonsters: [],
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function burnedRoadFixture(
|
||||
overrides: Partial<CurrentLocationResponse> = {},
|
||||
): CurrentLocationResponse {
|
||||
return southGateFixture({
|
||||
id: 'burned-road-id',
|
||||
key: 'burned-road',
|
||||
name: 'Verbrannte Straße',
|
||||
description: 'Die erste Jagdzone zwischen Asche und zerbrochenen Wagen.',
|
||||
maxRecommendedLevel: 2,
|
||||
dangerLevel: 1,
|
||||
isSafe: false,
|
||||
huntingEnabled: true,
|
||||
artworkPath: '/images/backgrounds/Aschestrasse.png',
|
||||
locationType: 'HUNTING_GROUND',
|
||||
localDescription:
|
||||
'Ein alter Handelsweg, der durch Feuer und Krieg in Asche gelegt wurde.',
|
||||
localArtworkPath: '/images/backgrounds/Aschestrasse.png',
|
||||
dangerRating: 'MATCH',
|
||||
recommendationLabel: '1–2',
|
||||
pointsOfInterest: BURNED_ROAD_POIS,
|
||||
primaryActions: BURNED_ROAD_ACTIONS,
|
||||
encounterPreview: [
|
||||
{
|
||||
key: 'ash-rat',
|
||||
name: 'Aschenratte',
|
||||
level: 1,
|
||||
iconPath: '/images/monsters/icons/ash-rat-128.png',
|
||||
},
|
||||
{
|
||||
key: 'road-bandit',
|
||||
name: 'Straßenräuber',
|
||||
level: 2,
|
||||
iconPath: '/images/monsters/icons/road-bandit-128.png',
|
||||
},
|
||||
],
|
||||
rewardPreview: [
|
||||
{ key: 'silver', label: 'Silber', iconKey: 'silver' },
|
||||
{ key: 'experience', label: 'Erfahrung', iconKey: 'experience' },
|
||||
],
|
||||
connections: [
|
||||
{
|
||||
targetLocation: {
|
||||
id: 'south-gate-id',
|
||||
key: 'south-gate',
|
||||
name: 'Südtor von Graufurt',
|
||||
},
|
||||
travelDurationSeconds: 10,
|
||||
danger: 'LOW',
|
||||
},
|
||||
],
|
||||
possibleMonsters: ['Aschenratte', 'Straßenräuber'],
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user