Start 0.8 support
This commit is contained in:
@@ -23,34 +23,48 @@ export class SoSActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getData() {
|
||||
let data = super.getData();
|
||||
|
||||
const objectData = SoSUtility.data(this.object);
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: objectData.id,
|
||||
type: objectData.type,
|
||||
img: objectData.img,
|
||||
name: objectData.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
data: foundry.utils.deepClone(this.object.data),
|
||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner
|
||||
};
|
||||
|
||||
this.actor.checkDeck();
|
||||
|
||||
data.data.edgecard = this.actor.getEdgesCard();
|
||||
data.data.deckSize = this.actor.getDeckSize();
|
||||
formData.edgecard = this.actor.getEdgesCard();
|
||||
formData.deckSize = this.actor.getDeckSize();
|
||||
|
||||
data.data.skills = this.actor.data.items.filter( item => item.type == 'skill').sort( (a, b) => {
|
||||
formData.skills = this.actor.data.items.filter( item => item.type == 'skill').sort( (a, b) => {
|
||||
if ( a.name > b.name ) return 1;
|
||||
return -1;
|
||||
});
|
||||
|
||||
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.consequences = this.actor.data.items.filter( item => item.type == 'consequence').sort( (a, b) => {
|
||||
|
||||
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) => {
|
||||
if ( a.name > b.name ) return 1;
|
||||
return -1;
|
||||
});
|
||||
data.data.gears = this.actor.data.items.filter( item => item.type == 'gear').concat( this.actor.data.items.filter( item => item.type == 'container') );
|
||||
formData.gears = this.actor.data.items.filter( item => item.type == 'gear').concat( this.actor.data.items.filter( item => item.type == 'container') );
|
||||
|
||||
// Build the gear tree
|
||||
data.data.gearsRoot = data.data.gears.filter(item => item.data.containerid == "");
|
||||
for ( let container of data.data.gearsRoot) {
|
||||
formData.gearsRoot = formData.gears.filter(item => item.data.containerid == "");
|
||||
for ( let container of formData.gearsRoot) {
|
||||
if ( container.type == 'container') {
|
||||
container.data.contains = []
|
||||
container.data.containerEnc = 0;
|
||||
for (let gear of data.data.gears) {
|
||||
if ( gear.data.containerid == container._id) {
|
||||
if ( gear.data.containerid == container.id) {
|
||||
container.data.contains.push( gear );
|
||||
if ( !gear.data.neg && !gear.data.software ) {
|
||||
container.data.containerEnc += (gear.big > 0) ? gear.big : 1;
|
||||
@@ -60,25 +74,25 @@ export class SoSActorSheet extends ActorSheet {
|
||||
}
|
||||
}
|
||||
|
||||
data.data.weapons = this.actor.data.items.filter( item => item.type == 'weapon');
|
||||
data.data.armors = this.actor.data.items.filter( item => item.type == 'armor');
|
||||
data.data.totalEncumbrance = SoSUtility.computeEncumbrance(this.actor.data.items);
|
||||
data.data.wounds = duplicate(this.actor.data.data.wounds);
|
||||
data.data.isGM = game.user.isGM;
|
||||
data.data.currentWounds = this.actor.computeCurrentWounds();
|
||||
data.data.totalWounds = this.actor.data.data.scores.wound.value;
|
||||
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.isGM = game.user.isGM;
|
||||
formData.currentWounds = this.actor.computeCurrentWounds();
|
||||
formData.totalWounds = this.actor.data.data.scores.wound.value;
|
||||
|
||||
data.data.subcultureList = this.actor.data.items.filter( item => item.type == 'subculture');
|
||||
if ( data.data.subculture != "" ) { // background.subculture contains the main subculture ID
|
||||
data.data.mainSubculture = data.data.subcultureList.find( subc => subc._id == data.data.subculture);
|
||||
formData.subcultureList = this.actor.data.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);
|
||||
}
|
||||
data.data.languageList = this.actor.data.items.filter( item => item.type == 'language');
|
||||
data.data.weaknessList = this.actor.data.items.filter( item => item.type == 'weakness');
|
||||
data.data.geneline = this.actor.data.items.find( item => item.type == 'geneline');
|
||||
data.data.editStatSkill = this.options.editStatSkill;
|
||||
//console.log("stats", data);
|
||||
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.editStatSkill = this.options.editStatSkill;
|
||||
|
||||
return data;
|
||||
console.log("stats", formData);
|
||||
return formData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -94,7 +108,7 @@ export class SoSActorSheet extends ActorSheet {
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(li.data("item-id"));
|
||||
const item = this.actor.items.get(li.data("item-id"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
html.find('.item-equip').click(ev => {
|
||||
@@ -163,7 +177,7 @@ export class SoSActorSheet extends ActorSheet {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(li.data("item-id"));
|
||||
let severity = $(event.currentTarget).val();
|
||||
this.actor.updateOwnedItem( { _id: item._id, 'data.severity': severity});
|
||||
this.actor.updateOwnedItem( { id: item.id, 'data.severity': severity});
|
||||
this.render(true);
|
||||
});
|
||||
html.find('.lock-unlock-sheet').click((event) => {
|
||||
|
||||
Reference in New Issue
Block a user