Skip to content

Commit

Permalink
fix: Fixes and additions
Browse files Browse the repository at this point in the history
Bug Fixes:
- Augment description fix
- Stat blocks visual fix in Firefox (But Chrome is still recommended)
- Page no longer jumps to the top, not on any tab.

Additional Fixes:
- Macro text visibility improved
- Player configuration screen text visibility improved
- Journal text visibility improved

Additions:
- Character input fields now no longer require to save and can just be written in.
  These have now been changed into regular text fields and are no longer the editor.
- New Ship Sheet. When you click ‘Create Actor’ a pop-up now appears with ‘character’ and ‘ship’. Please don’t forget to give it a name or an error will occur.
  • Loading branch information
UltraKev authored and xdy committed Sep 8, 2020
1 parent 3082042 commit 389d27e
Show file tree
Hide file tree
Showing 43 changed files with 1,799 additions and 320 deletions.
90 changes: 20 additions & 70 deletions package-lock.json

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

27 changes: 22 additions & 5 deletions src/module/entities/TwodsixActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,53 @@
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
* @extends {Actor}
*/
import {calcModFor} from "../utils/sheetUtils";
import { calcModFor } from "../utils/sheetUtils";

export default class TwodsixActor extends Actor {

/**
* Augment the basic actor data with additional dynamic data.
*/
prepareData():void {
prepareData(): void {
super.prepareData();

const actorData = this.data;
const data = actorData.data;
const flags = actorData.flags;

if (actorData.type === 'character') {
this._prepareCharacterData(actorData);
}

// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
switch (actorData.type) {
case 'traveller':
this._prepareCharacterData(actorData);
break;
case 'ship':

break;
default:
console.log(game.i18n.localize("Twodsix.Actor.UnknownActorType") + actorData.type);
}

}

/**
* Prepare Character type specific data
*/
_prepareCharacterData(actorData:ActorData):void {
_prepareCharacterData(actorData: ActorData): void {
// Get the Actor's data object
const { data } = actorData;

for (const cha of Object.values(data.characteristics as Record<any, any>)) {
cha.current = cha.value - cha.damage;
cha.mod = calcModFor(cha.current);
}
}
_prepareShipData(actorData: ActorData): void {
// Get the Actor's data object
const {data} = actorData;
const { data } = actorData;

for (const cha of Object.values(data.characteristics as Record<any, any>)) {
cha.current = cha.value - cha.damage;
Expand Down
7 changes: 7 additions & 0 deletions src/module/handlebars.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import {advantageDisadvantageTerm} from "./settings";
import * as util from "util";

export default function registerHandlebarsHelpers():void {

Handlebars.registerHelper('advantageDisadvantageTerm', (str) => {
return advantageDisadvantageTerm(str);
});

Handlebars.registerHelper('capitalize', (str) => {
if (!util.isString(str)) {
return '';
}
return str.charAt(0).toUpperCase() + str.slice(1);
});
}
20 changes: 12 additions & 8 deletions src/module/sheets/TwodsixActorSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ export class TwodsixActorSheet extends ActorSheet {


private static _prepareCharacterItems(sheetData:any) {

const actorData = sheetData.actor;

// Initialize containers.
const storage = [];
const inventory = [];
const equipment = [];
const weapon = [];
const armor = [];
const augment = [];
const tool = [];
const junk = [];
const skills = [];

// Iterate through items, allocating to containers
Expand All @@ -46,10 +46,7 @@ export class TwodsixActorSheet extends ActorSheet {
case 'storage':
storage.push(i);
break;
case 'inventory':
inventory.push(i);
break;
case 'equipment':
case 'equipment' || 'tool' || 'junk':
equipment.push(i);
break;
case 'weapon':
Expand All @@ -72,11 +69,12 @@ export class TwodsixActorSheet extends ActorSheet {
}
// Assign and return
actorData.storage = storage;
actorData.inventory = inventory;
actorData.equipment = equipment;
actorData.weapon = weapon;
actorData.armor = armor;
actorData.augment = augment;
actorData.tool = tool;
actorData.junk = junk;
actorData.skills = skills;

}
Expand All @@ -90,7 +88,7 @@ export class TwodsixActorSheet extends ActorSheet {
height: 648,
resizable: false,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "skills"}],
scrollY: [".skills", ".inventory"]
scrollY: [".skills", ".inventory", ".finances", ".info", ".notes"]
});
}

Expand Down Expand Up @@ -136,6 +134,12 @@ export class TwodsixActorSheet extends ActorSheet {
li.addEventListener("dragstart", handler, false);
});
}

html.find('div[contenteditable="true"][data-edit]').on(
'focusout',
this._onSubmit.bind(this)
);

}


Expand Down
7 changes: 6 additions & 1 deletion src/module/sheets/TwodsixItemSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export class TwodsixItemSheet extends ItemSheet {
return;
}

// Roll handlers, click handlers, etc. would go here.
html.find('div[contenteditable="true"][data-edit]').on(
'focusout',
this._onSubmit.bind(this)
);

// Roll handlers, click handlers, etc. would go here.
}
}
Loading

0 comments on commit 389d27e

Please sign in to comment.