Start 0.8 support
This commit is contained in:
@@ -171,8 +171,8 @@ export class SoSActor extends Actor {
|
||||
async wornObject( itemID) {
|
||||
let item = this.getOwnedItem(itemID);
|
||||
if (item && item.data.data) {
|
||||
let update = { _id: item._id, "data.worn": !item.data.data.worn };
|
||||
await this.updateEmbeddedEntity("OwnedItem", update);
|
||||
let update = { _id: item.id, "data.worn": !item.data.data.worn };
|
||||
await this.updateEmbeddedDocuments("Item", [update]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@ export class SoSActor extends Actor {
|
||||
async equipObject(itemID) {
|
||||
let item = this.getOwnedItem(itemID);
|
||||
if (item && item.data.data) {
|
||||
let update = { _id: item._id, "data.equiped": !item.data.data.equiped };
|
||||
await this.updateEmbeddedEntity("OwnedItem", update);
|
||||
let update = { _id: item.id, "data.equiped": !item.data.data.equiped };
|
||||
await this.updateEmbeddedDocuments("Item", [update]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,16 +222,16 @@ export class SoSActor extends Actor {
|
||||
async updateSkill(skillName, value) {
|
||||
let skill = this.data.items.find( item => item.name == skillName);
|
||||
if (skill) {
|
||||
const update = { _id: skill._id, 'data.value': value };
|
||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
const update = { _id: skill.id, 'data.value': value };
|
||||
const updated = await this.updateEmbeddedDocuments("Item", [ update] ); // Updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async updateSkillExperience(skillName, value) {
|
||||
let skill = this.data.items.find( item => item.name == skillName);
|
||||
if (skill) {
|
||||
const update = { _id: skill._id, 'data.xp': value };
|
||||
const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
|
||||
const update = { _id: skill.id, 'data.xp': value };
|
||||
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 ) {
|
||||
ui.notifications.warn("Container is already full !");
|
||||
} 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
|
||||
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) {
|
||||
let bleeding = this.data.items.find( item => item.type == 'consequence' && item.name == 'Bleeding');
|
||||
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;
|
||||
}
|
||||
// Stun consequence
|
||||
@@ -426,7 +426,7 @@ export class SoSActor extends Actor {
|
||||
for(i=0; i<flipData.nbStun; i++) {
|
||||
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;
|
||||
}
|
||||
await this.update( { 'data.scores.currentwounds': currentWounds, 'data.wounds': wounds } );
|
||||
|
||||
Reference in New Issue
Block a user