diff --git a/src/foundryvtt-5eOGLCharacterSheet.scss b/src/foundryvtt-5eOGLCharacterSheet.scss index 86e3751..d802bb6 100644 --- a/src/foundryvtt-5eOGLCharacterSheet.scss +++ b/src/foundryvtt-5eOGLCharacterSheet.scss @@ -226,4 +226,9 @@ .flexcol > * { flex: 0 auto; } + + .prosemirror .editor-container { + min-height: 80px; + margin-bottom: 8px; + } } diff --git a/src/foundryvtt-5eOGLCharacterSheet.ts b/src/foundryvtt-5eOGLCharacterSheet.ts index 1e6500d..85a1709 100644 --- a/src/foundryvtt-5eOGLCharacterSheet.ts +++ b/src/foundryvtt-5eOGLCharacterSheet.ts @@ -3,7 +3,6 @@ import { registerSettings } from './module/settings.js'; import { preloadTemplates } from './module/preloadTemplates.js'; import { MODULE_ID, MySettings } from './constants.js'; //@ts-ignore -import ActorSheet5eCharacter from '../../systems/dnd5e/module/actor/sheets/character.js'; Handlebars.registerHelper('ogl5e-sheet-path', (relativePath: string) => { return `modules/${MODULE_ID}/${relativePath}`; @@ -27,10 +26,10 @@ Handlebars.registerHelper('ogl5e-sheet-isEmpty', (input: Object | Array | S if (input instanceof Set) { return input.size < 1; } - return isObjectEmpty(input); + return isEmpty(input); }); -export class OGL5eCharacterSheet extends ActorSheet5eCharacter { +export class OGL5eCharacterSheet extends dnd5e.applications.actor.ActorSheet5eCharacter { get template() { //@ts-ignore if (!game.user.isGM && this.actor.limited && !game.settings.get(MODULE_ID, MySettings.expandedLimited)) { @@ -99,7 +98,7 @@ export class OGL5eCharacterSheet extends ActorSheet5eCharacter { const item = this.actor.items.get(itemId); const quantity = parseInt(event.target.value); event.target.value = quantity; - return item.update({ 'data.quantity': quantity }); + return item.update({ 'system.quantity': quantity }); } /** @@ -121,21 +120,24 @@ export class OGL5eCharacterSheet extends ActorSheet5eCharacter { .change(this._onQuantityChange.bind(this)); } - getData() { - const sheetData = super.getData(); + async getData() { + const sheetData = await super.getData(); // replace classLabels with Subclass + Class list try { let items = sheetData.items; let classList; //@ts-ignore - if (!foundry.utils.isNewerVersion('1.6.0', game.system.data.version)) { - classList = sheetData.features[1].items.map((item) => item.name); - } else { + if (!foundry.utils.isNewerVersion('1.6.0', game.system.version)) { + classList = sheetData.features[1].items.map((item) => { + if(item.type === "class") return `${item.name} ${item.system.levels}`; + return item.name + }); + } else { classList = items .filter((item) => item.type === 'class') .map((item) => { - return `${item.data.subclass} ${item.name} ${item.data.levels}`; + return `${item.system.subclass} ${item.name} ${item.system.levels}`; }); } @@ -195,8 +197,8 @@ export class OGL5eCharacterSheet extends ActorSheet5eCharacter { // if description is populated and appearance isn't use description as appearance try { log(false, sheetData); - if (!!sheetData.data.details.description?.value && !sheetData.data.details.appearance) { - sheetData.data.details.appearance = sheetData.data.details.description.value; + if (!!sheetData.system.details.description?.value && !sheetData.system.details.appearance) { + sheetData.system.details.appearance = sheetData.system.details.description.value; } } catch (e) { log(true, 'error trying to migrate description to appearance', e); @@ -208,7 +210,7 @@ export class OGL5eCharacterSheet extends ActorSheet5eCharacter { sheetData.settingsShowEquipInventory = game.settings.get(MODULE_ID, MySettings.showEquipOnInventoryList); // system features - const systemVersion = game.system.data.version; + const systemVersion = game.system.version; //@ts-ignore sheetData.systemFeatures = { //@ts-ignore @@ -227,6 +229,41 @@ export class OGL5eCharacterSheet extends ActorSheet5eCharacter { subclasses: !foundry.utils.isNewerVersion('1.6.0', systemVersion), }; + sheetData.trait = await TextEditor.enrichHTML(sheetData.system.details.trait, { + secrets: this.actor.isOwner, + rollData: sheetData.rollData, + async: true, + relativeTo: this.actor + }); + + sheetData.ideal = await TextEditor.enrichHTML(sheetData.system.details.ideal, { + secrets: this.actor.isOwner, + rollData: sheetData.rollData, + async: true, + relativeTo: this.actor + }); + + sheetData.bond = await TextEditor.enrichHTML(sheetData.system.details.bond, { + secrets: this.actor.isOwner, + rollData: sheetData.rollData, + async: true, + relativeTo: this.actor + }); + + sheetData.flaw = await TextEditor.enrichHTML(sheetData.system.details.flaw, { + secrets: this.actor.isOwner, + rollData: sheetData.rollData, + async: true, + relativeTo: this.actor + }); + + sheetData.appearance = await TextEditor.enrichHTML(sheetData.system.details.appearance, { + secrets: this.actor.isOwner, + rollData: sheetData.rollData, + async: true, + relativeTo: this.actor + }); + return sheetData; } } diff --git a/src/module.json b/src/module.json index d92eb30..8da9bb0 100644 --- a/src/module.json +++ b/src/module.json @@ -1,4 +1,5 @@ { + "id": "5e-ogl-character-sheet", "name": "5e-ogl-character-sheet", "title": "D&D 5e OGL Character Sheet", "description": "A character sheet resembling a classic Pencil and Paper or Roll20 sheet.", @@ -56,9 +57,23 @@ "link": "https://raw.githubusercontent.com/ElfFriend-DnD/foundryvtt-5eOGLCharacterSheet/master/readme-img/biography.png" } ], - "minimumCoreVersion": "9", - "compatibleCoreVersion": "9", - "minimumSystemVersion": "1.4.0", + "relationships": { + "systems": [ + { + "id": "dnd5e", + "type": "system", + "manifest": "https://raw.githubusercontent.com/foundryvtt/dnd5e/master/system.json", + "compatibility": { + "minimum": "2.0.0" + } + } + ] + }, + "compatibility":{ + "minimum": 10, + "verified": 10, + "maximum": 10 + }, "bugs": "https://github.com/ElfFriend-DnD/foundryvtt-5eOGLCharacterSheet/issues", "changelog": "https://github.com/ElfFriend-DnD/foundryvtt-5eOGLCharacterSheet/releases", "download": "https://github.com/ElfFriend-DnD/foundryvtt-5eOGLCharacterSheet/releases/download/v0.14.1/module.zip", @@ -69,4 +84,4 @@ "allowBugReporter": true }, "manifestPlusVersion": "1.0.0" -} \ No newline at end of file +} diff --git a/src/templates/character-sheet-ltd.hbs b/src/templates/character-sheet-ltd.hbs index 20a75b9..6eeddf0 100644 --- a/src/templates/character-sheet-ltd.hbs +++ b/src/templates/character-sheet-ltd.hbs @@ -13,14 +13,14 @@

