Converted more events

This commit is contained in:
2025-01-04 20:11:34 +01:00
parent 47ec425acf
commit 21f4c5328f
21 changed files with 113 additions and 102 deletions

View File

@ -11,10 +11,18 @@ export default class SpriteListEvent extends BaseEvent {
}
private async handleEvent(data: IPayload, callback: (response: Sprite[]) => void): Promise<void> {
if (!(await this.isCharacterGM())) return
try {
if (!(await this.isCharacterGM())) return
// get all sprites
const sprites = await SpriteRepository.getAll(['*'])
callback(sprites)
// Get all sprites
const spriteRepository = new SpriteRepository()
const sprites = await spriteRepository.getAll()
await spriteRepository.getEntityManager().populate(sprites, ['spriteActions'])
return callback(sprites)
} catch (error) {
this.logger.error('gm:sprite:list error', error)
return callback([])
}
}
}