diff --git a/src/ActorSheet.hbs b/src/ActorSheet.hbs index 733a57f..e679e2b 100644 --- a/src/ActorSheet.hbs +++ b/src/ActorSheet.hbs @@ -1,52 +1,18 @@ -{{#*inline "editable-input"}} -
- {{#if @root.editable}} - - {{else}} -
- {{value}} - {{#unless value}}{{placeholder}}{{/unless}} -
- {{/if}} - - {{#if placeholder}} -
{{placeholder}}
- {{/if}} -
-{{/inline}} - -{{#*inline "editable-checkbox"}} -
- {{#if @root.editable}} - - {{else}} -
- {{value}} - {{#unless value}}{{placeholder}}{{/unless}} -
- {{/if}} - - {{#if placeholder}} -
{{placeholder}}
- {{/if}} -
-{{/inline}} - {{#*inline "die-type"}}
{{localize (concat "DSA41.attributes.short." type)}}
{{/inline}} {{#*inline "die-value"}} -
+
{{#if header}}
{{header}}
{{/if}} -
+
{{{value}}}
{{/inline}} -
+
{{>editable-input type="text" name="name" value=actor.name placeholder=(localize "DSA41.name")}} {{>editable-input type="text" name="system.race" value=actor.system.race placeholder=(localize "DSA41.race")}} @@ -57,284 +23,262 @@
{{#each actor.system.attributes}} - {{>die-value type=@key header=(localize (concat "DSA41.attributes.short." @key)) value=(lookup @root.actor.system.computed.attributes @key)data-roll="1d20" data-tooltip=(lookup @root.tooltips.attributes @key)}} + {{>die-value type=@key header=(localize (concat "DSA41.attributes.short." @key)) value=(lookup @root.actor.system.computed.attributes @key) success-value=(lookup @root.actor.system.computed.attributes @key) data-roll="1d20" data-tooltip="attribute_tooltip"}} {{/each}} +
-
diff --git a/src/EditableInput.hbs b/src/EditableInput.hbs new file mode 100644 index 0000000..2c0d6db --- /dev/null +++ b/src/EditableInput.hbs @@ -0,0 +1,11 @@ +
+ {{#if (eq type "checkbox")}} + + {{else}} + + {{/if}} + + {{#if placeholder}} +
{{placeholder}}
+ {{/if}} +
\ No newline at end of file diff --git a/src/ItemSheets/Bewaffnung.hbs b/src/ItemSheets/Bewaffnung.hbs index 3b42630..3f8aa53 100644 --- a/src/ItemSheets/Bewaffnung.hbs +++ b/src/ItemSheets/Bewaffnung.hbs @@ -1,38 +1,4 @@ -{{#*inline "editable-input"}} -
- {{#if @root.editable}} - - {{else}} -
- {{value}} - {{#unless value}}{{placeholder}}{{/unless}} -
- {{/if}} - - {{#if placeholder}} -
{{placeholder}}
- {{/if}} -
-{{/inline}} - -{{#*inline "editable-checkbox"}} -
- {{#if @root.editable}} - - {{else}} -
- {{value}} - {{#unless value}}{{placeholder}}{{/unless}} -
- {{/if}} - - {{#if placeholder}} -
{{placeholder}}
- {{/if}} -
-{{/inline}} - -
+
@@ -44,129 +10,121 @@
-
-
- {{localize "DSA41.bewaffnung.nahkampfwaffe.trefferpunkte"}} -
- {{>editable-input type="text" name="system.nahkampfwaffe.basis" value=item.system.nahkampfwaffe.basis placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.basis")}} - {{>editable-input type="number" name="system.nahkampfwaffe.schwellenwert" value=item.system.nahkampfwaffe.schwellenwert placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.schwellenwert")}} - {{>editable-input type="number" name="system.nahkampfwaffe.schadensschritte" value=item.system.nahkampfwaffe.schadensschritte placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.schadensschritte")}} -
- {{localize "DSA41.bewaffnung.nahkampfwaffe.modifikator"}} -
- {{>editable-input type="number" name="system.nahkampfwaffe.modifikator_attacke" value=item.system.nahkampfwaffe.modifikator_attacke placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.attacke")}} - {{>editable-input type="number" name="system.nahkampfwaffe.modifikator_parade" value=item.system.nahkampfwaffe.modifikator_parade placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.parade")}} -
- - {{localize "DSA41.bewaffnung.nahkampfwaffe.initiative"}} -
{{>editable-input type="number" name="system.nahkampfwaffe.initiative" value=item.system.nahkampfwaffe.initiative}}
- {{localize "DSA41.bewaffnung.bruchfaktor"}} -
{{>editable-input type="number" name="system.nahkampfwaffe.bruchfaktor" value=item.system.nahkampfwaffe.bruchfaktor}}
- - {{localize "DSA41.bewaffnung.nahkampfwaffe.distanzklasse"}} -
{{>editable-input type="text" name="system.nahkampfwaffe.distanzklasse" value=item.system.nahkampfwaffe.distanzklasse}}
- {{localize "DSA41.bewaffnung.nahkampfwaffe.kampftalente"}} -
{{>editable-input type="text" name="system.nahkampfwaffe.kampftalente" value=item.system.nahkampfwaffe.kampftalente}}
- - {{localize "DSA41.bewaffnung.nahkampfwaffe.laenge"}} -
{{>editable-input type="number" name="system.nahkampfwaffe.laenge" value=item.system.nahkampfwaffe.laenge}}
-
- - {{localize "DSA41.bewaffnung.nahkampfwaffe.zweihaendig"}} -
{{>editable-checkbox name="system.nahkampfwaffe.zweihaendig" value=item.system.nahkampfwaffe.zweihaendig}}
- {{localize "DSA41.bewaffnung.nahkampfwaffe.werfbar"}} -
{{>editable-checkbox name="system.nahkampfwaffe.werfbar" value=item.system.nahkampfwaffe.werfbar}}
- - {{localize "DSA41.bewaffnung.nahkampfwaffe.improvisiert"}} -
{{>editable-checkbox name="system.nahkampfwaffe.improvisiert" value=item.system.nahkampfwaffe.improvisiert}}
- {{localize "DSA41.bewaffnung.nahkampfwaffe.priviligiert"}} -
{{>editable-checkbox name="system.nahkampfwaffe.priviligiert" value=item.system.nahkampfwaffe.priviligiert}}
+
+ {{localize "DSA41.bewaffnung.nahkampfwaffe.trefferpunkte"}} +
+ {{>editable-input type="text" name="system.nahkampfwaffe.basis" value=item.system.nahkampfwaffe.basis placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.basis")}} + {{>editable-input type="number" name="system.nahkampfwaffe.schwellenwert" value=item.system.nahkampfwaffe.schwellenwert placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.schwellenwert")}} + {{>editable-input type="number" name="system.nahkampfwaffe.schadensschritte" value=item.system.nahkampfwaffe.schadensschritte placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.schadensschritte")}}
+ {{localize "DSA41.bewaffnung.nahkampfwaffe.modifikator"}} +
+ {{>editable-input type="number" name="system.nahkampfwaffe.modifikator_attacke" value=item.system.nahkampfwaffe.modifikator_attacke placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.attacke")}} + {{>editable-input type="number" name="system.nahkampfwaffe.modifikator_parade" value=item.system.nahkampfwaffe.modifikator_parade placeholder=(localize "DSA41.bewaffnung.nahkampfwaffe.parade")}} +
+ + {{localize "DSA41.bewaffnung.nahkampfwaffe.initiative"}} +
{{>editable-input type="number" name="system.nahkampfwaffe.initiative" value=item.system.nahkampfwaffe.initiative}}
+ {{localize "DSA41.bewaffnung.bruchfaktor"}} +
{{>editable-input type="number" name="system.nahkampfwaffe.bruchfaktor" value=item.system.nahkampfwaffe.bruchfaktor}}
+ + {{localize "DSA41.bewaffnung.nahkampfwaffe.distanzklasse"}} +
{{>editable-input type="text" name="system.nahkampfwaffe.distanzklasse" value=item.system.nahkampfwaffe.distanzklasse}}
+ {{localize "DSA41.bewaffnung.nahkampfwaffe.kampftalente"}} +
{{>editable-input type="text" name="system.nahkampfwaffe.kampftalente" value=item.system.nahkampfwaffe.kampftalente}}
+ + {{localize "DSA41.bewaffnung.nahkampfwaffe.laenge"}} +
{{>editable-input type="number" name="system.nahkampfwaffe.laenge" value=item.system.nahkampfwaffe.laenge}}
+
+ + {{localize "DSA41.bewaffnung.nahkampfwaffe.zweihaendig"}} +
{{>editable-input type="checkbox" name="system.nahkampfwaffe.zweihaendig" value=item.system.nahkampfwaffe.zweihaendig}}
+ {{localize "DSA41.bewaffnung.nahkampfwaffe.werfbar"}} +
{{>editable-input type="checkbox" name="system.nahkampfwaffe.werfbar" value=item.system.nahkampfwaffe.werfbar}}
+ + {{localize "DSA41.bewaffnung.nahkampfwaffe.improvisiert"}} +
{{>editable-input type="checkbox" name="system.nahkampfwaffe.improvisiert" value=item.system.nahkampfwaffe.improvisiert}}
+ {{localize "DSA41.bewaffnung.nahkampfwaffe.priviligiert"}} +
{{>editable-input type="checkbox" name="system.nahkampfwaffe.priviligiert" value=item.system.nahkampfwaffe.priviligiert}}
-
-
- {{localize "DSA41.bewaffnung.parierwaffe.initiative"}} -
{{>editable-input type="number" name="system.parierwaffe.initiative" value=item.system.parierwaffe.initiative}}
- {{localize "DSA41.bewaffnung.parierwaffe.modifikator"}} -
- {{>editable-input type="number" name="system.parierwaffe.modifikator_attacke" value=item.system.parierwaffe.modifikator_attacke placeholder=(localize "DSA41.bewaffnung.parierwaffe.attacke")}} - {{>editable-input type="number" name="system.parierwaffe.modifikator_parade" value=item.system.parierwaffe.modifikator_parade placeholder=(localize "DSA41.bewaffnung.parierwaffe.parade")}} -
- - {{localize "DSA41.bewaffnung.bruchfaktor"}} -
{{>editable-input type="number" name="system.parierwaffe.bruchfaktor" value=item.system.parierwaffe.bruchfaktor}}
+
+ {{localize "DSA41.bewaffnung.parierwaffe.initiative"}} +
{{>editable-input type="number" name="system.parierwaffe.initiative" value=item.system.parierwaffe.initiative}}
+ {{localize "DSA41.bewaffnung.parierwaffe.modifikator"}} +
+ {{>editable-input type="number" name="system.parierwaffe.modifikator_attacke" value=item.system.parierwaffe.modifikator_attacke placeholder=(localize "DSA41.bewaffnung.parierwaffe.attacke")}} + {{>editable-input type="number" name="system.parierwaffe.modifikator_parade" value=item.system.parierwaffe.modifikator_parade placeholder=(localize "DSA41.bewaffnung.parierwaffe.parade")}}
+ + {{localize "DSA41.bewaffnung.bruchfaktor"}} +
{{>editable-input type="number" name="system.parierwaffe.bruchfaktor" value=item.system.parierwaffe.bruchfaktor}}
-
-
- {{localize "DSA41.bewaffnung.schild.groesse.label"}} - - {{localize "DSA41.bewaffnung.schild.modifikator"}} -
- {{>editable-input type="number" name="system.schild.modifikator_attacke" value=item.system.schild.modifikator_attacke placeholder=(localize "DSA41.bewaffnung.schild.attacke")}} - {{>editable-input type="number" name="system.schild.modifikator_parade" value=item.system.schild.modifikator_parade placeholder=(localize "DSA41.bewaffnung.schild.parade")}} -
- - {{localize "DSA41.bewaffnung.schild.initiative"}} -
{{>editable-input type="number" name="system.schild.initiative" value=item.system.schild.initiative}}
- {{localize "DSA41.bewaffnung.bruchfaktor"}} -
{{>editable-input type="number" name="system.schild.bruchfaktor" value=item.system.schild.bruchfaktor}}
+
+ {{localize "DSA41.bewaffnung.schild.groesse.label"}} + + {{localize "DSA41.bewaffnung.schild.modifikator"}} +
+ {{>editable-input type="number" name="system.schild.modifikator_attacke" value=item.system.schild.modifikator_attacke placeholder=(localize "DSA41.bewaffnung.schild.attacke")}} + {{>editable-input type="number" name="system.schild.modifikator_parade" value=item.system.schild.modifikator_parade placeholder=(localize "DSA41.bewaffnung.schild.parade")}}
+ + {{localize "DSA41.bewaffnung.schild.initiative"}} +
{{>editable-input type="number" name="system.schild.initiative" value=item.system.schild.initiative}}
+ {{localize "DSA41.bewaffnung.bruchfaktor"}} +
{{>editable-input type="number" name="system.schild.bruchfaktor" value=item.system.schild.bruchfaktor}}
-
-
- {{localize "DSA41.bewaffnung.fernkampfwaffe.trefferpunkte"}} -
{{>editable-input type="text" name="system.fernkampfwaffe.basis" value=item.system.fernkampfwaffe.basis}}
- {{localize "DSA41.bewaffnung.fernkampfwaffe.laden"}} -
{{>editable-input type="number" name="system.fernkampfwaffe.laden" value=item.system.fernkampfwaffe.laden}}
+
+ {{localize "DSA41.bewaffnung.fernkampfwaffe.trefferpunkte"}} +
{{>editable-input type="text" name="system.fernkampfwaffe.basis" value=item.system.fernkampfwaffe.basis}}
+ {{localize "DSA41.bewaffnung.fernkampfwaffe.laden"}} +
{{>editable-input type="number" name="system.fernkampfwaffe.laden" value=item.system.fernkampfwaffe.laden}}
- {{localize "DSA41.bewaffnung.fernkampfwaffe.munitionskosten"}} -
{{>editable-input type="number" name="system.fernkampfwaffe.munitionskosten" value=item.system.fernkampfwaffe.munitionskosten}}
- {{localize "DSA41.bewaffnung.fernkampfwaffe.munitionsgewicht"}} -
{{>editable-input type="number" name="system.fernkampfwaffe.munitionsgewicht" value=item.system.fernkampfwaffe.munitionsgewicht}}
+ {{localize "DSA41.bewaffnung.fernkampfwaffe.munitionskosten"}} +
{{>editable-input type="number" name="system.fernkampfwaffe.munitionskosten" value=item.system.fernkampfwaffe.munitionskosten}}
+ {{localize "DSA41.bewaffnung.fernkampfwaffe.munitionsgewicht"}} +
{{>editable-input type="number" name="system.fernkampfwaffe.munitionsgewicht" value=item.system.fernkampfwaffe.munitionsgewicht}}
- {{localize "DSA41.bewaffnung.fernkampfwaffe.reichweiten"}} -
- {{>editable-input type="number" name="system.fernkampfwaffe.reichweite1" value=item.system.fernkampfwaffe.reichweite1}} - {{>editable-input type="number" name="system.fernkampfwaffe.reichweite2" value=item.system.fernkampfwaffe.reichweite2}} - {{>editable-input type="number" name="system.fernkampfwaffe.reichweite3" value=item.system.fernkampfwaffe.reichweite3}} - {{>editable-input type="number" name="system.fernkampfwaffe.reichweite4" value=item.system.fernkampfwaffe.reichweite4}} - {{>editable-input type="number" name="system.fernkampfwaffe.reichweite5" value=item.system.fernkampfwaffe.reichweite5}} -
+ {{localize "DSA41.bewaffnung.fernkampfwaffe.reichweiten"}} +
+ {{>editable-input type="number" name="system.fernkampfwaffe.reichweite1" value=item.system.fernkampfwaffe.reichweite1}} + {{>editable-input type="number" name="system.fernkampfwaffe.reichweite2" value=item.system.fernkampfwaffe.reichweite2}} + {{>editable-input type="number" name="system.fernkampfwaffe.reichweite3" value=item.system.fernkampfwaffe.reichweite3}} + {{>editable-input type="number" name="system.fernkampfwaffe.reichweite4" value=item.system.fernkampfwaffe.reichweite4}} + {{>editable-input type="number" name="system.fernkampfwaffe.reichweite5" value=item.system.fernkampfwaffe.reichweite5}} +
- {{localize "DSA41.bewaffnung.fernkampfwaffe.modifikator"}} -
- {{>editable-input type="number" name="system.fernkampfwaffe.modifikator1" value=item.system.fernkampfwaffe.modifikator1}} - {{>editable-input type="number" name="system.fernkampfwaffe.modifikator2" value=item.system.fernkampfwaffe.modifikator2}} - {{>editable-input type="number" name="system.fernkampfwaffe.modifikator3" value=item.system.fernkampfwaffe.modifikator3}} - {{>editable-input type="number" name="system.fernkampfwaffe.modifikator4" value=item.system.fernkampfwaffe.modifikator4}} - {{>editable-input type="number" name="system.fernkampfwaffe.modifikator5" value=item.system.fernkampfwaffe.modifikator5}} -
+ {{localize "DSA41.bewaffnung.fernkampfwaffe.modifikator"}} +
+ {{>editable-input type="number" name="system.fernkampfwaffe.modifikator1" value=item.system.fernkampfwaffe.modifikator1}} + {{>editable-input type="number" name="system.fernkampfwaffe.modifikator2" value=item.system.fernkampfwaffe.modifikator2}} + {{>editable-input type="number" name="system.fernkampfwaffe.modifikator3" value=item.system.fernkampfwaffe.modifikator3}} + {{>editable-input type="number" name="system.fernkampfwaffe.modifikator4" value=item.system.fernkampfwaffe.modifikator4}} + {{>editable-input type="number" name="system.fernkampfwaffe.modifikator5" value=item.system.fernkampfwaffe.modifikator5}}
-
\ No newline at end of file +
diff --git a/src/ItemSheets/Gegenstand.hbs b/src/ItemSheets/Gegenstand.hbs index 8a78cb9..8c53988 100644 --- a/src/ItemSheets/Gegenstand.hbs +++ b/src/ItemSheets/Gegenstand.hbs @@ -1,20 +1,3 @@ -{{#*inline "editable-input"}} -
- {{#if @root.editable}} - - {{else}} -
- {{value}} - {{#unless value}}{{placeholder}}{{/unless}} -
- {{/if}} - - {{#if placeholder}} -
{{placeholder}}
- {{/if}} -
-{{/inline}} -
@@ -26,4 +9,4 @@
-
\ No newline at end of file +
diff --git a/src/ItemSheets/Ruestung.hbs b/src/ItemSheets/Ruestung.hbs index 67cd2ca..83e464d 100644 --- a/src/ItemSheets/Ruestung.hbs +++ b/src/ItemSheets/Ruestung.hbs @@ -1,20 +1,3 @@ -{{#*inline "editable-input"}} -
- {{#if @root.editable}} - - {{else}} -
- {{value}} - {{#unless value}}{{placeholder}}{{/unless}} -
- {{/if}} - - {{#if placeholder}} -
{{placeholder}}
- {{/if}} -
-{{/inline}} -
@@ -27,7 +10,7 @@
-
+
{{localize "DSA41.ruestungen.kopf"}}
{{>editable-input type="number" name="system.kopf" value=item.system.kopf}}
{{localize "DSA41.ruestungen.brust"}} diff --git a/src/lang/de.json b/src/lang/de.json index 36b65cb..b991243 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -361,4 +361,4 @@ "ruestungen": "RĂ¼stungen" } } -} \ No newline at end of file +} diff --git a/src/main.css b/src/main.css index 7b289cc..40d5c77 100644 --- a/src/main.css +++ b/src/main.css @@ -1,268 +1,305 @@ -.tabs > [data-tab] > * { - pointer-events: auto; -} - - -.row { - display: flex; - flex-direction: row; - flex: 1; -} - -.col { - display: flex; - flex-direction: column; - flex: 1; -} - -.noflex { - flex: 0; -} - -.wrap { - flex-wrap: wrap; -} - -.left { - text-align: left; - justify-content: left; - justify-self: left; -} - -.center { - text-align: center; - justify-content: center; - align-content: center; -} - -.none { - display: none; -} - -.grid2 { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); -} - -.grid3 { - display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); -} - -.grid4 { - display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); -} - -.grid5 { - display: grid; - grid-template-columns: repeat(5, minmax(0, 1fr)); -} - -.subgrid { - display: grid; - grid-template-rows: subgrid; - grid-template-columns: subgrid; -} - -.colspan2 { grid-column: span 2; } -.colspan3 { grid-column: span 3; } -.colspan4 { grid-column: span 4; } -.colspan5 { grid-column: span 5; } -.colspan6 { grid-column: span 6; } -.colspan7 { grid-column: span 7; } -.colspan8 { grid-column: span 8; } -.colspan9 { grid-column: span 9; } - -.rowspan2 { grid-row: span 2; } -.rowspan3 { grid-row: span 3; } -.rowspan4 { grid-row: span 4; } -.rowspan5 { grid-row: span 5; } -.rowspan6 { grid-row: span 6; } -.rowspan7 { grid-row: span 7; } -.rowspan8 { grid-row: span 8; } -.rowspan9 { grid-row: span 9; } - - - -.editable-input { - flex: 1; - padding: 0px 3px; -} - -.editable-input input { - border: none; -} - -.editable-number { - text-align: center; -} - -.placeholder { - font-size: 0.8em; - border-top: 1px solid; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - - - -.sheet .die { - display: inline-grid; - - text-align: center; - align-items: center; - color: #fff; - - width: 48px; - height: 48px; -} - -.sheet .die > * { - grid-row: 1; - grid-column: 1; -} - -.sheet .die-courage { fill: #b22319; } -.sheet .die-cleverness { fill: #8158a3; } -.sheet .die-intuition { fill: #388834; } -.sheet .die-charisma { fill: #0c0c0c; } -.sheet .die-dexterity { fill: #d4b366; } -.sheet .die-agility { fill: #678ec3; } -.sheet .die-constitution { fill: #a3a3a3; } -.sheet .die-strength { fill: #d5a877; } - -.sheet .die-attacke { fill: #b22319; } -.sheet .die-parade { fill: #388834; } -.sheet .die-trefferpunkte { fill: #0c0c0c; } - -.sheet .item-open, -.sheet .item-delete, -.sheet .roll { - cursor: pointer; -} - -.sheet .item-open:hover, -.sheet .item-delete:hover, -.sheet .roll:hover { - transform: scale(1.05); -} - - -.character-image { - width: 115px; - height: 115px; -} - -.item-image { - width: 80px; - height: 80px; -} - -.list-header { - padding: 0.5rem; -} - -.list { - box-shadow: 0 0 6px rgba(0, 0, 0, 0.45); -} - -.list-item { - padding: 0.25rem; - border-bottom: 1px dotted; -} - -.list-item:last-child { - border: none; -} - -.item-name { - gap: 0.5rem; - flex: 0 1 auto; -} - -.item-sub { - font-size: 0.625rem; -} - -.inventar { - gap: 16px; -} - -.kampf { - gap: 16px; -} - - -.actor-sheet fieldset { - width: 100%; -} - -.actor-sheet table { - border: none; - background: none; - table-layout: fixed; -} - -.actor-sheet .item-image { - width: 32px; - height: 32px; -} - -.actor-sheet .tabs, -.DSA41 .tabs { - padding: .5rem; - margin-top: .5rem; - margin-bottom: .5rem; - border-top: 1px solid; - border-bottom: 1px solid; -} - -.DSA41 .tabs > * { - align-items: center; -} - -.DSA41 .tabs .active { - text-decoration: underline; -} - -.actor-sheet .kampf .ruestungen { - display: grid; - grid-template-columns: 2fr repeat(8, 1fr) repeat(2, 1.5fr); -} - -.actor-sheet .kampf .ruestungen > * { - display: grid; - grid-column: 1 / -1; - grid-template-columns: subgrid; - - padding: 0.25rem; - border-bottom: 1px dotted; - - text-align: center; - place-items: center; -} - -.actor-sheet .kampf .ruestungen > *:last-child { - border: none; -} - -.DSA41 .Bewaffnung .tab > * { - display: grid; - grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr); - align-items: center; - gap: 0.5rem; -} - -.DSA41 .Ruestung { - display: grid; - grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr); - align-items: center; - gap: 0.5rem; - margin-top: 0.5rem; -} - -#tooltip:has(> .dsa41-tooltip) { - /* background-color: #678ec3; */ +.DSA41 { + font-size: 14px; + + /* Change from FoundryVTT's default of 'none' to 'auto' to allow checkboxes in the nav bar */ + & .tabs > [data-tab] > * { + pointer-events: auto; + } + + /* Allow application content to be scrolled */ + & .window-content { + overflow-y: scroll; + } + + & [data-action] { + cursor: pointer; + + &:hover { + transform: scale(1.05); + } + } + + & .small { + font-size: 0.75em; + } + + & .left { + text-align: left; + justify-content: left; + justify-self: left; + } + + & .right { + text-align: right; + justify-content: right; + justify-self: right; + } + + & .center { + text-align: center; + justify-content: center; + align-content: center; + align-items: center; + } + + & .row { + display: flex; + flex-direction: row; + flex: 1; + } + + & .col { + display: flex; + flex-direction: column; + flex: 1; + } + + & .noflex { + flex: 0; + } + + & .subgrid { + display: grid; + grid-template-rows: subgrid; + grid-template-columns: subgrid; + } + + & .subgrid-columns { + display: grid; + grid-template-columns: subgrid; + } + + & .subgrid-rows { + display: grid; + grid-template-rows: subgrid; + } + + & .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } + & .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); } + & .grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); } + & .grid5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); } + & .grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); } + & .grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); } + & .grid8 { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); } + & .grid9 { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); } + + & .colspan2 { grid-column: span 2; } + & .colspan3 { grid-column: span 3; } + & .colspan4 { grid-column: span 4; } + & .colspan5 { grid-column: span 5; } + & .colspan6 { grid-column: span 6; } + & .colspan7 { grid-column: span 7; } + & .colspan8 { grid-column: span 8; } + & .colspan9 { grid-column: span 9; } + & .colspan-all { grid-column: 1 / -1; } + + & .rowspan2 { grid-row: span 2; } + & .rowspan3 { grid-row: span 3; } + & .rowspan4 { grid-row: span 4; } + & .rowspan5 { grid-row: span 5; } + & .rowspan6 { grid-row: span 6; } + & .rowspan7 { grid-row: span 7; } + & .rowspan8 { grid-row: span 8; } + & .rowspan9 { grid-row: span 9; } + & .rowspan-all { grid-row: 1 / -1; } + + & .editable-input { + flex: 1; + padding: 0px 3px; + + & input { + border: none; + } + + &.editable-number { + text-align: center; + } + + & .placeholder { + font-size: 0.8em; + border-top: 1px solid; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + } + + & .character-image { + width: 115px; + height: 115px; + } + + & .item-image { + width: 80px; + height: 80px; + } + + & .die { + display: inline-grid; + + text-align: center; + align-items: center; + color: #fff; + + width: 3.5em; + height: 3.5em; + + & > * { + grid-row: 1; + grid-column: 1; + } + + &.die-courage { fill: #b22319; } + &.die-cleverness { fill: #8158a3; } + &.die-intuition { fill: #388834; } + &.die-charisma { fill: #0c0c0c; } + &.die-dexterity { fill: #d4b366; } + &.die-agility { fill: #678ec3; } + &.die-constitution { fill: #a3a3a3; } + &.die-strength { fill: #d5a877; } + + &.die-attacke { fill: #b22319; } + &.die-parade { fill: #388834; } + &.die-trefferpunkte { fill: #0c0c0c; } + } + + & .tabs { + padding: .5rem; + margin-top: .5rem; + margin-bottom: .5rem; + border-top: 1px solid; + border-bottom: 1px solid; + + & > * { + align-items: center; + } + + & .active { + text-decoration: underline; + } + } + + & .tab.active { + display: grid; + gap: 0.5rem; + } + + & .list { + display: grid; + + background: #252830; + box-shadow: 0 0 6px rgba(0, 0, 0, 0.45); + + & .item-image { + width: 40px; + height: 40px; + } + + & .item-name { + gap: 0.5rem; + } + } + + & .list-header { + display: grid; + grid-column: 1 / -1; + + grid-template-rows: subgrid; + grid-template-columns: subgrid; + + align-items: center; + + padding: 0.5rem; + border-radius: 5px 5px 0px 0px; + background: linear-gradient(90deg, rgb(36, 133, 44) 0%, rgb(0, 79, 7) 40%, rgb(0, 51, 5) 100%); + } + + & .list-item { + display: grid; + grid-column: 1 / -1; + + grid-template-rows: subgrid; + grid-template-columns: subgrid; + + align-items: center; + + padding: 0.25rem; + border-bottom: 1px dotted; + + &:last-child { + border: none; + } + } + + & [data-application-part="Bewaffnung"] { + & .tab { + grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr); + align-items: center; + } + } + + & [data-application-part="Ruestung"] { + & .tab { + grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr); + align-items: center; + } + } + + & [data-application-part="ActorSheet"] { + & .tab { + &[data-tab="tab1"] { + & .Eigenschaften { + display: grid; + grid-template-columns: minmax(0, max-content) repeat(8, minmax(0, 1fr)); + align-items: center; + gap: 0.5rem; + } + + + & .Basiswerte { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + } + } + + &[data-tab="tab2"] { + & .Kampftalente { + display: grid; + grid-template-columns: minmax(0, max-content) repeat(5, minmax(0, 1fr)); + align-items: center; + gap: 0.5rem; + } + + & .Talente { + display: grid; + grid-template-columns: minmax(0, max-content) repeat(2, minmax(0, 1fr)); + align-items: center; + gap: 0.5rem; + } + } + + &[data-tab="tab3"] { + grid-template-columns: minmax(min-content, max-content) auto minmax(min-content, max-content) min-content; + + & > * { + grid-column: 1 / -1; + } + } + + &[data-tab="tab4"] { + & .Bewaffnung { + grid-template-columns: minmax(0, max-content) repeat(3, minmax(0, auto)); + + & .die { + font-size: 12px; + } + } + + & .Ruestung { + grid-template-columns: 2fr repeat(8, 1fr) repeat(2, 1.5fr); + text-align: center; + } + } + } + } } diff --git a/src/main.mjs b/src/main.mjs index 514c1f2..49f81c7 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -1,6 +1,6 @@ const { TypeDataModel } = foundry.abstract; const { SchemaField, NumberField, StringField, BooleanField } = foundry.data.fields; -const { ItemSheetV2 } = foundry.applications.sheets; +const { ActorSheetV2, ItemSheetV2 } = foundry.applications.sheets; const { HandlebarsApplicationMixin } = foundry.applications.api; const { OperatorTerm, NumericTerm } = foundry.dice.terms; @@ -33,6 +33,8 @@ Hooks.once("init", function() { }); loadTemplates({ + "editable-input": "systems/dsa-4th-edition/src/EditableInput.hbs", + "attribute_tooltip": "systems/dsa-4th-edition/src/Tooltips/Attribute.hbs", "attacke_tooltip": "systems/dsa-4th-edition/src/Tooltips/Attacke.hbs", @@ -533,96 +535,96 @@ class DSA41_BewaffnungData extends TypeDataModel { } } -class DSA41_ActorSheet extends ActorSheet { - static get defaultOptions() { - return foundry.utils.mergeObject(super.defaultOptions, { - tabs: [{ navSelector: ".tabs", contentSelector: ".content", initial: "tab1" }], - template: "systems/dsa-4th-edition/src/ActorSheet.hbs", - }); - } - - async getData() { - let data = super.getData(); - - data.tooltips = { - attributes: {}, - kampf: { - attacke: {}, - parade: {}, - trefferpunkte: {}, - } +function DSA41_ApplicationMixin(BaseApplication) { + class DSA41_Application extends HandlebarsApplicationMixin(BaseApplication) { + static DEFAULT_OPTIONS= { + classes: [ "DSA41" ], + window: { resizable: true }, + form: { submitOnChange: true }, }; - for (const [attribute, value] of Object.entries(data.actor.system.attributes)) { - data.tooltips.attributes[attribute] = await renderTemplate("attribute_tooltip", value); + async _prepareContext(options) { + return this; } - - for (const [id, computed] of Object.entries(data.actor.system.computed.kampf.waffen)) { - data.tooltips.kampf.attacke [id] = await renderTemplate("attacke_tooltip", computed); - data.tooltips.kampf.parade [id] = await renderTemplate("parade_tooltip", computed); - data.tooltips.kampf.trefferpunkte[id] = await renderTemplate("trefferpunkte_tooltip", computed); - } - - return data; } - activateListeners(html) { - super.activateListeners(html); - - html.on("click", ".item-open", async (event) => { - const item_id = event.currentTarget.closest("[data-item-id]").dataset.itemId; - const item = this.object.items.get(item_id); - item.sheet.render(true) - }); - - html.on("click", ".item-delete", async (event) => { - const item_id = event.currentTarget.closest("[data-item-id]").dataset.itemId; - const item = this.object.items.get(item_id); - item.delete(); - }); - - html.on("click", ".roll", async (event) => { - const roll_formula = event.currentTarget.closest("[data-roll]").dataset.roll; - const roll_type = event.currentTarget.closest("[data-roll]").dataset.rollType; - const success_value = event.currentTarget.closest("[data-roll]").dataset.successValue; - - let flavor = game.i18n.localize("DSA41.roll_types." + roll_type); - if (typeof success_value !== 'undefined') { - flavor += " <= " + success_value; - } - - let roll = new Roll(roll_formula, this.object.system); - roll.toMessage({ - speaker: ChatMessage.getSpeaker({ actor: this.object }), - flavor: flavor, - }); - }); - } + return DSA41_Application; } -class DSA41_ItemSheetV2 extends HandlebarsApplicationMixin(ItemSheetV2) { - static DEFAULT_OPTIONS = { - classes: [ "DSA41" ], - position: { width: "480", height: "480" }, - window: { resizable: true }, - form: { submitOnChange: true }, +class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) { + static PARTS = { + ActorSheet: { template: "systems/dsa-4th-edition/src/ActorSheet.hbs" }, }; + static DEFAULT_OPTIONS = { + position: { width: "800", height: "650" }, + actions: { + "roll": async function(event, target) { + const roll_formula = event.target.closest("[data-roll]").dataset.roll; + const roll_type = event.target.closest("[data-roll-type]").dataset.rollType; + const success_value = event.target.closest("[data-success-value]")?.dataset.successValue; + + let flavor = game.i18n.localize("DSA41.roll_types." + roll_type); + if (typeof success_value !== 'undefined') { + flavor += " <= " + success_value; + } + + let roll = new Roll(roll_formula, this.document.system); + roll.toMessage({ + speaker: ChatMessage.getSpeaker({ actor: this.document }), + flavor: flavor, + }); + }, + + "item-open": async function(event, target) { + const item_id = event.target.closest("[data-item-id]").dataset.itemId; + const item = this.document.items.get(item_id); + item.sheet.render(true) + }, + + "item-delete": async function(event, target) { + const item_id = event.target.closest("[data-item-id]").dataset.itemId; + const item = this.document.items.get(item_id); + item.delete(); + }, + }, + }; + + _onFirstRender(context, options) { + super._onFirstRender(context, options); + + const content = this.element.querySelector(".window-content"); + content.addEventListener("drop", async (event) => { + event.preventDefault(); + const data = TextEditor.getDragEventData(event); + + switch (data.type) { + case "Item": { + const item = await Item.implementation.fromDropData(data); + await this.actor.createEmbeddedDocuments("Item", [item.toObject()]); + } break; + } + }); + } + + tabGroups = { primary: "tab1" }; +} + +class DSA41_ItemSheetV2 extends DSA41_ApplicationMixin(ItemSheetV2) { static PARTS = { Bewaffnung: { template: "systems/dsa-4th-edition/src/ItemSheets/Bewaffnung.hbs" }, Gegenstand: { template: "systems/dsa-4th-edition/src/ItemSheets/Gegenstand.hbs" }, Ruestung: { template: "systems/dsa-4th-edition/src/ItemSheets/Ruestung.hbs" }, }; + static DEFAULT_OPTIONS = { + position: { width: "600", height: "auto" }, + }; + + tabGroups = { primary: "tab1" }; + _configureRenderOptions(options) { super._configureRenderOptions(options); options.parts = [ this.options.document.type ]; } - - _prepareContext(options) { - return { - editable: true, - item: this.options.document, - }; - } }