Skip to content

Commit

Permalink
Merge pull request #110 from etiquettestartshere/1.2.15
Browse files Browse the repository at this point in the history
3.3.0
  • Loading branch information
etiquettestartshere authored Sep 5, 2024
2 parents a4c4b32 + 0103583 commit cf084cc
Show file tree
Hide file tree
Showing 12 changed files with 526 additions and 161 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.mjs text eol=lf
27 changes: 26 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

# Combine CSS files into a single CSS file
- name: Combine CSS files
run: |
cat styles/*.css > effectivetray.css
# Get part of the tag after the `v`.
- name: Extract tag version number
id: get_version
Expand All @@ -31,6 +36,8 @@ jobs:
url: https://github.com/${{github.repository}}
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip
styles: "[\"effectivetray.css\"]"
esmodules: "[\"effectivetray.mjs\"]"

# Substitute the Manifest and Download URLs in the module.json
# for a PRE RELEASE.
Expand All @@ -46,10 +53,28 @@ jobs:
url: https://github.com/${{github.repository}}
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip
styles: "[\"effectivetray.css\"]"
esmodules: "[\"effectivetray.mjs\"]"

# Set up Node
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: '20.10.0'
cache: 'npm'

# `npm ci` is recommended:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
- name: Install Dependencies
run: npm ci

# Run build scripts
- name: Build All
run: npm run build

# Create zip file.
- name: Create ZIP archive
run: zip -r ./module.zip module.json LICENSE styles/ scripts/ lang/
run: zip -r ./module.zip module.json effectivetray.mjs effectivetray.css lang/

# Create a release for this specific version.
- name: Update Release with Files
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
effectivetray.lock
node_modules/
120 changes: 61 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Allows users to use the damage tray for selected tokens that they own, and for t
- **Damage Target**: Allow users to damage targets (that they don't own) with the damage tray (off by default).
- **Delete Instead of Refresh**: Attempting to transfer an effect to an actor that has it already will delete it rather than refreshing its duration (off by default).
- **Filtering** based on actor type, permissions, and token disposition. This prevents users from seeing and interacting with effects of certain origins, depending on GM preference (no filtering is performed by default).
- **Multiple Effects with Concentration**: Allow multiple effects to be applied from spells with concentration (off by default).
- **Use Default Trays**: Adds settings (off by default) to use the default effects and damage trays. Only the features *below* this setting will function if a given tray is in its default mode.
- **Don't Close Trays on Apply**: Don't automatically close trays when hitting submit. Won't work with default effects tray (now off by default).
- **Scroll on Expand**: Scroll chat to bottom when expanding a tray that is at the bottom (experimental, on by default).
- **Remove 'Apply Effect to Actor'**: On the time of creation (i.e. drag & drop), remove 'Apply Effect to Actor' from effects on items that have a duration to allow for normal use of the timer (on by default).
- **Multiple Effects with Concentration**: Allow multiple effects to be applied from spells with concentration (off by default).

## Additional Features
- Flags enchantment effects with their spellLevel
Expand Down Expand Up @@ -56,58 +56,58 @@ effectiv.applyEffect(

`applyDamage`, helper function to allow users to apply damage. This function has been tested not at all and is included as a courtesy. Personally I find the way damage information must be structured to respect resistances, etc is too much of a mess to test this even a single time, but if someone really wants to do this over a socket but didn't write their own socket handler for it...here you go. Full, extensive documentation of the array that must be created is in scripts/api.mjs, copied directly from `dnd5e`, with the exception that socket transmission requires the sets to be arrays. Unlike `applyEffect`, this applies no damage via the requesting client, and so is basically only meant for damaging unowned targets. Users wishing to apply damage to owned targets should simply use the system's `Actor#applyDamage`.
```js
/**
* The below documentation is from the system's damage application method, except all Sets are arrays.
* Please see the system's documentation for a complete understanding of this method, as this helper is only
* provided as a courtesy.
*
* Description of a source of damage.
*
* @typedef {object} DamageDescription
* @property {number} value Amount of damage.
* @property {string} type Type of damage.
* @property {Array<string>} properties Physical properties that affect damage application.
* @property {object} [active]
* @property {number} [active.multiplier] Final calculated multiplier.
* @property {boolean} [active.modifications] Did modification affect this description?
* @property {boolean} [active.resistance] Did resistance affect this description?
* @property {boolean} [active.vulnerability] Did vulnerability affect this description?
* @property {boolean} [active.immunity] Did immunity affect this description?
*/

