mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 12:11:07 +01:00
Added stumps for all limited actor views
This commit is contained in:
parent
990c73987e
commit
cc3ebca075
11 changed files with 123 additions and 12 deletions
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -78,6 +78,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'],
|
||||
|
|
@ -146,19 +151,21 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
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();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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 +47,12 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
return (this.#settingSheet ??= SheetClass ? new SheetClass({ document: this.document }) : null);
|
||||
}
|
||||
|
||||
get isVisible() {
|
||||
const viewPermission = this.document.testUserPermission(game.user, this.options.viewPermission);
|
||||
const limitedOnly = this.document.testUserPermission(game.user, this.options.viewPermission, { exact: true });
|
||||
return limitedOnly ? this.document.system.metadata.hasLimitedView : viewPermission;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Prepare Context */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -72,6 +78,31 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
return context;
|
||||
}
|
||||
|
||||
_configureRenderParts(options) {
|
||||
const parts = super._configureRenderParts(options);
|
||||
if (!this.document.system.metadata.hasLimitedView) return parts;
|
||||
|
||||
if (this.document.testUserPermission(game.user, 'LIMITED', { exact: true })) return { limited: parts.limited };
|
||||
|
||||
return Object.keys(parts).reduce((acc, key) => {
|
||||
if (key !== 'limited') acc[key] = parts[key];
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
async _onRender(context, options) {
|
||||
await super._onRender(context, options);
|
||||
|
||||
if (
|
||||
this.document.system.metadata.hasLimitedView &&
|
||||
this.document.testUserPermission(game.user, 'LIMITED', { exact: true })
|
||||
) {
|
||||
this.element.classList = `${this.element.classList} limited`;
|
||||
}
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
isNPC: true,
|
||||
settingSheet: null,
|
||||
hasResistances: true,
|
||||
hasAttribution: false
|
||||
hasAttribution: false,
|
||||
hasLimitedView: true
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,40 @@
|
|||
font-family: @font-body;
|
||||
color: light-dark(@chat-blue-bg, @beige-50);
|
||||
}
|
||||
|
||||
&.limited {
|
||||
&.character,
|
||||
&.adversary,
|
||||
&.environment,
|
||||
&.companion {
|
||||
width: 360px !important;
|
||||
|
||||
.window-content {
|
||||
display: unset;
|
||||
}
|
||||
|
||||
.limited-container {
|
||||
width: 100%;
|
||||
padding-top: var(--header-height);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
|
||||
header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.profile {
|
||||
width: 275px;
|
||||
}
|
||||
|
||||
.title-name {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6
templates/sheets/actors/adversary/limited.hbs
Normal file
6
templates/sheets/actors/adversary/limited.hbs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<div class="limited-container">
|
||||
<header>
|
||||
<img class="profile" src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<h2 class="title-name">{{document.name}}</h2>
|
||||
</header>
|
||||
</div>
|
||||
6
templates/sheets/actors/character/limited.hbs
Normal file
6
templates/sheets/actors/character/limited.hbs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<div class="limited-container">
|
||||
<header>
|
||||
<img class="profile" src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<h2 class="title-name">{{document.name}}</h2>
|
||||
</header>
|
||||
</div>
|
||||
6
templates/sheets/actors/companion/limited.hbs
Normal file
6
templates/sheets/actors/companion/limited.hbs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<div class="limited-container">
|
||||
<header>
|
||||
<img class="profile" src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<h2 class="title-name">{{document.name}}</h2>
|
||||
</header>
|
||||
</div>
|
||||
6
templates/sheets/actors/environment/limited.hbs
Normal file
6
templates/sheets/actors/environment/limited.hbs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<div class="limited-container">
|
||||
<header>
|
||||
<img class="profile" src="{{document.img}}" alt="{{document.name}}" data-action='editImage' data-edit="img">
|
||||
<h2 class="title-name">{{document.name}}</h2>
|
||||
</header>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue