begins implementing sidebar elements for pinned Items

pull/65/head
macniel 2025-11-13 22:40:48 +01:00
parent 47280f7216
commit 6d366188ea
20 changed files with 170 additions and 32 deletions

View File

@ -16,7 +16,12 @@ function loadPartials(hbs) {
'systems/DSA_4-1/templates/ui/partial-equipment-button.hbs', 'systems/DSA_4-1/templates/ui/partial-equipment-button.hbs',
'systems/DSA_4-1/templates/ui/partial-array-editor.hbs', 'systems/DSA_4-1/templates/ui/partial-array-editor.hbs',
'systems/DSA_4-1/templates/actor/character/tab-set.hbs', 'systems/DSA_4-1/templates/actor/character/tab-set.hbs',
'systems/DSA_4-1/templates/dialog/liturgy-dialog.hbs' 'systems/DSA_4-1/templates/dialog/liturgy-dialog.hbs',
'systems/DSA_4-1/templates/ui/partial-mini-rollable-button.hbs',
'systems/DSA_4-1/templates/ui/partial-mini-rollable-liturgy-button.hbs',
'systems/DSA_4-1/templates/ui/partial-mini-rollable-weaponskill-button.hbs',
'systems/DSA_4-1/templates/ui/partial-mini-rollable-language-button.hbs',
'systems/DSA_4-1/templates/ui/partial-mini-rollable-spell-button.hbs',
]).then(resolve); ]).then(resolve);
}) })

View File

@ -21,7 +21,8 @@ export default {
description: item.system.description, description: item.system.description,
isAdvantage: !item.system.nachteil, isAdvantage: !item.system.nachteil,
isDisadvantage: item.system.nachteil, isDisadvantage: item.system.nachteil,
isBadAttribute: item.system.schlechteEigenschaft isBadAttribute: item.system.schlechteEigenschaft,
fav: item.getFlag("DSA_4-1", "favourite")
}) })
} else { } else {
context.flaws.push({ context.flaws.push({
@ -32,7 +33,8 @@ export default {
description: item.system.description, description: item.system.description,
isAdvantage: !item.system.nachteil, isAdvantage: !item.system.nachteil,
isDisadvantage: item.system.nachteil, isDisadvantage: item.system.nachteil,
isBadAttribute: item.system.schlechteEigenschaft isBadAttribute: item.system.schlechteEigenschaft,
fav: item.getFlag("DSA_4-1", "favourite")
}) })
} }
} }
@ -43,6 +45,7 @@ export default {
context.specialAbilities.push({ context.specialAbilities.push({
id: item._id, id: item._id,
name: item.system.value ? item.system.value : item.name, name: item.system.value ? item.system.value : item.name,
fav: item.getFlag("DSA_4-1", "favourite")
}); });
} }
); );

View File

@ -68,6 +68,7 @@ export default {
lkpReq: lkp, lkpReq: lkp,
lkpMod: mod, lkpMod: mod,
costKaP, costKaP,
fav: item.getFlag("DSA_4-1", "favourite"),
rank: index, // get effective liturgy rank based on deity rank: index, // get effective liturgy rank based on deity
liturgiekenntnis: deity, liturgiekenntnis: deity,
}) })

View File

@ -51,7 +51,8 @@ export default {
id: item._id, id: item._id,
at: item.system.at, at: item.system.at,
pa: item.system.pa, pa: item.system.pa,
komplexität: item.system.komplexität komplexität: item.system.komplexität,
fav: item.getFlag("DSA_4-1", "favourite")
}; };
if (talentGruppe === "Kampf") { if (talentGruppe === "Kampf") {

View File

@ -42,6 +42,7 @@ export default {
eigenschaft1: werte[0].name, eigenschaft1: werte[0].name,
eigenschaft2: werte[1].name, eigenschaft2: werte[1].name,
eigenschaft3: werte[2].name, eigenschaft3: werte[2].name,
fav: item.getFlag("DSA_4-1", "favourite")
}) })
}) })

View File

