Skip to content

Commit

Permalink
fix: Info tab visible again. Skill roll shows skill again. Fixed a lo…
Browse files Browse the repository at this point in the history
…t of warnings.
  • Loading branch information
xdy committed Aug 21, 2020
1 parent 32ab092 commit aa46fe9
Show file tree
Hide file tree
Showing 10 changed files with 294 additions and 237 deletions.
24 changes: 12 additions & 12 deletions src/module/handlebars.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { SIGKILL } from "constants";

export default function registerHandlebarsHelpers():void {

// If you need to add Handlebars helpers, here are a few useful examples:
Handlebars.registerHelper('concat', function() {
Handlebars.registerHelper('concat', function () {
let outStr = '';
for (const arg in arguments) {
if (typeof arguments[arg] != 'object') {
Expand All @@ -13,33 +11,35 @@ export default function registerHandlebarsHelpers():void {
return outStr;
});

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

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

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

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

Handlebars.registerHelper('getSkillValueWithJoat', function(skill, joat) {
Handlebars.registerHelper('getSkillValueWithJoat', getSkillValueWithJoat);

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

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


Handlebars.registerHelper({
Expand Down
24 changes: 12 additions & 12 deletions src/module/sheets/TwodsixActorSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ export class TwodsixActorSheet extends ActorSheet {
}));

// Delete Inventory Item
html.find('.item-delete').on('click',(ev => {
html.find('.item-delete').on('click', (ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.deleteOwnedItem(li.data("itemId"));
li.slideUp(200, () => this.render(false));
}));

// Rollable abilities.
html.find('.rollable').on('click',(this._onRoll.bind(this)));
html.find('.rollable').on('click', (this._onRoll.bind(this)));

// Upgrade/downgrade skills.
html.find('.upgrade-skill').on('click',this._onUpgrade.bind(this));
html.find('.downgrade-skill').on('click',this._onDowngrade.bind(this));
html.find('.upgrade-joat').on('click',this._onUpgradeJoat.bind(this));
html.find('.downgrade-joat').on('click',this._onDowngradeJoat.bind(this));
html.find('.upgrade-skill').on('click', this._onUpgrade.bind(this));
html.find('.downgrade-skill').on('click', this._onDowngrade.bind(this));
html.find('.upgrade-joat').on('click', this._onUpgradeJoat.bind(this));
html.find('.downgrade-joat').on('click', this._onDowngradeJoat.bind(this));

html.find('.toggle-skills').on('click',ev => {
html.find('.toggle-skills').on('click', ev => {
ev.preventDefault();
this.options.hideUntrainedSkills = !this.options.hideUntrainedSkills;
this.actor.sheet.render(true)
Expand Down Expand Up @@ -136,7 +136,7 @@ export class TwodsixActorSheet extends ActorSheet {
* @param {Event} event The originating click event
* @private
*/
_onRoll(event: { preventDefault: () => void; currentTarget: any; }):void {
_onRoll(event:{ preventDefault:() => void; currentTarget:any; }):void {
event.preventDefault();
const element = event.currentTarget;
const dataset = element.dataset;
Expand All @@ -151,7 +151,7 @@ export class TwodsixActorSheet extends ActorSheet {
}
}

_onUpgradeJoat(event: { preventDefault: () => void; currentTarget: any; }):void {
_onUpgradeJoat(event:{ preventDefault:() => void; currentTarget:any; }):void {
event.preventDefault();
const element = event.currentTarget;
const actorData = this.actor.data;
Expand All @@ -162,7 +162,7 @@ export class TwodsixActorSheet extends ActorSheet {
}
}

_onDowngradeJoat(event: { preventDefault: () => void; currentTarget: any; }):void {
_onDowngradeJoat(event:{ preventDefault:() => void; currentTarget:any; }):void {
event.preventDefault();
const element = event.currentTarget;
const actorData = this.actor.data;
Expand All @@ -178,7 +178,7 @@ export class TwodsixActorSheet extends ActorSheet {
* @param {Event} event The originating click event
* @private
*/
_onUpgrade(event: { preventDefault: () => void; currentTarget: any; }):void {
_onUpgrade(event:{ preventDefault:() => void; currentTarget:any; }):void {
event.preventDefault();
const element = event.currentTarget;
const skillName = element.getAttribute('data-label');
Expand All @@ -198,7 +198,7 @@ export class TwodsixActorSheet extends ActorSheet {
* @param {Event} event The originating click event
* @private
*/
_onDowngrade(event: { preventDefault: () => void; currentTarget: any; }):void {
_onDowngrade(event:{ preventDefault:() => void; currentTarget:any; }):void {
event.preventDefault();
const element = event.currentTarget;
const skillName = element.getAttribute('data-label');
Expand Down
4 changes: 2 additions & 2 deletions src/module/sheets/TwodsixItemSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class TwodsixItemSheet extends ItemSheet {
classes: ["twodsix", "sheet", "item"],
width: 520,
height: 377,
submitOnClose:true,
submitOnChange:true,
submitOnClose: true,
submitOnChange: true,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
});
}
Expand Down
Loading

0 comments on commit aa46fe9

Please sign in to comment.