forked from noxious/server
GM event fixes
This commit is contained in:
@ -2,6 +2,7 @@ import { Server } from 'socket.io'
|
||||
import { TSocket } from '../../../../utilities/types'
|
||||
import prisma from '../../../../utilities/prisma'
|
||||
import CharacterManager from '../../../../managers/characterManager'
|
||||
import characterRepository from '../../../../repositories/characterRepository'
|
||||
|
||||
type Payload = {
|
||||
id: string
|
||||
@ -22,9 +23,11 @@ type Payload = {
|
||||
*/
|
||||
export default function (socket: TSocket, io: Server) {
|
||||
socket.on('gm:object:update', async (data: Payload, callback: (success: boolean) => void) => {
|
||||
const character = CharacterManager.getCharacterFromSocket(socket);
|
||||
if (character?.role !== 'gm') {
|
||||
return
|
||||
const character = await characterRepository.getById(socket.characterId as number);
|
||||
if (!character) return callback(false)
|
||||
|
||||
if (character.role !== 'gm') {
|
||||
return callback(false)
|
||||
}
|
||||
|
||||
try {
|
||||
|
Reference in New Issue
Block a user