Cleanup
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import type { UUID } from '@/application/types'
|
||||
|
||||
import { BaseService } from '@/application/base/baseService'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
import SocketManager from '@/managers/socketManager'
|
||||
|
||||
|
@ -115,13 +115,7 @@ class CharacterMoveService extends BaseService {
|
||||
}
|
||||
|
||||
private isValidPosition(pos: Position, grid: number[][], end: Position): boolean {
|
||||
return (
|
||||
pos.positionX >= 0 &&
|
||||
pos.positionY >= 0 &&
|
||||
pos.positionX < grid[0]!.length &&
|
||||
pos.positionY < grid.length &&
|
||||
(grid[pos.positionY]![pos.positionX] === 0 || (pos.positionX === end.positionX && pos.positionY === end.positionY))
|
||||
)
|
||||
return pos.positionX >= 0 && pos.positionY >= 0 && pos.positionX < grid[0]!.length && pos.positionY < grid.length && (grid[pos.positionY]![pos.positionX] === 0 || (pos.positionX === end.positionX && pos.positionY === end.positionY))
|
||||
}
|
||||
|
||||
private getDistance(a: Position, b: Position): number {
|
||||
|
@ -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)
|
||||
|
@ -1,7 +1,6 @@
|
||||
import type { UUID } from '@/application/types'
|
||||
|
||||
import { BaseService } from '@/application/base/baseService'
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Chat } from '@/entities/chat'
|
||||
import SocketManager from '@/managers/socketManager'
|
||||
import CharacterRepository from '@/repositories/characterRepository'
|
||||
|
@ -1,12 +1,11 @@
|
||||
import bcrypt from 'bcryptjs'
|
||||
import NodeMailer from 'nodemailer'
|
||||
|
||||
import { BaseService } from '@/application/base/baseService'
|
||||
import config from '@/application/config'
|
||||
import { PasswordResetToken } from '@/entities/passwordResetToken'
|
||||
import { User } from '@/entities/user'
|
||||
import PasswordResetTokenRepository from '@/repositories/passwordResetTokenRepository'
|
||||
import UserRepository from '@/repositories/userRepository'
|
||||
import bcrypt from 'bcryptjs'
|
||||
import NodeMailer from 'nodemailer'
|
||||
|
||||
/**
|
||||
* User service
|
||||
|
Reference in New Issue
Block a user