1
0
forked from noxious/server

Don't attack if isMoving

This commit is contained in:
2025-02-12 03:01:07 +01:00
parent d75ed7a44f
commit 8cca44a3b4
3 changed files with 23 additions and 8 deletions

View File

@@ -2,6 +2,8 @@ import { SocketEvent } from '@/application/enums'
import Logger, { LoggerType } from '@/application/logger'
import type { TSocket } from '@/application/types'
import { Character } from '@/entities/character'
import MapManager from '@/managers/mapManager'
import type MapCharacter from '@/models/mapCharacter'
import CharacterRepository from '@/repositories/characterRepository'
import { Server } from 'socket.io'
@@ -27,6 +29,11 @@ export abstract class BaseEvent {
return false
}
protected getMapCharacter(): MapCharacter | null {
if (!this.socket.characterId) return null
return MapManager.getCharacterById(this.socket.characterId)
}
protected async getCharacter(): Promise<Character | null> {
if (!this.socket.characterId) return null
const characterRepository = new CharacterRepository()