mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Finalised levelup selections and propagating to PC
This commit is contained in:
parent
7a12783a8c
commit
d7ebeb3b2a
12 changed files with 282 additions and 234 deletions
|
|
@ -745,7 +745,13 @@
|
||||||
},
|
},
|
||||||
"LevelUp": {
|
"LevelUp": {
|
||||||
"AdvanceLevel": "Continue To Level {level}",
|
"AdvanceLevel": "Continue To Level {level}",
|
||||||
"TakeLevelUp": "Finish Level Up"
|
"TakeLevelUp": "Finish Level Up",
|
||||||
|
"notifications": {
|
||||||
|
"info": {
|
||||||
|
"insufficentAdvancements": "You don't have enough advancements left.",
|
||||||
|
"insufficientTierAdvancements": "You have no available advancements for this tier."
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"DeathMove": {
|
"DeathMove": {
|
||||||
"Title": "{actor} - Death Move",
|
"Title": "{actor} - Death Move",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['daggerheart', 'levelup'],
|
classes: ['daggerheart', 'levelup'],
|
||||||
position: { width: 1200, height: 'auto' },
|
position: { width: 1000, height: 'auto' },
|
||||||
window: {
|
window: {
|
||||||
resizable: true
|
resizable: true
|
||||||
},
|
},
|
||||||
|
|
@ -57,31 +57,43 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const levelSelections = this.levelup.levelSelections;
|
const levelSelections = this.levelup.levelSelections;
|
||||||
if (levelSelections.total >= this.levelup.maxSelections) {
|
if (levelSelections.total + Number(button.dataset.cost) > this.levelup.maxSelections) {
|
||||||
// Notification?
|
ui.notifications.info(
|
||||||
|
game.i18n.localize('DAGGERHEART.Application.LevelUp.notifications.info.insufficentAdvancements')
|
||||||
|
);
|
||||||
this.render();
|
this.render();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tier = this.levelup.tiers[button.dataset.tier];
|
const nrTiers = Object.keys(this.levelup.tiers).length;
|
||||||
const tierLevels = Object.keys(tier.levels).map(level => Number(level));
|
let lowestLevelChoice = null;
|
||||||
const lowestLevelChoice = Object.keys(levelSelections.selections).reduce((currentLowest, key) => {
|
for (var tierKey = Number(button.dataset.tier); tierKey <= nrTiers + 1; tierKey++) {
|
||||||
const level = Number(key);
|
const tier = this.levelup.tiers[tierKey];
|
||||||
if (tierLevels.includes(level)) {
|
lowestLevelChoice = Object.keys(levelSelections.available).reduce((currentLowest, key) => {
|
||||||
if (!currentLowest || level < currentLowest) return level;
|
const level = Number(key);
|
||||||
}
|
if (levelSelections.available[key] >= button.dataset.cost && tier.belongingLevels.includes(level)) {
|
||||||
|
if (!currentLowest || level < currentLowest) return level;
|
||||||
|
}
|
||||||
|
|
||||||
return currentLowest;
|
return currentLowest;
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
if (lowestLevelChoice) break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lowestLevelChoice) {
|
if (!lowestLevelChoice) {
|
||||||
// Notification?
|
ui.notifications.info(
|
||||||
|
game.i18n.localize(
|
||||||
|
'DAGGERHEART.Application.LevelUp.notifications.info.insufficientTierAdvancements'
|
||||||
|
)
|
||||||
|
);
|
||||||
this.render();
|
this.render();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.levelup.updateSource({
|
await this.levelup.updateSource({
|
||||||
[`tiers.${button.dataset.tier}.levels.${lowestLevelChoice}.optionSelections.${button.dataset.option}.${button.dataset.checkboxNr}`]: true
|
[`tiers.${button.dataset.tier}.levels.${lowestLevelChoice}.optionSelections.${button.dataset.option}.${button.dataset.checkboxNr}`]:
|
||||||
|
{ selected: true, minCost: button.dataset.cost }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,13 +166,26 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
|
|
||||||
_attachPartListeners(partId, htmlElement, options) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
$(htmlElement).find('.attribute-value').on('change', this.attributeChange.bind(this));
|
htmlElement
|
||||||
$(htmlElement).find('.tab-selector').on('click', this.tabSwitch.bind(this));
|
.querySelectorAll('.attribute-value')
|
||||||
$(htmlElement).find('.level-title.levelup').on('click', this.openLevelUp.bind(this));
|
.forEach(element => element.addEventListener('change', this.attributeChange.bind(this)));
|
||||||
$(htmlElement).find('.feature-input').on('change', this.onFeatureInputBlur.bind(this));
|
htmlElement
|
||||||
$(htmlElement).find('.experience-description').on('change', this.experienceDescriptionChange.bind(this));
|
.querySelectorAll('.tab-selector')
|
||||||
$(htmlElement).find('.experience-value').on('change', this.experienceValueChange.bind(this));
|
.forEach(element => element.addEventListener('click', this.tabSwitch.bind(this)));
|
||||||
$(htmlElement).find('[data-item]').on('change', this.itemUpdate.bind(this));
|
htmlElement.querySelector('.level-title.levelup')?.addEventListener('click', this.openLevelUp.bind(this));
|
||||||
|
htmlElement
|
||||||
|
.querySelectorAll('.feature-input')
|
||||||
|
.forEach(element => element.addEventListener('change', this.onFeatureInputBlur.bind(this)));
|
||||||
|
htmlElement
|
||||||
|
.querySelectorAll('.experience-description')
|
||||||
|
.forEach(element => element.addEventListener('change', this.experienceDescriptionChange.bind(this)));
|
||||||
|
htmlElement
|
||||||
|
.querySelectorAll('.experience-value')
|
||||||
|
.forEach(element => element.addEventListener('change', this.experienceValueChange.bind(this)));
|
||||||
|
htmlElement
|
||||||
|
.querySelectorAll('[data-item]')
|
||||||
|
.forEach(element => element.addEventListener.on('change', this.itemUpdate.bind(this)));
|
||||||
|
htmlElement.querySelector('.level-value').addEventListener('change', this.onLevelChange.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
|
|
@ -838,6 +851,11 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
await item.update({ [name]: event.currentTarget.value });
|
await item.update({ [name]: event.currentTarget.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onLevelChange(event) {
|
||||||
|
await this.document.updateLevel(Number(event.currentTarget.value));
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
static async deleteItem(_, button) {
|
static async deleteItem(_, button) {
|
||||||
const item = await fromUuid($(button).closest('[data-item-id]')[0].dataset.itemId);
|
const item = await fromUuid($(button).closest('[data-item-id]')[0].dataset.itemId);
|
||||||
await item.delete();
|
await item.delete();
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class DhLevelOption extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: new fields.StringField({ required: true }),
|
label: new fields.StringField({ required: true }),
|
||||||
checkboxQuantity: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
checkboxSelections: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
||||||
minCost: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
minCost: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
||||||
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
||||||
value: new fields.NumberField({ integer: true }),
|
value: new fields.NumberField({ integer: true }),
|
||||||
|
|
@ -118,14 +118,14 @@ export const defaultLevelTiers = {
|
||||||
options: {
|
options: {
|
||||||
trait: {
|
trait: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.trait',
|
label: 'DAGGERHEART.LevelUp.Options.trait',
|
||||||
checkboxQuantity: 3,
|
checkboxSelections: 3,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.trait.id,
|
type: LevelOptionType.trait.id,
|
||||||
amount: 2
|
amount: 2
|
||||||
},
|
},
|
||||||
hitPoint: {
|
hitPoint: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.hitPoint',
|
label: 'DAGGERHEART.LevelUp.Options.hitPoint',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 2,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.hitPoint.id,
|
type: LevelOptionType.hitPoint.id,
|
||||||
value: 1,
|
value: 1,
|
||||||
|
|
@ -133,14 +133,14 @@ export const defaultLevelTiers = {
|
||||||
},
|
},
|
||||||
stress: {
|
stress: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.stress',
|
label: 'DAGGERHEART.LevelUp.Options.stress',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 2,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.stress.id,
|
type: LevelOptionType.stress.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
experience: {
|
experience: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.experience',
|
label: 'DAGGERHEART.LevelUp.Options.experience',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.experience.id,
|
type: LevelOptionType.experience.id,
|
||||||
value: 1,
|
value: 1,
|
||||||
|
|
@ -148,14 +148,14 @@ export const defaultLevelTiers = {
|
||||||
},
|
},
|
||||||
domainCard: {
|
domainCard: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.domainCard',
|
label: 'DAGGERHEART.LevelUp.Options.domainCard',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.domainCard.id,
|
type: LevelOptionType.domainCard.id,
|
||||||
amount: 1
|
amount: 1
|
||||||
},
|
},
|
||||||
evasion: {
|
evasion: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.evasion',
|
label: 'DAGGERHEART.LevelUp.Options.evasion',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.evasion.id,
|
type: LevelOptionType.evasion.id,
|
||||||
value: 1
|
value: 1
|
||||||
|
|
@ -181,28 +181,28 @@ export const defaultLevelTiers = {
|
||||||
options: {
|
options: {
|
||||||
trait: {
|
trait: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.trait',
|
label: 'DAGGERHEART.LevelUp.Options.trait',
|
||||||
checkboxQuantity: 3,
|
checkboxSelections: 3,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.trait.id,
|
type: LevelOptionType.trait.id,
|
||||||
amount: 2
|
amount: 2
|
||||||
},
|
},
|
||||||
hitPoint: {
|
hitPoint: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.hitPoint',
|
label: 'DAGGERHEART.LevelUp.Options.hitPoint',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 2,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.hitPoint.id,
|
type: LevelOptionType.hitPoint.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
stress: {
|
stress: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.stress',
|
label: 'DAGGERHEART.LevelUp.Options.stress',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 2,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.stress.id,
|
type: LevelOptionType.stress.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
experience: {
|
experience: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.experience',
|
label: 'DAGGERHEART.LevelUp.Options.experience',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.experience.id,
|
type: LevelOptionType.experience.id,
|
||||||
value: 1,
|
value: 1,
|
||||||
|
|
@ -210,34 +210,34 @@ export const defaultLevelTiers = {
|
||||||
},
|
},
|
||||||
domainCard: {
|
domainCard: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.domainCard',
|
label: 'DAGGERHEART.LevelUp.Options.domainCard',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.domainCard.id,
|
type: LevelOptionType.domainCard.id,
|
||||||
amount: 1
|
amount: 1
|
||||||
},
|
},
|
||||||
evasion: {
|
evasion: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.evasion',
|
label: 'DAGGERHEART.LevelUp.Options.evasion',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.evasion.id,
|
type: LevelOptionType.evasion.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
subclass: {
|
subclass: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.subclass',
|
label: 'DAGGERHEART.LevelUp.Options.subclass',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.subclass.id
|
type: LevelOptionType.subclass.id
|
||||||
},
|
},
|
||||||
proficiency: {
|
proficiency: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.proficiency',
|
label: 'DAGGERHEART.LevelUp.Options.proficiency',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 1,
|
||||||
minCost: 2,
|
minCost: 2,
|
||||||
type: LevelOptionType.proficiency.id,
|
type: LevelOptionType.proficiency.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
multiclass: {
|
multiclass: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.multiclass',
|
label: 'DAGGERHEART.LevelUp.Options.multiclass',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 1,
|
||||||
minCost: 2,
|
minCost: 2,
|
||||||
type: LevelOptionType.multiclass.id
|
type: LevelOptionType.multiclass.id
|
||||||
}
|
}
|
||||||
|
|
@ -262,28 +262,28 @@ export const defaultLevelTiers = {
|
||||||
options: {
|
options: {
|
||||||
trait: {
|
trait: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.trait',
|
label: 'DAGGERHEART.LevelUp.Options.trait',
|
||||||
checkboxQuantity: 3,
|
checkboxSelections: 3,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.trait.id,
|
type: LevelOptionType.trait.id,
|
||||||
amount: 2
|
amount: 2
|
||||||
},
|
},
|
||||||
hitPoint: {
|
hitPoint: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.hitPoint',
|
label: 'DAGGERHEART.LevelUp.Options.hitPoint',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 2,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.hitPoint.id,
|
type: LevelOptionType.hitPoint.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
stress: {
|
stress: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.stress',
|
label: 'DAGGERHEART.LevelUp.Options.stress',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 2,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.stress.id,
|
type: LevelOptionType.stress.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
experience: {
|
experience: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.experience',
|
label: 'DAGGERHEART.LevelUp.Options.experience',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.experience.id,
|
type: LevelOptionType.experience.id,
|
||||||
value: 1,
|
value: 1,
|
||||||
|
|
@ -291,34 +291,34 @@ export const defaultLevelTiers = {
|
||||||
},
|
},
|
||||||
domainCard: {
|
domainCard: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.domainCard',
|
label: 'DAGGERHEART.LevelUp.Options.domainCard',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.domainCard.id,
|
type: LevelOptionType.domainCard.id,
|
||||||
amount: 1
|
amount: 1
|
||||||
},
|
},
|
||||||
evasion: {
|
evasion: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.evasion',
|
label: 'DAGGERHEART.LevelUp.Options.evasion',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.evasion.id,
|
type: LevelOptionType.evasion.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
subclass: {
|
subclass: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.subclass',
|
label: 'DAGGERHEART.LevelUp.Options.subclass',
|
||||||
checkboxQuantity: 1,
|
checkboxSelections: 1,
|
||||||
minCost: 1,
|
minCost: 1,
|
||||||
type: LevelOptionType.subclass.id
|
type: LevelOptionType.subclass.id
|
||||||
},
|
},
|
||||||
proficiency: {
|
proficiency: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.proficiency',
|
label: 'DAGGERHEART.LevelUp.Options.proficiency',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 1,
|
||||||
minCost: 2,
|
minCost: 2,
|
||||||
type: LevelOptionType.proficiency.id,
|
type: LevelOptionType.proficiency.id,
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
multiclass: {
|
multiclass: {
|
||||||
label: 'DAGGERHEART.LevelUp.Options.multiclass',
|
label: 'DAGGERHEART.LevelUp.Options.multiclass',
|
||||||
checkboxQuantity: 2,
|
checkboxSelections: 1,
|
||||||
minCost: 2,
|
minCost: 2,
|
||||||
type: LevelOptionType.multiclass.id
|
type: LevelOptionType.multiclass.id
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
|
import { chunkify } from '../helpers/utils.mjs';
|
||||||
import { LevelOptionType } from './levelTier.mjs';
|
import { LevelOptionType } from './levelTier.mjs';
|
||||||
|
|
||||||
export class DhLevelup extends foundry.abstract.DataModel {
|
export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
static initializeData(levelTierData, pcLevelData) {
|
static initializeData(levelTierData, pcLevelData) {
|
||||||
const availableChoicesPerLevel = levelTierData.availableChoicesPerLevel;
|
const availableChoicesPerLevel = levelTierData.availableChoicesPerLevel;
|
||||||
|
const tierKeys = Object.keys(levelTierData.tiers);
|
||||||
|
const maxLevel = levelTierData.tiers[tierKeys[tierKeys.length - 1]].levels.end;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tiers: Object.keys(levelTierData.tiers).reduce((acc, key) => {
|
tiers: tierKeys.reduce((acc, key) => {
|
||||||
acc[key] = DhLevelupTier.initializeData(
|
acc[key] = DhLevelupTier.initializeData(
|
||||||
levelTierData.tiers[key],
|
levelTierData.tiers[key],
|
||||||
|
maxLevel,
|
||||||
pcLevelData.selections.filter(x => x.tier === Number(key)),
|
pcLevelData.selections.filter(x => x.tier === Number(key)),
|
||||||
pcLevelData.level.changed
|
pcLevelData.level.changed
|
||||||
);
|
);
|
||||||
|
|
@ -39,16 +43,16 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
return Object.values(this.tiers).reduce(
|
return Object.values(this.tiers).reduce(
|
||||||
(acc, tier) => {
|
(acc, tier) => {
|
||||||
acc.total += tier.selections.total;
|
acc.total += tier.selections.total;
|
||||||
for (var key in tier.selections.selections) {
|
for (var key in tier.selections.available) {
|
||||||
const nrSelections = tier.selections.selections[key];
|
const availableSelections = tier.selections.available[key];
|
||||||
|
|
||||||
if (acc.selections[key]) acc.selections[key] += nrSelections;
|
if (acc.available[key]) acc.available[key] += availableSelections;
|
||||||
else acc.selections[key] = nrSelections;
|
else acc.available[key] = availableSelections;
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{ total: 0, selections: {} }
|
{ total: 0, available: {} }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,16 +81,22 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DhLevelupTier extends foundry.abstract.DataModel {
|
class DhLevelupTier extends foundry.abstract.DataModel {
|
||||||
static initializeData(levelTier, pcLevelData, pcLevel) {
|
static initializeData(levelTier, levelEndCap, pcLevelData, pcLevel) {
|
||||||
const levels = {};
|
const levels = {};
|
||||||
const levelEndCap = levelTier.levels.end + 1;
|
for (var level = levelTier.levels.start; level <= levelEndCap; level++) {
|
||||||
for (var level = levelTier.levels.start; level < levelEndCap; level++) {
|
|
||||||
levels[level] = DhLevelupLevel.initializeData(
|
levels[level] = DhLevelupLevel.initializeData(
|
||||||
levelTier.availableOptions,
|
level <= Math.min(pcLevel, levelTier.levels.end) ? levelTier.availableOptions : 0,
|
||||||
pcLevelData.filter(x => x.level === level)
|
levelTier.options,
|
||||||
|
pcLevelData.filter(x => x.level === level),
|
||||||
|
level < pcLevel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var belongingLevels = [];
|
||||||
|
for (var i = levelTier.levels.start; i <= levelTier.levels.end; i++) {
|
||||||
|
belongingLevels.push(i);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tier: levelTier.tier,
|
tier: levelTier.tier,
|
||||||
name: levelTier.name,
|
name: levelTier.name,
|
||||||
|
|
@ -96,6 +106,7 @@ class DhLevelupTier extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {}),
|
}, {}),
|
||||||
|
belongingLevels: belongingLevels,
|
||||||
levels: levels
|
levels: levels
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -108,19 +119,26 @@ class DhLevelupTier extends foundry.abstract.DataModel {
|
||||||
name: new fields.StringField({ required: true }),
|
name: new fields.StringField({ required: true }),
|
||||||
active: new fields.BooleanField({ required: true, initial: true }),
|
active: new fields.BooleanField({ required: true, initial: true }),
|
||||||
options: new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelupTierOption)),
|
options: new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelupTierOption)),
|
||||||
|
belongingLevels: new fields.ArrayField(new fields.NumberField({ required: true, integer: true })),
|
||||||
levels: new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelupLevel))
|
levels: new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelupLevel))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get selections() {
|
get selections() {
|
||||||
const allSelections = Object.keys(this.levels).reduce((acc, key) => {
|
const allSelections = Object.keys(this.levels).reduce(
|
||||||
acc[key] = this.levels[key].nrSelections;
|
(acc, key) => {
|
||||||
|
const { selections, available } = this.levels[key].nrSelections;
|
||||||
|
if (acc.available[key]) acc.available[key] += available;
|
||||||
|
else acc.available[key] = available;
|
||||||
|
acc.total += selections;
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
},
|
||||||
|
{ available: {}, total: 0 }
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
selections: allSelections,
|
available: allSelections.available,
|
||||||
total: Object.values(allSelections).reduce((acc, nr) => acc + nr, 0)
|
total: allSelections.total
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,24 +146,32 @@ class DhLevelupTier extends foundry.abstract.DataModel {
|
||||||
get tierCheckboxGroups() {
|
get tierCheckboxGroups() {
|
||||||
return Object.keys(this.options).map(optionKey => {
|
return Object.keys(this.options).map(optionKey => {
|
||||||
const option = this.options[optionKey];
|
const option = this.options[optionKey];
|
||||||
|
const checkboxes = [...Array(option.checkboxSelections).keys()].flatMap(checkboxNr => {
|
||||||
|
const levelId = Object.keys(this.levels).find(levelKey => {
|
||||||
|
const optionSelect = this.levels[levelKey].optionSelections;
|
||||||
|
return Object.keys(optionSelect)
|
||||||
|
.filter(key => key === optionKey)
|
||||||
|
.some(optionKey => optionSelect[optionKey][checkboxNr]?.selected);
|
||||||
|
});
|
||||||
|
|
||||||
|
return [...Array(option.minCost)].map(_ => ({
|
||||||
|
...option,
|
||||||
|
tier: this.tier,
|
||||||
|
level: levelId,
|
||||||
|
selected: Boolean(levelId),
|
||||||
|
optionKey: optionKey,
|
||||||
|
checkboxNr: checkboxNr,
|
||||||
|
disabled: !levelId ? false : this.levels[levelId].optionSelections[optionKey][checkboxNr]?.locked,
|
||||||
|
cost: option.minCost
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: game.i18n.localize(option.label),
|
label: game.i18n.localize(option.label),
|
||||||
checkboxes: [...Array(option.checkboxQuantity).keys()].map(checkboxNr => {
|
checkboxGroups: chunkify(checkboxes, option.minCost, chunkedBoxes => ({
|
||||||
const levelId = Object.keys(this.levels).find(levelKey => {
|
multi: option.minCost > 1,
|
||||||
const optionSelect = this.levels[levelKey].optionSelections;
|
checkboxes: chunkedBoxes
|
||||||
return Object.keys(optionSelect)
|
}))
|
||||||
.filter(key => key === optionKey)
|
|
||||||
.some(optionKey => optionSelect[optionKey][checkboxNr]);
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
...option,
|
|
||||||
tier: this.tier,
|
|
||||||
level: levelId,
|
|
||||||
selected: Boolean(levelId),
|
|
||||||
optionKey: optionKey,
|
|
||||||
checkboxNr: checkboxNr
|
|
||||||
};
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -157,7 +183,7 @@ class DhLevelupTierOption extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: new fields.StringField({ required: true }),
|
label: new fields.StringField({ required: true }),
|
||||||
checkboxQuantity: new fields.NumberField({ required: true, integer: true }),
|
checkboxSelections: new fields.NumberField({ required: true, integer: true }),
|
||||||
minCost: new fields.NumberField({ required: true, integer: true }),
|
minCost: new fields.NumberField({ required: true, integer: true }),
|
||||||
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
||||||
value: new fields.NumberField({ integer: true }),
|
value: new fields.NumberField({ integer: true }),
|
||||||
|
|
@ -167,12 +193,15 @@ class DhLevelupTierOption extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DhLevelupLevel extends foundry.abstract.DataModel {
|
class DhLevelupLevel extends foundry.abstract.DataModel {
|
||||||
static initializeData(maxSelections, levelData) {
|
static initializeData(maxSelections, optionSelections, levelData, locked) {
|
||||||
return {
|
return {
|
||||||
maxSelections: maxSelections,
|
maxSelections: maxSelections,
|
||||||
optionSelections: levelData.reduce((acc, data) => {
|
optionSelections: levelData.reduce((acc, data) => {
|
||||||
if (!acc[data.optionkey]) acc[data.optionKey] = {};
|
if (!acc[data.optionKey]) acc[data.optionKey] = {};
|
||||||
acc[data.optionKey][data.checkboxNr] = true;
|
acc[data.optionKey][data.checkboxNr] = {
|
||||||
|
minCost: optionSelections[data.optionKey].minCost,
|
||||||
|
locked: locked
|
||||||
|
};
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
|
|
@ -185,15 +214,30 @@ class DhLevelupLevel extends foundry.abstract.DataModel {
|
||||||
return {
|
return {
|
||||||
maxSelections: new fields.NumberField({ required: true, integer: true }),
|
maxSelections: new fields.NumberField({ required: true, integer: true }),
|
||||||
optionSelections: new fields.TypedObjectField(
|
optionSelections: new fields.TypedObjectField(
|
||||||
new fields.TypedObjectField(new fields.BooleanField({ required: true, initial: true }))
|
new fields.TypedObjectField(
|
||||||
|
new fields.SchemaField({
|
||||||
|
selected: new fields.BooleanField({ required: true, initial: true }),
|
||||||
|
minCost: new fields.NumberField({ required: true, integer: true }),
|
||||||
|
locked: new fields.BooleanField({ required: true, initial: false })
|
||||||
|
})
|
||||||
|
)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get nrSelections() {
|
get nrSelections() {
|
||||||
return Object.keys(this.optionSelections).reduce(
|
const selections = Object.keys(this.optionSelections).reduce((acc, optionKey) => {
|
||||||
(acc, optionKey) => acc + Object.keys(this.optionSelections[optionKey]).length,
|
const selection = this.optionSelections[optionKey];
|
||||||
0
|
acc += Object.values(selection)
|
||||||
);
|
.filter(x => x.selected)
|
||||||
|
.reduce((acc, x) => acc + x.minCost, 0);
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
return {
|
||||||
|
selections: selections,
|
||||||
|
available: this.maxSelections - selections
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { getPathValue, getTier } from '../helpers/utils.mjs';
|
import { getPathValue } from '../helpers/utils.mjs';
|
||||||
import { LevelOptionType } from './levelTier.mjs';
|
import { LevelOptionType } from './levelTier.mjs';
|
||||||
|
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
@ -349,7 +349,7 @@ export default class DhpPC extends foundry.abstract.TypeDataModel {
|
||||||
// this.armor.value = this.activeArmor?.baseScore ?? 0;
|
// this.armor.value = this.activeArmor?.baseScore ?? 0;
|
||||||
// this.damageThresholds = this.computeDamageThresholds();
|
// this.damageThresholds = this.computeDamageThresholds();
|
||||||
|
|
||||||
// this.applyLevels();
|
this.applyLevels();
|
||||||
this.applyEffects();
|
this.applyEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -370,97 +370,7 @@ export default class DhpPC extends foundry.abstract.TypeDataModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
applyLevels() {
|
applyLevels() {}
|
||||||
let healthBonus = 0,
|
|
||||||
stressBonus = 0,
|
|
||||||
proficiencyBonus = 0,
|
|
||||||
evasionBonus = 0,
|
|
||||||
armorBonus = 0;
|
|
||||||
let experienceBonuses = {};
|
|
||||||
let advancementFirst = null,
|
|
||||||
advancementSecond = null;
|
|
||||||
for (var level in this.levelData.levelups) {
|
|
||||||
var levelData = this.levelData.levelups[level];
|
|
||||||
for (var tier in levelData) {
|
|
||||||
var tierData = levelData[tier];
|
|
||||||
if (tierData) {
|
|
||||||
healthBonus += Object.keys(tierData.hitPointSlots).length;
|
|
||||||
stressBonus += Object.keys(tierData.stressSlots).length;
|
|
||||||
proficiencyBonus += Object.keys(tierData.proficiency).length;
|
|
||||||
advancementFirst =
|
|
||||||
Object.keys(tierData.subclass).length > 0 && level >= 5 && level <= 7
|
|
||||||
? { ...tierData.subclass[0], tier: getTier(Number.parseInt(level), true) }
|
|
||||||
: advancementFirst;
|
|
||||||
advancementSecond =
|
|
||||||
Object.keys(tierData.subclass).length > 0 && level >= 8 && level <= 10
|
|
||||||
? { ...tierData.subclass[0], tier: getTier(Number.parseInt(level), true) }
|
|
||||||
: advancementSecond;
|
|
||||||
|
|
||||||
for (var index in Object.keys(tierData.experiences)) {
|
|
||||||
for (var experienceKey in tierData.experiences[index]) {
|
|
||||||
var experience = tierData.experiences[index][experienceKey];
|
|
||||||
experienceBonuses[experience] = experienceBonuses[experience]
|
|
||||||
? experienceBonuses[experience] + 1
|
|
||||||
: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
evasionBonus += Object.keys(tierData.armorOrEvasionSlot).filter(
|
|
||||||
x => tierData.armorOrEvasionSlot[x] === 'evasion'
|
|
||||||
).length;
|
|
||||||
armorBonus += Object.keys(tierData.armorOrEvasionSlot).filter(
|
|
||||||
x => tierData.armorOrEvasionSlot[x] === 'armor'
|
|
||||||
).length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.resources.health.max += healthBonus;
|
|
||||||
this.resources.stress.max += stressBonus;
|
|
||||||
this.proficiency.value += proficiencyBonus;
|
|
||||||
this.evasion += evasionBonus;
|
|
||||||
this.armorMarks = {
|
|
||||||
max: this.armor ? this.armor.system.marks.max + armorBonus : 0,
|
|
||||||
value: this.armor ? this.armor.system.marks.value : 0
|
|
||||||
};
|
|
||||||
|
|
||||||
this.experiences = this.experiences.map(x => ({ ...x, value: x.value + (experienceBonuses[x.id] ?? 0) }));
|
|
||||||
|
|
||||||
const subclassFeatures = this.subclassFeatures;
|
|
||||||
if (advancementFirst) {
|
|
||||||
if (advancementFirst.multiclass) {
|
|
||||||
this.multiclassSubclass.system[`${advancementFirst.feature}Feature`].unlocked = true;
|
|
||||||
this.multiclassSubclass.system[`${advancementFirst.feature}Feature`].tier = advancementFirst.tier;
|
|
||||||
subclassFeatures.multiclassSubclass[advancementFirst.feature].forEach(x => (x.system.disabled = false));
|
|
||||||
} else {
|
|
||||||
this.subclass.system[`${advancementFirst.feature}Feature`].unlocked = true;
|
|
||||||
this.subclass.system[`${advancementFirst.feature}Feature`].tier = advancementFirst.tier;
|
|
||||||
subclassFeatures.subclass[advancementFirst.feature].forEach(x => (x.system.disabled = false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (advancementSecond) {
|
|
||||||
if (advancementSecond.multiclass) {
|
|
||||||
this.multiclassSubclass.system[`${advancementSecond.feature}Feature`].unlocked = true;
|
|
||||||
this.multiclassSubclass.system[`${advancementSecond.feature}Feature`].tier = advancementSecond.tier;
|
|
||||||
subclassFeatures.multiclassSubclass[advancementSecond.feature].forEach(
|
|
||||||
x => (x.system.disabled = false)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.subclass.system[`${advancementSecond.feature}Feature`].unlocked = true;
|
|
||||||
this.subclass.system[`${advancementSecond.feature}Feature`].tier = advancementSecond.tier;
|
|
||||||
subclassFeatures.subclass[advancementSecond.feature].forEach(x => (x.system.disabled = false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//General progression
|
|
||||||
for (var i = 0; i < this.levelData.currentLevel; i++) {
|
|
||||||
const tier = getTier(i + 1);
|
|
||||||
if (tier !== 'tier0') {
|
|
||||||
this.domainData.maxLoadout = Math.min(this.domainData.maxLoadout + 1, 5);
|
|
||||||
this.domainData.maxCards += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
applyEffects() {
|
applyEffects() {
|
||||||
const effects = this.effects;
|
const effects = this.effects;
|
||||||
|
|
@ -533,6 +443,6 @@ class DhPCLevelData extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get canLevelUp() {
|
get canLevelUp() {
|
||||||
return this.level.current < this.level.updated;
|
return this.level.current < this.level.changed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,48 +18,33 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _preUpdate(changed, options, user) {
|
async _preUpdate(changed, options, user) {
|
||||||
//Level Down
|
|
||||||
if (
|
|
||||||
changed.system?.levelData?.changedLevel &&
|
|
||||||
this.system.levelData.currentLevel > changed.system.levelData.changedLevel
|
|
||||||
) {
|
|
||||||
changed.system.levelData.currentLevel = changed.system.levelData.changedLevel;
|
|
||||||
changed.system.levelData.levelups = Object.keys(this.system.levelData.levelups).reduce((acc, x) => {
|
|
||||||
if (x > changed.system.levelData.currentLevel) {
|
|
||||||
acc[`-=${x}`] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
changed.system.traits = Object.keys(this.system.traits).reduce((acc, key) => {
|
|
||||||
acc[key] = {
|
|
||||||
levelMarks: this.system.traits[key].levelMarks.filter(
|
|
||||||
x => x <= changed.system.levelData.currentLevel
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
changed.system.experiences = this.system.experiences.filter(
|
|
||||||
x => x.level <= changed.system.levelData.currentLevel
|
|
||||||
);
|
|
||||||
|
|
||||||
if (
|
|
||||||
this.system.multiclass &&
|
|
||||||
this.system.multiclass.system.multiclass > changed.system.levelData.changedLevel
|
|
||||||
) {
|
|
||||||
const multiclassFeatures = this.items.filter(x => x.system.multiclass);
|
|
||||||
for (var feature of multiclassFeatures) {
|
|
||||||
await feature.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super._preUpdate(changed, options, user);
|
super._preUpdate(changed, options, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateLevel(newLevel) {
|
||||||
|
if (this.type !== 'pc' || newLevel === this.system.levelData.level.changed) return;
|
||||||
|
|
||||||
|
if (newLevel > this.system.levelData.level.current) {
|
||||||
|
await this.update({ 'system.levelData.level.changed': newLevel });
|
||||||
|
} else {
|
||||||
|
const newLevelData = {
|
||||||
|
level: {
|
||||||
|
current: newLevel,
|
||||||
|
changed: newLevel
|
||||||
|
},
|
||||||
|
selections: Object.keys(this.system.levelData.selections).reduce((acc, key) => {
|
||||||
|
const level = this.system.levelData.selections[key];
|
||||||
|
if (level.level <= newLevel) {
|
||||||
|
acc[key] = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
};
|
||||||
|
await this.update({ 'system.levelData': newLevelData });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async diceRoll(modifier, shiftKey) {
|
async diceRoll(modifier, shiftKey) {
|
||||||
if (this.type === 'pc') {
|
if (this.type === 'pc') {
|
||||||
return await this.dualityRoll(modifier, shiftKey);
|
return await this.dualityRoll(modifier, shiftKey);
|
||||||
|
|
|
||||||
|
|
@ -131,3 +131,17 @@ export const setDiceSoNiceForDualityRoll = (rollResult, advantage, disadvantage)
|
||||||
rollResult.dice[2].options.appearance = diceSoNicePresets.disadvantage;
|
rollResult.dice[2].options.appearance = diceSoNicePresets.disadvantage;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const chunkify = (array, chunkSize, mappingFunc) => {
|
||||||
|
var chunkifiedArray = [];
|
||||||
|
for (let i = 0; i < array.length; i += chunkSize) {
|
||||||
|
const chunk = array.slice(i, i + chunkSize);
|
||||||
|
if (mappingFunc) {
|
||||||
|
chunkifiedArray.push(mappingFunc(chunk));
|
||||||
|
} else {
|
||||||
|
chunkifiedArray.push(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return chunkifiedArray;
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -2786,11 +2786,17 @@ div.daggerheart.views.multiclass {
|
||||||
.theme-light {
|
.theme-light {
|
||||||
/* Add specifics*/
|
/* Add specifics*/
|
||||||
}
|
}
|
||||||
|
.daggerheart.levelup div[data-application-part="form"] {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
.daggerheart.levelup .tiers-container {
|
.daggerheart.levelup .tiers-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
.daggerheart.levelup .tiers-container .tier-container {
|
.daggerheart.levelup .tiers-container .tier-container {
|
||||||
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
@ -2809,13 +2815,30 @@ div.daggerheart.views.multiclass {
|
||||||
}
|
}
|
||||||
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container {
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 2.3fr;
|
grid-template-columns: 1fr 3fr;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkboxes-container {
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkboxes-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 4px;
|
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkboxes-container .checkbox-grouping-coontainer {
|
||||||
|
display: flex;
|
||||||
|
height: min-content;
|
||||||
|
}
|
||||||
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkboxes-container .checkbox-grouping-coontainer.multi {
|
||||||
|
border: 2px solid grey;
|
||||||
|
padding: 2.4px 2.5px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkboxes-container .checkbox-grouping-coontainer.multi .selection-checkbox {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkboxes-container .checkbox-grouping-coontainer .selection-checkbox {
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkbox-group-label {
|
.daggerheart.levelup .tiers-container .tier-container .checkbox-group-container .checkbox-group-label {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.daggerheart.levelup {
|
.daggerheart.levelup {
|
||||||
|
div[data-application-part='form'] {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.tiers-container {
|
.tiers-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
|
||||||
.tier-container {
|
.tier-container {
|
||||||
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
@ -28,16 +35,34 @@
|
||||||
|
|
||||||
.checkbox-group-container {
|
.checkbox-group-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 2.3fr;
|
grid-template-columns: 1fr 3fr;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
.checkbox-group-container-title {
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkboxes-container {
|
.checkboxes-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 4px;
|
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
.checkbox-grouping-coontainer {
|
||||||
|
display: flex;
|
||||||
|
height: min-content;
|
||||||
|
|
||||||
|
&.multi {
|
||||||
|
border: 2px solid grey;
|
||||||
|
padding: 2.4px 2.5px 0;
|
||||||
|
border-radius: 4px;
|
||||||
|
gap: 2px;
|
||||||
|
|
||||||
|
.selection-checkbox {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.selection-checkbox {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-group-label {
|
.checkbox-group-label {
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,13 @@
|
||||||
<button data-action="takeLongRest" title="{{localize "DAGGERHEART.Sheets.PC.LongRest"}}"><i class="fa-solid fa-bed"></i></button>
|
<button data-action="takeLongRest" title="{{localize "DAGGERHEART.Sheets.PC.LongRest"}}"><i class="fa-solid fa-bed"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-container {{#if document.system.canLevelUp}}levelup{{/if}}">
|
<div class="level-container {{#if document.system.levelData.canLevelUp}}levelup{{/if}}">
|
||||||
<div class="level-value-container">
|
<div class="level-value-container">
|
||||||
<input class="level-value {{#if document.system.levelData.canLevelUp}}levelup{{/if}}" name="system.levelData.level.changed" value="{{document.system.levelData.level.changed}}" type="text" data-dtype="Number" />
|
<input class="level-value {{#if document.system.levelData.canLevelUp}}levelup{{/if}}" value="{{document.system.levelData.level.changed}}" type="text" data-dtype="Number" />
|
||||||
{{#if document.system.levelData.canLevelUp}}<div class="levelup-marker">*</div>{{/if}}
|
{{#if document.system.levelData.canLevelUp}}<div class="levelup-marker">*</div>{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<img src="systems/daggerheart/assets/AttributeShield.svg" />
|
<img src="systems/daggerheart/assets/AttributeShield.svg" />
|
||||||
<div class="level-title {{#if document.system.canLevelUp}}levelup{{/if}}">{{localize "DAGGERHEART.Sheets.PC.Level"}}</div>
|
<div class="level-title {{#if document.system.levelData.canLevelUp}}levelup{{/if}}">{{localize "DAGGERHEART.Sheets.PC.Level"}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,19 @@
|
||||||
{{#each tier.tierCheckboxGroups}}
|
{{#each tier.tierCheckboxGroups}}
|
||||||
<div class="checkbox-group-container">
|
<div class="checkbox-group-container">
|
||||||
<div class="checkboxes-container">
|
<div class="checkboxes-container">
|
||||||
{{#each this.checkboxes}}
|
{{#each this.checkboxGroups}}
|
||||||
<input type="checkbox" class="selection-checkbox" data-tier="{{this.tier}}" data-level="{{this.level}}" data-option="{{this.optionKey}}" data-checkbox-nr="{{this.checkboxNr}}" {{checked this.selected}} />
|
<div class="checkbox-grouping-coontainer {{#if this.multi}}multi{{/if}}">
|
||||||
|
{{#each this.checkboxes}}
|
||||||
|
<input
|
||||||
|
type="checkbox" class="selection-checkbox{{#if (gt this.cost 1)}} multi{{/if}}" {{checked this.selected}} {{#if this.disabled}}disabled{{/if}}
|
||||||
|
data-tier="{{this.tier}}"
|
||||||
|
data-level="{{this.level}}"
|
||||||
|
data-option="{{this.optionKey}}"
|
||||||
|
data-checkbox-nr="{{this.checkboxNr}}"
|
||||||
|
data-cost="{{this.cost}}"
|
||||||
|
/>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox-group-label">{{this.label}}</div>
|
<div class="checkbox-group-label">{{this.label}}</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue