Almost finalised refactoring
This commit is contained in:
19
src/events/gameMaster/assetManager/mapObject/list.ts
Normal file
19
src/events/gameMaster/assetManager/mapObject/list.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import ObjectRepository from '#repositories/mapObjectRepository'
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { MapObject } from '#entities/mapObject'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
export default class MapObjectListEvent extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:mapObject:list', this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: IPayload, callback: (response: MapObject[]) => void): Promise<void> {
|
||||
if (!(await this.isCharacterGM())) return
|
||||
|
||||
// get all objects
|
||||
const objects = await ObjectRepository.getAll()
|
||||
return callback(objects)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user