mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-25 20:09:55 +02:00
Compare commits
No commits in common. "2b725e876018a7f519e28d8e47c210966f5c632d" and "f02e97f0cdf6483c63e33aeb11ef915e69b55c72" have entirely different histories.
2b725e8760
...
f02e97f0cd
14 changed files with 219 additions and 231 deletions
|
|
@ -603,7 +603,7 @@ export default function DHApplicationMixin(Base) {
|
||||||
const doc = await fromUuid(itemUuid);
|
const doc = await fromUuid(itemUuid);
|
||||||
|
|
||||||
//get inventory-item description element
|
//get inventory-item description element
|
||||||
const descriptionElement = el.querySelector('.inventory-description');
|
const descriptionElement = el.querySelector('.invetory-description');
|
||||||
if (!doc || !descriptionElement) continue;
|
if (!doc || !descriptionElement) continue;
|
||||||
|
|
||||||
// localize the description (idk if it's still necessary)
|
// localize the description (idk if it's still necessary)
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasDescription() {
|
|
||||||
return Boolean(this.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
|
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
|
||||||
*
|
*
|
||||||
|
|
@ -451,15 +447,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
|
|
||||||
static migrateData(source) {
|
static migrateData(source) {
|
||||||
if (source.damage?.parts && Array.isArray(source.damage.parts)) {
|
if (source.damage?.parts && Array.isArray(source.damage.parts)) {
|
||||||
let hitPointsExists = source.damage.parts.some(x => x.applyTo === 'hitPoints');
|
|
||||||
source.damage.parts = source.damage.parts.reduce((acc, part) => {
|
source.damage.parts = source.damage.parts.reduce((acc, part) => {
|
||||||
if (!part.applyTo && hitPointsExists) return acc;
|
|
||||||
|
|
||||||
if (!part.applyTo) {
|
|
||||||
hitPointsExists = true;
|
|
||||||
part.applyTo = 'hitPoints';
|
|
||||||
}
|
|
||||||
|
|
||||||
acc[part.applyTo] = part;
|
acc[part.applyTo] = part;
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ export default class DhpAdversary extends DhCreature {
|
||||||
parts: {
|
parts: {
|
||||||
hitPoints: {
|
hitPoints: {
|
||||||
type: ['physical'],
|
type: ['physical'],
|
||||||
applyTo: 'hitPoints',
|
|
||||||
value: {
|
value: {
|
||||||
multiplier: 'flat'
|
multiplier: 'flat'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,6 @@ export default class DhCharacter extends DhCreature {
|
||||||
parts: {
|
parts: {
|
||||||
hitPoints: {
|
hitPoints: {
|
||||||
type: ['physical'],
|
type: ['physical'],
|
||||||
applyTo: 'hitPoints',
|
|
||||||
value: {
|
value: {
|
||||||
custom: {
|
custom: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ export default class DhCompanion extends DhCreature {
|
||||||
parts: {
|
parts: {
|
||||||
hitPoints: {
|
hitPoints: {
|
||||||
type: ['physical'],
|
type: ['physical'],
|
||||||
applyTo: 'hitPoints',
|
|
||||||
value: {
|
value: {
|
||||||
dice: 'd6',
|
dice: 'd6',
|
||||||
multiplier: 'prof'
|
multiplier: 'prof'
|
||||||
|
|
|
||||||
|
|
@ -28,39 +28,6 @@ export default class DhCountdowns extends foundry.abstract.DataModel {
|
||||||
for (const countdownKey of changedCountdowns)
|
for (const countdownKey of changedCountdowns)
|
||||||
foundry.ui.countdowns.changedCountdownsForAnimation.add(countdownKey);
|
foundry.ui.countdowns.changedCountdownsForAnimation.add(countdownKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static migrateData(source) {
|
|
||||||
const migrateOldCountdowns = (data, type) => {
|
|
||||||
for (const key of Object.keys(data.countdowns)) {
|
|
||||||
const countdown = data.countdowns[key];
|
|
||||||
source.countdowns[key] = {
|
|
||||||
...countdown,
|
|
||||||
type: type,
|
|
||||||
ownership: Object.keys(countdown.ownership.players).reduce((acc, key) => {
|
|
||||||
acc[key] =
|
|
||||||
countdown.ownership.players[key].type === 1 ? 2 : countdown.ownership.players[key].type;
|
|
||||||
return acc;
|
|
||||||
}, {}),
|
|
||||||
progress: {
|
|
||||||
...countdown.progress,
|
|
||||||
type: countdown.progress.type.value
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
source[type] = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (source.narrative) {
|
|
||||||
migrateOldCountdowns(source.narrative, 'narrative');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (source.encounter) {
|
|
||||||
migrateOldCountdowns(source.encounter, 'encounter');
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.migrateData(source);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DhCountdown extends foundry.abstract.DataModel {
|
export class DhCountdown extends foundry.abstract.DataModel {
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,6 @@ export default class DHArmor extends AttachableItem {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get itemFeatures() {
|
|
||||||
return this.armorFeatures;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData() {
|
async getDescriptionData() {
|
||||||
const baseDescription = this.description;
|
const baseDescription = this.description;
|
||||||
|
|
@ -173,4 +169,8 @@ export default class DHArmor extends AttachableItem {
|
||||||
const labels = [`${game.i18n.localize('DAGGERHEART.ITEMS.Armor.baseScore')}: ${this.armor.max}`];
|
const labels = [`${game.i18n.localize('DAGGERHEART.ITEMS.Armor.baseScore')}: ${this.armor.max}`];
|
||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get itemFeatures() {
|
||||||
|
return this.armorFeatures;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,6 @@ export default class DHWeapon extends AttachableItem {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get itemFeatures() {
|
|
||||||
return this.weaponFeatures;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData() {
|
async getDescriptionData() {
|
||||||
const baseDescription = this.description;
|
const baseDescription = this.description;
|
||||||
|
|
@ -273,4 +269,8 @@ export default class DHWeapon extends AttachableItem {
|
||||||
|
|
||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get itemFeatures() {
|
||||||
|
return this.weaponFeatures;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasDescription() {
|
|
||||||
return Boolean(this.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Event Handlers */
|
/* Event Handlers */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,6 @@ export default class DHItem extends foundry.documents.Item {
|
||||||
return !pack?.locked && this.isOwner && isValidType && hasActions;
|
return !pack?.locked && this.isOwner && isValidType && hasActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasDescription() {
|
|
||||||
return Boolean(this.system.description) || Boolean(this.system.itemFeatures?.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static async createDialog(data = {}, createOptions = {}, options = {}) {
|
static async createDialog(data = {}, createOptions = {}, options = {}) {
|
||||||
const { folders, types, template, context = {}, ...dialogOptions } = options;
|
const { folders, types, template, context = {}, ...dialogOptions } = options;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { defaultRestOptions } from '../config/generalConfig.mjs';
|
import { defaultRestOptions } from '../config/generalConfig.mjs';
|
||||||
|
import { RefreshType, socketEvent } from './socket.mjs';
|
||||||
|
|
||||||
export async function runMigrations() {
|
export async function runMigrations() {
|
||||||
let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion);
|
let lastMigrationVersion = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LastMigrationVersion);
|
||||||
|
|
@ -152,11 +153,47 @@ export async function runMigrations() {
|
||||||
await pack.configure({ locked: true });
|
await pack.configure({ locked: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Migrate old countdown structure */
|
||||||
|
const countdownSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
|
||||||
|
const getCountdowns = (data, type) => {
|
||||||
|
return Object.keys(data.countdowns).reduce((acc, key) => {
|
||||||
|
const countdown = data.countdowns[key];
|
||||||
|
acc[key] = {
|
||||||
|
...countdown,
|
||||||
|
type: type,
|
||||||
|
ownership: Object.keys(countdown.ownership.players).reduce((acc, key) => {
|
||||||
|
acc[key] =
|
||||||
|
countdown.ownership.players[key].type === 1 ? 2 : countdown.ownership.players[key].type;
|
||||||
|
return acc;
|
||||||
|
}, {}),
|
||||||
|
progress: {
|
||||||
|
...countdown.progress,
|
||||||
|
type: countdown.progress.type.value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
await countdownSettings.updateSource({
|
||||||
|
countdowns: {
|
||||||
|
...getCountdowns(countdownSettings.narrative, 'narrative'),
|
||||||
|
...getCountdowns(countdownSettings.encounter, 'encounter')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await game.settings.set(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns, countdownSettings);
|
||||||
|
|
||||||
|
game.socket.emit(`system.${CONFIG.DH.id}`, {
|
||||||
|
action: socketEvent.Refresh,
|
||||||
|
data: { refreshType: RefreshType.Countdown }
|
||||||
|
});
|
||||||
|
Hooks.callAll(socketEvent.Refresh, { refreshType: RefreshType.Countdown });
|
||||||
|
|
||||||
lastMigrationVersion = '1.2.0';
|
lastMigrationVersion = '1.2.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) {
|
if (foundry.utils.isNewerVersion('1.2.7', lastMigrationVersion)) {
|
||||||
try {
|
|
||||||
const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll');
|
const tagTeam = game.settings.get(CONFIG.DH.id, 'TagTeamRoll');
|
||||||
const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator);
|
const initatorMissing = tagTeam.initiator && !game.actors.some(actor => actor.id === tagTeam.initiator);
|
||||||
const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => {
|
const missingMembers = Object.keys(tagTeam.members).reduce((acc, id) => {
|
||||||
|
|
@ -171,7 +208,6 @@ export async function runMigrations() {
|
||||||
members: missingMembers
|
members: missingMembers
|
||||||
});
|
});
|
||||||
await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam);
|
await game.settings.set(CONFIG.DH.id, 'TagTeamRoll', tagTeam);
|
||||||
} catch { }
|
|
||||||
|
|
||||||
lastMigrationVersion = '1.2.7';
|
lastMigrationVersion = '1.2.7';
|
||||||
}
|
}
|
||||||
|
|
@ -267,8 +303,6 @@ export async function runMigrations() {
|
||||||
|
|
||||||
/* Migrate existing effects modifying armor, creating new Armor Effects instead */
|
/* Migrate existing effects modifying armor, creating new Armor Effects instead */
|
||||||
const migrateEffects = async entity => {
|
const migrateEffects = async entity => {
|
||||||
if (!entity?.effects) return;
|
|
||||||
|
|
||||||
for (const effect of entity.effects) {
|
for (const effect of entity.effects) {
|
||||||
if (effect.system.changes.every(x => x.key !== 'system.armorScore')) continue;
|
if (effect.system.changes.every(x => x.key !== 'system.armorScore')) continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,26 +43,36 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-main {
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 2px;
|
|
||||||
margin: -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.inventory-item-header .item-label .item-name .expanded-icon {
|
.inventory-item-header .item-label .item-name .expanded-icon {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.item-main {
|
&:has(.inventory-item-content.extensible) {
|
||||||
|
.inventory-item-header,
|
||||||
|
.inventory-item-content {
|
||||||
background: light-dark(@dark-blue-40, @golden-40);
|
background: light-dark(@dark-blue-40, @golden-40);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
&:has(.inventory-item-content.extended) {
|
&:has(.inventory-item-content.extended) {
|
||||||
.inventory-item-header .item-label .item-name .expanded-icon {
|
.inventory-item-header .item-label .item-name .expanded-icon {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:has(.inventory-item-content.extensible) {
|
||||||
|
.inventory-item-header {
|
||||||
|
border-radius: 5px 5px 0 0;
|
||||||
|
}
|
||||||
|
.inventory-item-content {
|
||||||
|
border-radius: 0 0 5px 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(:has(.inventory-item-content.extensible)) .inventory-item-header {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.inventory-item-header,
|
.inventory-item-header,
|
||||||
|
|
@ -161,7 +171,7 @@
|
||||||
grid-template-rows: 1fr;
|
grid-template-rows: 1fr;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
}
|
}
|
||||||
.inventory-description {
|
.invetory-description {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "daggerheart",
|
"id": "daggerheart",
|
||||||
"title": "Daggerheart",
|
"title": "Daggerheart",
|
||||||
"description": "An unofficial implementation of the Daggerheart system",
|
"description": "An unofficial implementation of the Daggerheart system",
|
||||||
"version": "2.4.2",
|
"version": "2.4.1",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "14.364",
|
"minimum": "14.364",
|
||||||
"verified": "14.364",
|
"verified": "14.364",
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"url": "https://github.com/Foundryborne/daggerheart",
|
"url": "https://github.com/Foundryborne/daggerheart",
|
||||||
"manifest": "https://raw.githubusercontent.com/Foundryborne/daggerheart/v14/system.json",
|
"manifest": "https://raw.githubusercontent.com/Foundryborne/daggerheart/v14/system.json",
|
||||||
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.4.2/system.zip",
|
"download": "https://github.com/Foundryborne/daggerheart/releases/download/2.4.1/system.zip",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "WBHarry"
|
"name": "WBHarry"
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@ Parameters:
|
||||||
data-type="{{type}}" data-item-type="{{item.type}}"
|
data-type="{{type}}" data-item-type="{{item.type}}"
|
||||||
data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}"
|
data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}"
|
||||||
>
|
>
|
||||||
<div class="item-main">
|
<div class="inventory-item-header {{#if hideContextMenu}}padded{{/if}}" {{#unless noExtensible}}data-action="toggleExtended" {{/unless}}>
|
||||||
<div class="inventory-item-header{{#if hideContextMenu}} padded{{/if}}" {{#unless (or noExtensible (not item.hasDescription))}}data-action="toggleExtended" {{/unless}}>
|
|
||||||
{{!-- Image --}}
|
{{!-- Image --}}
|
||||||
<div class="img-portait" draggable="true"
|
<div class="img-portait" draggable="true"
|
||||||
{{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}}
|
{{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}}
|
||||||
|
|
@ -44,16 +43,18 @@ Parameters:
|
||||||
{{!-- Name & Tags --}}
|
{{!-- Name & Tags --}}
|
||||||
<div class="item-label" draggable="true">
|
<div class="item-label" draggable="true">
|
||||||
{{!-- Item Name --}}
|
{{!-- Item Name --}}
|
||||||
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.hasDescription))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
|
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
|
||||||
|
|
||||||
{{!-- Tags Start --}}
|
{{!-- Tags Start --}}
|
||||||
{{#if (not hideTags)}}
|
{{#if (not hideTags)}}
|
||||||
{{#> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item}}
|
{{#> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item}}
|
||||||
{{#if (and (eq ../type 'feature') system.featureForm (ne @root.document.type "character"))}}
|
{{#if (eq ../type 'feature')}}
|
||||||
|
{{#if (and system.featureForm (ne @root.document.type "character"))}}
|
||||||
<div class="tag feature-form">
|
<div class="tag feature-form">
|
||||||
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
|
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{/ "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs"}}
|
{{/ "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
@ -130,11 +131,10 @@ Parameters:
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
{{#unless hideDescription}}
|
<div class="inventory-item-content{{#unless noExtensible}} extensible{{/unless}}">
|
||||||
<div class="inventory-item-content{{#unless (or noExtensible (not item.hasDescription))}} extensible{{/unless}}">
|
|
||||||
{{!-- Description --}}
|
{{!-- Description --}}
|
||||||
<div class="inventory-description"></div>
|
{{#unless hideDescription}}
|
||||||
</div>
|
<div class="invetory-description"></div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
{{!-- Dice Resource --}}
|
{{!-- Dice Resource --}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue