Skip to content

Commit

Permalink
Merge branch 'master' into V10-Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Aug 2, 2022
2 parents 1437ae2 + 10716c4 commit 8b66b44
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 1 deletion.
62 changes: 62 additions & 0 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,57 @@ function isNumeric(n) {
}

export class SystemProvider {
/**
* The provider's ID. You can also use this function for setting Handlebars helpers.
* @param {String} id
*/
constructor(id) {
this.id = id;
}

/**
* In case the system uses a styling different from vanilla Foundry (e.g. WFRP4e).
*/
get customCSS() {
return "";
}

/**
* If the system provider has parts to be loaded during the startup.
*/
get loadTemplates() {
return [];
}

/**
* Tabs to be toggled by the GM for users to see.
* Example:
* {
* saves: { id: "saves", visible: true, localization: "Saving Throws" },
* }
*/
get tabs() {
return {};
}

/**
* The template with the actual data.
*/
get template() {
return "/modules/party-overview/templates/generic.hbs";
}

/**
* Default width for the system's overview.
*/
get width() {
return 500;
}

/**
* Handles calculation of a single actor's data (e.g. actor's total wealth).
* @param {Document} actor
*/
getActorDetails(actor) {
const data = actor.system;
return {
Expand All @@ -36,6 +63,11 @@ export class SystemProvider {
};
}

/**
* Handles calculations of all the actors' data (e.g. party's total wealth).
* @param {Array} actors
* @returns [Array, Object]
*/
getUpdate(actors) {
return [actors, {}];
}
Expand Down Expand Up @@ -1347,3 +1379,33 @@ export class cyphersystemProvider extends SystemProvider {
];
}
}

export class CoC7Provider {
get template() {
return "/modules/party-overview/templates/coc7.hbs";
}

getActorDetails(actor) {
const data = actor.data.data;
return {
id: actor.id,
name: actor.name,
hp: data.attribs.hp,
luck: data.attribs.lck,
move: data.attribs.mov,
mp: data.attribs.mp,
san: data.attribs.san,
armor: data.attribs.armor,
build: data.attribs.build,
db: data.attribs.db,
app: data.characteristics.app,
con: data.characteristics.con,
dex: data.characteristics.dex,
edu: data.characteristics.edu,
int: data.characteristics.int,
pow: data.characteristics.pow,
siz: data.characteristics.siz,
str: data.characteristics.str,
};
}
}
5 changes: 4 additions & 1 deletion module/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// prettier-ignore
import { SystemProvider, archmageProvider, bitdProvider, dccProvider, dnd35eProvider, dnd4eProvider, dnd5eProvider, pf1Provider, pf2eProvider,
scumAndVillainyProvider, sfrpgProvider, swadeProvider, tormenta20Provider, wfrp4eProvider, cyphersystemProvider} from "./SystemProvider.js";
scumAndVillainyProvider, sfrpgProvider, swadeProvider, tormenta20Provider, wfrp4eProvider, cyphersystemProvider, CoC7Provider} from "./SystemProvider.js";

export const availableSystemProviders = {};
export let currentSystemProvider = undefined;
Expand Down Expand Up @@ -85,6 +85,9 @@ export function initApi() {
case 'cyphersystem':
systemProviders.push(new cyphersystemProvider("native.cyphersystem"));
break;
case "CoC7":
systemProviders.push(new CoC7Provider("native.coc7"))
break;
default:
systemProviders.push(new SystemProvider("native"));
break;
Expand Down
41 changes: 41 additions & 0 deletions templates/coc7.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<div>
<section class="content">
<div class="tab" data-group="party">
<div class="table-row header">
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
<div class="text">Name</div>

<div class="num" title="{{localize "CHARAC.Strength"}}">{{localize "CHARAC.STR"}}</div>
<div class="num" title="{{localize "CHARAC.Constitution"}}">{{localize "CHARAC.CON"}}</div>
<div class="num" title="{{localize "CHARAC.Size"}}">{{localize "CHARAC.SIZ"}}</div>
<div class="num" title="{{localize "CHARAC.Dexterity"}}">{{localize "CHARAC.Dex"}}</div>

<div class="num" title="{{localize "CHARAC.Appearance"}}">{{localize "CHARAC.APP"}}</div>
<div class="num" title="{{localize "CHARAC.Intelligence"}}">{{localize "CHARAC.INT"}}</div>
<div class="num" title="{{localize "CHARAC.Power"}}">{{localize "CHARAC.POW"}}</div>
<div class="num" title="{{localize "CHARAC.Education"}}">{{localize "CHARAC.EDU"}}</div>

<div class="num" title="{{localize "CoC7.HitPoints"}}"><i class="fas fa-heart"></i></div>
</div>

{{#each actors as | actor | }}
<div class="table-row">
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
<div class="text">{{ actor.shortestName }}</div>

<div class="num">{{ actor.str.value }}</div>
<div class="num">{{ actor.con.value }}</div>
<div class="num">{{ actor.siz.value }}</div>
<div class="num">{{ actor.dex.value }}</div>

<div class="num">{{ actor.app.value }}</div>
<div class="num">{{ actor.int.value }}</div>
<div class="num">{{ actor.pow.value }}</div>
<div class="num">{{ actor.edu.value }}</div>

<div class="num">{{ actor.hp.value }}/{{ actor.hp.max }}</div>
</div>
{{/each}}
</div>
</section>
</div>

0 comments on commit 8b66b44

Please sign in to comment.