ENH: XP shares
- Compute given xp with predefined shares - Fixed party sheet button css - Fixed data types in entity tweaksmaster
parent
8de509be12
commit
e4e2bfd042
|
@ -57,12 +57,12 @@ export class OsePartySheet extends FormApplication {
|
|||
const template = `
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label>How much ?</label>
|
||||
<label>Amount</label>
|
||||
<input name="total" placeholder="0" type="text"/>
|
||||
</div>
|
||||
</form>`;
|
||||
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 */
|
||||
|
|
|
@ -65,8 +65,8 @@
|
|||
}
|
||||
.img-btns {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
bottom: 6px;
|
||||
left: 3px;
|
||||
width: 45px;
|
||||
height: 12px;
|
||||
button {
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
<label for="spellcaster">{{localize "OSE.Spellcaster"}}</label>
|
||||
<div class="form-fields">
|
||||
<input type="checkbox" name="data.spells.enabled" id="spellcaster" {{checked
|
||||
data.spells.enabled}} />
|
||||
data.spells.enabled}} data-dtype="Boolean" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="retainer">{{localize "OSE.Retainer"}}</label>
|
||||
<div class="form-fields">
|
||||
<input type="checkbox" name="data.retainer.enabled" id="retainer" {{checked
|
||||
data.retainer.enabled}} />
|
||||
data.retainer.enabled}} data-dtype="Boolean"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -24,19 +24,19 @@
|
|||
<div class="form-group">
|
||||
<label>{{localize "OSE.details.experience.next"}}</label>
|
||||
<div class="form-fields">
|
||||
<input type="text" name="data.details.xp.next" id="experiencenext" value="{{data.details.xp.next}}" />
|
||||
<input type="text" name="data.details.xp.next" id="experiencenext" value="{{data.details.xp.next}}" data-dtype="Number" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{localize "OSE.details.experience.bonus"}} (%)</label>
|
||||
<div class="form-fields">
|
||||
<input type="text" name="data.details.xp.bonus" id="experience" value="{{data.details.xp.bonus}}" />
|
||||
<input type="text" name="data.details.xp.bonus" id="experience" value="{{data.details.xp.bonus}}" data-dtype="Number"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{localize "OSE.details.experience.share"}} (%)</label>
|
||||
<div class="form-fields">
|
||||
<input type="text" name="data.details.xp.share" id="experience-share" value="{{data.details.xp.share}}" />
|
||||
<input type="text" name="data.details.xp.share" id="experience-share" value="{{data.details.xp.share}}" data-dtype="Number"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -75,7 +75,7 @@
|
|||
<label for="movementAuto">{{localize "OSE.Setting.MovementAuto"}}</label>
|
||||
<div class="form-fields">
|
||||
<input type="checkbox" name="data.config.movementAuto" id="movementAuto" {{checked
|
||||
data.config.movementAuto}} {{#unless user.isGM}}disabled{{/unless}} />
|
||||
data.config.movementAuto}} data-dtype="Boolean" {{#unless user.isGM}}disabled{{/unless}} />
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue