Start 0.8 support
This commit is contained in:
parent
6ebc11c518
commit
3d23807820
@ -175,9 +175,9 @@ export class SoSActorSheet extends ActorSheet {
|
|||||||
});
|
});
|
||||||
html.find('.consequence-severity').click((event) => {
|
html.find('.consequence-severity').click((event) => {
|
||||||
const li = $(event.currentTarget).parents(".item");
|
const li = $(event.currentTarget).parents(".item");
|
||||||
const item = this.actor.getOwnedItem(li.data("item-id"));
|
const item = this.actor.items.get(li.data("item-id"));
|
||||||
let severity = $(event.currentTarget).val();
|
let severity = $(event.currentTarget).val();
|
||||||
this.actor.updateOwnedItem( { id: item.id, 'data.severity': severity});
|
this.actor.updateEmbeddedDocuments( "Item", [ { _id: item.id, 'data.severity': severity} ] );
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
html.find('.lock-unlock-sheet').click((event) => {
|
html.find('.lock-unlock-sheet').click((event) => {
|
||||||
|
@ -171,8 +171,8 @@ export class SoSActor extends Actor {
|
|||||||
async wornObject( itemID) {
|
async wornObject( itemID) {
|
||||||
let item = this.getOwnedItem(itemID);
|
let item = this.getOwnedItem(itemID);
|
||||||
if (item && item.data.data) {
|
if (item && item.data.data) {
|
||||||
let update = { _id: item._id, "data.worn": !item.data.data.worn };
|
let update = { _id: item.id, "data.worn": !item.data.data.worn };
|
||||||
await this.updateEmbeddedEntity("OwnedItem", update);
|
await this.updateEmbeddedDocuments("Item", [update]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,8 +180,8 @@ export class SoSActor extends Actor {
|
|||||||
async equipObject(itemID) {
|
async equipObject(itemID) {
|
||||||
let item = this.getOwnedItem(itemID);
|
let item = this.getOwnedItem(itemID);
|
||||||
if (item && item.data.data) {
|
if (item && item.data.data) {
|
||||||
let update = { _id: item._id, "data.equiped": !item.data.data.equiped };
|
let update = { _id: item.id, "data.equiped": !item.data.data.equiped };
|
||||||
await this.updateEmbeddedEntity("OwnedItem", update);
|
await this.updateEmbeddedDocuments("Item", [update]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,16 +222,16 @@ export class SoSActor extends Actor {
|
|||||||
async updateSkill(skillName, value) {
|
async updateSkill(skillName, value) {
|
||||||
let skill = this.data.items.find( item => item.name == skillName);
|
let skill = this.data.items.find( item => item.name == skillName);
|
||||||
if (skill) {
|
if (skill) {
|
||||||
const update = { _id: skill._id, 'data.value': value };
|
const update = { _id: skill.id, 'data.value': value };
|
||||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
const updated = await this.updateEmbeddedDocuments("Item", [ update] ); // Updates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateSkillExperience(skillName, value) {
|
async updateSkillExperience(skillName, value) {
|
||||||
let skill = this.data.items.find( item => item.name == skillName);
|
let skill = this.data.items.find( item => item.name == skillName);
|
||||||
if (skill) {
|
if (skill) {
|
||||||
const update = { _id: skill._id, 'data.xp': value };
|
const update = { _id: skill.id, 'data.xp': value };
|
||||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
const updated = await this.updateEmbeddedDocuments("Item", [update]); // Updates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,10 +387,10 @@ export class SoSActor extends Actor {
|
|||||||
if ( alreadyInside.length >= container.data.container ) {
|
if ( alreadyInside.length >= container.data.container ) {
|
||||||
ui.notifications.warn("Container is already full !");
|
ui.notifications.warn("Container is already full !");
|
||||||
} else {
|
} else {
|
||||||
await this.updateOwnedItem( { _id: object._id, 'data.containerid':containerId });
|
await this.updateOwnedItem( { _id: object.id, 'data.containerid':containerId });
|
||||||
}
|
}
|
||||||
} else if ( object && object.data.containerid) { // remove from container
|
} else if ( object && object.data.containerid) { // remove from container
|
||||||
await this.updateOwnedItem( { _id: object._id, 'data.containerid':"" });
|
await this.updateOwnedItem( { _id: object.id, 'data.containerid':"" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ export class SoSActor extends Actor {
|
|||||||
if ( sumWound >= this.data.data.scores.wound.value) {
|
if ( sumWound >= this.data.data.scores.wound.value) {
|
||||||
let bleeding = this.data.items.find( item => item.type == 'consequence' && item.name == 'Bleeding');
|
let bleeding = this.data.items.find( item => item.type == 'consequence' && item.name == 'Bleeding');
|
||||||
let newSeverity = SoSUtility.increaseConsequenceSeverity( bleeding.severity );
|
let newSeverity = SoSUtility.increaseConsequenceSeverity( bleeding.severity );
|
||||||
await this.updateOwnedItem( { _id: bleeding._id, 'data.severity': newSeverity});
|
await this.updateOwnedItem( { _id: bleeding.id, 'data.severity': newSeverity});
|
||||||
flipData.isBleeding = newSeverity;
|
flipData.isBleeding = newSeverity;
|
||||||
}
|
}
|
||||||
// Stun consequence
|
// Stun consequence
|
||||||
@ -426,7 +426,7 @@ export class SoSActor extends Actor {
|
|||||||
for(i=0; i<flipData.nbStun; i++) {
|
for(i=0; i<flipData.nbStun; i++) {
|
||||||
newSeverity = SoSUtility.increaseConsequenceSeverity( newSeverity );
|
newSeverity = SoSUtility.increaseConsequenceSeverity( newSeverity );
|
||||||
}
|
}
|
||||||
await this.updateOwnedItem( { _id: stun._id, 'data.severity': newSeverity});
|
await this.updateOwnedItem( { _id: stun.id, 'data.severity': newSeverity});
|
||||||
flipData.isStun = newSeverity;
|
flipData.isStun = newSeverity;
|
||||||
}
|
}
|
||||||
await this.update( { 'data.scores.currentwounds': currentWounds, 'data.wounds': wounds } );
|
await this.update( { 'data.scores.currentwounds': currentWounds, 'data.wounds': wounds } );
|
||||||
|
@ -43,15 +43,30 @@ export class SoSItemSheet extends ItemSheet {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async getData() {
|
async getData() {
|
||||||
let data = super.getData();
|
const objectData = SoSUtility.data(this.object);
|
||||||
data.isGM = game.user.isGM;
|
let formData = {
|
||||||
if ( data.item.type == 'skillexperience') {
|
title: this.title,
|
||||||
data.skillList = await SoSUtility.loadCompendiumNames("foundryvtt-shadows-over-sol.skills");
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
formData.isGM = game.user.isGM;
|
||||||
|
if ( objectData.type == 'skillexperience') {
|
||||||
|
formData.skillList = await SoSUtility.loadCompendiumNames("foundryvtt-shadows-over-sol.skills");
|
||||||
}
|
}
|
||||||
if ( data.item.type == 'skill' && this.object.options?.actor) {
|
if ( objectData.type == 'skill' && this.object.options?.actor) {
|
||||||
data.skillExperienceList = this.object.options.actor.getSkillExperience( data.item.name );
|
formData.skillExperienceList = this.object.options.actor.getSkillExperience( data.item.name );
|
||||||
}
|
}
|
||||||
return data;
|
return formData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -130,8 +130,8 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
<span class="skill-label"><a>{{skill.name}}</a></span>
|
<span class="skill-label"><a>{{skill.name}}</a></span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<input class="skill-value" type="text" skillname="{{skill.name}}" value="{{numberFormat skill.data.value decimals=0}}" data-dtype="number" {{#unless @root.data.editStatSkill}}disabled{{/unless}}/>
|
<input class="skill-value" type="text" skillname="{{skill.name}}" value="{{numberFormat skill.data.data.value decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
<input class="skill-xp" type="text" skillname="{{skill.name}}" value="{{skill.data.xp}}" data-dtype="number" {{#unless @root.data.editStatSkill}}disabled{{/unless}}/>
|
<input class="skill-xp" type="text" skillname="{{skill.name}}" value="{{skill.data.data.xp}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<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-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>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -158,8 +158,8 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
<span class="skill-label"><a>{{skill.name}}</a></span>
|
<span class="skill-label"><a>{{skill.name}}</a></span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<input class="skill-value" type="text" skillname="{{skill.name}}" value="{{numberFormat skill.data.value decimals=0}}" data-dtype="number" {{#unless @root.data.editStatSkill}}disabled{{/unless}}/>
|
<input class="skill-value" type="text" skillname="{{skill.name}}" value="{{numberFormat skill.data.data.value decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
<input class="skill-xp" type="text" skillname="{{skill.name}}" value="{{skill.data.xp}}" data-dtype="number" {{#unless @root.data.editStatSkill}}disabled{{/unless}}/>
|
<input class="skill-xp" type="text" skillname="{{skill.name}}" value="{{skill.data.data.xp}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<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-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>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -182,16 +182,16 @@
|
|||||||
<ul class="item-list alterne-list">
|
<ul class="item-list alterne-list">
|
||||||
<li class="item flexrow list-item" data-wound-name="light"><h4>Wounds : </h4></li>
|
<li class="item flexrow list-item" data-wound-name="light"><h4>Wounds : </h4></li>
|
||||||
<li class="item flexrow list-item" data-wound-name="light"><span class="skill-label">Light :</span>
|
<li class="item flexrow list-item" data-wound-name="light"><span class="skill-label">Light :</span>
|
||||||
<input class="wound-value" type="text" woundname="light" value="{{numberFormat data.wounds.light decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
<input class="wound-value" type="text" woundname="light" value="{{numberFormat data.data.wounds.light decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
</li>
|
</li>
|
||||||
<li class="item flexrow list-item" data-wound-name="moderate"><span class="skill-label">Moderate :</span>
|
<li class="item flexrow list-item" data-wound-name="moderate"><span class="skill-label">Moderate :</span>
|
||||||
<input class="wound-value" type="text" woundname="moderate" value="{{numberFormat data.wounds.moderate decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
<input class="wound-value" type="text" woundname="moderate" value="{{numberFormat data.data.wounds.moderate decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
</li>
|
</li>
|
||||||
<li class="item flexrow list-item" data-wound-name="severe"><span class="skill-label">Severe :</span>
|
<li class="item flexrow list-item" data-wound-name="severe"><span class="skill-label">Severe :</span>
|
||||||
<input class="wound-value" type="text" woundname="severe" value="{{numberFormat data.wounds.severe decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
<input class="wound-value" type="text" woundname="severe" value="{{numberFormat data.data.wounds.severe decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
</li>
|
</li>
|
||||||
<li class="item flexrow list-item" data-wound-name="critical"><span class="skill-label">Critical :</span>
|
<li class="item flexrow list-item" data-wound-name="critical"><span class="skill-label">Critical :</span>
|
||||||
<input class="wound-value" type="text" woundname="critical" value="{{numberFormat data.wounds.critical decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
<input class="wound-value" type="text" woundname="critical" value="{{numberFormat data.data.wounds.critical decimals=0}}" data-dtype="number" {{#unless @root.editStatSkill}}disabled{{/unless}}/>
|
||||||
</li>
|
</li>
|
||||||
<li class="item flexrow list-item" data-wound-name="critical"><span class="skill-label">Total :</span>
|
<li class="item flexrow list-item" data-wound-name="critical"><span class="skill-label">Total :</span>
|
||||||
<span class="skill-label">{{data.currentWounds}} / {{data.totalWounds}}</span>
|
<span class="skill-label">{{data.currentWounds}} / {{data.totalWounds}}</span>
|
||||||
@ -204,8 +204,8 @@
|
|||||||
<li class="item flexrow list-item" data-item-id="{{conseq.id}}">
|
<li class="item flexrow list-item" data-item-id="{{conseq.id}}">
|
||||||
<img class="sheet-skill-img" src="{{conseq.img}}"/>
|
<img class="sheet-skill-img" src="{{conseq.img}}"/>
|
||||||
<span class="conseq-label">{{conseq.name}}</span>
|
<span class="conseq-label">{{conseq.name}}</span>
|
||||||
<select class="consequence-severity" type="text" name="conseq.data.severity" value="{{conseq.data.severity}}" data-dtype="String">
|
<select class="consequence-severity" type="text" name="conseq.data.data.severity" value="{{conseq.data.data.severity}}" data-dtype="String">
|
||||||
{{#select conseq.data.severity}}
|
{{#select conseq.data.data.severity}}
|
||||||
<option value="none">None</option>
|
<option value="none">None</option>
|
||||||
<option value="light">Light</option>
|
<option value="light">Light</option>
|
||||||
<option value="moderate">Moderate</option>
|
<option value="moderate">Moderate</option>
|
||||||
@ -390,12 +390,12 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<h3>Biography : </h3>
|
<h3>Biography : </h3>
|
||||||
<div class="form-group editor">
|
<div class="form-group editor">
|
||||||
{{editor content=data.history target="data.history" button=true owner=owner editable=editable}}
|
{{editor content=data.data.history target="data.history" button=true owner=owner editable=editable}}
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<h3>Notes : </h3>
|
<h3>Notes : </h3>
|
||||||
<div class="form-group editor">
|
<div class="form-group editor">
|
||||||
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}}
|
{{editor content=data.data.notes target="data.notes" button=true owner=owner editable=editable}}
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
{{>"systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html"}}
|
{{>"systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html"}}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<form class="{{cssClass}}" autocomplete="off">
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
<header class="sheet-header">
|
<header class="sheet-header">
|
||||||
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
|
<img class="profile-img" src="{{data.img}}" data-edit="img" title="{{data.name}}"/>
|
||||||
<div class="header-fields">
|
<div class="header-fields">
|
||||||
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
|
<h1 class="charname"><input name="name" type="text" value="{{data.name}}" placeholder="Name"/></h1>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@ -13,8 +13,8 @@
|
|||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
<label class="generic-label">Severity</label>
|
<label class="generic-label">Severity</label>
|
||||||
<div class="form-group small-editor">
|
<div class="form-group small-editor">
|
||||||
<select class="stat-value flexrow" type="text" name="data.severity" value="{{data.severity}}" data-dtype="String">
|
<select class="stat-value flexrow" type="text" name="data.severity" value="{{data.data.severity}}" data-dtype="String">
|
||||||
{{#select data.severity}}
|
{{#select data.data.severity}}
|
||||||
<option value="none">None</option>
|
<option value="none">None</option>
|
||||||
<option value="light">Light</option>
|
<option value="light">Light</option>
|
||||||
<option value="moderate">Moderate</option>
|
<option value="moderate">Moderate</option>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
<label class="generic-label">Description</label>
|
<label class="generic-label">Description</label>
|
||||||
<div class="form-group medium-editor">
|
<div class="form-group medium-editor">
|
||||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
{{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<form class="{{cssClass}}" autocomplete="off">
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
<header class="sheet-header">
|
<header class="sheet-header">
|
||||||
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
|
<img class="profile-img" src="{{data.img}}" data-edit="img" title="{{data.name}}"/>
|
||||||
<div class="header-fields">
|
<div class="header-fields">
|
||||||
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
|
<h1 class="charname"><input name="name" type="text" value="{{data.name}}" placeholder="Name"/></h1>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<div class="tab" data-group="primary">
|
<div class="tab" data-group="primary">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="flexrow"><label class="generic-label">Value</label><input type="text" name="data.value" value="{{data.value}}" data-dtype="Number"/></li>
|
<li class="flexrow"><label class="generic-label">Value</label><input type="text" name="data.data.value" value="{{data.data.value}}" data-dtype="Number"/></li>
|
||||||
<ul class="stat-list alternate-list">
|
<ul class="stat-list alternate-list">
|
||||||
<li class="stat flexrow list-item" data-attribute="{{key}}">
|
<li class="stat flexrow list-item" data-attribute="{{key}}">
|
||||||
<span class="generic-label flexrow tooltip tooltip-nobottom" name="">Experiences list : </span>
|
<span class="generic-label flexrow tooltip tooltip-nobottom" name="">Experiences list : </span>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
<label class="generic-label">Description</label>
|
<label class="generic-label">Description</label>
|
||||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
{{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user