Skip to content

Commit

Permalink
feature: Switched to Kevin's/Rob's way of doing things.
Browse files Browse the repository at this point in the history
  • Loading branch information
xdy committed Aug 16, 2020
1 parent eb346c9 commit 5a97768
Show file tree
Hide file tree
Showing 16 changed files with 1,256 additions and 672 deletions.
85 changes: 38 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions src/module/entities/TwodsixActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,9 @@ export default class TwodsixActor extends Actor {
// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
switch (actorData.type) {
case 'character':
case 'traveller':
this._prepareCharacterData(actorData);
break;
// case 'npc':
// // TODO Should share a lot of functionality with character
// this._prepareNpcData(actorData);
// break;
// case 'animal':
// TODO This is for animals 'without characteristics', like in mongoose 2. If they have characteristics, they're npcs.
// this._prepareAnimalData(actorData);
// break;
// case 'vehicle':
// this._prepareVehicleData(actorData);
// break;
// case 'ship':
// this._prepareShipData(actorData);
// break;
default:
console.log(`Unhandled actorData.type in prepareData:${actorData.type}`)
}
Expand Down
37 changes: 37 additions & 0 deletions src/module/handlebars.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
export default function registerHandlebarsHelpers():void {

// If you need to add Handlebars helpers, here are a few useful examples:
Handlebars.registerHelper('concat', function() {
let outStr = '';
for (const arg in arguments) {
if (typeof arguments[arg] != 'object') {
outStr += arguments[arg];
}
}
return outStr;
});

Handlebars.registerHelper('toLowerCase', function(str) {
return str.toLowerCase();
});

Handlebars.registerHelper('checkPsi', function(characteristic) {
if (!game.user.isGM && characteristic.shortlabel === 'PSI' && characteristic.value === 0) {
return false;
}
return true;
});

Handlebars.registerHelper('checkTrainedSkill', function(skill) {
return skill.trained
});

Handlebars.registerHelper('shouldShowSkill', function(skill, hideUntrainedSkills) {
console.log('shouldShowSkill', skill, hideUntrainedSkills)
return skill.trained || hideUntrainedSkills
});

Handlebars.registerHelper('getSkillValueWithJoat', function(skill, joat) {
if (skill.trained) return skill.value
return skill.value + joat.value
});

Handlebars.registerHelper({
add: (v1, v2) => v1 + v2,
sub: (v1, v2) => v1 - v2,
Expand Down
Loading

0 comments on commit 5a97768

Please sign in to comment.