Skip to content

Commit

Permalink
feat(*): Another new (old) direction, this time with some help incoming.
Browse files Browse the repository at this point in the history
Added Kevin to "author", brought back a lot of old code, and compendiums, but this time in the ce directory (as these are intended for ce), we need to decide how to handle other variants (maybe simply name them like 'ce-skills'? Or, maybe foundry supports folders for compendiums, I *think* I've seen that in a system.

Figured this was enough for a bump of minor version.
  • Loading branch information
xdy committed Jul 19, 2020
1 parent f97f24e commit 6e5f7af
Show file tree
Hide file tree
Showing 22 changed files with 681 additions and 149 deletions.
164 changes: 72 additions & 92 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions src/module/TwodsixSystem.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export class TwodsixSystem {
//Nothing to do yet

//TODO
}
74 changes: 74 additions & 0 deletions src/module/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Namespace TWODSIX Configuration Values
export const TWODSIX:any = {};

/**
* The sets of rules variants one can use
* @type {Object}
*/
TWODSIX.variant = {
"ce": "Cepheus Engine",
}


//TODO Start with skills, should do for others as well I guess
export class TwodsixItemList {
static async getItems(itemType?:string, metadataName?:string, labels_only = true):Promise<string[] | Item[]> {
// First, retrieve any custom or overridden items so that we can prioritize those.
const items = game.items;
if (items == null) {
return null;
}
let allItems = items.entities.filter(item => item.type == itemType);
// Next, retrieve compendium items and merge them in.
let c:any;
for (c of game.packs) {
if (c.metadata.entity && c.metadata.entity == 'Item' && c.metadata.name == metadataName) {
allItems = allItems.concat(c ? await c.getContent() : []);
}
}
// Reduce duplicates. Because item classes happen first, this will prevent
// duplicate compendium entries from overriding the items.
const charItemNames:string[] = [];
for (const charItem of allItems) {
const charItemName = charItem.data.name;
if (charItemNames.includes(charItemName) !== false) {
allItems = allItems.filter(item => item._id != charItem._id);
} else {
charItemNames.push(charItemName);
}
}

// Sort the charItemNames list.
if (labels_only) {
charItemNames.sort((a, b) => {
const aSort = a.toLowerCase();
const bSort = b.toLowerCase();
if (aSort < bSort) {
return -1;
}
if (aSort > bSort) {
return 1;
}
return 0;
});

return charItemNames;
}
// Sort the class objects list.
else {
allItems.sort((a, b) => {
const aSort = a.data.name.toLowerCase();
const bSort = b.data.name.toLowerCase();
if (aSort < bSort) {
return -1;
}
if (aSort > bSort) {
return 1;
}
return 0;
});

return allItems;
}
}
}
9 changes: 9 additions & 0 deletions src/module/entities/TwodsixActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ export default class TwodsixActor extends Actor {
return ucfData;
}

// _upp(actorData: ActorData) {
// const data = actorData.data;
//
// for (const abl of Object.values(data.characteristics as Record<any, any>)) {
// if (abl.short != 'PSI') data.upp += this._pseudoHex(abl.value);
// }
// return data;
// }

_pseudoHex(value:number):string {
switch (value) {
case 0:
Expand Down
Loading

0 comments on commit 6e5f7af

Please sign in to comment.