Skip to content

Commit

Permalink
Merge pull request #79 from etiquettestartshere/1.1.20
Browse files Browse the repository at this point in the history
api changes, checking for damage roll change
  • Loading branch information
etiquettestartshere authored May 17, 2024
2 parents df5e423 + 0f2edcd commit c963899
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "effectivetray",
"title": "Effective Tray",
"version": "1.1.19",
"version": "1.1.20",
"compatibility": {
"minimum": "11",
"verified": "11"
Expand Down
11 changes: 7 additions & 4 deletions scripts/api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class API {
// Handle a single Uuid
else if (foundry.utils.getType(targets) === "string") {
const t = await fromUuid(targets);
t.document.isOwner ? owned = Array.from(t) : toTarget = Array.from(t);
t.isOwner ? owned = [t] : toTarget = [t.uuid];
}

// Handle an array of Tokens
Expand All @@ -79,11 +79,14 @@ export class API {


// Apply what effects you can apply yourself
const actors = new Set();
for (const token of owned) if (token.actor) actors.add(token.actor);
for (const actor of actors) await _applyEffects(actor, effect, {effectData, concentration});
if (!foundry.utils.isEmpty(owned)) {
const actors = new Set();
for (const token of owned) if (token.actor ?? token) actors.add(token.actor ?? token);
for (const actor of actors) await _applyEffects(actor, effect, {effectData, concentration});
};

// Ask the GM client to apply the rest
if (foundry.utils.isEmpty(toTarget)) return;
if (!game.users.activeGM) return ui.notifications.warn(game.i18n.localize("EFFECTIVETRAY.NOTIFICATION.NoActiveGMEffect"));

await game.socket.emit(socketID, {
Expand Down
4 changes: 2 additions & 2 deletions scripts/effective-tray.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class effectiveDamage {
* Methods lacking documentation below share these parameters.
*/
static _damageTray(message, html) {
if (foundry.utils.getProperty(message, "flags.dnd5e.roll.type") === "damage") {
if (message.rolls.some(r => r instanceof CONFIG.Dice.DamageRoll)) {
if (!game.user.isGM) {
if (message.whisper.length && !message.whisper.includes(game.user.id)) return;
const damageApplication = document.createElement("effective-damage-application");
Expand Down Expand Up @@ -363,7 +363,7 @@ async function _effectSocket(request) {
const actors = new Set();
for (const target of targets) {
const token = await fromUuid(target);
const targetActor = token.actor;
const targetActor = token.actor ?? token;
if (target) actors.add(targetActor);
};
for (const actor of actors) {
Expand Down

0 comments on commit c963899

Please sign in to comment.