Fixed characterhair:create
This commit is contained in:
parent
6b12d8e7b1
commit
48784a437f
@ -7,22 +7,17 @@ export default class CharacterHairCreateEvent extends BaseEvent {
|
||||
this.socket.on('gm:characterHair:create', this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: undefined, callback: (response: boolean, characterType?: any) => void): Promise<void> {
|
||||
private async handleEvent(data: undefined, callback: (response: boolean, characterHair?: any) => void): Promise<void> {
|
||||
try {
|
||||
const character = await characterRepository.getById(this.socket.characterId!)
|
||||
if (!character) return callback(false)
|
||||
|
||||
if (character.role !== 'gm') {
|
||||
return callback(false)
|
||||
}
|
||||
if (!(await this.isCharacterGM())) return
|
||||
|
||||
const newCharacterHair = new CharacterHair()
|
||||
await newCharacterHair.setName('New hair').save()
|
||||
|
||||
callback(true, newCharacterHair)
|
||||
return callback(true, newCharacterHair)
|
||||
} catch (error) {
|
||||
console.error('Error creating character hair:', error)
|
||||
callback(false)
|
||||
return callback(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Item } from '#entities/item'
|
||||
|
||||
export default class ItemCreateEvent extends BaseEvent {
|
||||
|
||||
public listen(): void {
|
||||
this.socket.on('gm:item:create', this.handleEvent.bind(this))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user