Improved service names, added attack anim. sprite to init.ts, added attackService, added attack event

This commit is contained in:
2025-02-01 04:30:54 +01:00
parent a5ca524bb4
commit 70aa7345e0
9 changed files with 143 additions and 24 deletions

View File

@ -0,0 +1,20 @@
import { BaseEvent } from '#application/base/baseEvent'
import CharacterAttackService from '#services/characterAttackService'
export default class CharacterMove extends BaseEvent {
private readonly characterAttackService = CharacterAttackService
public listen(): void {
this.socket.on('map:character:attack', this.handleEvent.bind(this))
}
private async handleEvent(data: any, callback: (response: any) => void): Promise<void> {
try {
console.log('attack', this.socket.characterId)
await this.characterAttackService.attack(this.socket.characterId!)
} catch (error) {
this.logger.error('map:character:attack error', error)
return callback(false)
}
}
}