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

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
espositos committed Sep 24, 2020
2 parents fb532ea + 82072c4 commit 92cb92d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 12 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.7.16] 2020-09-22
### Bugfix
- Pf2e - Add action categories for exploration and downtime and add setting for ignoring passive actions (default: false)

## [0.7.15] 2020-09-22
### Bugfix
- SFRPG - recognise professions for skills
Expand Down
4 changes: 4 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
"tokenactionhud.wounded": "Wounded",
"tokenactionhud.dying": "Dying",
"tokenactionhud.profession": "Profession",
"tokenactionhud.exploration": "Exploration",
"tokenactionhud.downtime": "Downtime",

"tokenactionhud.utility": "Utility",
"tokenactionhud.toggleCombatState": "Toggle Combat State",
Expand Down Expand Up @@ -155,6 +157,8 @@
"tokenactionhud.settings.pf2e.printSpellCard.hint": "If disabled, left-clicking a spell will roll attack (shift right-click for bonus dialogue), right-clicking will roll damage (ctrl right-click for bonus dialogue). If neither are applicable, the spell card will be printed to chat anyway.",
"tokenactionhud.settings.pf2e.abbreviateSkills.name": "Abbreviate skill and ability names",
"tokenactionhud.settings.pf2e.abbreviateSkills.hint": "If enabled, skills and abilities will use a three-character abbreviation.",
"tokenactionhud.settings.pf2e.ignorePassiveActions.name": "Ignore passive actions",
"tokenactionhud.settings.pf2e.ignorePassiveActions.hint": "If enabled, passive actions are not shown.",

"tokenactionhud.settings.sfrpg.showSpellInfo.name": "Display spell information",
"tokenactionhud.settings.sfrpg.showSpellInfo.hint": "If enabled, spell resistance, dismissible, concentration and save information noted next to the spell name.",
Expand Down
22 changes: 19 additions & 3 deletions scripts/actions/pf2e/pf2e-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,38 @@ export class ActionHandlerPf2e extends ActionHandler {

let filteredActions = (actor.items ?? []).filter(a => a.type === macroType);

if (settings.get('ignorePassiveActions'))
filteredActions = filteredActions.filter(a => a.data.data.actionType.value !== 'passive');

let actions = this.initializeEmptySubcategory();
actions.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.actionType.value === 'action'), macroType);
actions.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.actionType.value === 'action' && this._actionIsShort(a)), macroType);

let reactions = this.initializeEmptySubcategory();
reactions.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.actionType.value === 'reaction'), macroType);
reactions.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.actionType.value === 'reaction' && this._actionIsShort(a)), macroType);

let free = this.initializeEmptySubcategory();
free.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.actionType.value === 'free'), macroType);
free.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.actionType.value === 'free' && this._actionIsShort(a)), macroType);

let exploration = this.initializeEmptySubcategory();
exploration.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.traits?.value.includes('exploration')), macroType);

let downtime = this.initializeEmptySubcategory();
downtime.actions = this._produceMap(tokenId, (filteredActions ?? []).filter(a => a.data.data.traits?.value.includes('downtime')), macroType);

this._combineSubcategoryWithCategory(result, this.i18n('tokenactionhud.actions'), actions);
this._combineSubcategoryWithCategory(result, this.i18n('tokenactionhud.reactions'), reactions);
this._combineSubcategoryWithCategory(result, this.i18n('tokenactionhud.free'), free);
this._combineSubcategoryWithCategory(result, this.i18n('tokenactionhud.exploration'), exploration);
this._combineSubcategoryWithCategory(result, this.i18n('tokenactionhud.downtime'), downtime);

return result;
}

/** @private */
_actionIsShort(action) {
return !(action.data.data.traits?.value.includes('exploration') || action.data.data.traits?.value.includes('downtime'));
}

/** @private */
_getSpellsList(actor, tokenId) {
let result = this.initializeEmptyCategory('spells');
Expand Down
28 changes: 19 additions & 9 deletions scripts/settings/pf2e-settings.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export function registerSettings(app, updateSettings) {
game.settings.register(app,'showPcAbilities', {
name: game.i18n.localize('tokenactionhud.settings.pf2e.showPcAbilities.name'),
hint: game.i18n.localize('tokenactionhud.settings.pf2e.showPcAbilities.hint'),
scope: "client",
config: true,
type: Boolean,
default: true,
onChange: value => { updateSettings(value); }
});
game.settings.register(app,'showPcAbilities', {
name: game.i18n.localize('tokenactionhud.settings.pf2e.showPcAbilities.name'),
hint: game.i18n.localize('tokenactionhud.settings.pf2e.showPcAbilities.hint'),
scope: "client",
config: true,
type: Boolean,
default: true,
onChange: value => { updateSettings(value); }
});

game.settings.register(app,'showNpcAbilities', {
name: game.i18n.localize('tokenactionhud.settings.pf2e.showNpcAbilities.name'),
Expand All @@ -18,6 +18,16 @@ export function registerSettings(app, updateSettings) {
default: true,
onChange: value => { updateSettings(value); }
});

game.settings.register(app,'ignorePassiveActions', {
name: game.i18n.localize('tokenactionhud.settings.pf2e.ignorePassiveActions.name'),
hint: game.i18n.localize('tokenactionhud.settings.pf2e.ignorePassiveActions.hint'),
scope: "client",
config: true,
type: Boolean,
default: false,
onChange: value => { updateSettings(value); }
});

game.settings.register(app,'calculateAttackPenalty', {
name: game.i18n.localize('tokenactionhud.settings.pf2e.calculateAttackPenalty.name'),
Expand Down

0 comments on commit 92cb92d

Please sign in to comment.