1
0
forked from noxious/server

#184: Added commands to toggle rain / fog, command bug fix, minor improvements

This commit is contained in:
2024-11-05 23:15:56 +01:00
parent 26dbaa45a7
commit c4a42066ab
6 changed files with 160 additions and 12 deletions

View File

@ -24,16 +24,24 @@ export default class AlertCommandEvent {
return
}
const args = getArgs('alert', data.message)
if (!args) {
// Check if character exists
const character = await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number)
if (!character) {
gameLogger.error('chat:alert_command error', 'Character not found')
callback(false)
return
}
const character = await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number)
if (!character) {
gameLogger.error('chat:alert_command error', 'Character not found')
// Check if the user is the GM
if (character.role !== 'gm') {
gameLogger.info(`User ${character.id} tried to set time but is not a game master.`)
callback(false)
return
}
const args = getArgs('alert', data.message)
if (!args) {
callback(false)
return
}