19 lines
553 B
TypeScript
19 lines
553 B
TypeScript
import ObjectRepository from '#repositories/objectRepository'
|
|
import { BaseEvent } from '#application/base/baseEvent'
|
|
|
|
interface IPayload {}
|
|
|
|
export default class ObjectListEvent extends BaseEvent{
|
|
public listen(): void {
|
|
this.socket.on('gm:object:list', this.handleEvent.bind(this))
|
|
}
|
|
|
|
private async handleEvent(data: IPayload, callback: (response: Object[]) => void): Promise<void> {
|
|
if (!(await this.isCharacterGM())) return
|
|
|
|
// get all objects
|
|
const objects = await ObjectRepository.getAll()
|
|
return callback(objects)
|
|
}
|
|
}
|