Working on the spells panel, which resulted in a lot of weird structural changes that aren't *really* functional yet

This commit is contained in:
Oliver-Akins 2024-01-07 22:27:26 -07:00
parent 227029ffcd
commit dfc51a5899
31 changed files with 499 additions and 84 deletions

View file

@ -1,35 +1,44 @@
{{#> dotdungeon.panel class="spells" title="dotdungeon.actor.pc.panel.spells"}}
{{#each system.spells as | spell |}}
<details {{dd-expanded ../meta.expanded @key}}>
<summary data-collapse-id="{{@key}}">
{{spell.name}} (Cost: {{spell.cost}})
{{#each items.spell as | spell |}}
<details {{dd-expanded ../meta.expanded spell.uuid}}>
<summary data-collapse-id="{{spell.uuid}}">
<span class="flex-grow" style="flex-grow: 1">
{{spell.name}}
{{#if spell.system.cost }}
(Cost: {{spell.system.cost}})
{{/if}}
</span>
</summary>
<div class="spell">
<div class="spell__name">
<label for="{{meta.idp}}-{{@key}}-name">Name</label>
<label for="{{spell.uuid}}-name">Name</label>
<input
type="text"
id="{{meta.idp}}-{{@key}}-name"
name="system.spells.{{@key}}.name"
id="{{spell.uuid}}-name"
value="{{spell.name}}"
data-embedded-update="name"
data-embedded-id="{{spell.uuid}}"
>
</div>
<div class="spell__cost">
<label for="{{meta.idp}}-{{@key}}-cost"></label>
<label for="{{spell.uuid}}-cost">Cost</label>
<input
type="text"
id="{{meta.idp}}-{{@key}}-cost"
name="system.spells.{{@key}}.cost"
value="{{spell.cost}}"
id="{{spell.uuid}}-cost"
value="{{spell.system.cost}}"
data-embedded-update="system.cost"
data-embedded-id="{{spell.uuid}}"
>
</div>
<div class="spell__description">
{{spell.description}}
</div>
<div class="flex-row flex-end">
<button>
Delete
</button>
<label for="{{spell.uuid}}-description"></label>
<textarea
id="{{spell.uuid}}-description"
data-embedded-update="system.description"
data-embedded-id="{{spell.uuid}}"
>{{spell.system.description}}</textarea>
</div>
</div>
</details>
@ -37,10 +46,9 @@
<p>
You have no spells yet!
</p>
<div class="debug-data">
{{dd-stringify system.spells}}
</div>
{{/each}}
<div class="flex-row">
<button
class="primary add-spell"

View file

@ -55,6 +55,11 @@
<pre><code>{{dd-stringify CONFIG}}</code></pre>
</div>
<hr>
<div>
Items:
<pre><code>{{dd-stringify items}}</code></pre>
</div>
<hr>
<div>
System:
<pre><code>{{dd-stringify system}}</code></pre>

View file

@ -15,7 +15,6 @@
name="system.deactivateAfter"
value="{{system.deactivateAfter}}"
>
{{dd-toFriendlyDuration system.deactivateAfter}}
</label>
<label>
{{localize "dotdungeon.item.aspect.description"}}:

27
templates/items/spell.hbs Normal file
View file

@ -0,0 +1,27 @@
<form autocomplete="off" class="item--spell">
<h2>
<input
type="text"
placeholder="{{localize "dotdungeon.item.spell.name.placeholder"}}"
name="name"
value="{{item.name}}"
aria-label="{{localize "dotdungeon.item.spell.aria.name"}}"
>
</h2>
<label>
{{localize "dotdungeon.item.spell.cost.label"}}
<input
type="number"
name="system.cost"
value="{{system.cost}}"
aria-label="{{localize "dotdungeon.item.spell.aria.cost"}}"
>
</label>
<label>
{{localize "dotdungeon.item.spell.description.label"}}:
<textarea
name="system.description"
aria-description="{{localize "dotdungeon.item.spell.aria.description"}}"
>{{system.description}}</textarea>
</label>
</form>