1
0
forked from noxious/server

Major refractor, cleaning and improvements.

This commit is contained in:
2024-08-24 03:08:43 +02:00
parent e0b376cb83
commit 39f4e79a88
30 changed files with 123 additions and 69 deletions

View File

@ -0,0 +1,24 @@
import { Server } from 'socket.io'
import { TSocket } from '../../../../utilities/types'
import { Tile } from '@prisma/client'
import TileRepository from '../../../../repositories/tileRepository'
interface IPayload {}
/**
* Handle game master list tile event
* @param socket
* @param io
*/
export default function (socket: TSocket, io: Server) {
socket.on('gm:tile:list', async (data: any, callback: (response: Tile[]) => void) => {
if (socket.character?.role !== 'gm') {
console.log(`---Character #${socket.character?.id} is not a game master.`)
return
}
// get all tiles
const tiles = await TileRepository.getAll()
callback(tiles)
})
}