mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Feature] Compedium Browser (#707)
* Create files * Item Browser v0.5 * dialog with (temporary) * Css * initial style in compedium browser * config * fixes * Replace compendium calls * Level Up * style compedium item list * removing css files --------- Co-authored-by: Dapoolp <elcatnet@gmail.com> Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
a19c77ae4a
commit
a25007b994
34 changed files with 1650 additions and 123 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { abilities, subclassFeatureLabels } from '../../config/actorConfig.mjs';
|
||||
import { getDeleteKeys, tagifyElement } from '../../helpers/utils.mjs';
|
||||
import { ItemBrowser } from '../ui/itemBrowser.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
|
|
@ -11,6 +12,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
this._dragDrop = this._createDragDropHandlers();
|
||||
this.tabGroups.primary = 'advancements';
|
||||
|
||||
this.itemBrowser = null;
|
||||
}
|
||||
|
||||
get title() {
|
||||
|
|
@ -533,8 +536,30 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
this.render();
|
||||
}
|
||||
|
||||
static async viewCompendium(_, button) {
|
||||
(await game.packs.get(`daggerheart.${button.dataset.compendium}`))?.render(true);
|
||||
static async viewCompendium(event, target) {
|
||||
const type = target.dataset.compendium ?? target.dataset.type;
|
||||
|
||||
const presets = {
|
||||
compendium: 'daggerheart',
|
||||
folder: type,
|
||||
render: {
|
||||
noFolder: true
|
||||
}
|
||||
};
|
||||
|
||||
if (type == 'domains') {
|
||||
const domains = this.actor.system.domains,
|
||||
multiclassDomain = this.levelup.classUpgradeChoices?.multiclass?.domain;
|
||||
if (multiclassDomain) {
|
||||
if (!domains.includes(x => x === multiclassDomain)) domains.push(multiclassDomain);
|
||||
}
|
||||
presets.filter = {
|
||||
'level.max': { key: 'level.max', value: this.levelup.currentLevel },
|
||||
'system.domain': { key: 'system.domain', value: domains }
|
||||
};
|
||||
}
|
||||
|
||||
return (this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true }));
|
||||
}
|
||||
|
||||
static async selectPreview(_, button) {
|
||||
|
|
@ -635,6 +660,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
}, {});
|
||||
|
||||
await this.actor.levelUp(levelupData);
|
||||
if (this.itemBrowser) this.itemBrowser.close();
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue