mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
[Fix] 691 - CharacterCreation Improvement (#863)
* Removed main creation tab. Added equipment to remaining tab * Fixed MixedAncestry name setting * Fixed tab after first creation
This commit is contained in:
parent
7755179434
commit
e90355b08b
15 changed files with 141 additions and 263 deletions
|
|
@ -233,13 +233,14 @@
|
||||||
},
|
},
|
||||||
"APPLICATIONS": {
|
"APPLICATIONS": {
|
||||||
"CharacterCreation": {
|
"CharacterCreation": {
|
||||||
"setupTabs": {
|
"tabs": {
|
||||||
"ancestry": "Ancestry",
|
"ancestry": "Ancestry",
|
||||||
"community": "Community",
|
"community": "Community",
|
||||||
"class": "Class",
|
"class": "Class",
|
||||||
"experience": "Experience",
|
"experience": "Experience",
|
||||||
"traits": "Traits",
|
"traits": "Traits",
|
||||||
"domainCards": "Domain Cards"
|
"domainCards": "Domain Cards",
|
||||||
|
"equipment": "Equipment"
|
||||||
},
|
},
|
||||||
"ancestryNamePlaceholder": "Your ancestry's name",
|
"ancestryNamePlaceholder": "Your ancestry's name",
|
||||||
"buttonTitle": "Character Setup",
|
"buttonTitle": "Character Setup",
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
|
|
||||||
this.setup = {
|
this.setup = {
|
||||||
traits: this.character.system.traits,
|
traits: this.character.system.traits,
|
||||||
ancestryName: '',
|
ancestryName: {
|
||||||
|
primary: '',
|
||||||
|
secondary: ''
|
||||||
|
},
|
||||||
mixedAncestry: false,
|
mixedAncestry: false,
|
||||||
primaryAncestry: this.character.system.ancestry ?? {},
|
primaryAncestry: this.character.system.ancestry ?? {},
|
||||||
secondaryAncestry: {},
|
secondaryAncestry: {},
|
||||||
|
|
@ -83,131 +86,70 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
|
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
tabs: { template: 'systems/daggerheart/templates/characterCreation/tabs.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/characterCreation/tabs.hbs' },
|
||||||
setup: { template: 'systems/daggerheart/templates/characterCreation/tabs/setup.hbs' },
|
ancestry: { template: 'systems/daggerheart/templates/characterCreation/tabs/ancestry.hbs' },
|
||||||
ancestry: { template: 'systems/daggerheart/templates/characterCreation/setupTabs/ancestry.hbs' },
|
community: { template: 'systems/daggerheart/templates/characterCreation/tabs/community.hbs' },
|
||||||
community: { template: 'systems/daggerheart/templates/characterCreation/setupTabs/community.hbs' },
|
class: { template: 'systems/daggerheart/templates/characterCreation/tabs/class.hbs' },
|
||||||
class: { template: 'systems/daggerheart/templates/characterCreation/setupTabs/class.hbs' },
|
traits: { template: 'systems/daggerheart/templates/characterCreation/tabs/traits.hbs' },
|
||||||
traits: { template: 'systems/daggerheart/templates/characterCreation/setupTabs/traits.hbs' },
|
experience: { template: 'systems/daggerheart/templates/characterCreation/tabs/experience.hbs' },
|
||||||
experience: { template: 'systems/daggerheart/templates/characterCreation/setupTabs/experience.hbs' },
|
domainCards: { template: 'systems/daggerheart/templates/characterCreation/tabs/domainCards.hbs' },
|
||||||
domainCards: { template: 'systems/daggerheart/templates/characterCreation/setupTabs/domainCards.hbs' },
|
equipment: { template: 'systems/daggerheart/templates/characterCreation/equipment.hbs' },
|
||||||
equipment: { template: 'systems/daggerheart/templates/characterCreation/tabs/equipment.hbs' },
|
// story: { template: 'systems/daggerheart/templates/characterCreation/story.hbs' },
|
||||||
// story: { template: 'systems/daggerheart/templates/characterCreation/tabs/story.hbs' },
|
|
||||||
footer: { template: 'systems/daggerheart/templates/characterCreation/footer.hbs' }
|
footer: { template: 'systems/daggerheart/templates/characterCreation/footer.hbs' }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TABS = {
|
static TABS = {
|
||||||
setup: {
|
|
||||||
active: true,
|
|
||||||
cssClass: '',
|
|
||||||
group: 'primary',
|
|
||||||
id: 'setup',
|
|
||||||
label: 'DAGGERHEART.GENERAL.Tabs.setup'
|
|
||||||
},
|
|
||||||
equipment: {
|
|
||||||
active: false,
|
|
||||||
cssClass: '',
|
|
||||||
group: 'primary',
|
|
||||||
id: 'equipment',
|
|
||||||
label: 'DAGGERHEART.GENERAL.Tabs.equipment',
|
|
||||||
optional: true
|
|
||||||
}
|
|
||||||
// story: {
|
|
||||||
// active: false,
|
|
||||||
// cssClass: '',
|
|
||||||
// group: 'primary',
|
|
||||||
// id: 'story',
|
|
||||||
// label: 'DAGGERHEART.GENERAL.Tabs.story',
|
|
||||||
// optional: true
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
static SETUPTABS = {
|
|
||||||
ancestry: {
|
ancestry: {
|
||||||
active: true,
|
active: true,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
group: 'setup',
|
group: 'setup',
|
||||||
id: 'ancestry',
|
id: 'ancestry',
|
||||||
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.setupTabs.ancestry'
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.ancestry'
|
||||||
},
|
},
|
||||||
community: {
|
community: {
|
||||||
active: false,
|
active: false,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
group: 'setup',
|
group: 'setup',
|
||||||
id: 'community',
|
id: 'community',
|
||||||
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.setupTabs.community'
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.community'
|
||||||
},
|
},
|
||||||
class: {
|
class: {
|
||||||
active: false,
|
active: false,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
group: 'setup',
|
group: 'setup',
|
||||||
id: 'class',
|
id: 'class',
|
||||||
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.setupTabs.class'
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.class'
|
||||||
},
|
},
|
||||||
traits: {
|
traits: {
|
||||||
active: false,
|
active: false,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
group: 'setup',
|
group: 'setup',
|
||||||
id: 'traits',
|
id: 'traits',
|
||||||
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.setupTabs.traits'
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.traits'
|
||||||
},
|
},
|
||||||
experience: {
|
experience: {
|
||||||
active: false,
|
active: false,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
group: 'setup',
|
group: 'setup',
|
||||||
id: 'experience',
|
id: 'experience',
|
||||||
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.setupTabs.experience'
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.experience'
|
||||||
},
|
},
|
||||||
domainCards: {
|
domainCards: {
|
||||||
active: false,
|
active: false,
|
||||||
cssClass: '',
|
cssClass: '',
|
||||||
group: 'setup',
|
group: 'setup',
|
||||||
id: 'domainCards',
|
id: 'domainCards',
|
||||||
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.setupTabs.domainCards'
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.domainCards'
|
||||||
|
},
|
||||||
|
equipment: {
|
||||||
|
active: false,
|
||||||
|
cssClass: '',
|
||||||
|
group: 'setup',
|
||||||
|
id: 'equipment',
|
||||||
|
label: 'DAGGERHEART.APPLICATIONS.CharacterCreation.tabs.equipment'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_getTabs(tabs) {
|
_getTabs(tabs) {
|
||||||
for (const v of Object.values(tabs)) {
|
|
||||||
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
|
|
||||||
v.cssClass = v.active ? 'active' : '';
|
|
||||||
|
|
||||||
switch (v.id) {
|
|
||||||
case 'setup':
|
|
||||||
const ancestryFinished = this.setup.primaryAncestry.uuid;
|
|
||||||
const communityFinished = this.setup.community.uuid;
|
|
||||||
const classFinished = this.setup.class.uuid && this.setup.subclass.uuid;
|
|
||||||
const traitsFinished = Object.values(this.setup.traits).every(x => x.value !== null);
|
|
||||||
const experiencesFinished = Object.values(this.setup.experiences).every(x => x.name);
|
|
||||||
const domainCardsFinished = Object.values(this.setup.domainCards).every(x => x.uuid);
|
|
||||||
v.finished =
|
|
||||||
ancestryFinished &&
|
|
||||||
communityFinished &&
|
|
||||||
classFinished &&
|
|
||||||
traitsFinished &&
|
|
||||||
experiencesFinished &&
|
|
||||||
domainCardsFinished;
|
|
||||||
break;
|
|
||||||
case 'equipment':
|
|
||||||
const armorFinished = this.equipment.armor?.uuid;
|
|
||||||
const primaryFinished = this.equipment.primaryWeapon?.uuid;
|
|
||||||
const secondaryFinished =
|
|
||||||
this.equipment.secondaryWeapon?.uuid ||
|
|
||||||
(primaryFinished && this.equipment.primaryWeapon.system.burden == burden.twoHanded.value);
|
|
||||||
const choiceAFinished = this.equipment.inventory.choiceA?.uuid;
|
|
||||||
const choiceBFinished = this.equipment.inventory.choiceB?.uuid;
|
|
||||||
|
|
||||||
v.finished =
|
|
||||||
armorFinished && primaryFinished && secondaryFinished && choiceAFinished && choiceBFinished;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tabs.equipment.cssClass = tabs.setup.finished ? tabs.equipment.cssClass : 'disabled';
|
|
||||||
// tabs.story.cssClass = tabs.setup.finished ? tabs.story.cssClass : 'disabled';
|
|
||||||
|
|
||||||
return tabs;
|
|
||||||
}
|
|
||||||
|
|
||||||
_getSetupTabs(tabs) {
|
|
||||||
for (const v of Object.values(tabs)) {
|
for (const v of Object.values(tabs)) {
|
||||||
v.active = this.tabGroups[v.group]
|
v.active = this.tabGroups[v.group]
|
||||||
? this.tabGroups[v.group] === v.id
|
? this.tabGroups[v.group] === v.id
|
||||||
|
|
@ -232,37 +174,15 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
case 'domainCards':
|
case 'domainCards':
|
||||||
v.disabled = this.setup.visibility < 6;
|
v.disabled = this.setup.visibility < 6;
|
||||||
break;
|
break;
|
||||||
|
case 'equipment':
|
||||||
|
v.disabled = this.setup.visibility < 7;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTab(tab, group, options) {
|
|
||||||
super.changeTab(tab, group, options);
|
|
||||||
|
|
||||||
if (group === 'primary') {
|
|
||||||
for (var listTab of Object.keys(this.constructor.TABS)) {
|
|
||||||
const marker = options.navElement.querySelector(`a[data-action="tab"].${listTab} .finish-marker`);
|
|
||||||
if (listTab === tab) {
|
|
||||||
marker.classList.add('active');
|
|
||||||
} else {
|
|
||||||
marker.classList.remove('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tab === 'equipment') {
|
|
||||||
this.tabGroups.setup = null;
|
|
||||||
this.element.querySelector('section[data-group="setup"].active')?.classList?.remove?.('active');
|
|
||||||
} else {
|
|
||||||
this.tabGroups.setup = 'domainCards';
|
|
||||||
this.element
|
|
||||||
.querySelector('section[data-group="setup"][data-tab="domainCards"]')
|
|
||||||
?.classList?.add?.('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_attachPartListeners(partId, htmlElement, options) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
|
@ -274,14 +194,71 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async _preFirstRender(_context, _options) {
|
|
||||||
this.tabGroups.primary = 'setup';
|
|
||||||
this.tabGroups.setup = 'ancestry';
|
|
||||||
}
|
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
|
this.tabGroups.setup = this.tabGroups.setup ?? 'ancestry';
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
|
|
||||||
context.tabs = this._getTabs(this.constructor.TABS);
|
context.tabs = this._getTabs(this.constructor.TABS);
|
||||||
|
const availableTraitModifiers = game.settings
|
||||||
|
.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew)
|
||||||
|
.traitArray.map(trait => ({ key: trait, name: trait }));
|
||||||
|
for (let trait of Object.values(this.setup.traits).filter(x => x.value !== null)) {
|
||||||
|
const index = availableTraitModifiers.findIndex(x => x.key === trait.value);
|
||||||
|
if (index !== -1) {
|
||||||
|
availableTraitModifiers.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context.suggestedTraits = this.setup.class.system
|
||||||
|
? Object.keys(this.setup.class.system.characterGuide.suggestedTraits).map(traitKey => {
|
||||||
|
const trait = this.setup.class.system.characterGuide.suggestedTraits[traitKey];
|
||||||
|
return `${game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${traitKey}.short`)} ${trait > 0 ? `+${trait}` : trait}`;
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
context.traits = {
|
||||||
|
values: Object.keys(this.setup.traits).map(traitKey => {
|
||||||
|
const trait = this.setup.traits[traitKey];
|
||||||
|
const options = [...availableTraitModifiers];
|
||||||
|
if (trait.value !== null && !options.some(x => x.key === trait.value))
|
||||||
|
options.push({ key: trait.value, name: trait.value });
|
||||||
|
|
||||||
|
return {
|
||||||
|
...trait,
|
||||||
|
key: traitKey,
|
||||||
|
name: game.i18n.localize(abilities[traitKey].label),
|
||||||
|
options: options
|
||||||
|
};
|
||||||
|
})
|
||||||
|
};
|
||||||
|
context.traits.nrTotal = Object.keys(context.traits.values).length;
|
||||||
|
context.traits.nrSelected = this.getNrSelectedTrait();
|
||||||
|
|
||||||
|
context.experience = {
|
||||||
|
values: this.setup.experiences,
|
||||||
|
nrTotal: Object.keys(this.setup.experiences).length,
|
||||||
|
nrSelected: Object.values(this.setup.experiences).reduce((acc, exp) => acc + (exp.name ? 1 : 0), 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
context.mixedAncestry = Number(this.setup.mixedAncestry);
|
||||||
|
|
||||||
|
const { primary, secondary, overwrite } = this.setup.ancestryName;
|
||||||
|
context.ancestryName = overwrite ?? (primary && secondary ? `${primary}/${secondary}` : primary);
|
||||||
|
context.primaryAncestry = { ...this.setup.primaryAncestry, compendium: 'ancestries' };
|
||||||
|
context.secondaryAncestry = { ...this.setup.secondaryAncestry, compendium: 'ancestries' };
|
||||||
|
context.community = { ...this.setup.community, compendium: 'communities' };
|
||||||
|
context.class = { ...this.setup.class, compendium: 'classes' };
|
||||||
|
context.subclass = { ...this.setup.subclass, compendium: 'subclasses' };
|
||||||
|
|
||||||
|
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
|
||||||
|
context.classDomains = context.class.uuid
|
||||||
|
? context.class.system.domains.map(key => game.i18n.localize(allDomainData[key].label))
|
||||||
|
: [];
|
||||||
|
context.domainCards = Object.keys(this.setup.domainCards).reduce((acc, x) => {
|
||||||
|
acc[x] = { ...this.setup.domainCards[x], compendium: 'domains' };
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
context.visibility = this.setup.visibility;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +266,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
async _preparePartContext(partId, context) {
|
async _preparePartContext(partId, context) {
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
case 'footer':
|
case 'footer':
|
||||||
context.isLastTab = this.tabGroups.setup === 'domainCards' || this.tabGroups.primary !== 'setup';
|
context.isLastTab = this.tabGroups.setup === 'equipment';
|
||||||
switch (this.tabGroups.setup) {
|
switch (this.tabGroups.setup) {
|
||||||
case null:
|
case null:
|
||||||
case 'ancestry':
|
case 'ancestry':
|
||||||
|
|
@ -307,69 +284,11 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
case 'experience':
|
case 'experience':
|
||||||
context.nextDisabled = this.setup.visibility === 5;
|
context.nextDisabled = this.setup.visibility === 5;
|
||||||
break;
|
break;
|
||||||
|
case 'domainCards':
|
||||||
|
context.nextDisabled = this.setup.visibility === 6;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
case 'setup':
|
|
||||||
context.setupTabs = this._getSetupTabs(this.constructor.SETUPTABS);
|
|
||||||
const availableTraitModifiers = game.settings
|
|
||||||
.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew)
|
|
||||||
.traitArray.map(trait => ({ key: trait, name: trait }));
|
|
||||||
for (let trait of Object.values(this.setup.traits).filter(x => x.value !== null)) {
|
|
||||||
const index = availableTraitModifiers.findIndex(x => x.key === trait.value);
|
|
||||||
if (index !== -1) {
|
|
||||||
availableTraitModifiers.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.suggestedTraits = this.setup.class.system
|
|
||||||
? Object.keys(this.setup.class.system.characterGuide.suggestedTraits).map(traitKey => {
|
|
||||||
const trait = this.setup.class.system.characterGuide.suggestedTraits[traitKey];
|
|
||||||
return `${game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${traitKey}.short`)} ${trait > 0 ? `+${trait}` : trait}`;
|
|
||||||
})
|
|
||||||
: [];
|
|
||||||
context.traits = {
|
|
||||||
values: Object.keys(this.setup.traits).map(traitKey => {
|
|
||||||
const trait = this.setup.traits[traitKey];
|
|
||||||
const options = [...availableTraitModifiers];
|
|
||||||
if (trait.value !== null && !options.some(x => x.key === trait.value))
|
|
||||||
options.push({ key: trait.value, name: trait.value });
|
|
||||||
|
|
||||||
return {
|
|
||||||
...trait,
|
|
||||||
key: traitKey,
|
|
||||||
name: game.i18n.localize(abilities[traitKey].label),
|
|
||||||
options: options
|
|
||||||
};
|
|
||||||
})
|
|
||||||
};
|
|
||||||
context.traits.nrTotal = Object.keys(context.traits.values).length;
|
|
||||||
context.traits.nrSelected = this.getNrSelectedTrait();
|
|
||||||
|
|
||||||
context.experience = {
|
|
||||||
values: this.setup.experiences,
|
|
||||||
nrTotal: Object.keys(this.setup.experiences).length,
|
|
||||||
nrSelected: Object.values(this.setup.experiences).reduce((acc, exp) => acc + (exp.name ? 1 : 0), 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
context.mixedAncestry = Number(this.setup.mixedAncestry);
|
|
||||||
context.ancestryName = this.setup.ancestryName;
|
|
||||||
context.primaryAncestry = { ...this.setup.primaryAncestry, compendium: 'ancestries' };
|
|
||||||
context.secondaryAncestry = { ...this.setup.secondaryAncestry, compendium: 'ancestries' };
|
|
||||||
context.community = { ...this.setup.community, compendium: 'communities' };
|
|
||||||
context.class = { ...this.setup.class, compendium: 'classes' };
|
|
||||||
context.subclass = { ...this.setup.subclass, compendium: 'subclasses' };
|
|
||||||
|
|
||||||
const allDomainData = CONFIG.DH.DOMAIN.allDomains();
|
|
||||||
context.classDomains = context.class.uuid
|
|
||||||
? context.class.system.domains.map(key => game.i18n.localize(allDomainData[key].label))
|
|
||||||
: [];
|
|
||||||
context.domainCards = Object.keys(this.setup.domainCards).reduce((acc, x) => {
|
|
||||||
acc[x] = { ...this.setup.domainCards[x], compendium: 'domains' };
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
context.visibility = this.setup.visibility;
|
|
||||||
break;
|
break;
|
||||||
case 'equipment':
|
case 'equipment':
|
||||||
const suggestions = await this.getEquipmentSuggestions(
|
const suggestions = await this.getEquipmentSuggestions(
|
||||||
|
|
@ -438,8 +357,10 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
|
|
||||||
getUpdateVisibility() {
|
getUpdateVisibility() {
|
||||||
switch (this.setup.visibility) {
|
switch (this.setup.visibility) {
|
||||||
|
case 7:
|
||||||
|
return 7;
|
||||||
case 6:
|
case 6:
|
||||||
return 6;
|
return Object.values(this.setup.domainCards).every(x => x.uuid) ? 7 : 6;
|
||||||
case 5:
|
case 5:
|
||||||
return Object.values(this.setup.experiences).every(x => x.name) ? 6 : 5;
|
return Object.values(this.setup.experiences).every(x => x.name) ? 6 : 5;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
@ -505,7 +426,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
|
|
||||||
const presets = {
|
const presets = {
|
||||||
compendium: 'daggerheart',
|
compendium: 'daggerheart',
|
||||||
folder: equipment.includes(type) ? "equipments" : type,
|
folder: equipment.includes(type) ? 'equipments' : type,
|
||||||
render: {
|
render: {
|
||||||
noFolder: true
|
noFolder: true
|
||||||
}
|
}
|
||||||
|
|
@ -565,6 +486,9 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
case 6:
|
case 6:
|
||||||
this.tabGroups.setup = 'domainCards';
|
this.tabGroups.setup = 'domainCards';
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
this.tabGroups.setup = 'equipment';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
|
|
@ -576,9 +500,10 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
? this.setup.secondaryAncestry.system.secondaryFeature
|
? this.setup.secondaryAncestry.system.secondaryFeature
|
||||||
: this.setup.primaryAncestry.system.secondaryFeature;
|
: this.setup.primaryAncestry.system.secondaryFeature;
|
||||||
|
|
||||||
|
const { primary, secondary, overwrite } = this.setup.ancestryName;
|
||||||
const ancestry = {
|
const ancestry = {
|
||||||
...this.setup.primaryAncestry,
|
...this.setup.primaryAncestry,
|
||||||
name: this.setup.ancestryName ?? this.setup.primaryAncestry.name,
|
name: overwrite ?? (primary && secondary ? `${primary}/${secondary}` : primary),
|
||||||
system: {
|
system: {
|
||||||
...this.setup.primaryAncestry.system,
|
...this.setup.primaryAncestry.system,
|
||||||
features: [
|
features: [
|
||||||
|
|
@ -650,13 +575,14 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
const item = await foundry.utils.fromUuid(data.uuid);
|
const item = await foundry.utils.fromUuid(data.uuid);
|
||||||
if (item.type === 'ancestry' && event.target.closest('.primary-ancestry-card')) {
|
if (item.type === 'ancestry' && event.target.closest('.primary-ancestry-card')) {
|
||||||
this.setup.ancestryName = item.name;
|
this.setup.ancestryName.primary = item.name;
|
||||||
this.setup.primaryAncestry = {
|
this.setup.primaryAncestry = {
|
||||||
...item,
|
...item,
|
||||||
effects: Array.from(item.effects).map(x => x.toObject()),
|
effects: Array.from(item.effects).map(x => x.toObject()),
|
||||||
uuid: item.uuid
|
uuid: item.uuid
|
||||||
};
|
};
|
||||||
} else if (item.type === 'ancestry' && event.target.closest('.secondary-ancestry-card')) {
|
} else if (item.type === 'ancestry' && event.target.closest('.secondary-ancestry-card')) {
|
||||||
|
this.setup.ancestryName.secondary = item.name;
|
||||||
this.setup.secondaryAncestry = {
|
this.setup.secondaryAncestry = {
|
||||||
...item,
|
...item,
|
||||||
effects: Array.from(item.effects).map(x => x.toObject()),
|
effects: Array.from(item.effects).map(x => x.toObject()),
|
||||||
|
|
|
||||||
|
|
@ -3,59 +3,16 @@
|
||||||
.daggerheart.dh-style.dialog.character-creation {
|
.daggerheart.dh-style.dialog.character-creation {
|
||||||
.tab-navigation {
|
.tab-navigation {
|
||||||
nav {
|
nav {
|
||||||
flex: 1;
|
border-bottom: 0;
|
||||||
|
border-top: 0;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
flex: 1;
|
font-family: @font-body;
|
||||||
text-align: center;
|
color: light-dark(@dark-blue, @golden);
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&.disabled {
|
&[disabled] {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-section-text {
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.finish-marker {
|
|
||||||
position: absolute;
|
|
||||||
align-self: center;
|
|
||||||
top: -8px;
|
|
||||||
padding: 4px;
|
|
||||||
border: 1px solid;
|
|
||||||
border-radius: 50%;
|
|
||||||
height: 16px;
|
|
||||||
width: 16px;
|
|
||||||
font-size: 12px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: var(--color-cool-4);
|
|
||||||
content: '';
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: var(--color-warm-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.descriptor {
|
|
||||||
position: absolute;
|
|
||||||
bottom: -8px;
|
|
||||||
font-size: 12px;
|
|
||||||
border-radius: 8px;
|
|
||||||
width: 56px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 1;
|
|
||||||
border: 1px solid light-dark(@dark-blue, @golden);
|
|
||||||
border-radius: 6px;
|
|
||||||
color: light-dark(@beige, @dark);
|
|
||||||
background-image: url(../assets/parchments/dh-parchment-light.png);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section class="creation-action-footer">
|
<section class="creation-action-footer">
|
||||||
<button data-action="close">{{localize "Cancel"}}</button>
|
<button data-action="close">{{localize "Cancel"}}</button>
|
||||||
{{#if isLastTab}}
|
{{#if isLastTab}}
|
||||||
<button data-action="finish" {{disabled (not tabs.setup.finished)}}>{{localize "DAGGERHEART.APPLICATIONS.CharacterCreation.finishCreation"}}</button>
|
<button data-action="finish">{{localize "DAGGERHEART.APPLICATIONS.CharacterCreation.finishCreation"}}</button>
|
||||||
{{else}}
|
{{else}}
|
||||||
<button data-action="setupGoNext" {{disabled nextDisabled}}>{{localize "Next"}}</button>
|
<button data-action="setupGoNext" {{disabled nextDisabled}}>{{localize "Next"}}</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
7
templates/characterCreation/setup.hbs
Normal file
7
templates/characterCreation/setup.hbs
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<nav class='feature-tab sheet-tabs tabs setup-tabs' data-group='setup'>
|
||||||
|
{{#each tabs as |tab|}}
|
||||||
|
<button class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}' {{disabled tab.disabled}}>
|
||||||
|
{{localize tab.label}}
|
||||||
|
</button>
|
||||||
|
{{/each}}
|
||||||
|
</nav>
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<line-div></line-div>
|
<line-div></line-div>
|
||||||
<nav class='feature-tab sheet-tabs tabs' data-group='primary'>
|
<nav class='feature-tab sheet-tabs tabs' data-group='primary'>
|
||||||
{{#each tabs as |tab|}}
|
{{#each tabs as |tab|}}
|
||||||
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}'>
|
<a class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}' {{disabled tab.disabled}}>
|
||||||
{{localize tab.label}}
|
{{localize tab.label}}
|
||||||
<div class="finish-marker {{#if (eq tab.cssClass 'active')}}active{{/if}}">{{#if tab.finished}}<i class="fa-solid fa-check"></i>{{/if}}</div>
|
<div class="finish-marker {{#if (eq tab.cssClass 'active')}}active{{/if}}">{{#if tab.finished}}<i class="fa-solid fa-check"></i>{{/if}}</div>
|
||||||
{{#if tab.optional}}<div class="descriptor">{{localize "DAGGERHEART.GENERAL.Tabs.optional"}}</div>{{/if}}
|
{{#if tab.optional}}<div class="descriptor">{{localize "DAGGERHEART.GENERAL.Tabs.optional"}}</div>{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
<section
|
<section
|
||||||
class='tab {{setupTabs.ancestry.cssClass}} {{setupTabs.ancestry.id}}'
|
class='tab {{tabs.ancestry.cssClass}} {{tabs.ancestry.id}}'
|
||||||
data-tab='{{setupTabs.ancestry.id}}'
|
data-tab='{{tabs.ancestry.id}}'
|
||||||
data-group='{{setupTabs.ancestry.group}}'
|
data-group='{{tabs.ancestry.group}}'
|
||||||
>
|
>
|
||||||
<div class="main-selections-container">
|
<div class="main-selections-container">
|
||||||
<fieldset class="section-container">
|
<fieldset class="section-container">
|
||||||
<legend>{{localize "TYPES.Item.ancestry"}}</legend>
|
<legend>{{localize "TYPES.Item.ancestry"}}</legend>
|
||||||
|
|
||||||
<div class="ancestry-name">
|
<div class="ancestry-name">
|
||||||
<input type="text" name="ancestryName" value="{{ancestryName}}" placeholder="{{localize "DAGGERHEART.APPLICATIONS.CharacterCreation.ancestryNamePlaceholder"}}" {{disabled (not primaryAncestry.uuid)}} />
|
<input type="text" name="ancestryName.overwrite" value="{{ancestryName}}" placeholder="{{localize "DAGGERHEART.APPLICATIONS.CharacterCreation.ancestryNamePlaceholder"}}" {{disabled (not primaryAncestry.uuid)}} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ancestry-mixed-controller {{#if mixedAncestry}}active{{/if}}">
|
<div class="ancestry-mixed-controller {{#if mixedAncestry}}active{{/if}}">
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section
|
<section
|
||||||
class='tab {{setupTabs.class.cssClass}} {{setupTabs.class.id}}'
|
class='tab {{tabs.class.cssClass}} {{tabs.class.id}}'
|
||||||
data-tab='{{setupTabs.class.id}}'
|
data-tab='{{tabs.class.id}}'
|
||||||
data-group='{{setupTabs.class.group}}'
|
data-group='{{tabs.class.group}}'
|
||||||
>
|
>
|
||||||
<div class="main-selections-container">
|
<div class="main-selections-container">
|
||||||
<fieldset class="section-container">
|
<fieldset class="section-container">
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section
|
<section
|
||||||
class='tab {{setupTabs.community.cssClass}} {{setupTabs.community.id}}'
|
class='tab {{tabs.community.cssClass}} {{tabs.community.id}}'
|
||||||
data-tab='{{setupTabs.community.id}}'
|
data-tab='{{tabs.community.id}}'
|
||||||
data-group='{{setupTabs.community.group}}'
|
data-group='{{tabs.community.group}}'
|
||||||
>
|
>
|
||||||
<div class="main-selections-container">
|
<div class="main-selections-container">
|
||||||
<fieldset class="section-container">
|
<fieldset class="section-container">
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section
|
<section
|
||||||
class='tab {{setupTabs.domainCards.cssClass}} {{setupTabs.domainCards.id}}'
|
class='tab {{tabs.domainCards.cssClass}} {{tabs.domainCards.id}}'
|
||||||
data-tab='{{setupTabs.domainCards.id}}'
|
data-tab='{{tabs.domainCards.id}}'
|
||||||
data-group='{{setupTabs.domainCards.group}}'
|
data-group='{{tabs.domainCards.group}}'
|
||||||
>
|
>
|
||||||
<div class="main-selections-container">
|
<div class="main-selections-container">
|
||||||
<fieldset class="section-container">
|
<fieldset class="section-container">
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section
|
<section
|
||||||
class='tab {{setupTabs.experience.cssClass}} {{setupTabs.experience.id}}'
|
class='tab {{tabs.experience.cssClass}} {{tabs.experience.id}}'
|
||||||
data-tab='{{setupTabs.experience.id}}'
|
data-tab='{{tabs.experience.id}}'
|
||||||
data-group='{{setupTabs.experience.group}}'
|
data-group='{{tabs.experience.group}}'
|
||||||
>
|
>
|
||||||
<div class="main-selections-container">
|
<div class="main-selections-container">
|
||||||
<fieldset class="section-container">
|
<fieldset class="section-container">
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<section
|
|
||||||
class='tab {{tabs.setup.cssClass}} {{tabs.setup.id}}'
|
|
||||||
data-tab='{{tabs.setup.id}}'
|
|
||||||
data-group='{{tabs.setup.group}}'
|
|
||||||
>
|
|
||||||
<nav class='feature-tab sheet-tabs tabs setup-tabs' data-group='setup'>
|
|
||||||
{{#each setupTabs as |tab|}}
|
|
||||||
<button class='{{tab.id}} {{tab.cssClass}}' data-action='tab' data-group='{{tab.group}}' data-tab='{{tab.id}}' {{disabled tab.disabled}}>
|
|
||||||
{{localize tab.label}}
|
|
||||||
</button>
|
|
||||||
{{/each}}
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section
|
<section
|
||||||
class='tab {{setupTabs.traits.cssClass}} {{setupTabs.traits.id}}'
|
class='tab {{tabs.traits.cssClass}} {{tabs.traits.id}}'
|
||||||
data-tab='{{setupTabs.traits.id}}'
|
data-tab='{{tabs.traits.id}}'
|
||||||
data-group='{{setupTabs.traits.group}}'
|
data-group='{{tabs.traits.group}}'
|
||||||
>
|
>
|
||||||
<div class="main-selections-container">
|
<div class="main-selections-container">
|
||||||
<fieldset class="section-container">
|
<fieldset class="section-container">
|
||||||
Loading…
Add table
Add a link
Reference in a new issue