feat(sprint4): achievements, community goals, hall of fame, profile
Some checks failed
CI/CD — Build & Deploy / Build & Deploy (push) Failing after 37s
Some checks failed
CI/CD — Build & Deploy / Build & Deploy (push) Failing after 37s
4 modules: achievement (15 succès, 5 catégories, 3 paliers), community (objectifs collectifs + boosts globaux), halloffame (classement mensuel), profile (titre actif + badges + % progression). Event-driven: combat/forge/craft émettent des events via @nestjs/event-emitter. Character entity: +activeTitle, +totalGoldEarned. Seeds: 15 achievements + 3 community goals.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable, BadRequestException, NotFoundException } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { Recipe } from './recipe.entity';
|
||||
import { CraftJob } from './craft-job.entity';
|
||||
import { Character } from '../character/entities/character.entity';
|
||||
@@ -19,6 +20,7 @@ export class CraftService {
|
||||
private readonly characterRepository: Repository<Character>,
|
||||
private readonly itemService: ItemService,
|
||||
private readonly materialService: MaterialService,
|
||||
private readonly eventEmitter: EventEmitter2,
|
||||
) {}
|
||||
|
||||
findAllRecipes() {
|
||||
@@ -113,6 +115,13 @@ export class CraftService {
|
||||
job.collected = true;
|
||||
await this.craftJobRepository.save(job);
|
||||
|
||||
// Emit achievement event
|
||||
this.eventEmitter.emit('achievement.check', {
|
||||
characterId: char.id,
|
||||
type: 'craft_completed',
|
||||
increment: 1,
|
||||
});
|
||||
|
||||
return {
|
||||
collected: true,
|
||||
item: charItem.item,
|
||||
|
||||
Reference in New Issue
Block a user