forked from noxious/server
fuk it
This commit is contained in:
@ -3,6 +3,7 @@ import { TSocket } from '../../../utilities/types'
|
||||
import ZoneRepository from '../../../repositories/zoneRepository'
|
||||
import { Zone } from '@prisma/client'
|
||||
import prisma from '../../../utilities/prisma'
|
||||
import CharacterManager from '../../../managers/characterManager'
|
||||
|
||||
type Payload = {
|
||||
name: string
|
||||
@ -17,12 +18,13 @@ type Payload = {
|
||||
*/
|
||||
export default function (socket: TSocket, io: Server) {
|
||||
socket.on('gm:zone_editor:zone:create', async (data: Payload, callback: (response: Zone[]) => 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
|
||||
}
|
||||
|
||||
console.log(`---GM ${socket.character?.id} has created a new zone via zone editor.`)
|
||||
console.log(`---GM ${character?.id} has created a new zone via zone editor.`)
|
||||
let zoneList: Zone[] = []
|
||||
try {
|
||||
const zone = await prisma.zone.create({
|
||||
|
Reference in New Issue
Block a user