diff --git a/module/actor/sheets/newSheet/npc.js b/module/actor/sheets/newSheet/npc.js index 8ca16e5d..2ef953a5 100644 --- a/module/actor/sheets/newSheet/npc.js +++ b/module/actor/sheets/newSheet/npc.js @@ -1,4 +1,4 @@ -import ActorSheet5e from "../base.js"; +import ActorSheet5e from "./base.js"; /** * An Actor sheet for NPC type characters in the SW5E system. diff --git a/module/item/entity.js b/module/item/entity.js index 504e3bc9..f75cdca3 100644 --- a/module/item/entity.js +++ b/module/item/entity.js @@ -252,12 +252,8 @@ export default class Item5e extends Item { // Item Actions if ( data.hasOwnProperty("actionType") ) { - // Saving throws for unowned items - const save = data.save; - if ( save?.ability && !this.isOwned ) { - if ( save.scaling !== "flat" ) save.dc = null; - labels.save = game.i18n.format("SW5E.SaveDC", {dc: save.dc || "", ability: C.abilities[save.ability]}); - } + // Saving throws + this.getSaveDC(); // Damage let dam = data.damage || {}; @@ -271,6 +267,30 @@ export default class Item5e extends Item { this.labels = labels; } + /** + * Update the derived spell DC for an item that requires a saving throw + * @returns {number|null} + */ + getSaveDC() { + if ( !this.hasSave ) return; + const save = this.data.data?.save; + + // Actor spell-DC based scaling + if ( save.scaling === "spell" ) { + save.dc = this.isOwned ? getProperty(this.actor.data, "data.attributes.spelldc") : null; + } + + // Ability-score based scaling + else if ( save.scaling !== "flat" ) { + save.dc = this.isOwned ? getProperty(this.actor.data, `data.abilities.${save.scaling}.dc`) : null; + } + + // Update labels + const abl = CONFIG.DND5E.abilities[save.ability]; + this.labels.save = game.i18n.format("DND5E.SaveDC", {dc: save.dc || "", ability: abl}); + return save.dc; + } + /* -------------------------------------------- */ /** diff --git a/sw5e-global.css b/sw5e-global.css index f5349371..71738ad7 100644 --- a/sw5e-global.css +++ b/sw5e-global.css @@ -80,9 +80,6 @@ body { font-family: 'Open Sans'; font-size: 13px; font-weight: 400; - background-image: url('./ui/SW5e-logo.svg'); - background-repeat: no-repeat; - background-size: cover; } h1 { font-family: 'Russo One'; @@ -379,12 +376,12 @@ input[type="reset"]:disabled { padding: 0; border: none; } -.sw5e.chat-card .card-header, +.sw5e.chat-card .card-header img, .midi-qol-item-card .card-header img { flex: 0 0 36px; margin-right: 4px; } -.sw5e.chat-card .card-header, +.sw5e.chat-card .card-header h3, .midi-qol-item-card .card-header h3 { flex: 1; margin: 0; @@ -945,7 +942,7 @@ input[type="reset"]:disabled { } .sw5e.sheet.actor .swalt-sheet nav.sheet-navigation { display: grid; - grid-template-columns: repeat(7, 1fr); + grid-template-columns: repeat(6, 1fr); column-gap: 16px; margin: 4px 0; } diff --git a/sw5e.css b/sw5e.css index 19c1a5fb..60b3c478 100644 --- a/sw5e.css +++ b/sw5e.css @@ -272,9 +272,12 @@ background: transparent; } .sw5e.sheet .editable .rollable:hover { + cursor: pointer; +} +.sw5e.sheet .editable h4.rollable:hover, +.sw5e.sheet .editable .rollable:hover > h4 { color: #000; text-shadow: 0 0 10px red; - cursor: pointer; } .sw5e.sheet span.sep { flex: none; @@ -366,6 +369,7 @@ overflow: hidden; } .sw5e.sheet .filter-list { + align-items: center; list-style: none; margin: 0; padding: 0; @@ -423,6 +427,28 @@ margin: 0; padding: 0; } +.sw5e.sheet .items-list .item-name { + flex: 2; + margin: 0; + overflow: hidden; + font-size: 13px; + text-align: left; + align-items: center; +} +.sw5e.sheet .items-list .item-name h3, +.sw5e.sheet .items-list .item-name h4 { + margin: 0; + white-space: nowrap; + overflow-x: hidden; +} +.sw5e.sheet .items-list .item-controls { + flex: 0 0 60px; + justify-content: space-between; +} +.sw5e.sheet .items-list .item-controls a { + font-size: 12px; + text-align: center; +} .sw5e.sheet .items-list .item { align-items: center; padding: 0 2px; @@ -459,25 +485,10 @@ font-size: 12px; text-align: center; } -.sw5e.sheet .items-list .items-header .item-name { +.sw5e.sheet .items-list .items-header h3 { padding-left: 5px; - font-size: 16px; -} -.sw5e.sheet .items-list .item-name { - flex: 2; - margin: 0; - overflow: hidden; - font-size: 13px; text-align: left; - align-items: center; -} -.sw5e.sheet .items-list .item-controls { - flex: 0 0 60px; - justify-content: space-between; -} -.sw5e.sheet .items-list .item-controls a { - font-size: 12px; - text-align: center; + font-size: 16px; } .sw5e.sheet .effects .item .effect-source, .sw5e.sheet .effects .item .effect-duration, @@ -586,7 +597,21 @@ height: 30px; line-height: 30px; } -.sw5e.sheet.actor .attributes input.temphp { +.sw5e.sheet.actor .sheet-header .attributes .movement h4.attribute-name { + position: relative; +} +.sw5e.sheet.actor .sheet-header .attributes .movement .config-button { + position: absolute; + display: none; + right: 0; + top: 1px; + font-size: 12px; + font-weight: normal; +} +.sw5e.sheet.actor .sheet-header .attributes .movement:hover .config-button { + display: block; +} +.sw5e.sheet.actor .sheet-header .attributes input.temphp { width: 48%; } .sw5e.sheet.actor h4.box-title { @@ -798,7 +823,7 @@ margin: 0 0 3px 0; justify-content: space-between; } -.sw5e.sheet.actor .traits .configure-flags { +.sw5e.sheet.actor .traits .config-button { flex: 1; } .sw5e.sheet.actor .traits label { @@ -871,8 +896,8 @@ .sw5e.sheet.actor .inventory-list .item .item-name i.attuned { color: #7a7971; } -.sw5e.sheet.actor .inventory-list .item .item-name h4 { - font-size: 14px; +.sw5e.sheet.actor .inventory-list .item .item-name i.not-attuned { + color: #44191A; } .sw5e.sheet.actor .inventory-list .item .item-uses input { width: 24px; @@ -905,6 +930,9 @@ .sw5e.sheet.actor .inventory-list .item-detail.item-action { flex: 0 0 100px; } +.sw5e.sheet.actor .inventory-list .item-detail.attunement { + flex: 0 0 24px; +} .sw5e.sheet.actor .inventory-list .item-weight { flex: 0 0 60px; border-left: 1px solid #c9c7b8; @@ -995,24 +1023,22 @@ flex: 0 0 240px; margin: 0; } -.sw5e.sheet.actor .powercasting-ability input, +.sw5e.sheet.actor .powercasting-ability label, .sw5e.sheet.actor .powercasting-ability span { - flex: 0 0 32px; + flex: none; +} +.sw5e.sheet.actor .powercasting-ability input { + flex: 0 0 28px; text-align: center; } .sw5e.sheet.actor .powercasting-ability select { margin: 0 5px; - flex: 0 0 150px; -} -.sw5e.sheet.actor .powercasting-ability h3.power-dc { - flex: 1; - text-align: right; + flex: 0 0 120px; } .sw5e.sheet.actor .power-slots, .sw5e.sheet.actor .power-comps { - flex: 0 0 75px; - padding-right: 5px; - text-align: right; + flex: none; + padding: 0 5px; font-size: 12px; color: #7a7971; border-right: 1px solid #c9c7b8; @@ -1025,9 +1051,10 @@ font-size: 13px; font-weight: normal; } -.sw5e.sheet.actor .power-uses { - padding-right: 8px; - text-align: right !important; +.sw5e.sheet.actor .powerbook .power-uses { + padding-right: 5px; + text-align: right; + color: #7a7971; } .sw5e.sheet.actor .power-school, .sw5e.sheet.actor .power-action, @@ -1069,6 +1096,7 @@ padding-right: 8px; margin-bottom: 4px; overflow-y: auto; + scrollbar-width: thin; } .sw5e.sheet.item { min-height: 660px; @@ -1587,7 +1615,7 @@ .sw5e.chat-card .card-footer span, .midi-qol-item-card .card-footer span { border-right: 2px groove #FFF; - padding: 0 5px 0 0; + padding: 0 3px 0 0; font-size: 10px; } .sw5e.chat-card .card-footer span:last-child, @@ -1762,7 +1790,7 @@ resize: none; } .sw5e.sheet.actor.character .biography { - max-width: calc(-80%); + max-width: calc(100% - 180px); } /* ----------------------------------------- */ /* Basic Structure */ @@ -1794,9 +1822,6 @@ .sw5e.sheet.actor.npc .summary { font-size: 18px; } -.sw5e.sheet.actor.npc .powercasting-ability label { - flex: none; -} .sw5e.sheet.actor.vehicle .features .item-controls { flex: 0 0 68px; } @@ -1817,30 +1842,3 @@ max-width: 40px; text-align: right; } -input[type="number"] { - width: calc(100% - 2px); - min-width: 20px; - height: 26px; - background: rgba(0, 0, 0, 0.05); - padding: 1px 3px; - margin: 0; - color: #191813; - font-family: inherit; - font-size: inherit; - text-align: inherit; - line-height: inherit; - border: 1px solid #7a7971; - border-radius: 3px; - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; - -moz-appearance: textfield; -} -input[type="number"]:focus { - box-shadow: 0 0 5px red; -} -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - -webkit-appearance: none; -} diff --git a/templates/actors/newActor/parts/swalt-traits.html b/templates/actors/newActor/parts/swalt-traits.html index 8cb587c3..96544a56 100644 --- a/templates/actors/newActor/parts/swalt-traits.html +++ b/templates/actors/newActor/parts/swalt-traits.html @@ -18,6 +18,8 @@