v10 branch - Update manifest

This commit is contained in:
2022-07-13 08:11:00 +02:00
parent 73312c1957
commit 9551b2a050
28 changed files with 271 additions and 297 deletions

View File

@@ -23,7 +23,7 @@ export class SoSActorSheet extends ActorSheet {
/* -------------------------------------------- */
getData() {
const objectData = SoSUtility.data(this.object);
const objectData = this.object
let formData = {
title: this.title,
id: objectData.id,
@@ -32,7 +32,7 @@ export class SoSActorSheet extends ActorSheet {
name: objectData.name,
editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked",
data: foundry.utils.deepClone(this.object.data),
data: foundry.utils.deepClone(this.object.system),
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
limited: this.object.limited,
options: this.options,
@@ -44,52 +44,52 @@ export class SoSActorSheet extends ActorSheet {
formData.edgecard = this.actor.getEdgesCard();
formData.deckSize = this.actor.getDeckSize();
formData.skills = this.actor.data.items.filter( item => item.type == 'skill').sort( (a, b) => {
formData.skills = this.actor.items.filter( item => item.type == 'skill').sort( (a, b) => {
if ( a.name > b.name ) return 1;
return -1;
});
formData.skill1 = formData.skills.slice(0, Math.ceil(formData.skills.length/2) )
formData.skill2 = formData.skills.slice(Math.ceil(formData.skills.length/2), formData.skills.length )
formData.consequences = this.actor.data.items.filter( item => item.type == 'consequence').sort( (a, b) => {
formData.consequences = this.actor.items.filter( item => item.type == 'consequence').sort( (a, b) => {
if ( a.name > b.name ) return 1;
return -1;
});
formData.gears = this.actor.data.items.filter( item => item.type == 'gear').concat( this.actor.data.items.filter( item => item.type == 'container') );
formData.gears = this.actor.items.filter( item => item.type == 'gear').concat( this.actor.items.filter( item => item.type == 'container') );
// Build the gear tree
formData.gearsRoot = formData.gears.filter(item => item.data.data.containerid == "");
formData.gearsRoot = formData.gears.filter(item => item.system.containerid == "");
for ( let container of formData.gearsRoot) {
if ( container.type == 'container') {
container.data.contains = []
container.data.containerEnc = 0;
for (let gear of formData.gears) {
console.log("GEAR", gear, container)
if ( gear.data.data.containerid == container.id) {
if ( gear.system.containerid == container.id) {
container.data.contains.push( gear )
if ( !gear.data.data.neg && !gear.data.data.software ) {
container.data.containerEnc += (gear.data.data.big > 0) ? gear.data.data.big : 1;
if ( !gear.system.neg && !gear.system.software ) {
container.system.containerEnc += (gear.system.big > 0) ? gear.system.big : 1;
}
}
}
}
}
formData.weapons = this.actor.data.items.filter( item => item.type == 'weapon');
formData.armors = this.actor.data.items.filter( item => item.type == 'armor');
formData.totalEncumbrance = SoSUtility.computeEncumbrance(this.actor.data.items);
formData.wounds = duplicate(this.actor.data.data.wounds);
formData.weapons = this.actor.items.filter( item => item.type == 'weapon');
formData.armors = this.actor.items.filter( item => item.type == 'armor');
formData.totalEncumbrance = SoSUtility.computeEncumbrance(this.actor.items);
formData.wounds = duplicate(this.actor.system.wounds);
formData.isGM = game.user.isGM;
formData.currentWounds = this.actor.computeCurrentWounds();
formData.totalWounds = this.actor.data.data.scores.wound.value;
formData.totalWounds = this.actor.system.scores.wound.value;
formData.subcultureList = this.actor.data.items.filter( item => item.type == 'subculture');
formData.subcultureList = this.actor.items.filter( item => item.type == 'subculture');
if ( formData.subculture != "" ) { // background.subculture contains the main subculture ID
formData.mainSubculture = formData.subcultureList.find( subc => subc._id == data.data.subculture);
formData.mainSubculture = formData.subcultureList.find( subc => subc._id == this.actor.system.subculture);
}
formData.languageList = this.actor.data.items.filter( item => item.type == 'language');
formData.weaknessList = this.actor.data.items.filter( item => item.type == 'weakness');
formData.geneline = this.actor.data.items.find( item => item.type == 'geneline');
formData.languageList = this.actor.items.filter( item => item.type == 'language');
formData.weaknessList = this.actor.items.filter( item => item.type == 'weakness');
formData.geneline = this.actor.items.find( item => item.type == 'geneline');
formData.editStatSkill = this.options.editStatSkill;
console.log("stats", formData);
@@ -178,7 +178,7 @@ export class SoSActorSheet extends ActorSheet {
const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
let severity = $(event.currentTarget).val();
this.actor.updateEmbeddedDocuments( "Item", [ { _id: item.id, 'data.severity': severity} ] );
this.actor.updateEmbeddedDocuments( "Item", [ { _id: item.id, 'system.severity': severity} ] );
this.render(true);
});
html.find('.lock-unlock-sheet').click((event) => {