forked from noxious/server
20 lines
573 B
TypeScript
20 lines
573 B
TypeScript
import { BaseEvent } from '#application/base/baseEvent'
|
|
import { Tile } from '#entities/tile'
|
|
import TileRepository from '#repositories/tileRepository'
|
|
|
|
interface IPayload {}
|
|
|
|
export default class TileListEven extends BaseEvent {
|
|
public listen(): void {
|
|
this.socket.on('gm:tile:list', this.handleEvent.bind(this))
|
|
}
|
|
|
|
private async handleEvent(data: IPayload, callback: (response: Tile[]) => void): Promise<void> {
|
|
if (!(await this.isCharacterGM())) return
|
|
|
|
// get all tiles
|
|
const tiles = await TileRepository.getAll()
|
|
return callback(tiles)
|
|
}
|
|
}
|