forked from noxious/server
GM event fixes
This commit is contained in:
@ -3,6 +3,7 @@ import { TSocket } from '../../../../utilities/types'
|
||||
import { Tile } from '@prisma/client'
|
||||
import TileRepository from '../../../../repositories/tileRepository'
|
||||
import CharacterManager from '../../../../managers/characterManager'
|
||||
import characterRepository from '../../../../repositories/characterRepository'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
@ -13,9 +14,10 @@ interface IPayload {}
|
||||
*/
|
||||
export default function (socket: TSocket, io: Server) {
|
||||
socket.on('gm:tile:list', async (data: any, callback: (response: Tile[]) => void) => {
|
||||
const character = CharacterManager.getCharacterFromSocket(socket);
|
||||
if (character?.role !== 'gm') {
|
||||
console.log(`---Character #${character?.id} is not a game master.`)
|
||||
const character = await characterRepository.getById(socket.characterId as number);
|
||||
if (!character) return
|
||||
|
||||
if (character.role !== 'gm') {
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user