/**
* Options for damage application.
*
* @typedef {object} DamageApplicationOptions
* @property {boolean|Array<string>} [downgrade] Should this actor's resistances and immunities be downgraded by one
* step? A Array of damage types to be downgraded or `true` to downgrade
* all damage types.
* @property {number} [multiplier=1] Amount by which to multiply all damage.
* @property {object|boolean} [ignore] Array to `true` to ignore all damage modifiers. If Array to an object, then
* values can either be `true` to indicate that the all modifications of
* that type should be ignored, or a Array of specific damage types for which
* it should be ignored.
* @property {boolean|Array<string>} [ignore.immunity] Should this actor's damage immunity be ignored?
* @property {boolean|Array<string>} [ignore.resistance] Should this actor's damage resistance be ignored?
* @property {boolean|Array<string>} [ignore.vulnerability] Should this actor's damage vulnerability be ignored?
* @property {boolean|Array<string>} [ignore.modification] Should this actor's damage modification be ignored?
* @property {boolean} [invertHealing=true] Automatically invert healing types to it heals, rather than damages.
* @property {"damage"|"healing"} [only] Apply only damage or healing parts. Untyped rolls will always be applied.
*/

/**
* Apply a certain amount of damage or healing to the health pool for Actor
* @param {DamageDescription[]|number} damages Damages to apply.
* @param {DamageApplicationOptions} [options={}] Damage application options.
* @returns {Promise<Actor5e>} A Promise which resolves once the damage has been applied.
*/

/**
* Helper function to allow for macros or other applications to apply damage via socket request.
* @param {array} damage Array of damage objects; see above.
* @param {array} opts Object of options (which may inlude arrays); see above.
* @param {string} id Uuid of the target.
*/
/**
* The below documentation is from the system's damage application method, except all Sets are arrays.
* Please see the system's documentation for a complete understanding of this method, as this helper is only
* provided as a courtesy.
*
* Description of a source of damage.
*
* @typedef {object} DamageDescription
* @property {number} value Amount of damage.
* @property {string} type Type of damage.
* @property {Array<string>} properties Physical properties that affect damage application.
* @property {object} [active]
* @property {number} [active.multiplier] Final calculated multiplier.
* @property {boolean} [active.modifications] Did modification affect this description?
* @property {boolean} [active.resistance] Did resistance affect this description?
* @property {boolean} [active.vulnerability] Did vulnerability affect this description?
* @property {boolean} [active.immunity] Did immunity affect this description?
*/

/**
* Options for damage application.
*
* @typedef {object} DamageApplicationOptions
* @property {boolean|Array<string>} [downgrade] Should this actor's resistances and immunities be downgraded by one
* step? A Array of damage types to be downgraded or `true` to downgrade
* all damage types.
* @property {number} [multiplier=1] Amount by which to multiply all damage.
* @property {object|boolean} [ignore] Array to `true` to ignore all damage modifiers. If Array to an object, then
* values can either be `true` to indicate that the all modifications of
* that type should be ignored, or a Array of specific damage types for which
* it should be ignored.
* @property {boolean|Array<string>} [ignore.immunity] Should this actor's damage immunity be ignored?
* @property {boolean|Array<string>} [ignore.resistance] Should this actor's damage resistance be ignored?
* @property {boolean|Array<string>} [ignore.vulnerability] Should this actor's damage vulnerability be ignored?
* @property {boolean|Array<string>} [ignore.modification] Should this actor's damage modification be ignored?
* @property {boolean} [invertHealing=true] Automatically invert healing types to it heals, rather than damages.
* @property {"damage"|"healing"} [only] Apply only damage or healing parts. Untyped rolls will always be applied.
*/

/**
* Apply a certain amount of damage or healing to the health pool for Actor
* @param {DamageDescription[]|number} damages Damages to apply.
* @param {DamageApplicationOptions} [options={}] Damage application options.
* @returns {Promise<Actor5e>} A Promise which resolves once the damage has been applied.
*/

