Plusieurs ajouts :
Some checks failed
Build & Push Images / build (brain) (push) Has been cancelled
Build & Push Images / build (core) (push) Has been cancelled
Build & Push Images / build (web) (push) Has been cancelled
Build & Push Images / build-switcher (push) Has been cancelled

- Possibilité de configurer des lieux dans une scène : permet de configurer un donjon par exemple avec les pièces, les trésors par pièce, la narration..... Mise en place également de conditions permettant de conditionner le déblocage des quêtes.
- Possibilité de transformé un arc en instance non linéaire afin de faire un hub. Permet de jouer de préparer des campagnes type Dragon of Icespire peak plus facilement.
- Configuration de partie : chaque partie va contenir les séances, ce qui permettra de suivre le déblocage des conditions pour les quêtes.

Passage en 0.9.1-beta
This commit is contained in:
2026-06-03 15:44:48 +02:00
parent e3fc96a1bc
commit 504c4b7b6c
147 changed files with 5347 additions and 392 deletions

View File

@@ -0,0 +1,19 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
/**
* Liste les noms de faits référencés par les conditions des quêtes d'une Campagne.
* Modèle "déclaration implicite" : un fait existe dès qu'au moins une quête le
* référence dans ses prérequis FLAG_SET.
*/
@Injectable({ providedIn: 'root' })
export class CampaignFlagService {
constructor(private http: HttpClient) {}
/** Noms de faits dédupliqués et triés. */
listReferenced(campaignId: string): Observable<string[]> {
return this.http.get<string[]>(`/api/campaigns/${campaignId}/flags`);
}
}

View File

