-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,582 additions
and
799 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export function onManageActiveEffect(event, owner) { | ||
event.preventDefault(); | ||
const a = event.currentTarget; | ||
const li = a.closest("li"); | ||
const effect = li.dataset.effectId ? owner.effects.get(li.dataset.effectId) : null; | ||
switch ( a.dataset.action ) { | ||
case "create": | ||
return ActiveEffect.create({ | ||
label: "New Effect", | ||
icon: "icons/svg/aura.svg", | ||
origin: owner.uuid, | ||
"duration.rounds": li.dataset.effectType === "temporary" ? 1 : undefined, | ||
disabled: li.dataset.effectType === "inactive" | ||
}, owner).create(); | ||
case "edit": | ||
return effect.sheet.render(true); | ||
case "delete": | ||
return effect.delete(); | ||
case "toggle": | ||
return effect.update({disabled: !effect.data.disabled}); | ||
} | ||
} | ||
|
||
|
||
export function prepareActiveEffectCategories(effects) { | ||
// Define effect header categories | ||
const categories = { | ||
temporary: { | ||
type: "temporary", | ||
label: "Temporary Effects", | ||
effects: [] | ||
}, | ||
passive: { | ||
type: "passive", | ||
label: "Passive Effects", | ||
effects: [] | ||
}, | ||
inactive: { | ||
type: "inactive", | ||
label: "Inactive Effects", | ||
effects: [] | ||
} | ||
}; | ||
|
||
// Iterate over active effects, classifying them into categories | ||
for ( let e of effects ) { | ||
e._getSourceName(); // Trigger a lookup for the source name | ||
if ( e.data.disabled ) categories.inactive.effects.push(e); | ||
else if ( e.isTemporary ) categories.temporary.effects.push(e); | ||
else categories.passive.effects.push(e); | ||
} | ||
return categories; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.