/**
* Helper function to allow for macros or other applications to apply damage via socket request.
* @param {Array} damage Array of damage objects; see above.
* @param {Array} opts Object of options (which may inlude arrays); see above.
* @param {string} id Uuid of the target.
*/
async function applyDamage(damage = [], opts = {}, id)
```
```js
Expand All @@ -119,8 +119,8 @@ effectiv.applyDamage(damage = [], opts = {}, id)
```js
/**
* Sort tokens into owned and unowned categories.
* @param {Set|array} targets The set or array of tokens to be sorted.
* @returns {array} An Array of length two, the elements of which are the partitioned pieces of the original.
* @param {Set|Token[]} targets The set or array of tokens to be sorted.
* @returns {Array} An Array of length two, the elements of which are the partitioned pieces of the original.
*/
function partitionTargets(targets)
```
Expand All @@ -138,8 +138,9 @@ These hooks have not been extensively tested.
* Hook called before the effect is completed and applied.
* @param {Actor5e} actor The actor to create the effect on.
* @param {ActiveEffect5e} effect The effect to create.
* @param {object} effectData A generic data object that contains spellLevel in a `dnd5e` scoped flag, and whatever else.
* @param {ActiveEffect5e} concentration The concentration effect on which `effect` is dependent, if it requires concentration.
* @param {object} [options] Additional data that may be included with the effect.
* @param {object} [options.effectData] A generic data object that contains spellLevel in a `dnd5e` scoped flag, and whatever else.
* @param {ActiveEffect5e} [options.concentration] The concentration effect on which `effect` is dependent, if it requires concentration.
*/
Hooks.call("effectiv.preApplyEffect", actor, effect, { effectData, concentration });
```
Expand All @@ -148,8 +149,9 @@ Hooks.call("effectiv.preApplyEffect", actor, effect, { effectData, concentration
* Hook called before the effect is completed and applied. Same as above except for effectData.
* @param {Actor5e} actor The actor to create the effect on.
* @param {ActiveEffect5e} effect The effect to create.
* @param {object} effectData The packaged effect immediately before application.
* @param {ActiveEffect5e} concentration The concentration effect on which `effect` is dependent, if it requires concentration.
* @param {object} [options] Additional data that may be included with the effect.
* @param {object} [options.effectData] The packaged effect immediately before application.
* @param {ActiveEffect5e} [options.concentration] The concentration effect on which `effect` is dependent, if it requires concentration.
*/
Hooks.callAll("effectiv.applyEffect", actor, effect, { effectData, concentration });
```
Expand Down
71 changes: 39 additions & 32 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
{
"EFFECTIVETRAY.AllowTargetSettingName": "Transfer to Target",
"EFFECTIVETRAY.AllowTargetSettingHint": "Allow users to transfer effects to targets with right click.",
"EFFECTIVETRAY.ContextTargetSettingName": "Legacy Targeting for Effects",
"EFFECTIVETRAY.ContextTargetSettingHint": "Apply effects to target with right click, rather than the target source control.",
"EFFECTIVETRAY.DamageDefaultSettingName": "Use Default Damage Tray",
"EFFECTIVETRAY.DamageDefaultSettingHint": "Retain default system behavior (only the GM can see damage trays).",
"EFFECTIVETRAY.DamageTargetSettingName": "Damage Target",
"EFFECTIVETRAY.DamageTargetSettingHint": "Allow users to damage targets (that they don't own) with the damage tray.",
"EFFECTIVETRAY.DeleteInsteadSettingName": "Delete Instead of Refresh",
"EFFECTIVETRAY.DeleteInsteadSettingHint": "Attempting to transfer an effect to an actor that has it already will delete it rather than refreshing its duration.",
"EFFECTIVETRAY.DontCloseOnPressSettingName": "Don't Close Trays on Apply",
"EFFECTIVETRAY.DontCloseOnPressSettingHint": "Don't automatically close trays when hitting submit. Won't work with default effects tray.",
"EFFECTIVETRAY.FilterDispositionSettingName": "Filter by Disposition",
"EFFECTIVETRAY.FilterDispositionSettingHint": "Hide effects from users if they originate from tokens with the selected (or worse) disposition.",
"EFFECTIVETRAY.FilterPermissionSettingName": "Filter by Permission",
"EFFECTIVETRAY.FilterPermissionSettingHint": "Hide effects from users if they originate from actors which the users lack the selected permissions (or below) for.",
"EFFECTIVETRAY.IgnoreNPCSettingName": "Filter NPCs",
"EFFECTIVETRAY.IgnoreNPCSettingHint": "Hide effects from users if they originate from NPCs they do not own.",
"EFFECTIVETRAY.MultipleConcentrationEffectsSettingName": "Multiple Effects with Concentration",
"EFFECTIVETRAY.MultipleConcentrationEffectsSettingHint": "Allow multiple effects to be applied from spells with concentration",
"EFFECTIVETRAY.NoFilter": "No Filter",
"EFFECTIVETRAY.NOTIFICATION.NoActiveGMDamage": "There is no active GM. An active GM is required to damage targets you do not own.",
"EFFECTIVETRAY.NOTIFICATION.NoActiveGMEffect": "There is no active GM. An active GM is required to create effects on targets you do not own.",
"EFFECTIVETRAY.NOTIFICATION.NoTarget": "You don't have a target.",
"EFFECTIVETRAY.RemoveTransferSettingName": "Remove 'Apply Effect to Actor'",
"EFFECTIVETRAY.RemoveTransferSettingHint": "On the time of creation (i.e. drag & drop), remove 'Apply Effect to Actor' from effects on items that have a duration to allow for normal use of the timer.",
"EFFECTIVETRAY.ScrollOnExpandSettingName": "Scroll on Expand",
"EFFECTIVETRAY.ScrollOnExpandSettingHint": "Scroll chat to bottom when expanding a tray that is at the bottom.",
"EFFECTIVETRAY.SystemDefaultSettingName": "Use Default Effects Tray",
"EFFECTIVETRAY.SystemDefaultSettingHint": "Retain default system behavior (if you only want the settings below this one).",
"EFFECTIVETRAY.TOOLTIP.EffectsApplyTokens": "Apply to selected or targeted tokens.",
"EFFECTIVETRAY.TOOLTIP.EffectsApplyTokensLegacy": "Left click: Apply to selected tokens, Right click: Apply to targets"
"EFFECTIVETRAY": {
"AllowTargetSettingName": "Transfer to Target",
"AllowTargetSettingHint": "Allow users to transfer effects to targets they do not own.",
"ContextTargetSettingName": "Legacy Targeting for Effects",
"ContextTargetSettingHint": "Apply effects to target with right click, rather than the target source control.",
"DamageDefaultSettingName": "Use Default Damage Tray",
"DamageDefaultSettingHint": "Retain default system behavior (only the GM can see damage trays).",
"DamageTargetSettingName": "Damage Target",
"DamageTargetSettingHint": "Allow users to damage targets that they do not own with the damage tray.",
"DeleteInsteadSettingName": "Delete Instead of Refresh",
"DeleteInsteadSettingHint": "Attempting to transfer an effect to an actor that has it already will delete it rather than refreshing its duration.",
"DontCloseOnPressSettingName": "Don't Close Trays on Apply",
"DontCloseOnPressSettingHint": "Don't automatically close trays when hitting submit.",
"FilterDispositionSettingName": "Filter by Disposition",
"FilterDispositionSettingHint": "Hide effects from users if they originate from tokens with the selected (or worse) disposition.",
"FilterPermissionSettingName": "Filter by Permission",
"FilterPermissionSettingHint": "Hide effects from users if they originate from actors which the users lack the selected permissions (or below) for.",
"GmOnly": "GM Only",
"IgnoreNPCSettingName": "Filter NPCs",
"IgnoreNPCSettingHint": "Hide effects from users if they originate from NPCs they do not own.",
"MultipleConcentrationEffectsSettingName": "Multiple Effects with Concentration",
"MultipleConcentrationEffectsSettingHint": "Allow multiple effects to be applied from spells with concentration",
"NoFilter": "No Filter",
"NOTIFICATION": {
"NoActiveGMDamage": "There is no active GM. An active GM is required to damage targets you do not own.",
"NoActiveGMEffect": "There is no active GM. An active GM is required to create effects on targets you do not own.",
"NoTarget": "You don't have a target."
},
"RemoveTransferSettingName": "Remove 'Apply Effect to Actor'",
"RemoveTransferSettingHint": "On the time of creation (i.e. drag & drop), remove 'Apply Effect to Actor' from effects on items that have a duration to allow for normal use of the timer.",
"ScrollOnExpandSettingName": "Scroll on Expand",
"ScrollOnExpandSettingHint": "Scroll chat to bottom when expanding a tray that is at the bottom.",
"SystemDefaultSettingName": "Use Default Effects Tray",
"SystemDefaultSettingHint": "Retain default system behavior (if you only want the settings below this one).",
"TOOLTIP": {
"EffectsApplyTokens": "Apply to selected or targeted tokens.",
"EffectsApplyTokensLegacy": "Left click: Apply to selected tokens, Right click: Apply to targets"
}
}
}
Loading

0 comments on commit cf084cc

Please sign in to comment.