mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Feature/armor stack uses on damage (#300)
* ArmorStack use as User query * Remove unnecessart args * Fixes
This commit is contained in:
parent
861dfd977d
commit
059b814fdf
7 changed files with 103 additions and 57 deletions
|
|
@ -63,21 +63,28 @@ export const registerSocketHooks = () => {
|
|||
});
|
||||
};
|
||||
|
||||
export const emitAsGM = async (eventName, callback, args) => {
|
||||
export const emitAsGM = async (eventName, callback, update, uuid = null) => {
|
||||
if(!game.user.isGM) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const response = await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.GMUpdate,
|
||||
data: {
|
||||
action: eventName,
|
||||
update: args
|
||||
}
|
||||
});
|
||||
resolve(response);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return await game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: socketEvent.GMUpdate,
|
||||
data: {
|
||||
action: eventName,
|
||||
uuid,
|
||||
update
|
||||
}
|
||||
})
|
||||
} else return callback(args);
|
||||
});
|
||||
} else return callback(update);
|
||||
}
|
||||
|
||||
export const emitAsOwner = (eventName, userId, args) => {
|
||||
if(userId === game.user.id) return;
|
||||
if(!eventName || !userId) return false;
|
||||
game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||
action: eventName,
|
||||
data: {
|
||||
userId,
|
||||
...args
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue