Skip to content

Commit

Permalink
Improved character sheet printing
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaumRystra committed Oct 13, 2024
1 parent efc52b4 commit f37149f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 44 deletions.
1 change: 0 additions & 1 deletion app/imports/client/ui/components/ColumnLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default {
.column-layout>*,
.column-layout>span>div {
display: inline-block;
break-inside: avoid;
page-break-inside: avoid;
margin-bottom: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default {
name: 'characterSheet',
params: { id: this.creatureId},
});
return new URL(props?.href, document.baseURI).href
return new URL(props?.href, 'https://dicecloud.com').href
},
level() {
return this.variables?.level?.value;
Expand Down Expand Up @@ -139,7 +139,6 @@ export default {
].sort((a, b) => a.order - b.order);
},
},
// @ts-ignore reactiveProvide isn't defined on vue
reactiveProvide: {
name: 'context',
include: ['creatureId', 'editPermission'],
Expand Down Expand Up @@ -278,7 +277,8 @@ export default {
}
.character-sheet-printed .column-layout>div {
position:relative;
position: relative;
display: inline-block;
margin-top: 4px;
margin-bottom: 4px;
}
Expand Down Expand Up @@ -382,7 +382,8 @@ export default {
margin: 8mm;
}
body {
margin: 0;
margin: 0;
padding: 2mm;
}
.character-sheet-printed .page {
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export default {
organize: false,
}
},
// @ts-ignore Meteor isn't defined on vue
meteor: {
containers() {
return CreatureProperties.find({
Expand All @@ -128,7 +127,7 @@ export default {
containersWithoutAncestorContainers() {
return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.containers),
$nor: [getFilter.descendantsOfAll(this.containers)],
type: 'container',
removed: { $ne: true },
inactive: { $ne: true },
Expand All @@ -151,7 +150,7 @@ export default {
carriedItems() {
return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.containers),
$nor: [getFilter.descendantsOfAll(this.containers)],
type: 'item',
equipped: { $ne: true },
removed: { $ne: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default {
organize: false,
}
},
// @ts-ignore-error Meteor not defined on vue
meteor: {
spellLists() {
return CreatureProperties.find({
Expand All @@ -76,7 +75,7 @@ export default {
spellsWithoutList() {
return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.spellLists),
$nor: [getFilter.descendantsOfAll(this.spellLists)],
type: 'spell',
removed: { $ne: true },
deactivatedByAncestor: { $ne: true },
Expand All @@ -91,7 +90,7 @@ export default {
spellListsWithoutAncestorSpellLists() {
return CreatureProperties.find({
...getFilter.descendantsOfRoot(this.creatureId),
$not: getFilter.descendantsOfAll(this.spellLists),
$nor: [getFilter.descendantsOfAll(this.spellLists)],
type: 'spellList',
removed: { $ne: true },
inactive: { $ne: true },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="html">
<div class="stats">
<div
class="d-flex wrap justify-space-between px-2 pt-3 pb-1"
class="d-flex wrap justify-space-between px-2 pt-3 pb-2"
style="page-break-after: avoid"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
:class="cardClasses"
>
<div class="d-flex align-center mb-2">
<div class="roll-bonus">
<template v-if="!onHitDamage && rollBonus">
{{ rollBonus }}
</template>
</div>
<div class="action-title text-center flex-grow-1">
{{ model.name || propertyName }}
</div>
Expand Down Expand Up @@ -51,28 +46,21 @@
<markdown-text :markdown="model.summary.value || model.summary.text" />
</template>
<div
v-if="onHitDamage"
v-if="rollBonus"
class="roll-bonus"
>
<span class="damage">
<span class="to-hit ml-2">
{{ rollBonus }}
</span>
<span>
to hit
</span>
</div>
<div v-if="onHitDamage">
<span class="damage">
{{ onHitDamage.damage }}
</span>
<span>
{{ onHitDamage.suffix }}
</span>
</div>
<tree-node-list
v-else-if="children && children.length"
v-if="children && children.length"
start-expanded
show-external-details
:children="children"
:root="{id: model._id, collection: 'creatureProperties'}"
@selected="e => $emit('sub-click', e)"
/>
</div>
Expand Down Expand Up @@ -151,21 +139,6 @@ export default {
'long': 'Long Action'
}[this.model.actionType] || this.model.actionType
},
onHitDamage() {
/**
* Only match a property who has exactly one to-hit child with one damage under that
*/
if (this.children?.length !== 1) return;
if (this.children[0]?.node?.type !== 'branch') return;
if (this.children[0].children?.length !== 1) return;
if (this.children[0].children[0]?.node?.type !== 'damage') return;
if (this.children[0].children[0].children?.length !== 0) return;
const damage = this.children[0].children[0]?.node;
return {
damage: damage.value,
suffix: damage.damageType + (damage.damageType !== 'healing' ? ' damage ' : '')
};
},
},
meteor: {
children() {
Expand Down Expand Up @@ -205,6 +178,10 @@ export default {
transform 0.075s ease;
}
.roll-bonus {
color: rgba(0, 0, 0, 0.87);
}
.to-hit {
color: rgba(0, 0, 0, 0.54);
font-size: 18pt;
flex-basis: 24px;
}
Expand Down

0 comments on commit f37149f

Please sign in to comment.