@@ -21,6 +21,27 @@ export interface CampaignCreate {
gameSystemId?: string | null;
}
/** Type structurel d'un Arc (miroir de l'enum Java ArcType). */
export type ArcType = 'LINEAR' | 'HUB';
/** Statut de progression piloté manuellement par le MJ (persisté). */
export type ProgressionStatus = 'NOT_STARTED' | 'IN_PROGRESS' | 'COMPLETED';
/**
* Statut effectif d'une quête tel qu'affiché dans la vue Hub.
* Calculé côté backend — ne jamais le re-dériver côté front.
*/
export type QuestStatus = 'LOCKED' | 'AVAILABLE' | 'IN_PROGRESS' | 'COMPLETED';
/**
* Condition de déblocage d'une quête. Union TS discriminée sur `kind` —
* miroir du sealed type Java Prerequisite. Le narrowing TS marche sur le `kind`.
*/
export type Prerequisite =
| { kind: 'QUEST_COMPLETED'; questId: string }
| { kind: 'SESSION_REACHED'; minSessionNumber: number }
| { kind: 'FLAG_SET'; flagName: string };
export interface Arc {
id?: string;
name: string;
@@ -29,6 +50,9 @@ export interface Arc {
order?: number;
chapterCount?: number;
/** Type structurel (défaut LINEAR côté backend si omis). */
type?: ArcType;
/** Cle d'icone choisie par l'utilisateur (cf. CAMPAIGN_ICON_OPTIONS). */
icon?: string | null;
@@ -55,6 +79,7 @@ export interface ArcCreate {
description?: string;
campaignId: string;
order: number;
type?: ArcType;
icon?: string | null;
themes?: string;
@@ -76,6 +101,20 @@ export interface Chapter {
order?: number;
icon?: string | null;
/** Conditions de déblocage (ET logique). Donnée de SCÉNARIO. */
prerequisites?: Prerequisite[];
/**
* Statut de progression read-only — peuplé par le backend uniquement quand
* un playthroughId est passé en query param. Ne pas inclure en écriture.
*/
progressionStatus?: ProgressionStatus;
/**
* Statut effectif read-only — idem, dépend du Playthrough.
*/
effectiveStatus?: QuestStatus;
// Champs narratifs enrichis
gmNotes?: string;
playerObjectives?: string;
@@ -93,6 +132,8 @@ export interface ChapterCreate {
order: number;
icon?: string | null;
prerequisites?: Prerequisite[];
gmNotes?: string;
playerObjectives?: string;
narrativeStakes?: string;
@@ -102,6 +143,35 @@ export interface ChapterCreate {
mapImageIds?: string[];
}
/**
* Partie / instance jouée d'une Campagne par une table donnée.
* Porte la progression dynamique des quêtes, les flags et les sessions.
*/
export interface Playthrough {
id?: string;
campaignId: string;
name: string;
description?: string;
createdAt?: string;
updatedAt?: string;
}
export interface PlaythroughCreate {
campaignId: string;
name: string;
description?: string;
}
/**
* Valeur courante d'un fait pour une Partie donnée.
* Pas de déclaration explicite : un fait existe dès qu'au moins une quête le
* référence via un prérequis FLAG_SET.
*/
export interface PlaythroughFlag {
name: string;
value: boolean;
}
/**
* Branche narrative : sortie possible d'une scène vers une autre du même chapitre.
* Pendant TS du Value Object Java SceneBranch.
@@ -112,6 +182,37 @@ export interface SceneBranch {
condition?: string;
}
/**
* Sortie d'une pièce vers une autre pièce du même lieu explorable.
* Pendant TS du record domaine RoomBranch.
*/
export interface RoomBranch {
label: string;
targetRoomId: string;
condition?: string;
}
/**
* Pièce d'un lieu explorable attachée à une Scene.
* Dès qu'une Scene a au moins une Room, elle bascule sur le rendu « donjon ».
*/
export interface Room {
/** UUID stable généré côté client à la création (sert de cible aux RoomBranch). */
id: string;
name: string;
description?: string;
enemies?: string;
loot?: string;
traps?: string;
gmNotes?: string;
/** Étage : 0 = RdC, 1 = 1er etc. null/undefined = pas d'étage défini. */
floor?: number | null;
order: number;
illustrationImageIds?: string[];
mapImageId?: string | null;
branches?: RoomBranch[];
}
export interface Scene {
id?: string;
name: string;
@@ -136,6 +237,9 @@ export interface Scene {
/** Sorties narratives (graphe intra-chapitre). */
branches?: SceneBranch[];
/** Pièces explorables. Vide = scène classique, non-vide = lieu type donjon. */
rooms?: Room[];
}
export interface SceneCreate {
@@ -158,4 +262,5 @@ export interface SceneCreate {
illustrationImageIds?: string[];
mapImageIds?: string[];
branches?: SceneBranch[];
rooms?: Room[];
}

View File

@@ -8,7 +8,7 @@ export interface CampaignDeletionImpact {
arcs: number;
chapters: number;
scenes: number;
characters: number;
playthroughs: number;
}
/** Compte des entités qui seront supprimées en cascade avec un arc. */
@@ -85,13 +85,20 @@ export class CampaignService {
}
// ========== CHAPTER ==========
getChapters(arcId: string): Observable<Chapter[]> {
const params = new HttpParams().set('arcId', arcId);
/**
* Liste les chapitres d'un arc. Si {@code playthroughId} est fourni, le backend
* enrichit les DTOs avec progressionStatus + effectiveStatus relatifs à la Partie.
*/
getChapters(arcId: string, playthroughId?: string): Observable<Chapter[]> {
let params = new HttpParams().set('arcId', arcId);
if (playthroughId) params = params.set('playthroughId', playthroughId);
return this.http.get<Chapter[]>('/api/chapters', { params });
}
getChapterById(id: string): Observable<Chapter> {
return this.http.get<Chapter>(`/api/chapters/${id}`);
getChapterById(id: string, playthroughId?: string): Observable<Chapter> {
let params = new HttpParams();
if (playthroughId) params = params.set('playthroughId', playthroughId);
return this.http.get<Chapter>(`/api/chapters/${id}`, { params });
}
createChapter(payload: ChapterCreate): Observable<Chapter> {

View File

@@ -1,10 +1,7 @@
/**
* Fiche de personnage joueur (PJ) d'une campagne.
* Refonte 2026-04-30 : abandon du markdownContent au profit d'un systeme
* template-based pilote par le GameSystem de la campagne.
* - portraitImageId / headerImageId : champs universels hard-codes
* - values : Map<champ template TEXT/NUMBER, valeur>
* - imageValues : Map<champ template IMAGE, liste d'IDs d'images>
* Fiche de personnage joueur (PJ) d'une Partie (Playthrough).
* Refonte Playthrough : les PJ appartiennent à la Partie (table jouée),
* plus à la Campagne (scénario).
*/
export interface Character {
id?: string;
@@ -15,7 +12,7 @@ export interface Character {
imageValues?: Record<string, string[]>;
/** Champs KEY_VALUE_LIST : fieldName -> label -> value. */
keyValueValues?: Record<string, Record<string, string>>;
campaignId: string;
playthroughId: string;
order?: number;
}
@@ -26,5 +23,5 @@ export interface CharacterCreate {
values?: Record<string, string>;
imageValues?: Record<string, string[]>;
keyValueValues?: Record<string, Record<string, string>>;
campaignId: string;
playthroughId: string;
}

View File

@@ -12,8 +12,8 @@ export class CharacterService {
constructor(private http: HttpClient) {}
getByCampaign(campaignId: string): Observable<Character[]> {
return this.http.get<Character[]>(`${this.apiUrl}/campaign/${campaignId}`);
getByPlaythrough(playthroughId: string): Observable<Character[]> {
return this.http.get<Character[]>(`${this.apiUrl}/playthrough/${playthroughId}`);
}
getById(id: string): Observable<Character> {

View File

@@ -0,0 +1,31 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { PlaythroughFlag } from './campaign.model';
/**
* Endpoints des flags narratifs d'une Partie (Playthrough).
* Remplace l'ancien CampaignFlagService.
*/
@Injectable({ providedIn: 'root' })
export class PlaythroughFlagService {
constructor(private http: HttpClient) {}
list(playthroughId: string): Observable<PlaythroughFlag[]> {
return this.http.get<PlaythroughFlag[]>(`/api/playthroughs/${playthroughId}/flags`);
}
setFlag(playthroughId: string, name: string, value: boolean): Observable<PlaythroughFlag> {
return this.http.put<PlaythroughFlag>(
`/api/playthroughs/${playthroughId}/flags/${encodeURIComponent(name)}`,
{ name, value }
);
}
deleteFlag(playthroughId: string, name: string): Observable<void> {
return this.http.delete<void>(
`/api/playthroughs/${playthroughId}/flags/${encodeURIComponent(name)}`
);
}
}

View File

@@ -0,0 +1,44 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Playthrough, PlaythroughCreate } from './campaign.model';
export interface PlaythroughDeletionImpact {
sessions: number;
characters: number;
flags: number;
progressions: number;
}
@Injectable({ providedIn: 'root' })
export class PlaythroughService {
private apiUrl = '/api/playthroughs';
constructor(private http: HttpClient) {}
listByCampaign(campaignId: string): Observable<Playthrough[]> {
const params = new HttpParams().set('campaignId', campaignId);
return this.http.get<Playthrough[]>(this.apiUrl, { params });
}
getById(id: string): Observable<Playthrough> {
return this.http.get<Playthrough>(`${this.apiUrl}/${id}`);
}
create(payload: PlaythroughCreate): Observable<Playthrough> {
return this.http.post<Playthrough>(this.apiUrl, payload);
}
update(id: string, payload: Playthrough): Observable<Playthrough> {
return this.http.put<Playthrough>(`${this.apiUrl}/${id}`, payload);
}
delete(id: string): Observable<void> {
return this.http.delete<void>(`${this.apiUrl}/${id}`);
}
deletionImpact(id: string): Observable<PlaythroughDeletionImpact> {
return this.http.get<PlaythroughDeletionImpact>(`${this.apiUrl}/${id}/deletion-impact`);
}
}

View File

@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ProgressionStatus } from './campaign.model';
/**
* Endpoints de progression des quêtes pour un Playthrough.
* Modèle "absence = NOT_STARTED" — envoyer NOT_STARTED supprime la ligne côté backend.
*/
@Injectable({ providedIn: 'root' })
export class QuestProgressionService {
constructor(private http: HttpClient) {}
/** Map chapterId -> ProgressionStatus pour le Playthrough donné. */
list(playthroughId: string): Observable<Record<string, ProgressionStatus>> {
return this.http.get<Record<string, ProgressionStatus>>(
`/api/playthroughs/${playthroughId}/quest-progressions`
);
}
setStatus(playthroughId: string, chapterId: string, status: ProgressionStatus): Observable<void> {
return this.http.put<void>(
`/api/playthroughs/${playthroughId}/quest-progressions/${chapterId}`,
{ status }
);
}
}

View File

@@ -5,7 +5,7 @@
export interface Session {
id: string;
name: string;
campaignId: string;
playthroughId: string;
startedAt: string;
/** Null/undefined = session en cours. */
endedAt: string | null;

View File

@@ -5,7 +5,7 @@ import { Session } from './session.model';
/**
* Service HTTP pour le Play Context (gestion des Sessions de jeu).
* Port de sortie vers le Backend Java (Architecture Hexagonale).
* Depuis Playthrough : une Session est rattachée à un Playthrough, pas à une Campagne.
*/
@Injectable({
providedIn: 'root'
@@ -15,20 +15,31 @@ export class SessionService {
constructor(private http: HttpClient) {}
/** Lance une nouvelle session sur la campagne donnée. */
startSession(campaignId: string): Observable<Session> {
return this.http.post<Session>(this.apiUrl, { campaignId });
/** Lance une nouvelle session sur la Partie (Playthrough) donnée. */
startSession(playthroughId: string): Observable<Session> {
return this.http.post<Session>(this.apiUrl, { playthroughId });
}
/** Récupère la session active (204 No Content si aucune). */
/**
* Récupère UNE session active dans l'app (legacy, multi-actives possibles désormais).
* Préférer {@link getActiveByPlaythrough} quand on veut le statut d'une Partie précise.
*/
getActiveSession(): Observable<Session | null> {
return this.http.get<Session | null>(`${this.apiUrl}/active`, { observe: 'body' });
}
getSessions(campaignId?: string): Observable<Session[]> {
/** Récupère la session active de la Partie donnée (null si aucune). */
getActiveByPlaythrough(playthroughId: string): Observable<Session | null> {
return this.http.get<Session | null>(`${this.apiUrl}/active`, {
params: new HttpParams().set('playthroughId', playthroughId),
observe: 'body'
});
}
getSessions(playthroughId?: string): Observable<Session[]> {
let params = new HttpParams();
if (campaignId) {
params = params.set('campaignId', campaignId);
if (playthroughId) {
params = params.set('playthroughId', playthroughId);
}
return this.http.get<Session[]>(this.apiUrl, { params });
}