From c4b8f30188179394030be59e9551585ceef13c4e Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sat, 29 May 2021 23:20:50 +0200 Subject: [PATCH] Fix stuff --- lang/en.json | 3 ++ module/actor/actor-sheet.js | 26 +++++++++------- module/frostgrave.js | 8 ++--- module/item/dist/item-sheet.dev.js | 2 +- module/item/item-sheet.js | 10 +++++-- module/templates.js | 16 +++++----- system.json | 26 ++++++++-------- templates/actor/actor-sheet.html | 16 +++++----- templates/actor/partials/actor-header.html | 12 ++++---- templates/actor/partials/actor-stats.html | 10 +++---- .../actor/partials/actor-tab-experience.html | 10 +++---- templates/actor/partials/actor-tab-items.html | 30 +++++++++---------- .../actor/partials/actor-tab-navigation.html | 6 ++-- .../actor/partials/actor-tab-spells.html | 24 +++++++-------- templates/item/item-item-sheet.html | 6 ++-- 15 files changed, 109 insertions(+), 96 deletions(-) diff --git a/lang/en.json b/lang/en.json index e69de29..077404a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 899688b..a6401c1 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -7,7 +7,7 @@ export class frostgraveActorSheet extends ActorSheet { static get defaultOptions() { return mergeObject(super.defaultOptions, { classes: ["frostgrave", "sheet", "actor"], - template: "systems/frostgrave/templates/actor/actor-sheet.html", + template: "systems/foundryvtt-frostgrave/templates/actor/actor-sheet.html", width: 650, height: 650, tabs: [{ @@ -23,17 +23,23 @@ export class frostgraveActorSheet extends ActorSheet { /** @override */ getData() { const data = super.getData(); - data.dtypes = ["String", "Number", "Boolean"]; + let formData = { + data: data.data, + actor: this.actor, + dtypes: ["String", "Number", "Boolean"] + } + //for (let attr of Object.values(data.data.attributes)) { // attr.isCheckbox = attr.dtype === "Boolean"; // } // Prepare items. if (this.actor.data.type == "character") { - this._prepareCharacterItems(data); + this._prepareCharacterItems(formData); } - - return data; + + console.log("FORMDATA", formData); + return formData; } /** @override */ @@ -203,9 +209,9 @@ export class frostgraveActorSheet extends ActorSheet { // Iterate through items, allocating to containers // let totalWeight = 0; - for (let i of sheetData.items) { + for (let i of actorData.data.items) { let item = i.data; - i.img = i.img || DEFAULT_TOKEN; + //i.img = i.img || DEFAULT_TOKEN; // Append to gear. if (i.type === "item") { gear.push(i); @@ -221,8 +227,8 @@ export class frostgraveActorSheet extends ActorSheet { } // Assign and return - actorData.gear = gear; - actorData.features = features; - actorData.spells = spells; + sheetData.gear = gear; + sheetData.features = features; + sheetData.spells = spells; } } \ No newline at end of file diff --git a/module/frostgrave.js b/module/frostgrave.js index 7387703..30660a5 100644 --- a/module/frostgrave.js +++ b/module/frostgrave.js @@ -21,16 +21,16 @@ Hooks.once("init", async function () { }; // Define custom Entity classes - CONFIG.Actor.entityClass = frostgraveActor; - CONFIG.Item.entityClass = frostgraveItem; + CONFIG.Actor.documentClas = frostgraveActor; + CONFIG.Item.documentClas = frostgraveItem; // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet("frostgrave", frostgraveActorSheet, { + Actors.registerSheet("foundryvtt-frostgrave", frostgraveActorSheet, { makeDefault: true, }); Items.unregisterSheet("core", ItemSheet); - Items.registerSheet("frostgrave", frostgraveItemSheet, { + Items.registerSheet("foundryvtt-frostgrave", frostgraveItemSheet, { types: ["item", "feature", "spell"], makeDefault: true, }); diff --git a/module/item/dist/item-sheet.dev.js b/module/item/dist/item-sheet.dev.js index 2c8a0f7..e812fe4 100644 --- a/module/item/dist/item-sheet.dev.js +++ b/module/item/dist/item-sheet.dev.js @@ -99,7 +99,7 @@ function (_ItemSheet) { /** @override */ get: function get() { return mergeObject(_get(_getPrototypeOf(frostgraveItemSheet), "defaultOptions", this), { - classes: ["frostgrave", "sheet", "item"], + classes: ["foundryvtt-frostgrave", "sheet", "item"], width: 450, height: 500, tabs: [{ diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js index 3a46e76..754711a 100644 --- a/module/item/item-sheet.js +++ b/module/item/item-sheet.js @@ -6,7 +6,7 @@ export class frostgraveItemSheet extends ItemSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["frostgrave", "sheet", "item"], + classes: ["foundryvtt-frostgrave", "sheet", "item"], width: 450, height: 500, tabs: [{ @@ -19,7 +19,7 @@ export class frostgraveItemSheet extends ItemSheet { /** @override */ get template() { - const path = "systems/frostgrave/templates/item"; + const path = "systems/foundryvtt-frostgrave/templates/item"; // Return a single sheet for all item types. // return `${path}/item-sheet.html`; @@ -33,7 +33,11 @@ export class frostgraveItemSheet extends ItemSheet { /** @override */ getData() { const data = super.getData(); - return data; + + let formData = duplicate(data.data) + console.log("ITEM", formData); + + return formData; } /* -------------------------------------------- */ diff --git a/module/templates.js b/module/templates.js index 059957b..84b2f1c 100644 --- a/module/templates.js +++ b/module/templates.js @@ -9,14 +9,14 @@ export const preloadHandlebarsTemplates = async function() { const templatePaths = [ // Actor Sheet Partials - "systems/frostgrave/templates/actor/partials/actor-header.html", - "systems/frostgrave/templates/actor/partials/actor-stats.html", - "systems/frostgrave/templates/actor/partials/actor-tab-navigation.html", - "systems/frostgrave/templates/actor/partials/actor-tab-notes.html", - "systems/frostgrave/templates/actor/partials/actor-tab-experience.html", - "systems/frostgrave/templates/actor/partials/actor-tab-homebase.html", - "systems/frostgrave/templates/actor/partials/actor-tab-items.html", - "systems/frostgrave/templates/actor/partials/actor-tab-spells.html" + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-header.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-stats.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-navigation.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-notes.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-experience.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-homebase.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-items.html", + "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-spells.html" // Item Sheet Partials diff --git a/system.json b/system.json index db5c75e..4208bd4 100644 --- a/system.json +++ b/system.json @@ -1,10 +1,10 @@ { - "name": "frostgrave", + "name": "foundryvtt-frostgrave", "title": "Frostgrave", "description": "The Frostgrave system for Foundry VTT", - "version": "1.0.0", - "minimumCoreVersion": "0.6.5", - "compatibleCoreVersion": "0.6.6", + "version": "2.0.0", + "minimumCoreVersion": "0.8.0", + "compatibleCoreVersion": "0.8.5", "templateVersion": 2, "author": "Phenomen", "esmodules": [ @@ -17,35 +17,35 @@ "packs": [{ "name": "spellcasters", "label": "Spellcasters", - "system": "frostgrave", + "system": "foundryvtt-frostgrave", "path": "./packs/spellcasters.db", "entity": "Actor" }, { "name": "soldiers", "label": "Soldiers", - "system": "frostgrave", + "system": "foundryvtt-frostgrave", "path": "./packs/soldiers.db", "entity": "Actor" }, { "name": "armour", "label": "Armour", - "system": "frostgrave", + "system": "foundryvtt-frostgrave", "path": "./packs/armour.db", "entity": "Item" }, { "name": "weapons", "label": "Weapons", - "system": "frostgrave", + "system": "foundryvtt-frostgrave", "path": "./packs/weapons.db", "entity": "Item" }, { "name": "potions", "label": "Potions", - "system": "frostgrave", + "system": "foundryvtt-frostgrave", "path": "./packs/potions.db", "entity": "Item" } @@ -58,8 +58,8 @@ "gridDistance": 5, "gridUnits": "ft", "primaryTokenAttribute": "health", - "url": "https://github.com/Phenomen/foundry-frostgrave", - "manifest": "https://raw.githubusercontent.com/Phenomen/foundry-frostgrave/master/system.json", - "download": "https://github.com/Phenomen/foundry-frostgrave/archive/master.zip", + "url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-frostgrave", + "manifest": "https://gitlab.com/LeRatierBretonnien/foundryvtt-frostgrave/-/raw/master/system.json", + "download": "https://gitlab.com/LeRatierBretonnien/foundryvtt-frostgrave/archive/master.zip", "license": "LICENSE.txt" -} \ No newline at end of file +} diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index 4170c53..0cbdf5e 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -1,30 +1,30 @@
{{!-- Actor Header --}} - {{> "systems/frostgrave/templates/actor/partials/actor-header.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-header.html"}} {{!-- Actor Stats --}} - {{> "systems/frostgrave/templates/actor/partials/actor-stats.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-stats.html"}} {{!-- Tab Navigation --}} - {{> "systems/frostgrave/templates/actor/partials/actor-tab-navigation.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-navigation.html"}} {{!-- Sheet Body --}}
{{!-- Notes Tab --}} - {{> "systems/frostgrave/templates/actor/partials/actor-tab-notes.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-notes.html"}} {{!-- Experience Tab --}} - {{> "systems/frostgrave/templates/actor/partials/actor-tab-experience.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-experience.html"}} {{!-- Homebase Tab --}} - {{> "systems/frostgrave/templates/actor/partials/actor-tab-homebase.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-homebase.html"}} {{!-- Items Tab --}} - {{> "systems/frostgrave/templates/actor/partials/actor-tab-items.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-items.html"}} {{!-- Spells Tab --}} - {{> "systems/frostgrave/templates/actor/partials/actor-tab-spells.html"}} + {{> "systems/foundryvtt-frostgrave/templates/actor/partials/actor-tab-spells.html"}}
\ No newline at end of file diff --git a/templates/actor/partials/actor-header.html b/templates/actor/partials/actor-header.html index 1e93667..ebc8101 100644 --- a/templates/actor/partials/actor-header.html +++ b/templates/actor/partials/actor-header.html @@ -16,7 +16,7 @@
- {{#select data.class}} - {{#if (or (eq data.category "Wizard") (eq data.category "Apprentice"))}} + {{#select data.data.class}} + {{#if (or (eq data.data.category "Wizard") (eq data.data.category "Apprentice"))}} @@ -43,15 +43,15 @@ {{/if}} - {{#if (eq data.category "Soldier")}} + {{#if (eq data.data.category "Soldier")}} {{/if}} - {{#if (eq data.category "Creature")}} + {{#if (eq data.data.category "Creature")}} {{/if}} - {{#if (eq data.category "Base")}} + {{#if (eq data.data.category "Base")}} diff --git a/templates/actor/partials/actor-stats.html b/templates/actor/partials/actor-stats.html index c2875e0..3d89248 100644 --- a/templates/actor/partials/actor-stats.html +++ b/templates/actor/partials/actor-stats.html @@ -10,7 +10,7 @@

 

- {{#each data.stats as |stat key|}} + {{#each data.data.stats as |stat key|}}
diff --git a/templates/actor/partials/actor-tab-experience.html b/templates/actor/partials/actor-tab-experience.html index 10e9cb8..45a95e2 100644 --- a/templates/actor/partials/actor-tab-experience.html +++ b/templates/actor/partials/actor-tab-experience.html @@ -4,24 +4,24 @@
- +
- +
- +
- +

Leveling Log

- {{editor content=data.levellog target="data.levellog" button=true owner=owner editable=editable}} + {{editor content=data.data.levellog target="data.levellog" button=true owner=owner editable=editable}}
\ No newline at end of file diff --git a/templates/actor/partials/actor-tab-items.html b/templates/actor/partials/actor-tab-items.html index 8adf172..58f08c0 100644 --- a/templates/actor/partials/actor-tab-items.html +++ b/templates/actor/partials/actor-tab-items.html @@ -1,6 +1,6 @@
- {{#each actor.gear as |item id|}} + {{#each gear as |item id|}}
@@ -35,41 +35,41 @@
- {{item.data.category}} + {{item.data.data.category}} {{#if (ne item.data.subcategory "None")}} - {{item.data.subcategory}} + {{item.data.data.subcategory}} {{/if}}
- {{#if (ne item.data.damage null)}} + {{#if (ne item.data.data.damage null)}}
Damage - {{item.data.damage}} + {{item.data.data.damage}}
{{/if}} - {{#if (ne item.data.range null)}} + {{#if (ne item.data.data.range null)}}
Range - {{item.data.range}} + {{item.data.data.range}}
{{/if}} - {{#if (ne item.data.armour null)}} + {{#if (ne item.data.data.armour null)}}
Armour - {{item.data.armour}} + {{item.data.data.armour}}
{{/if}} - {{#if (and (ne item.data.effect "") (ne item.data.effect null))}} + {{#if (and (ne item.data.data.effect "") (ne item.data.data.effect null))}}
Effect @@ -78,26 +78,26 @@
{{/if}} - {{#if (ne item.data.price null)}} + {{#if (ne item.data.data.price null)}}
Price - {{item.data.price}} + {{item.data.data.price}}
{{/if}} - {{#if (ne item.data.sale null)}} + {{#if (ne item.data.data.sale null)}}
Sale - {{item.data.sale}} + {{item.data.data.sale}}
{{/if}}
-
{{formatHTMLMessage item.data.description}}
+
{{{item.data.data.description}}}
diff --git a/templates/actor/partials/actor-tab-navigation.html b/templates/actor/partials/actor-tab-navigation.html index 4f41df2..a569bd4 100644 --- a/templates/actor/partials/actor-tab-navigation.html +++ b/templates/actor/partials/actor-tab-navigation.html @@ -2,15 +2,15 @@
  • {{#if (eq data.category "Base")}}Vault{{else}}Items{{/if}}
  • - {{#if (eq data.category "Base")}} + {{#if (eq data.data.category "Base")}}
  • Homebase
  • {{/if}} - {{#if (or (eq data.category "Wizard") (eq data.category "Apprentice"))}} + {{#if (or (eq data.data.category "Wizard") (eq data.category "Apprentice"))}}
  • Spells
  • {{/if}} - {{#if (eq data.category "Wizard")}} + {{#if (eq data.data.category "Wizard")}}
  • Experience
  • {{/if}} diff --git a/templates/actor/partials/actor-tab-spells.html b/templates/actor/partials/actor-tab-spells.html index 6283145..e36432f 100644 --- a/templates/actor/partials/actor-tab-spells.html +++ b/templates/actor/partials/actor-tab-spells.html @@ -10,7 +10,7 @@

    -

@@ -19,7 +19,7 @@
- {{#each actor.spells as |item id|}} + {{#each spells as |item id|}}
@@ -55,39 +55,39 @@
- {{item.data.school}} - {{item.data.category}} + {{item.data.data.school}} + {{item.data.data.category}}
- {{item.data.alignment}} + {{item.data.data.alignment}}
BCN - {{item.data.bcn}} + {{item.data.data.bcn}}
- {{#if (ne item.data.improved 0)}} + {{#if (ne item.data.data.improved 0)}}
Improved - {{item.data.improved}} + {{item.data.data.improved}}
{{/if}}
-
{{formatHTMLMessage item.data.description}}
+
{{{item.data.data.description}}}