update characterLeave event to new event format, npm run format

This commit is contained in:
2024-09-15 02:06:16 +02:00
parent b08b4cb013
commit d93044d9d7
5 changed files with 64 additions and 56 deletions

View File

@ -3,10 +3,10 @@ import { Zone } from '@prisma/client'
import prisma from '../utilities/prisma'
class CharacterManager {
private characters!: ExtendedCharacter[];
private characters!: ExtendedCharacter[]
public async boot() {
this.characters = [];
this.characters = []
}
public initCharacter(character: ExtendedCharacter) {
@ -23,20 +23,20 @@ class CharacterManager {
zoneId: character.zoneId
}
})
this.characters = this.characters.filter(x => x.id !== character.id);
this.characters = this.characters.filter((x) => x.id !== character.id)
}
public getCharacter(characterId: number) {
return this.characters.find((x) => x.id === characterId);
return this.characters.find((x) => x.id === characterId)
}
public getCharacterFromSocket(socket: TSocket) {
return this.characters.find((x) => x.id === socket?.character?.id);
return this.characters.find((x) => x.id === socket?.character?.id)
}
public getCharactersInZone(zone: Zone) {
return this.characters.filter(x => x.zoneId === zone.id);
return this.characters.filter((x) => x.zoneId === zone.id)
}
}
export default new CharacterManager();
export default new CharacterManager()