Fix #160 - Add new values...

This commit is contained in:
sladecraven 2022-11-27 19:07:34 +01:00
parent cb896c9813
commit f61e5b4b41

View File

@ -253,7 +253,7 @@ export class PegasusActor extends Actor {
getRoleLevel() { getRoleLevel() {
let role = this.items.find(item => item.type == 'role') let role = this.items.find(item => item.type == 'role')
if (role) { if (role) {
console.log("Role", role) //console.log("Role", role)
return role.system.rolelevel return role.system.rolelevel
} }
return 0 return 0
@ -452,7 +452,7 @@ export class PegasusActor extends Actor {
async activatePerk(perkId) { async activatePerk(perkId) {
let item = this.items.find(item => item.id == perkId); let item = this.items.find(item => item.id == perkId);
if (item && item.system) { if (item && item.system) {
let update = { _id: item.id, "data.active": !item.system.active }; let update = { _id: item.id, "system.active": !item.system.active };
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} }
} }
@ -483,7 +483,7 @@ export class PegasusActor extends Actor {
await this.deleteEmbeddedDocuments('Item', toRem) await this.deleteEmbeddedDocuments('Item', toRem)
} }
} }
let update = { _id: item.id, "data.activated": !item.system.activated } let update = { _id: item.id, "system.activated": !item.system.activated }
await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity
} }
} }
@ -494,8 +494,11 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
increaseRoleAbility() { increaseRoleAbility() {
let role = this.getRole()
let level = role.system.rolelevel + 1
this.updateEmbeddedDocuments('Item', [ {_id: role.id, 'system.rolelevel': level} ])
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
setBonusInformation( info) { setBonusInformation( info) {
this.update( {'system.biodata.bonusselection': info}) this.update( {'system.biodata.bonusselection': info})
@ -586,7 +589,7 @@ export class PegasusActor extends Actor {
ChatMessage.create({ content: `Power ${item.name} deactivated : ${item.system.deactivatedtext}` }) ChatMessage.create({ content: `Power ${item.name} deactivated : ${item.system.deactivatedtext}` })
} }
} }
let update = { _id: item.id, "data.activated": !item.system.activated } let update = { _id: item.id, "system.activated": !item.system.activated }
await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]) // Updates one EmbeddedEntity
} }
} }
@ -595,7 +598,7 @@ export class PegasusActor extends Actor {
async equipItem(itemId) { async equipItem(itemId) {
let item = this.items.find(item => item.id == itemId); let item = this.items.find(item => item.id == itemId);
if (item && item.system) { if (item && item.system) {
let update = { _id: item.id, "data.equipped": !item.system.equipped }; let update = { _id: item.id, "system.equipped": !item.system.equipped };
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
} }
} }