From e4e2bfd04247b6099c958c62d1e80f8f1d24fe1f Mon Sep 17 00:00:00 2001 From: U~man Date: Fri, 17 Jul 2020 12:01:37 +0200 Subject: [PATCH] ENH: XP shares - Compute given xp with predefined shares - Fixed party sheet button css - Fixed data types in entity tweaks --- src/module/dialog/party-sheet.js | 15 +++++++++------ src/scss/apps.scss | 4 ++-- src/templates/actors/dialogs/tweaks-dialog.html | 12 ++++++------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/module/dialog/party-sheet.js b/src/module/dialog/party-sheet.js index 80b5759..2c8f7d8 100644 --- a/src/module/dialog/party-sheet.js +++ b/src/module/dialog/party-sheet.js @@ -57,12 +57,12 @@ export class OsePartySheet extends FormApplication { const template = `
- +
`; let pcs = this.object.entities.filter((e) => { - return e.data.type == "character"; + return e.getFlag('ose', 'party') && e.data.type == "character"; }); new Dialog({ title: "Deal Experience", @@ -73,11 +73,14 @@ export class OsePartySheet extends FormApplication { label: game.i18n.localize("OSE.dialog.dealXP"), callback: (html) => { let toDeal = html.find('input[name="total"]').val(); - const value = parseFloat(toDeal) / pcs.length; + // calculate number of shares + let shares = 0; + pcs.forEach(c => {shares += c.data.data.details.xp.share}); + const value = parseFloat(toDeal) / shares; if (value) { // Give experience - pcs.forEach((t) => { - t.getExperience(Math.floor(value)); + pcs.forEach((c) => { + c.getExperience(Math.floor(c.data.data.details.xp.share * value)); }); } }, @@ -108,7 +111,7 @@ export class OsePartySheet extends FormApplication { }, }, }, - }, {height: "auto"}).render(true); + }, {height: "auto", width: 220}).render(true); } /** @override */ diff --git a/src/scss/apps.scss b/src/scss/apps.scss index 3326a19..4dff34d 100644 --- a/src/scss/apps.scss +++ b/src/scss/apps.scss @@ -65,8 +65,8 @@ } .img-btns { position: absolute; - bottom: 0; - left: 0; + bottom: 6px; + left: 3px; width: 45px; height: 12px; button { diff --git a/src/templates/actors/dialogs/tweaks-dialog.html b/src/templates/actors/dialogs/tweaks-dialog.html index e8cc220..6a7dc4e 100644 --- a/src/templates/actors/dialogs/tweaks-dialog.html +++ b/src/templates/actors/dialogs/tweaks-dialog.html @@ -3,14 +3,14 @@
+ data.spells.enabled}} data-dtype="Boolean" />
+ data.retainer.enabled}} data-dtype="Boolean"/>
@@ -24,19 +24,19 @@
- +
- +
- +
@@ -75,7 +75,7 @@
+ data.config.movementAuto}} data-dtype="Boolean" {{#unless user.isGM}}disabled{{/unless}} />
{{/if}}