forked from noxious/server
Don't attack if isMoving
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user