mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Added confirmation on ignoring character setup. Added reset option to character sheet.
This commit is contained in:
parent
5b61340fee
commit
96c421cc6a
2 changed files with 50 additions and 1 deletions
|
|
@ -237,10 +237,13 @@
|
|||
"confirmText": "Would you like to level up your companion {name} by {levelChange} levels at this time? (You can do it manually later)"
|
||||
},
|
||||
"viewLevelups": "View Levelups",
|
||||
"resetCharacter": "Reset Character",
|
||||
"viewParty": "View Party",
|
||||
"InvalidOldCharacterImportTitle": "Old Character Import",
|
||||
"InvalidOldCharacterImportText": "Character data exported prior to system version 1.1 will not generate a complete character. Do you wish to continue?",
|
||||
"cancelBeastform": "Cancel Beastform"
|
||||
"cancelBeastform": "Cancel Beastform",
|
||||
"resetCharacterConfirmationTitle": "Reset Character",
|
||||
"resetCharacterConfirmationContent": "You are reseting all character data except name and portrait. Are you sure?"
|
||||
},
|
||||
"Companion": {
|
||||
"FIELDS": {
|
||||
|
|
@ -314,6 +317,8 @@
|
|||
"selectPrimaryWeapon": "Select Primary Weapon",
|
||||
"selectSecondaryWeapon": "Select Secondary Weapon",
|
||||
"selectSubclass": "Select Subclass",
|
||||
"setupSkipTitle": "Skipping Character Setup",
|
||||
"setupSkipContent": "You are skipping the Character Setup by adding this manually. The character setup is the blinking arrows in the top-right. Are you sure you want to continue?",
|
||||
"startingItems": "Starting Items",
|
||||
"story": "Story",
|
||||
"storyExplanation": "Select which background and connection prompts you want to copy into your character's background.",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
makeDeathMove: CharacterSheet.#makeDeathMove,
|
||||
levelManagement: CharacterSheet.#levelManagement,
|
||||
viewLevelups: CharacterSheet.#viewLevelups,
|
||||
resetCharacter: CharacterSheet.#resetCharacter,
|
||||
toggleEquipItem: CharacterSheet.#toggleEquipItem,
|
||||
toggleResourceDice: CharacterSheet.#toggleResourceDice,
|
||||
handleResourceDice: CharacterSheet.#handleResourceDice,
|
||||
|
|
@ -42,6 +43,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
icon: 'fa-solid fa-angles-up',
|
||||
label: 'DAGGERHEART.ACTORS.Character.viewLevelups',
|
||||
action: 'viewLevelups'
|
||||
},
|
||||
{
|
||||
icon: 'fa-solid fa-arrow-rotate-left',
|
||||
label: 'DAGGERHEART.ACTORS.Character.resetCharacter',
|
||||
action: 'resetCharacter'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -666,6 +672,32 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
new LevelupViewMode(this.document).render({ force: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the character data and removes all embedded documents.
|
||||
*/
|
||||
static async #resetCharacter() {
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.localize('DAGGERHEART.ACTORS.Character.resetCharacterConfirmationTitle')
|
||||
},
|
||||
content: game.i18n.localize('DAGGERHEART.ACTORS.Character.resetCharacterConfirmationContent')
|
||||
});
|
||||
|
||||
if (!confirmed) return;
|
||||
|
||||
await this.document.update({
|
||||
'==system': {}
|
||||
});
|
||||
await this.document.deleteEmbeddedDocuments(
|
||||
'Item',
|
||||
this.document.items.map(x => x.id)
|
||||
);
|
||||
await this.document.deleteEmbeddedDocuments(
|
||||
'ActiveEffect',
|
||||
this.document.effects.map(x => x.id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Death Move interface for the character.
|
||||
* @type {ApplicationClickAction}
|
||||
|
|
@ -956,6 +988,18 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
}
|
||||
|
||||
async _onDropItem(event, item) {
|
||||
const setupCriticalItemTypes = ['class', 'subclass', 'ancestry', 'community'];
|
||||
if (this.document.system.needsCharacterSetup && setupCriticalItemTypes.includes(item.type)) {
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.localize('DAGGERHEART.APPLICATIONS.CharacterCreation.setupSkipTitle')
|
||||
},
|
||||
content: game.i18n.localize('DAGGERHEART.APPLICATIONS.CharacterCreation.setupSkipContent')
|
||||
});
|
||||
|
||||
if (!confirmed) return;
|
||||
}
|
||||
|
||||
if (this.document.uuid === item.parent?.uuid) {
|
||||
return super._onDropItem(event, item);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue