Add consequenes to actor sheet
This commit is contained in:
parent
e412f0cb3b
commit
1d2f438235
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"SHEET.TabStats": "Stats",
|
"SHEET.TabStats": "Stats",
|
||||||
"SHEET.TabSkills": "Skills",
|
"SHEET.TabSkills": "Skills",
|
||||||
"SHEET.TabFight": "Fight",
|
"SHEET.TabConsequences": "Consequences",
|
||||||
"SHEET.TabGears": "Gears",
|
"SHEET.TabGears": "Gears",
|
||||||
"SHEET.TabDescription": "Description",
|
"SHEET.TabDescription": "Description",
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@ export class SoSActorSheet extends ActorSheet {
|
|||||||
});
|
});
|
||||||
data.data.skill1 = data.data.skills.slice(0, Math.ceil(data.data.skills.length/2) )
|
data.data.skill1 = data.data.skills.slice(0, Math.ceil(data.data.skills.length/2) )
|
||||||
data.data.skill2 = data.data.skills.slice(Math.ceil(data.data.skills.length/2), data.data.skills.length )
|
data.data.skill2 = data.data.skills.slice(Math.ceil(data.data.skills.length/2), data.data.skills.length )
|
||||||
|
data.data.consequences = this.actor.data.items.filter( item => item.type == 'consequence').sort( (a, b) => {
|
||||||
|
if ( a.name > b.name ) return 1;
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
data.data.subculture = this.actor.data.items.find( item => item.type == 'subculture');
|
data.data.subculture = this.actor.data.items.find( item => item.type == 'subculture');
|
||||||
data.data.geneline = this.actor.data.items.find( item => item.type == 'geneline');
|
data.data.geneline = this.actor.data.items.find( item => item.type == 'geneline');
|
||||||
data.data.editStatSkill = this.options.editStatSkill;
|
data.data.editStatSkill = this.options.editStatSkill;
|
||||||
|
@ -34,6 +34,18 @@ export class SoSActor extends Actor {
|
|||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.items = [];
|
||||||
|
let compendiumName = "foundryvtt-shadows-over-sol.skills";
|
||||||
|
if ( compendiumName ) {
|
||||||
|
let skills = await SoSUtility.loadCompendium(compendiumName);
|
||||||
|
data.items = data.items.concat( skills );
|
||||||
|
}
|
||||||
|
compendiumName = "foundryvtt-shadows-over-sol.consequences";
|
||||||
|
if ( compendiumName ) {
|
||||||
|
let consequences = await SoSUtility.loadCompendium(compendiumName)
|
||||||
|
data.items = data.items.concat(consequences);
|
||||||
|
}
|
||||||
|
|
||||||
return super.create(data, options);
|
return super.create(data, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,15 @@ export class SoSCardDeck {
|
|||||||
this.data.cardState = [];
|
this.data.cardState = [];
|
||||||
this.data.cardEdge = [];
|
this.data.cardEdge = [];
|
||||||
|
|
||||||
if ( savedDeck.deck && savedDeck.deck.length > 0 ) {}
|
if ( savedDeck.deck && savedDeck.deck.length > 0 ) {
|
||||||
this.data.deck = duplicate(savedDeck.deck);
|
this.data.deck = duplicate(savedDeck.deck);
|
||||||
if ( savedDeck.discard && savedDeck.discard.length > 0 ) {}
|
}
|
||||||
|
if ( savedDeck.discard && savedDeck.discard.length > 0 ) {
|
||||||
this.data.discard = duplicate(savedDeck.discard);
|
this.data.discard = duplicate(savedDeck.discard);
|
||||||
if ( savedDeck.cardEdge && savedDeck.cardEdge.length > 0 ) {}
|
}
|
||||||
|
if ( savedDeck.cardEdge && savedDeck.cardEdge.length > 0 ) {
|
||||||
this.data.cardEdge = duplicate(savedDeck.cardEdge);
|
this.data.cardEdge = duplicate(savedDeck.cardEdge);
|
||||||
|
}
|
||||||
|
|
||||||
this.data.actor = actor;
|
this.data.actor = actor;
|
||||||
if ( this.data.deck.length == 0 && this.data.discard.length == 0) {
|
if ( this.data.deck.length == 0 && this.data.discard.length == 0) {
|
||||||
|
@ -19,7 +19,34 @@ export class SoSUtility {
|
|||||||
return loadTemplates(templatePaths);
|
return loadTemplates(templatePaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static fillRange (start, end) {
|
static fillRange (start, end) {
|
||||||
return Array(end - start + 1).fill().map((item, index) => start + index);
|
return Array(end - start + 1).fill().map((item, index) => start + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async loadCompendiumNames(compendium) {
|
||||||
|
const pack = game.packs.get(compendium);
|
||||||
|
let competences;
|
||||||
|
await pack.getIndex().then(index => competences = index);
|
||||||
|
return competences;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static async loadCompendium(compendium, filter = item => true) {
|
||||||
|
let compendiumItems = await SoSUtility.loadCompendiumNames(compendium);
|
||||||
|
|
||||||
|
const pack = game.packs.get(compendium);
|
||||||
|
let list = [];
|
||||||
|
for (let compendiumItem of compendiumItems) {
|
||||||
|
await pack.getEntity(compendiumItem._id).then(it => {
|
||||||
|
const item = it.data;
|
||||||
|
if (filter(item)) {
|
||||||
|
list.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
"name": "foundryvtt-shadows-over-sol",
|
"name": "foundryvtt-shadows-over-sol",
|
||||||
"title": "Shadows over Sol",
|
"title": "Shadows over Sol",
|
||||||
"description": "Shadows over Sol for FoundryVTT",
|
"description": "Shadows over Sol for FoundryVTT",
|
||||||
"version": "0.0.10",
|
"version": "0.0.11",
|
||||||
"manifestPlusVersion": "1.0.0",
|
"manifestPlusVersion": "1.0.0",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.9",
|
"compatibleCoreVersion": "0.7.9",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<nav class="sheet-tabs tabs" data-group="primary">
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
<a class="item" data-tab="stats">{{localize 'SHEET.TabStats'}}</a>
|
<a class="item" data-tab="stats">{{localize 'SHEET.TabStats'}}</a>
|
||||||
<a class="item" data-tab="skills">{{localize 'SHEET.TabSkills'}}</a>
|
<a class="item" data-tab="skills">{{localize 'SHEET.TabSkills'}}</a>
|
||||||
<a class="item" data-tab="fight">{{localize 'SHEET.TabFight'}}</a>
|
<a class="item" data-tab="consequences">{{localize 'SHEET.TabConsequences'}}</a>
|
||||||
<a class="item" data-tab="gears">{{localize 'SHEET.TabGears'}}</a>
|
<a class="item" data-tab="gears">{{localize 'SHEET.TabGears'}}</a>
|
||||||
<a class="item" data-tab="description">{{localize 'SHEET.TabDescription'}}</a>
|
<a class="item" data-tab="description">{{localize 'SHEET.TabDescription'}}</a>
|
||||||
</nav>
|
</nav>
|
||||||
@ -157,9 +157,19 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{!-- Fight Tab --}}
|
{{!-- Consequences Tab --}}
|
||||||
<div class="tab fight" data-group="primary" data-tab="fight">
|
<div class="tab consequences" data-group="primary" data-tab="consequences">
|
||||||
<ul class="item-list alternate-list">
|
<ul class="item-list alternate-list">
|
||||||
|
{{#each data.consequences as |conseq key|}}
|
||||||
|
<li class="item flexrow list-item" data-item-id="{{conseq._id}}">
|
||||||
|
<img class="sheet-skill-img" src="{{conseq.img}}"/>
|
||||||
|
<span class="conseq-label"><a>{{conseq.name}}</a></span>
|
||||||
|
<div class="item-controls">
|
||||||
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user