Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Commit

Permalink
Add VSM,R,C info to spells
Browse files Browse the repository at this point in the history
  • Loading branch information
espositos committed Jun 25, 2020
1 parent 4c9bd2b commit b250fbb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 16 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.2.1] 2-2-06-25
### Changed
- Removed some excess logging.
- DND5e: Renamed Ability Tests to Ability Checks.
- DND5e: Add choice of showing VSM/C/R info next to spells.

## [0.2.0] 2020-06-25
### Added
- DND5e: add choice of showing all nonprepared spells (innate, pact, at-will, always prepared), or hiding based on their 'prepared'-ness.
Expand Down
38 changes: 22 additions & 16 deletions scripts/actions/actions-dnd5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,9 @@ export class ActionHandler5e extends ActionHandler {
}

let spell = this._buildItem(tokenId, actor, macroType, s);

let c = s.data.components;

if (c.vocal)
spell.info1 += 'V';

if (c.somatic)
spell.info1 += 'S';

if (c.material)
spell.info1 += 'M';

if (s.data.components.concentration)
spell.info2 += 'C';

if (c.ritual)
spell.info3 += 'R';
if (settings.get('showSpellInfo'))
this._addSpellInfo(s, spell);

if (!max || levelInfo?.slotsAvailable) {
if (power) {
Expand All @@ -248,6 +234,26 @@ export class ActionHandler5e extends ActionHandler {

return result;
}

/** @private */
_addSpellInfo(s, spell) {
let c = s.data.components;

if (c?.vocal)
spell.info1 += 'V';

if (c?.somatic)
spell.info1 += 'S';

if (c?.material)
spell.info1 += 'M';

if (c?.concentration)
spell.info2 += 'C';

if (c?.ritual)
spell.info3 += 'R';
}

/** FEATS **/

Expand Down
11 changes: 11 additions & 0 deletions scripts/settings/dnd5e-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ export function registerSettings(app, settings, updateSettings) {
onChange: value => { updateSettings(value); }
});

game.settings.register(app,'showSpellInfo', {
name: "Display spell information",
hint: "If enabled, spell component information, concentration, and ritual status will be noted next to the spell name.",
scope: "client",
config: true,
type: Boolean,
default: true,
onChange: value => { updateSettings(value); }
});

game.settings.register(app,'showAllNonpreparableSpells', {
name: "Show all non-preparable spells",
hint: "If disabled, spells such as cantrips, innate, pact, and at-will spells need to be 'prepared' via the spell details to be shown on the HUD.",
Expand Down Expand Up @@ -66,4 +76,5 @@ export function registerSettings(app, settings, updateSettings) {
settings['hideLongerActions'] = 'hideLongerActions';
settings['abbreviateSkills'] = 'abbreviateSkills';
settings['splitAbilities'] = 'splitAbilities';
settings['showSpellInfo'] = 'showSpellInfo';
}

0 comments on commit b250fbb

Please sign in to comment.