{{ localize "DND5E.Appearance" }}

- {{editor content=data.details.appearance target="data.details.appearance" button=true owner=owner editable=editable}} + {{editor appearance target="system.details.appearance" button=true editable=editable engine="prosemirror" collaborate=false}}

{{ localize "DND5E.Background" }}/{{ localize "DND5E.Biography" }}

- {{editor content=data.details.biography.value target="data.details.biography.value" button=true owner=owner editable=editable}} + {{editor biographyHTML target="system.details.biography.value" button=true editable=editable engine="prosemirror" collaborate=false}}
diff --git a/src/templates/character-sheet.hbs b/src/templates/character-sheet.hbs index d6d1ab1..2eafdf8 100644 --- a/src/templates/character-sheet.hbs +++ b/src/templates/character-sheet.hbs @@ -10,13 +10,13 @@
{{!-- Ability Scores --}}

{{ localize "DND5E.Background" }}

- {{editor content=data.details.biography.value target="data.details.biography.value" button=true owner=owner - editable=editable}} + {{editor biographyHTML target="system.details.biography.value" button=true editable=editable engine="prosemirror" collaborate=false}}
diff --git a/src/templates/parts/actor-features.hbs b/src/templates/parts/actor-features.hbs index fea2835..abd9e60 100644 --- a/src/templates/parts/actor-features.hbs +++ b/src/templates/parts/actor-features.hbs @@ -35,7 +35,7 @@

{{#if (eq item.type "subclass")}}↳{{/if}} {{item.name}} - {{#if item.data.isOriginalClass}} {{/if}}

{{else}} @@ -59,20 +59,20 @@ {{/if}} {{/if}} - {{#if (or item.isOnCooldown item.data.recharge.value item.hasUses)}} + {{#if (or item.isOnCooldown item.system.recharge.value item.hasUses)}}
{{#if item.isOnCooldown}} {{item.labels.recharge}} - {{else if item.data.recharge.value}} + {{else if item.system.recharge.value}} {{localize "DND5E.Charged"}} {{else if item.hasUses}} - / {{item.data.uses.max}} + / {{item.system.uses.max}} {{localize "DND5E.Uses"}} @@ -84,7 +84,7 @@ {{#if section.hasActions}}
- {{#if item.data.activation.type }} + {{#if item.system.activation.type }} {{!-- Use our custom abbreviated labels --}} {{item.labels.activationAbbrev}} {{/if}} @@ -94,13 +94,13 @@ {{#if section.isClass}} {{#unless @root/systemFeatures.subclasses}}
- {{item.data.subclass}} + {{item.system.subclass}}
{{/unless}} {{#unless @root/systemFeatures.levelDropdown}} {{#if (eq item.type "class")}}
- Level {{item.data.levels}} + Level {{item.system.levels}}
{{/if}} {{/unless}} diff --git a/src/templates/parts/actor-health-armor.hbs b/src/templates/parts/actor-health-armor.hbs index d7d7edc..f2f3eab 100644 --- a/src/templates/parts/actor-health-armor.hbs +++ b/src/templates/parts/actor-health-armor.hbs @@ -7,7 +7,7 @@

Armor

- {{data.attributes.ac.value}} + {{system.attributes.ac.value}}

Class

{{ localize "DND5E.Initiative" }}

- {{numberFormat data.attributes.init.total decimals=0 sign=true}} + {{numberFormat system.attributes.init.total decimals=0 sign=true}}
{{ localize "DND5E.Modifier" }} - +
  • -

    {{ localize "DND5E.Speed" }} ({{data.attributes.movement.units}})

    +

    {{ localize "DND5E.Speed" }} ({{system.attributes.movement.units}})

    {{movement.primary}}
    @@ -43,17 +43,17 @@

    {{ localize "DND5E.HitPoints" }}

    - / -
    - - + +
    @@ -65,13 +65,13 @@ class="fas fa-cog">
    - / - {{data.details.level}} + {{system.details.level}}
    - {{!-- display hit die size? features[class].data.hitdice --}} + {{!-- display hit die size? features[class].system.hitdice --}}
  • @@ -79,12 +79,12 @@

    Death Saves

    - +
    - +