Renamed zone > map

This commit is contained in:
2025-01-02 17:31:24 +01:00
parent 887da447e0
commit 11041fec83
54 changed files with 871 additions and 895 deletions

View File

@ -0,0 +1,25 @@
import { BaseEvent } from '#application/base/baseEvent'
import { Map } from '#entities/map'
import MapRepository from '#repositories/mapRepository'
interface IPayload {}
export default class MapListEvent extends BaseEvent {
public listen(): void {
this.socket.on('gm:map_editor:map:list', this.handleEvent.bind(this))
}
private async handleEvent(data: IPayload, callback: (response: Map[]) => void): Promise<void> {
try {
if (!(await this.isCharacterGM())) return
this.logger.info(`User ${(await this.getCharacter())!.getId()} has created a new map via map editor.`)
const maps = await MapRepository.getAll()
return callback(maps)
} catch (error: any) {
this.logger.error('gm:map_editor:map:list error', error.message)
return callback([])
}
}
}