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 Jun 25, 2020
2 parents 82006f5 + b250fbb commit ddb462e
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 18 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
24 changes: 24 additions & 0 deletions scripts/actions/actions-dnd5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ export class ActionHandler5e extends ActionHandler {
}

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

if (settings.get('showSpellInfo'))
this._addSpellInfo(s, spell);

if (!max || levelInfo?.slotsAvailable) {
if (power) {
powers.subcategories[prepType].actions.push(spell);
Expand All @@ -230,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
1 change: 0 additions & 1 deletion scripts/actions/actions-wfrp.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class ActionHandlerWfrp extends ActionHandler {
if (Object.entries(characteristics.subcategories).length > 0)
result.categories["characteristics"] = characteristics;

console.log(result);
return result;
}

Expand Down
6 changes: 3 additions & 3 deletions scripts/actions/checks-dnd5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export function buildChecksList(tokenId) {
result["skills"] = { subcategories: skills };

if (settings.get('splitAbilities')) {
let tests = mapToSubcategory(tokenId, "tests", "abilityTest", game.dnd5e.config.abilities, abbr);
result["tests"] = { subcategories: tests };
let checks = mapToSubcategory(tokenId, "checks", "abilityChecks", game.dnd5e.config.abilities, abbr);
result["checks"] = { subcategories: checks };

let saves = mapToSubcategory(tokenId, "saves", "abilitySave", game.dnd5e.config.abilities, abbr);
result["saves"] = { subcategories: saves};
Expand All @@ -24,7 +24,7 @@ export function buildChecksList(tokenId) {
}

function mapToSubcategory(tokenId, categoryName, categoryType, list, abbr) {
console.log(abbr);

let result = { [categoryName]:
{
"actions": Object.entries(list).map(e => {
Expand Down
2 changes: 0 additions & 2 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Hooks.on('init', () => {
if (!game.tokenActionHUD) {
let actionHandler = HandlersManager.getActionHandler(system);
let handlerId = settings.get('rollHandler');
console.log(handlerId);

if (! (handlerId === 'core' || game.modules.get(handlerId).active) ) {
settings.Logger.error(handlerId, "not found, reverting to core roller.")
Expand All @@ -31,7 +30,6 @@ Hooks.on('init', () => {
}

let rollHandler = HandlersManager.getRollHandler(system, handlerId);
console.log(rollHandler);

game.tokenActionHUD = new TokenActionHUD(actionHandler, rollHandler);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export class Logger {

static debug(...args) {
if (game.settings.get('token-action-hud', 'debug'))
Logger.info("debug: ", ...args);
Logger.info("debug:", ...args);
}
}
8 changes: 4 additions & 4 deletions scripts/rolls/base-dnd5e-rolls.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class RollHandlerBase5e extends RollHandler {

/** @override */
handleActionEvent(event, encodedValue) {
console.log(encodedValue);
settings.Logger.debug(encodedValue);
let payload = encodedValue.split('.');

if (payload.length != 3) {
Expand All @@ -29,8 +29,8 @@ export class RollHandlerBase5e extends RollHandler {
case "abilitySave":
this.rollAbilitySaveMacro(event, tokenId, actionId);
break;
case "abilityTest":
this.rollAbilityTestMacro(event, tokenId, actionId);
case "abilityCheck":
this.rollAbilityCheckMacro(event, tokenId, actionId);
break;
case "item":
case "spell":
Expand All @@ -46,7 +46,7 @@ export class RollHandlerBase5e extends RollHandler {
super.getActor(tokenId).rollAbility(checkId, {event: event});
}

rollAbilityTestMacro(event, tokenId, checkId) {
rollAbilityCheckMacro(event, tokenId, checkId) {
super.getActor(tokenId).rollAbilityTest(checkId, {event: event});
}

Expand Down
5 changes: 1 addition & 4 deletions scripts/rolls/base-wfrp-rolls.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class RollHandlerBaseWfrp4e extends RollHandler {

handleActionEvent(event, encodedValue) {
let payload = encodedValue.split('.');
console.log(encodedValue);
settings.Logger.debug(encodedValue);
if (payload.length != 3) {
super.throwInvalidValueErr();
}
Expand All @@ -18,11 +18,8 @@ export class RollHandlerBaseWfrp4e extends RollHandler {

let actor = super.getActor(tokenId);
let item = actor.getOwnedItem(actionId).data;
console.log(item);
console.log(event);

let bypassData = {bypass: !!event.shiftKey};
console.log("BypassData: ", bypassData);

switch (macroType) {
case "weapon":
Expand Down
2 changes: 1 addition & 1 deletion scripts/rolls/betterrolls5e-dnd5e-rolls.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class RollHandlerBetterRolls5e extends RollHandlerBase5e {
}

/** @override */
rollAbilityTestMacro(event, tokenId, checkId) {
rollAbilityCheckMacro(event, tokenId, checkId) {
let actor = super.getActor(tokenId);

let params = {adv:0, disadv:0};
Expand Down
15 changes: 13 additions & 2 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 @@ -41,8 +51,8 @@ export function registerSettings(app, settings, updateSettings) {
});

game.settings.register(app,'splitAbilities', {
name: "Show separate ability test and save categories",
hint: "If enabled, abilities will be separated into tests and saves.",
name: "Show separate ability check and save categories",
hint: "If enabled, abilities will be separated into checks and saves.",
scope: "client",
config: true,
type: Boolean,
Expand All @@ -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 ddb462e

Please sign in to comment.