This commit is contained in:
2025-02-12 00:50:51 +01:00
parent c47339dfcd
commit e40a56825a
121 changed files with 468 additions and 3305 deletions

View File

@ -1,7 +1,6 @@
import type { UUID } from '@/application/types'
import { SocketEvent } from '@/application/enums'
import Logger, { LoggerType } from '@/application/logger'
import type { UUID } from '@/application/types'
import { Character } from '@/entities/character'
import MapManager from '@/managers/mapManager'
import SocketManager from '@/managers/socketManager'
@ -37,7 +36,7 @@ class CharacterTeleportService {
const existingCharacter = !options.isInitialJoin && MapManager.getCharacterById(characterId)
const mapCharacter = options.isInitialJoin
? new MapCharacter(options.character!)
? new MapCharacter(options.character)
: existingCharacter ||
(() => {
this.logger.error(`Teleport failed - Character ${characterId} not found in MapManager`)
@ -84,7 +83,7 @@ class CharacterTeleportService {
targetMap.addCharacter(mapCharacter.getCharacter())
const map = await mapRepository.getById(options.targetMapId)
await mapRepository.getEntityManager().populate(map!, mapRepository.POPULATE_TELEPORT as any)
await mapRepository.getEntityManager().populate(map, mapRepository.POPULATE_TELEPORT as any)
// Notify clients
io.in(options.targetMapId).emit(SocketEvent.MAP_CHARACTER_JOIN, mapCharacter)