[Feature] 942 - Limited Sheet Views (#1090)

* Added stumps for all limited actor views

* Added description to adversary and environment

* style limited sheets

* Limited views are no longer resizable

* .

* Update styles/less/sheets/actors/actor-sheet-shared.less

Co-authored-by: Nikhil Nagarajan <potter.nikhil@gmail.com>

---------

Co-authored-by: moliloo <dev.murilobrito@gmail.com>
Co-authored-by: Nikhil Nagarajan <potter.nikhil@gmail.com>
This commit is contained in:
WBHarry 2025-11-07 15:04:34 +01:00 committed by GitHub
parent ce3e2a804c
commit ba84a75bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 479 additions and 12 deletions

View file

@ -25,6 +25,10 @@ export default class AdversarySheet extends DHBaseActorSheet {
};
static PARTS = {
limited: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/limited.hbs',
scrollable: ['.limited-container']
},
sidebar: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs',
scrollable: ['.shortcut-items-section']
@ -52,6 +56,18 @@ export default class AdversarySheet extends DHBaseActorSheet {
}
};
/** @inheritdoc */
_initializeApplicationOptions(options) {
const applicationOptions = super._initializeApplicationOptions(options);
if (applicationOptions.document.testUserPermission(game.user, 'LIMITED', { exact: true })) {
applicationOptions.position.width = 360;
applicationOptions.position.height = 'auto';
}
return applicationOptions;
}
/**@inheritdoc */
async _prepareContext(options) {
const context = await super._prepareContext(options);
@ -65,6 +81,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
context = await super._preparePartContext(partId, context, options);
switch (partId) {
case 'header':
case 'limited':
await this._prepareHeaderContext(context, options);
const adversaryTypes = CONFIG.DH.ACTOR.allAdversaryTypes();

View file

@ -76,6 +76,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
/**@override */
static PARTS = {
limited: {
id: 'limited',
scrollable: ['.limited-container'],
template: 'systems/daggerheart/templates/sheets/actors/character/limited.hbs'
},
sidebar: {
id: 'sidebar',
scrollable: ['.shortcut-items-section'],
@ -141,23 +146,37 @@ export default class CharacterSheet extends DHBaseActorSheet {
});
}
/** @inheritdoc */
_initializeApplicationOptions(options) {
const applicationOptions = super._initializeApplicationOptions(options);
if (applicationOptions.document.testUserPermission(game.user, 'LIMITED', { exact: true })) {
applicationOptions.position.width = 360;
applicationOptions.position.height = 'auto';
}
return applicationOptions;
}
/** @inheritDoc */
async _onRender(context, options) {
await super._onRender(context, options);
this.element
.querySelector('.level-value')
?.addEventListener('change', event => this.document.updateLevel(Number(event.currentTarget.value)));
if (!this.document.testUserPermission(game.user, 'LIMITED', { exact: true })) {
this.element
.querySelector('.level-value')
?.addEventListener('change', event => this.document.updateLevel(Number(event.currentTarget.value)));
const observer = this.document.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER, {
exact: true
});
if (observer) {
this.element.querySelector('.window-content').classList.add('viewMode');
const observer = this.document.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER, {
exact: true
});
if (observer) {
this.element.querySelector('.window-content').classList.add('viewMode');
}
this._createFilterMenus();
this._createSearchFilter();
}
this._createFilterMenus();
this._createSearchFilter();
}
/* -------------------------------------------- */

View file

@ -14,6 +14,10 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
};
static PARTS = {
limited: {
template: 'systems/daggerheart/templates/sheets/actors/companion/limited.hbs',
scrollable: ['.limited-container']
},
header: { template: 'systems/daggerheart/templates/sheets/actors/companion/header.hbs' },
details: { template: 'systems/daggerheart/templates/sheets/actors/companion/details.hbs' },
effects: {

View file

@ -26,6 +26,10 @@ export default class DhpEnvironment extends DHBaseActorSheet {
/**@override */
static PARTS = {
limited: {
template: 'systems/daggerheart/templates/sheets/actors/environment/limited.hbs',
scrollable: ['.limited-container']
},
header: { template: 'systems/daggerheart/templates/sheets/actors/environment/header.hbs' },
features: {
template: 'systems/daggerheart/templates/sheets/actors/environment/features.hbs',
@ -47,6 +51,18 @@ export default class DhpEnvironment extends DHBaseActorSheet {
}
};
/** @inheritdoc */
_initializeApplicationOptions(options) {
const applicationOptions = super._initializeApplicationOptions(options);
if (applicationOptions.document.testUserPermission(game.user, 'LIMITED', { exact: true })) {
applicationOptions.position.width = 360;
applicationOptions.position.height = 'auto';
}
return applicationOptions;
}
/**@inheritdoc */
async _preparePartContext(partId, context, options) {
context = await super._preparePartContext(partId, context, options);