@ -47,6 +47,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
openSpeciesDocument: CharacterSheet.#openSpeciesDocument, openSpeciesDocument: CharacterSheet.#openSpeciesDocument,
openCombatAction: CharacterSheet.#openCombatAction, openCombatAction: CharacterSheet.#openCombatAction,
openLiturgyDialog: CharacterSheet.#openLiturgyDialog, openLiturgyDialog: CharacterSheet.#openLiturgyDialog,
openSpellDialog: CharacterSheet.#openSpellDialog,
progressCooldown: CharacterSheet.#progressCooldown, progressCooldown: CharacterSheet.#progressCooldown,
cancelCooldown: CharacterSheet.#cancelCooldown, cancelCooldown: CharacterSheet.#cancelCooldown,
activateCooldown: CharacterSheet.#activateCooldown, activateCooldown: CharacterSheet.#activateCooldown,
@ -54,7 +55,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
removeEffect: CharacterSheet.#removeEffect, removeEffect: CharacterSheet.#removeEffect,
rollDamage: CharacterSheet.#rollDamage, rollDamage: CharacterSheet.#rollDamage,
openItemBrowser: CharacterSheet.#openItemBrowser, openItemBrowser: CharacterSheet.#openItemBrowser,
newItem: CharacterSheet.#addNewItem newItem: CharacterSheet.#addNewItem,
toggleFav: CharacterSheet.#toggleFav,
} }
} }
@ -233,6 +235,12 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
new LiturgyDialog(this.document, lkp, id, deity).render(true) new LiturgyDialog(this.document, lkp, id, deity).render(true)
} }
static #openSpellDialog(event, target) {
const {itemId} = target.dataset
console.log(itemId)
this.document.itemTypes["Spell"]?.find(p => p.id === itemId)?.sheet.render(true)
}
static #startResting(event, target) { static #startResting(event, target) {
const dialog = new RestingDialog(this.document) const dialog = new RestingDialog(this.document)
@ -267,6 +275,16 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
items[0].sheet.render(true) items[0].sheet.render(true)
} }
static async #toggleFav(event, target) {
const {itemId} = target.dataset
const doc = this.document.items.find(p => p.id === itemId)
if (doc) {
const previous = doc.getFlag("DSA_4-1", "favourite") ?? false
doc.setFlag("DSA_4-1", "favourite", !previous)
}
}
_configureRenderOptions(options) { _configureRenderOptions(options) {
super._configureRenderOptions(options) super._configureRenderOptions(options)
@ -277,6 +295,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
return options return options
} }
/** /**
* Handle form submission * Handle form submission
* @this {AdvantageSheet} * @this {AdvantageSheet}
@ -485,6 +504,44 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
}) })
} }
context.favourites = actorData.items.filter(item => item.getFlag("DSA_4-1", "favourite") === true).map(item => {
let id = item.id
let t = null
switch (item.type) {
case "Spell":
t = "systems/DSA_4-1/templates/ui/partial-mini-rollable-spell-button.hbs"
break;
case "Skill":
switch (item.system.gruppe) {
case "Kampf":
t = "systems/DSA_4-1/templates/ui/partial-mini-rollable-weaponskill-button.hbs"
break;
case "Sprachen":
t = "systems/DSA_4-1/templates/ui/partial-mini-rollable-language-button.hbs"
break;
default:
t = "systems/DSA_4-1/templates/ui/partial-mini-rollable-button.hbs"
}
break;
case "Liturgy":
t = "systems/DSA_4-1/templates/ui/partial-mini-rollable-liturgy-button.hbs"
break;
default:
t = null
}
let obj = Object.assign({}, item)
obj.fav = item.getFlag("DSA_4-1", "favourite")
obj.id = id
if (t) {
obj.template = t
}
return obj
})
context.cooldowns = actorData.system.cooldowns ?? [] context.cooldowns = actorData.system.cooldowns ?? []
context.cooldowns.forEach(cooldown => { context.cooldowns.forEach(cooldown => {
let weapon = null let weapon = null

View File

@ -36,7 +36,7 @@ $rollable_colours_font: (
display: block; display: block;
height: 32px; height: 32px;
position: relative; position: relative;
margin: 4px; margin: 4px 32px 4px 4px;
.die { .die {
width: 32px; width: 32px;
@ -69,6 +69,24 @@ $rollable_colours_font: (
top: 6px; top: 6px;
} }
} }
&:active {
scale: 0.8;
.value {
img {
position: absolute;
width: 20px;
height: 20px;
left: 4px;
top: 7px;
}
}
}
} }
.container { .container {
@ -122,6 +140,18 @@ $rollable_colours_font: (
} }
} }
} }
.outside {
position: absolute;
right: -24px;
top: 8px;
bottom: 8px;
z-index: 3;
&:hover {
text-shadow: 0 0 10px rgb(255 0 0);
}
}
} }
// interactivity // interactivity
@ -135,23 +165,7 @@ $rollable_colours_font: (
} }
&:active {
.die {
scale: 0.8;
.value {
img {
position: absolute;
width: 20px;
height: 20px;
left: 4px;
top: 7px;
}
}
}
}
} }
} }

View File

@ -99,6 +99,13 @@
</div> </div>
{{/each}} {{/each}}
<section class="favourites">
<h3>Angepinnt</h3>
{{#each this.favourites}}
{{> (lookup this "template") this}}
{{/each}}
</section>
<section class="cooldowns"> <section class="cooldowns">
<h3>Abklingzeiten</h3> <h3>Abklingzeiten</h3>
{{#each this.cooldowns}} {{#each this.cooldowns}}

View File

@ -33,7 +33,7 @@
<td class="spell rollable"> <td class="spell rollable">
{{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }} {{> 'systems/DSA_4-1/templates/ui/partial-die.hbs' }}
</td> </td>
<td class="clickable" data-id="{{this.id}}" data-action="openActorSheet"> <td class="clickable" data-item-id="{{this.id}}" data-action="openSpellDialog">
<span>{{this.name}}</span></td> <span>{{this.name}}</span></td>
<td>{{this.eigenschaft1}}</td> <td>{{this.eigenschaft1}}</td>
<td>{{this.eigenschaft2}}</td> <td>{{this.eigenschaft2}}</td>
@ -43,6 +43,15 @@
<ul class="merkmal-list">{{#each this.merkmal}} <ul class="merkmal-list">{{#each this.merkmal}}
<li>{{this}}</li>{{/each}}</ul> <li>{{this}}</li>{{/each}}</ul>
</td> </td>
<td>
<div data-action="toggleFav" data-item-id="{{this.id}}">
{{#if this.fav}}
<i class="fa-solid fa-star"></i>
{{else}}
<i class="fa-regular fa-star"></i>
{{/if}}
</div>
</td>
</tr> </tr>
{{/each}} {{/each}}
</tbody> </tbody>

View File

@ -1,7 +1,7 @@
<section class="tab {{tabs.commonality.id}} {{tabs.commonality.cssClass}}" <section class="tab {{tabs.commonality.id}} {{tabs.commonality.cssClass}}"
data-tab="{{tabs.commonality.id}}" data-tab="{{tabs.commonality.id}}"
data-group="{{tabs.commonality.group}}"> data-group="{{tabs.commonality.group}}">
<div>
<div> <div>
<label>Komplexität <label>Komplexität
<input type="text" name="system.komplexität" value="{{system.komplexität}}"/> <input type="text" name="system.komplexität" value="{{system.komplexität}}"/>
@ -17,5 +17,5 @@
<input type="text" name="system.info" value="{{system.info}}"/> <input type="text" name="system.info" value="{{system.info}}"/>
</label> </label>
</div> </div>
</div>
</section> </section>

View File

@ -1,11 +1,11 @@
<section class="tab {{tabs.meta.id}} {{tabs.meta.cssClass}}" <section class="tab {{tabs.meta.id}} {{tabs.meta.cssClass}}"
data-tab="{{tabs.meta.id}}" data-tab="{{tabs.meta.id}}"
data-group="{{tabs.meta.group}}"> data-group="{{tabs.meta.group}}">
<div>
<div> <div>
<label>Name <label>Name
<input type="text" name="system.name.value" <input type="text" name="name"
value="{{system.attributeReference1.value}}"/> value="{{name}}"/>
</label> </label>
</div> </div>
<div> <div>
@ -14,7 +14,7 @@
value="{{system.probe.[0]}}"/> value="{{system.probe.[0]}}"/>
<input type="text" name="system.probe.1" <input type="text" name="system.probe.1"
value="{{system.probe.[1]}}"/> value="{{system.probe.[1]}}"/>
<input type="text" name="system.probe[2].value" <input type="text" name="system.probe.2"
value="{{system.probe.[2]}}"/> value="{{system.probe.[2]}}"/>
</label> </label>
</div> </div>
@ -44,5 +44,5 @@
</label> </label>
</div> </div>
</div>
</section> </section>

View File

@ -1,7 +1,7 @@
<section class="tab {{tabs.variants.id}} {{tabs.variants.cssClass}}" <section class="tab {{tabs.variants.id}} {{tabs.variants.cssClass}}"
data-tab="{{tabs.variants.id}}" data-tab="{{tabs.variants.id}}"
data-group="{{tabs.variants.group}}"> data-group="{{tabs.variants.group}}">
<div>
<div> <div>
<label>Modifikationen <label>Modifikationen
<input type="text" name="system.modifikationen" value="{{system.modifikationen}}"/> <input type="text" name="system.modifikationen" value="{{system.modifikationen}}"/>
@ -22,5 +22,5 @@
<input type="text" name="system.antimagie" value="{{system.antimagie}}"/> <input type="text" name="system.antimagie" value="{{system.antimagie}}"/>
</label> </label>
</div> </div>
</div>
</section> </section>

View File

@ -0,0 +1,3 @@
<div class="mini-skill" data-action="rollSkill" data-id="{{this.id}}">
{{this.name}}
</div>

View File

@ -0,0 +1,3 @@
<div class="mini-language-skill" data-action="rollSkill" data-id="{{this.id}}">
{{this.name}}
</div>

View File

@ -0,0 +1,3 @@
<div class="mini-liturgy">
{{this.name}}
</div>

View File

@ -0,0 +1,3 @@
<div class="mini-spell" data-action="openSpellDialog" data-item-id="{{this.id}}">
{{this.name}}
</div>

View File

@ -0,0 +1,7 @@
<div class="mini-weaponskill" data-action="rollCombatSkill" data-id="{{this._id}}"
data-tooltip="{{this.name}}<br/>{{#if this.system.at}}AT: {{this.system.at}} {{/if}}{{#if
this.system.pa}}PA: {{this.system.pa}}{{/if}}<hr/><i class='fa-solid fa-computer-mouse'></i>: Attacke<br/><kbd>Shift</kbd>+<i class='fa-solid fa-computer-mouse'></i>: Parrieren">
<div class="container">
<span class="name" data-id="{{this.id}}">{{this.name}}</span>
</div>
</div>

View File

@ -21,4 +21,11 @@
{{/each}} {{/each}}
</div> </div>
</div> </div>
<div class="outside" data-action="toggleFav" data-item-id="{{this.id}}">
{{#if this.fav}}
<i class="fa-solid fa-star"></i>
{{else}}
<i class="fa-regular fa-star"></i>
{{/if}}
</div>
</div> </div>

View File

@ -23,4 +23,11 @@
{{/each}} {{/each}}
</div> </div>
</div> </div>
<div class="outside" data-action="toggleFav" data-item-id="{{this.id}}">
{{#if this.fav}}
<i class="fa-solid fa-star"></i>
{{else}}
<i class="fa-regular fa-star"></i>
{{/if}}
</div>
</div> </div>

View File

@ -24,4 +24,11 @@
{{/if}} {{/if}}
</div> </div>
</div> </div>
<div class="outside" data-action="toggleFav" data-item-id="{{this.id}}">
{{#if this.fav}}
<i class="fa-solid fa-star"></i>
{{else}}
<i class="fa-regular fa-star"></i>
{{/if}}
</div>
</div> </div>