mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-24 11:29:54 +02:00
Compare commits
No commits in common. "70388dbd736631679fc8c22d17d43f0b8912f7d9" and "8c6a470d84d80ac70966e7b0c985daf396637c70" have entirely different histories.
70388dbd73
...
8c6a470d84
9 changed files with 38 additions and 74 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { getWorldActor, itemAbleRollParse, triggerChatRollFx } from '../../../helpers/utils.mjs';
|
import { itemAbleRollParse, triggerChatRollFx } from '../../../helpers/utils.mjs';
|
||||||
import FormulaField from '../formulaField.mjs';
|
import FormulaField from '../formulaField.mjs';
|
||||||
|
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
@ -42,7 +42,7 @@ export default class DHSummonField extends fields.ArrayField {
|
||||||
const count = roll.total;
|
const count = roll.total;
|
||||||
if (!roll.isDeterministic) rolls.push(roll);
|
if (!roll.isDeterministic) rolls.push(roll);
|
||||||
|
|
||||||
const actor = await getWorldActor(await foundry.utils.fromUuid(summon.actorUUID));
|
const actor = await DHSummonField.getWorldActor(await foundry.utils.fromUuid(summon.actorUUID));
|
||||||
/* Extending summon data in memory so it's available in actionField.toChat. Think it's harmless, but ugly. Could maybe find a better way. */
|
/* Extending summon data in memory so it's available in actionField.toChat. Think it's harmless, but ugly. Could maybe find a better way. */
|
||||||
summon.actor = actor.toObject();
|
summon.actor = actor.toObject();
|
||||||
|
|
||||||
|
|
@ -62,6 +62,19 @@ export default class DHSummonField extends fields.ArrayField {
|
||||||
DHSummonField.handleSummon(summonData, this.actor);
|
DHSummonField.handleSummon(summonData, this.actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for any available instances of the actor present in the world if we're missing artwork in the compendium. If none exists, create one. */
|
||||||
|
static async getWorldActor(baseActor) {
|
||||||
|
const dataType = game.system.api.data.actors[`Dh${baseActor.type.capitalize()}`];
|
||||||
|
if (baseActor.inCompendium && dataType && baseActor.img === dataType.DEFAULT_ICON) {
|
||||||
|
const worldActorCopy = game.actors.find(x => x.name === baseActor.name);
|
||||||
|
if (worldActorCopy) return worldActorCopy;
|
||||||
|
|
||||||
|
return await game.system.api.documents.DhpActor.create(baseActor.toObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseActor;
|
||||||
|
}
|
||||||
|
|
||||||
static async handleSummon(summonData, actionActor) {
|
static async handleSummon(summonData, actionActor) {
|
||||||
await CONFIG.ux.TokenManager.createTokensWithPreview(summonData, { elevation: actionActor.token?.elevation });
|
await CONFIG.ux.TokenManager.createTokensWithPreview(summonData, { elevation: actionActor.token?.elevation });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -889,27 +889,4 @@ export async function triggerChatRollFx(rolls, options = { whisper: false, blind
|
||||||
export function shouldUseHopeFearAutomation(options = { gmAsPlayer: true }) {
|
export function shouldUseHopeFearAutomation(options = { gmAsPlayer: true }) {
|
||||||
const { hopeFear } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
const { hopeFear } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
||||||
return (!game.user.isGM || options.gmAsPlayer) ? hopeFear.players : hopeFear.gm;
|
return (!game.user.isGM || options.gmAsPlayer) ? hopeFear.players : hopeFear.gm;
|
||||||
}
|
|
||||||
|
|
||||||
export async function getWorldActor(baseActor) {
|
|
||||||
if (baseActor.inCompendium) {
|
|
||||||
const worldActorCopy = game.actors.find(x =>
|
|
||||||
x._stats.compendiumSource === baseActor.uuid &&
|
|
||||||
(!x.prototypeToken.actorLink || x.name === baseActor.name)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (worldActorCopy)
|
|
||||||
return worldActorCopy;
|
|
||||||
|
|
||||||
const baseActorData = baseActor;
|
|
||||||
return await game.system.api.documents.DhpActor.create({
|
|
||||||
...baseActorData,
|
|
||||||
_stats: {
|
|
||||||
...baseActorData._stats,
|
|
||||||
compendiumSource: baseActor.uuid
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseActor;
|
|
||||||
}
|
}
|
||||||
|
|
@ -12,9 +12,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.daggerheart.dh-style {
|
.daggerheart.dh-style {
|
||||||
/** Not an actual scrollbar width (it can't be configured on all browsers) but actually a compensation value for scrollbar gutter purposes */
|
|
||||||
--scrollbar-width: 10px;
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
|
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
@import '../utils/colors.less';
|
@import '../utils/colors.less';
|
||||||
@import '../utils/fonts.less';
|
@import '../utils/fonts.less';
|
||||||
@import '../utils/mixin.less';
|
|
||||||
|
|
||||||
.application.daggerheart {
|
.application.daggerheart {
|
||||||
prose-mirror {
|
prose-mirror {
|
||||||
|
|
@ -13,7 +12,6 @@
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
.editor-content {
|
.editor-content {
|
||||||
.with-scroll-shadows();
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: var(--font-size-32);
|
font-size: var(--font-size-32);
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +42,7 @@
|
||||||
ul {
|
ul {
|
||||||
list-style: disc;
|
list-style: disc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fixes centering and makes it not render over scrollbar
|
// Fixes centering and makes it not render over scrollbar
|
||||||
&:hover button.toggle:enabled {
|
&:hover button.toggle:enabled {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -54,37 +54,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab.notes.active {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
margin-top: -10px; // will be removed once tab-navigation bottom margin is removed on all actor sheets
|
|
||||||
scrollbar-gutter: unset;
|
|
||||||
|
|
||||||
// Add padding around top level level prosemirrors used for note tabs
|
|
||||||
> prose-mirror {
|
|
||||||
@right-padding: calc(16px - var(--scrollbar-width));
|
|
||||||
.editor-content {
|
|
||||||
scrollbar-gutter: stable;
|
|
||||||
padding-right: @right-padding;
|
|
||||||
}
|
|
||||||
&.inactive {
|
|
||||||
button.toggle {
|
|
||||||
top: 16px;
|
|
||||||
}
|
|
||||||
.editor-content {
|
|
||||||
padding: 16px @right-padding 4px 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.active {
|
|
||||||
padding: 8px 0 4px 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.artist-attribution {
|
|
||||||
padding-left: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-section {
|
.search-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
<section
|
<section
|
||||||
class="tab {{tabs.notes.cssClass}} {{tabs.notes.id}}"
|
class='tab {{tabs.notes.cssClass}} {{tabs.notes.id}}'
|
||||||
data-tab="{{tabs.notes.id}}"
|
data-tab='{{tabs.notes.id}}'
|
||||||
data-group="{{tabs.notes.group}}"
|
data-group='{{tabs.notes.group}}'
|
||||||
>
|
>
|
||||||
{{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
|
<fieldset class="fit-height">
|
||||||
|
<legend>{{localize tabs.notes.label}}</legend>
|
||||||
|
{{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
{{#if (and showAttribution document.system.attribution.artist)}}
|
{{#if (and showAttribution document.system.attribution.artist)}}
|
||||||
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
|
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
data-tab='{{tabs.notes.id}}'
|
data-tab='{{tabs.notes.id}}'
|
||||||
data-group='{{tabs.notes.group}}'
|
data-group='{{tabs.notes.group}}'
|
||||||
>
|
>
|
||||||
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
<fieldset class="fit-height">
|
||||||
|
<legend>{{localize tabs.notes.label}}</legend>
|
||||||
|
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
{{#if (and showAttribution document.system.attribution.artist)}}
|
{{#if (and showAttribution document.system.attribution.artist)}}
|
||||||
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
|
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<section
|
<section
|
||||||
class="tab {{tabs.notes.cssClass}} {{tabs.notes.id}}"
|
class='tab {{tabs.notes.cssClass}} {{tabs.notes.id}}'
|
||||||
data-tab="{{tabs.notes.id}}"
|
data-tab='{{tabs.notes.id}}'
|
||||||
data-group="{{tabs.notes.group}}"
|
data-group='{{tabs.notes.group}}'
|
||||||
>
|
>
|
||||||
{{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
|
{{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
<section
|
<section
|
||||||
class="tab {{tabs.notes.cssClass}} {{tabs.notes.id}}"
|
class='tab {{tabs.notes.cssClass}} {{tabs.notes.id}}'
|
||||||
data-tab="{{tabs.notes.id}}"
|
data-tab='{{tabs.notes.id}}'
|
||||||
data-group="{{tabs.notes.group}}"
|
data-group='{{tabs.notes.group}}'
|
||||||
>
|
>
|
||||||
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
<fieldset class="fit-height">
|
||||||
|
<legend>{{localize tabs.notes.label}}</legend>
|
||||||
|
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
||||||
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue