1
0
forked from noxious/server
This commit is contained in:
Zaxiure
2024-09-20 21:58:38 +02:00
parent b772ade582
commit ed92663313
27 changed files with 117 additions and 68 deletions

View File

@ -2,6 +2,7 @@ import { Server } from 'socket.io'
import { TSocket } from '../../../../utilities/types'
import { Sprite } from '@prisma/client'
import SpriteRepository from '../../../../repositories/spriteRepository'
import CharacterManager from '../../../../managers/characterManager'
interface IPayload {}
@ -12,8 +13,9 @@ interface IPayload {}
*/
export default function (socket: TSocket, io: Server) {
socket.on('gm:sprite:list', async (data: any, callback: (response: Sprite[]) => void) => {
if (socket.character?.role !== 'gm') {
console.log(`---Character #${socket.character?.id} is not a game master.`)
const character = CharacterManager.getCharacterFromSocket(socket);
if (character?.role !== 'gm') {
console.log(`---Character #${character?.id} is not a game master.`)
return
}