diff --git a/less/v2/character.less b/less/v2/character.less index 9a7ec5a790..11eae3ca2c 100644 --- a/less/v2/character.less +++ b/less/v2/character.less @@ -101,6 +101,18 @@ } } + /* Name */ + .document-name { + color: var(--color-text-light-0); + font-size: var(--font-size-46); + text-shadow: 2px 2px 2px var(--color-shadow-dark); + font-family: var(--dnd5e-font-modesto); + font-weight: bold; + letter-spacing: 2px; + padding: 0; + margin: 0; + transition: font-size 250ms ease; + } /* Name & Class */ > .left { @@ -119,19 +131,6 @@ .document-name { font-size: var(--font-size-36); } } - /* Name */ - .document-name { - color: var(--color-text-light-0); - font-size: var(--font-size-46); - text-shadow: 2px 2px 2px var(--color-shadow-dark); - font-family: var(--dnd5e-font-modesto); - font-weight: bold; - letter-spacing: 2px; - padding: 0; - margin: 0; - transition: font-size 250ms ease; - } - input.document-name { padding: .3125rem .75rem; border-radius: 6px; @@ -1566,6 +1565,50 @@ .ability-scores { left: 0; } } + /* ---------------------------------- */ + /* Limited Sheets */ + /* ---------------------------------- */ + + &.limited { + min-width: 600px; + min-height: 600px; + + .sheet-header { + display: flex; + gap: 1.5rem; + padding: 1rem 1.5rem; + + > * { flex: unset; } + + .portrait { + width: 128px; + height: 128px; + border-radius: 100%; + border: 4px solid var(--dnd5e-color-gold); + box-shadow: 0 0 6px var(--dnd5e-color-black); + overflow: hidden; + + > img { + border: none; + width: 100%; + height: 100%; + object-fit: cover; + object-position: top; + background-color: var(--dnd5e-color-light-gray); + margin: 0; + } + } + } + + .tab.biography > .bottom { + padding: .5rem .5rem 1.5rem; + .editor { min-height: unset; } + } + + .main-content { display: unset; } + .sheet-body .tab-body .tab:not(.details) { padding: 0; } + } + /* ---------------------------------- */ /* Edit Mode */ /* ---------------------------------- */ diff --git a/module/applications/actor/character-sheet-2.mjs b/module/applications/actor/character-sheet-2.mjs index b8b6d5dd35..91349216cd 100644 --- a/module/applications/actor/character-sheet-2.mjs +++ b/module/applications/actor/character-sheet-2.mjs @@ -10,7 +10,8 @@ import ActorSheet5eCharacter from "./character-sheet.mjs"; */ export default class ActorSheet5eCharacter2 extends ActorSheet5eCharacter { constructor(object, options={}) { - const { width, height } = game.user.getFlag("dnd5e", "sheetPrefs.character") ?? {}; + const key = `character${object.limited ? ":limited" : ""}`; + const { width, height } = game.user.getFlag("dnd5e", `sheetPrefs.${key}`) ?? {}; if ( width && !("width" in options) ) options.width = width; if ( height && !("height" in options) ) options.height = height; super(object, options); @@ -95,6 +96,7 @@ export default class ActorSheet5eCharacter2 extends ActorSheet5eCharacter { /** @override */ get template() { + if ( !game.user.isGM && this.actor.limited ) return "systems/dnd5e/templates/actors/limited-sheet-2.hbs"; return "systems/dnd5e/templates/actors/character-sheet-2.hbs"; } @@ -131,6 +133,11 @@ export default class ActorSheet5eCharacter2 extends ActorSheet5eCharacter { firstButton?.insertAdjacentElement("beforebegin", idLink); } + if ( !game.user.isGM && this.actor.limited ) { + html[0].classList.add("limited"); + return html; + } + // Render tabs. const nav = document.createElement("nav"); nav.classList.add("tabs"); @@ -149,7 +156,7 @@ export default class ActorSheet5eCharacter2 extends ActorSheet5eCharacter { html[0].insertAdjacentElement("afterbegin", nav); this._tabs = this.options.tabs.map(t => { t.callback = this._onChangeTab.bind(this); - if (this._tabs?.[0]?.active !== t.initial) t.initial = this._tabs?.[0]?.active ?? t.initial; + if ( this._tabs?.[0]?.active !== t.initial ) t.initial = this._tabs?.[0]?.active ?? t.initial; return new Tabs5e(t); }); @@ -176,7 +183,7 @@ export default class ActorSheet5eCharacter2 extends ActorSheet5eCharacter { const context = await super.getData(options); context.editable = this.isEditable && (this._mode === this.constructor.MODES.EDIT); context.cssClass = context.editable ? "editable" : this.isEditable ? "interactable" : "locked"; - const activeTab = this._tabs?.[0]?.active ?? "details"; + const activeTab = (game.user.isGM || !this.actor.limited) ? this._tabs?.[0]?.active ?? "details" : "biography"; context.cssClass += ` tab-${activeTab}`; const sidebarCollapsed = game.user.getFlag("dnd5e", `sheetPrefs.character.tabs.${activeTab}.collapseSidebar`); if ( sidebarCollapsed ) { @@ -1003,7 +1010,8 @@ export default class ActorSheet5eCharacter2 extends ActorSheet5eCharacter { _onResize(event) { super._onResize(event); const { width, height } = this.position; - game.user.setFlag("dnd5e", "sheetPrefs.character", { width, height }); + const key = `character${this.actor.limited ? ":limited": ""}`; + game.user.setFlag("dnd5e", `sheetPrefs.${key}`, { width, height }); } /* -------------------------------------------- */ diff --git a/templates/actors/limited-sheet-2.hbs b/templates/actors/limited-sheet-2.hbs new file mode 100644 index 0000000000..9ee32f41c5 --- /dev/null +++ b/templates/actors/limited-sheet-2.hbs @@ -0,0 +1,48 @@ +