mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 12:41:07 +01:00
start development
This commit is contained in:
parent
fa8bd63614
commit
9a1ed95c9f
15 changed files with 277 additions and 4 deletions
1
assets/icons/documents/actors/dark-squad.svg
Normal file
1
assets/icons/documents/actors/dark-squad.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000" fill-opacity="1"></path><g class="" transform="translate(0,0)" style=""><path d="M369.1 21.22c-19.2 0-36.2 10.63-47.9 26.47-11.7 15.84-18.6 37.03-18.6 60.31 0 21.1 5.7 40.5 15.5 55.7-5.7 1.6-11 3.9-15.9 6.6-10.2-8.5-22.6-13.6-35.9-13.6-19.3 0-36.3 10.6-48 26.4-4.7 6.4-8.6 13.6-11.6 21.5-4.8-2.4-9.9-4.3-15.5-5.6 9.4-15.1 14.8-34.1 14.8-54.7 0-23.2-6.9-44.43-18.6-60.27-11.7-15.84-28.7-26.5-47.9-26.5s-36.2 10.66-47.94 26.5C79.87 99.87 73 121.1 73 144.3c0 21.1 5.69 40.5 15.47 55.8-32.07 9.1-50.29 37.1-59.44 70-9.79 35.2-10.87 77.3-10.87 115.6v9.4h45.5l6.78 99.3h18.75l-7.28-106.5-4.1-80-18.65 1 3.47 67.5H36.97c.24-35.2 1.97-72.1 10.09-101.2 8.78-31.6 23.32-52.8 51.25-58.2l4.69-.1c10.3 8.8 22.9 14.2 36.5 14.2 14.1 0 26.9-5.7 37.4-15h4.6c7.8 1.2 14.4 3.5 20.1 6.7-1.2 6.6-1.9 13.5-1.9 20.6 0 21.1 5.7 40.5 15.5 55.8-32.1 9.1-50.3 37.2-59.4 70-9.8 35.2-10.9 77.3-10.9 115.6v9.4c21.7-.3 42.8.2 64.3.2l-.5-7.3-4.1-80-18.7.9 3.4 67.5h-25.6c.3-35.2 2-72.1 10.1-101.2 8.7-31.6 23.3-52.7 51.1-58.2l4.9-.1c10.3 8.8 22.8 14.2 36.4 14.2 14.1 0 27-5.7 37.5-15h4.4c15.4 2.4 26.1 8.9 34.5 18.6 8.5 9.7 14.5 23.2 18.5 39.2 7.3 29.5 7.7 66.9 7.7 102.5h-23.4l3.5-67.5-18.7-.9-4.2 82-.3 5.3c20.8 0 43.3-.3 61.9-.2v-9.4c0-38.1.5-80.6-8.4-116.3-4.4-17.8-11.3-34.1-22.4-47-9.7-11.1-22.7-19.4-38.8-23.4 9.4-15.1 14.7-34.1 14.7-54.7 0-22.5-6.4-43.2-17.5-58.8 3.9-1.8 8.1-3.1 12.7-4h4.7c10.3 8.8 22.9 14.2 36.5 14.2 14.1 0 27-5.8 37.4-15l4.6-.1c15.4 2.5 26 8.9 34.4 18.6 8.5 9.8 14.5 23.3 18.5 39.3 7.3 29.4 7.7 66.8 7.7 102.4h-23.4l3.5-67.4-18.7-1-4.1 79.7-8.6 143.1h18.7l8.2-135.7h43.1v-9.3c0-38.2.6-80.7-8.3-116.3-4.5-17.9-11.4-34.2-22.5-47-9.6-11.2-22.6-19.5-38.8-23.5 9.4-15.1 14.8-34 14.8-54.6 0-23.28-6.9-44.47-18.6-60.31-11.6-15.29-31.5-26.13-47.9-26.47zm0 18.69c12.4 0 23.9 6.69 32.9 18.87 9 12.19 14.9 29.67 14.9 49.22 0 19.5-5.9 37-14.9 49.2-9 12.2-20.5 18.9-32.9 18.9-12.3 0-23.9-6.7-32.9-18.9s-14.9-29.7-14.9-49.2c0-19.55 5.9-37.03 14.9-49.22 9-12.18 20.6-18.87 32.9-18.87zM139.5 76.22c12.4 0 23.9 6.72 32.9 18.9s14.9 29.68 14.9 49.18-5.9 37-14.9 49.2c-9 12.2-20.5 18.9-32.9 18.9-12.4 0-23.9-6.7-32.9-18.9-8.97-12.2-14.91-29.7-14.91-49.2 0-19.5 5.94-37 14.91-49.17 9-12.19 20.5-18.91 32.9-18.91zm197.8 22.34v18.64h22.5V98.56h-22.5zm41.1 0v18.64h22.5V98.56h-22.5zM107.7 134.9v18.7h22.5v-18.7h-22.5zm41.1 0v18.7h22.5v-18.7h-22.5zm117.5 40.4c12.3 0 23.8 6.7 32.8 18.9 9 12.2 15 29.7 15 49.2 0 19.6-6 37-15 49.2-9 12.2-20.5 18.9-32.8 18.9-12.4 0-24-6.7-33-18.9-8.9-12.2-14.9-29.6-14.9-49.2 0-19.5 6-37 14.9-49.2 9-12.2 20.6-18.9 33-18.9zM234.5 234v18.7h22.4V234zm41.1 0v18.7H298V234h-22.4z" fill="#fff" fill-opacity="1"></path></g></svg>
|
||||||
|
After Width: | Height: | Size: 2.7 KiB |
|
|
@ -93,6 +93,10 @@ Hooks.once('init', () => {
|
||||||
types: ['environment'],
|
types: ['environment'],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
});
|
});
|
||||||
|
Actors.registerSheet(SYSTEM.id, applications.sheets.actors.Party, {
|
||||||
|
types: ['party'],
|
||||||
|
makeDefault: true
|
||||||
|
});
|
||||||
|
|
||||||
CONFIG.ActiveEffect.documentClass = documents.DhActiveEffect;
|
CONFIG.ActiveEffect.documentClass = documents.DhActiveEffect;
|
||||||
CONFIG.ActiveEffect.dataModels = models.activeEffects.config;
|
CONFIG.ActiveEffect.dataModels = models.activeEffects.config;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
"character": "Character",
|
"character": "Character",
|
||||||
"companion": "Companion",
|
"companion": "Companion",
|
||||||
"adversary": "Adversary",
|
"adversary": "Adversary",
|
||||||
"environment": "Environment"
|
"environment": "Environment",
|
||||||
|
"party": "Party"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"CONTROLS": {
|
"CONTROLS": {
|
||||||
|
|
@ -1890,7 +1891,8 @@
|
||||||
"tier4": "tier 4",
|
"tier4": "tier 4",
|
||||||
"domains": "Domains",
|
"domains": "Domains",
|
||||||
"downtime": "Downtime",
|
"downtime": "Downtime",
|
||||||
"rules": "Rules"
|
"rules": "Rules",
|
||||||
|
"partyMembers": "Party Members"
|
||||||
},
|
},
|
||||||
"Tiers": {
|
"Tiers": {
|
||||||
"singular": "Tier",
|
"singular": "Tier",
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ export { default as Adversary } from './adversary.mjs';
|
||||||
export { default as Character } from './character.mjs';
|
export { default as Character } from './character.mjs';
|
||||||
export { default as Companion } from './companion.mjs';
|
export { default as Companion } from './companion.mjs';
|
||||||
export { default as Environment } from './environment.mjs';
|
export { default as Environment } from './environment.mjs';
|
||||||
|
export { default as Party } from './party.mjs';
|
||||||
|
|
|
||||||
122
module/applications/sheets/actors/party.mjs
Normal file
122
module/applications/sheets/actors/party.mjs
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
import DHBaseActorSheet from '../api/base-actor.mjs';
|
||||||
|
|
||||||
|
export default class Party extends DHBaseActorSheet {
|
||||||
|
/**@inheritdoc */
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
classes: ['party'],
|
||||||
|
position: {
|
||||||
|
width: 500
|
||||||
|
},
|
||||||
|
window: {
|
||||||
|
resizable: true
|
||||||
|
},
|
||||||
|
actions: {},
|
||||||
|
dragDrop: [{ dragSelector: '.actors-section .inventory-item', dropSelector: null }]
|
||||||
|
};
|
||||||
|
|
||||||
|
/**@override */
|
||||||
|
static PARTS = {
|
||||||
|
header: { template: 'systems/daggerheart/templates/sheets/actors/party/header.hbs' },
|
||||||
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
|
partyMembers: { template: 'systems/daggerheart/templates/sheets/actors/party/party-members.hbs' },
|
||||||
|
notes: { template: 'systems/daggerheart/templates/sheets/actors/party/notes.hbs' }
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static TABS = {
|
||||||
|
primary: {
|
||||||
|
tabs: [{ id: 'partyMembers' }, { id: 'notes' }],
|
||||||
|
initial: 'partyMembers',
|
||||||
|
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async _preparePartContext(partId, context, options) {
|
||||||
|
context = await super._preparePartContext(partId, context, options);
|
||||||
|
switch (partId) {
|
||||||
|
case 'header':
|
||||||
|
await this._prepareHeaderContext(context, options);
|
||||||
|
break;
|
||||||
|
case 'notes':
|
||||||
|
await this._prepareNotesContext(context, options);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare render context for the Header part.
|
||||||
|
* @param {ApplicationRenderContext} context
|
||||||
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _prepareHeaderContext(context, _options) {
|
||||||
|
const { system } = this.document;
|
||||||
|
const { TextEditor } = foundry.applications.ux;
|
||||||
|
|
||||||
|
context.description = await TextEditor.implementation.enrichHTML(system.description, {
|
||||||
|
secrets: this.document.isOwner,
|
||||||
|
relativeTo: this.document
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare render context for the Biography part.
|
||||||
|
* @param {ApplicationRenderContext} context
|
||||||
|
* @param {ApplicationRenderOptions} options
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
async _prepareNotesContext(context, _options) {
|
||||||
|
const { system } = this.document;
|
||||||
|
const { TextEditor } = foundry.applications.ux;
|
||||||
|
|
||||||
|
const paths = {
|
||||||
|
notes: 'notes'
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const [key, path] of Object.entries(paths)) {
|
||||||
|
const value = foundry.utils.getProperty(system, path);
|
||||||
|
context[key] = {
|
||||||
|
field: system.schema.getField(path),
|
||||||
|
value,
|
||||||
|
enriched: await TextEditor.implementation.enrichHTML(value, {
|
||||||
|
secrets: this.document.isOwner,
|
||||||
|
relativeTo: this.document
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
async _onDragStart(event) {
|
||||||
|
const item = event.currentTarget.closest('.inventory-item');
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
const adversaryData = { type: 'Actor', uuid: item.dataset.itemUuid };
|
||||||
|
event.dataTransfer.setData('text/plain', JSON.stringify(adversaryData));
|
||||||
|
event.dataTransfer.setDragImage(item, 60, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async _onDrop(event) {
|
||||||
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
|
if (data.fromInternal) return;
|
||||||
|
|
||||||
|
const item = await fromUuid(data.uuid);
|
||||||
|
if (item.type === 'adversary' && event.target.closest('.category-container')) {
|
||||||
|
const target = event.target.closest('.category-container');
|
||||||
|
const path = `system.potentialAdversaries.${target.dataset.potentialAdversary}.adversaries`;
|
||||||
|
const current = foundry.utils.getProperty(this.actor, path).map(x => x.uuid);
|
||||||
|
await this.actor.update({
|
||||||
|
[path]: [...current, item.uuid]
|
||||||
|
});
|
||||||
|
this.render();
|
||||||
|
} else if (item.type === 'feature' && event.target.closest('.tab.features')) {
|
||||||
|
await this.actor.createEmbeddedDocuments('Item', [item]);
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -473,6 +473,7 @@ export default function DHApplicationMixin(Base) {
|
||||||
context.fields = this.document.schema.fields;
|
context.fields = this.document.schema.fields;
|
||||||
context.systemFields = this.document.system.schema.fields;
|
context.systemFields = this.document.system.schema.fields;
|
||||||
context.settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
context.settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
||||||
|
console.log(context);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,14 @@ import DhCharacter from './character.mjs';
|
||||||
import DhCompanion from './companion.mjs';
|
import DhCompanion from './companion.mjs';
|
||||||
import DhAdversary from './adversary.mjs';
|
import DhAdversary from './adversary.mjs';
|
||||||
import DhEnvironment from './environment.mjs';
|
import DhEnvironment from './environment.mjs';
|
||||||
|
import DhParty from './party.mjs';
|
||||||
|
|
||||||
export { DhCharacter, DhCompanion, DhAdversary, DhEnvironment };
|
export { DhCharacter, DhCompanion, DhAdversary, DhEnvironment, DhParty };
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
character: DhCharacter,
|
character: DhCharacter,
|
||||||
companion: DhCompanion,
|
companion: DhCompanion,
|
||||||
adversary: DhAdversary,
|
adversary: DhAdversary,
|
||||||
environment: DhEnvironment
|
environment: DhEnvironment,
|
||||||
|
party: DhParty
|
||||||
};
|
};
|
||||||
|
|
|
||||||
26
module/data/actor/party.mjs
Normal file
26
module/data/actor/party.mjs
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import BaseDataActor from './base.mjs';
|
||||||
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
|
|
||||||
|
export default class DhParty extends BaseDataActor {
|
||||||
|
/**@inheritdoc */
|
||||||
|
static defineSchema() {
|
||||||
|
const fields = foundry.data.fields;
|
||||||
|
return {
|
||||||
|
...super.defineSchema(),
|
||||||
|
partyMembers: new fields.TypedObjectField(
|
||||||
|
new fields.SchemaField({
|
||||||
|
label: new fields.StringField(),
|
||||||
|
adversaries: new ForeignDocumentUUIDArrayField({ type: 'Actor' })
|
||||||
|
})
|
||||||
|
),
|
||||||
|
notes: new fields.HTMLField()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/**@inheritdoc */
|
||||||
|
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/actors/dark-squad.svg';
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
}
|
||||||
42
styles/less/sheets/actors/party/header.less
Normal file
42
styles/less/sheets/actors/party/header.less
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
@import '../../../utils/colors.less';
|
||||||
|
@import '../../../utils/fonts.less';
|
||||||
|
|
||||||
|
.party-header-sheet {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: start;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.profile {
|
||||||
|
height: 235px;
|
||||||
|
mask-image: linear-gradient(0deg, transparent 0%, black 10%);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-container {
|
||||||
|
.item-name {
|
||||||
|
padding: 0 20px;
|
||||||
|
input[type='text'] {
|
||||||
|
font-size: 32px;
|
||||||
|
height: 42px;
|
||||||
|
text-align: center;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
outline: 2px solid transparent;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&:hover[type='text'],
|
||||||
|
&:focus[type='text'] {
|
||||||
|
box-shadow: none;
|
||||||
|
outline: 2px solid light-dark(@dark-blue, @golden);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
styles/less/sheets/actors/party/sheet.less
Normal file
28
styles/less/sheets/actors/party/sheet.less
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
@import '../../../utils/colors.less';
|
||||||
|
@import '../../../utils/fonts.less';
|
||||||
|
@import '../../../utils/mixin.less';
|
||||||
|
|
||||||
|
.appTheme({
|
||||||
|
&.party {
|
||||||
|
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
&.party {
|
||||||
|
background: url('../assets/parchments/dh-parchment-light.png');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
.application.sheet.daggerheart.actor.dh-style.party {
|
||||||
|
.tab {
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
@import './actors/environment/header.less';
|
@import './actors/environment/header.less';
|
||||||
@import './actors/environment/sheet.less';
|
@import './actors/environment/sheet.less';
|
||||||
|
|
||||||
|
@import './actors/party/header.less';
|
||||||
|
@import './actors/party/sheet.less';
|
||||||
|
|
||||||
@import './items/beastform.less';
|
@import './items/beastform.less';
|
||||||
@import './items/class.less';
|
@import './items/class.less';
|
||||||
@import './items/domain-card.less';
|
@import './items/domain-card.less';
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,9 @@
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
"htmlFields": ["notes", "description"]
|
"htmlFields": ["notes", "description"]
|
||||||
|
},
|
||||||
|
"party": {
|
||||||
|
"htmlFields": ["notes"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
|
|
|
||||||
9
templates/sheets/actors/party/header.hbs
Normal file
9
templates/sheets/actors/party/header.hbs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<header class='party-header-sheet'>
|
||||||
|
<img class='profile' src='{{source.img}}' data-action='editImage' data-edit='img' />
|
||||||
|
<div class='item-container'>
|
||||||
|
<div class="item-info">
|
||||||
|
<h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1>
|
||||||
|
<h2 class="label">Party</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
10
templates/sheets/actors/party/notes.hbs
Normal file
10
templates/sheets/actors/party/notes.hbs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<section
|
||||||
|
class='tab {{tabs.notes.cssClass}} {{tabs.notes.id}}'
|
||||||
|
data-tab='{{tabs.notes.id}}'
|
||||||
|
data-group='{{tabs.notes.group}}'
|
||||||
|
>
|
||||||
|
<fieldset class="fit-height">
|
||||||
|
<legend>{{localize tabs.notes.label}}</legend>
|
||||||
|
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
19
templates/sheets/actors/party/party-members.hbs
Normal file
19
templates/sheets/actors/party/party-members.hbs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<section
|
||||||
|
class='tab {{tabs.partyMembers.cssClass}} {{tabs.partyMembers.id}}'
|
||||||
|
data-tab='{{tabs.partyMembers.id}}'
|
||||||
|
data-group='{{tabs.partyMembers.group}}'
|
||||||
|
>
|
||||||
|
<div class="action-section">
|
||||||
|
{{#each document.system.partyMembers as |category categoryId|}}
|
||||||
|
{{> 'daggerheart.inventory-items'
|
||||||
|
title=tabs.partyMembers.label
|
||||||
|
type='character'
|
||||||
|
isGlassy=true
|
||||||
|
isActor=true
|
||||||
|
hideControls=true
|
||||||
|
collection=category.adversaries
|
||||||
|
hideResources=true
|
||||||
|
}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue