1
0
forked from noxious/server

Renamed zone > map

This commit is contained in:
2025-01-02 17:31:24 +01:00
parent 887da447e0
commit 11041fec83
54 changed files with 871 additions and 895 deletions

View File

@ -1,6 +1,6 @@
import { BaseEvent } from '#application/base/baseEvent'
import ZoneManager from '#managers/zoneManager'
import ZoneRepository from '#repositories/zoneRepository'
import MapManager from '#managers/mapManager'
import MapRepository from '#repositories/mapRepository'
import ChatService from '#services/chatService'
type TypePayload = {
@ -18,21 +18,21 @@ export default class ChatMessageEvent extends BaseEvent {
return callback(false)
}
const zoneCharacter = ZoneManager.getCharacterById(this.socket.characterId!)
if (!zoneCharacter) {
const mapCharacter = MapManager.getCharacterById(this.socket.characterId!)
if (!mapCharacter) {
this.logger.error('chat:message error', 'Character not found')
return callback(false)
}
const character = zoneCharacter.character
const character = mapCharacter.character
const zone = await ZoneRepository.getById(character.zone.id)
if (!zone) {
this.logger.error('chat:message error', 'Zone not found')
const map = await MapRepository.getById(character.map.id)
if (!map) {
this.logger.error('chat:message error', 'Map not found')
return callback(false)
}
if (await ChatService.sendZoneMessage(character.getId(), zone.getId(), data.message)) {
if (await ChatService.sendMapMessage(character.getId(), map.getId(), data.message)) {
return callback(true)
}