1
0
forked from noxious/server

Fixed left-overs from #293

This commit is contained in:
2025-01-01 21:49:01 +01:00
parent 7c473de12b
commit 45e756fcd3
19 changed files with 53 additions and 41 deletions

View File

@ -1,14 +1,14 @@
import { Server } from 'socket.io'
import { BaseService } from '#application/base/baseService'
import { TSocket } from '#application/types'
import { TSocket, UUID } from '#application/types'
import { Chat } from '#entities/chat'
import CharacterRepository from '#repositories/characterRepository'
import ChatRepository from '#repositories/chatRepository'
import ZoneRepository from '#repositories/zoneRepository'
class ChatService extends BaseService {
async sendZoneMessage(io: Server, socket: TSocket, message: string, characterId: number, zoneId: number): Promise<boolean> {
async sendZoneMessage(io: Server, socket: TSocket, message: string, characterId: UUID, zoneId: UUID): Promise<boolean> {
try {
const character = await CharacterRepository.getById(characterId)
if (!character) return false

View File

@ -1,11 +1,12 @@
import Logger, { LoggerType } from '#application/logger'
import { UUID } from '#application/types'
import { Character } from '#entities/character'
import SocketManager from '#managers/socketManager'
import ZoneManager from '#managers/zoneManager'
import ZoneCharacter from '#models/zoneCharacter'
interface TeleportOptions {
targetZoneId: number
targetZoneId: UUID
targetX: number
targetY: number
rotation?: number
@ -16,7 +17,7 @@ interface TeleportOptions {
class TeleportService {
private readonly logger = Logger.type(LoggerType.GAME)
public async teleportCharacter(characterId: number, options: TeleportOptions): Promise<boolean> {
public async teleportCharacter(characterId: UUID, options: TeleportOptions): Promise<boolean> {
const { targetZoneId, targetX, targetY, rotation = 0, isInitialJoin = false, character } = options
const socket = SocketManager.getSocketByCharacterId(characterId)