diff --git a/changelog.md b/changelog.md index cbd8ea4..f4d9c73 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Changelog +## 3.0.1 v11 support +- enables support for v11 + ## 3.0.x progress tracking and multiple tests - This module now enables tracking of your progress through a series of tests. - You can now specify a tool roll test in dnd5e. diff --git a/module.json b/module.json index f36002a..5af1798 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "title": "Beaver's Crafting Module", "description": "A Crafting Module for DnD", "id": "beavers-crafting", - "version": "3.0.0", + "version": "3.0.1", "authors": [ { "name": "angryBeaver", @@ -44,7 +44,7 @@ "type": "module", "manifest": "https://github.com/AngryBeaver/beavers-system-interface/releases/latest/download/module.json", "compatibility": { - "verified": "1.0.5" + "verified": "1.1.0" } }, { @@ -52,7 +52,7 @@ "type": "module", "manifest": "https://github.com/AngryBeaver/bsa-dnd5e/releases/latest/download/module.json", "compatibility": { - "verified": "1.0.0" + "verified": "1.0.1" } }, { @@ -67,6 +67,6 @@ }, "compatibility": { "minimum": "10", - "verified": "10" + "verified": "11" } } diff --git a/package.json b/package.json index 3fa3f36..7f82cb4 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "name": "beavers-crafting", "title": "Beaver's Crafting", - "version": "3.0.0", + "version": "3.0.1", "description": "Crafting", "devDir": "C:\\Users\\Riess\\AppData\\Local\\FoundryVTT\\Data\\modules", + "#devDir": "C:\\data\\Data\\modules", "main": "src/main.js", "scripts": { "build": "npx gulp", diff --git a/src/Crafting.ts b/src/Crafting.ts index fad39be..36a7d6a 100644 --- a/src/Crafting.ts +++ b/src/Crafting.ts @@ -1,7 +1,6 @@ import {Recipe} from "./Recipe.js"; import {Settings} from "./Settings.js"; import {RecipeCompendium} from "./apps/RecipeCompendium.js"; -import {getItem} from "./helpers/Utility.js"; import {AnyOf} from "./AnyOf.js"; import {Result} from "./Result.js"; import {TestHandler} from "./TestHandler.js"; @@ -463,7 +462,7 @@ export class Crafting implements CraftingData { } async _rollTableToComponents(component: Component, result: Result) { - const table = await getItem(component.uuid); + const table = await beaversSystemInterface.uuidToDocument(component.uuid); let components: Component[] = []; if (!table) { // @ts-ignore @@ -485,7 +484,7 @@ export class Crafting implements CraftingData { } uuid = "Compendium." + uuid; } - const item = await getItem(uuid) + const item = await beaversSystemInterface.uuidToDocument(uuid) if (!item) { // @ts-ignore ui.notifications.error(game.i18n.localize(`beaversCrafting.crafting-app.errors.tableItemNotFound`) + r.name); diff --git a/src/apps/CraftingApp.ts b/src/apps/CraftingApp.ts index ec908a0..c721d78 100644 --- a/src/apps/CraftingApp.ts +++ b/src/apps/CraftingApp.ts @@ -1,6 +1,6 @@ import {FilterType, RecipeCompendium} from "./RecipeCompendium.js"; import {Crafting} from "../Crafting.js"; -import {getDataFrom, getItem, sanitizeUuid} from "../helpers/Utility.js"; +import {getDataFrom, sanitizeUuid} from "../helpers/Utility.js"; import {Settings} from "../Settings.js"; import {getToolConfig} from "./ToolConfig.js"; import {AnyOf} from "../AnyOf.js"; @@ -130,13 +130,13 @@ export class CraftingApp extends Application { html.find('.results .flexrow').on("click",e=>{ const uuid = $(e.currentTarget).data("id"); if(Settings.get(Settings.DISPLAY_RESULTS)) { - getItem(uuid).then(i=>i.sheet._render(true)); + beaversSystemInterface.uuidToDocument(uuid).then(i=>i.sheet._render(true)); } }); html.find('.ingredients .flexrow').on("click",e=>{ const uuid = $(e.currentTarget).data("id"); if(Settings.get(Settings.DISPLAY_INGREDIENTS)) { - getItem(uuid).then(i=>i.sheet._render(true)); + beaversSystemInterface.uuidToDocument(uuid).then(i=>i.sheet._render(true)); } }); this.addDragDrop(html); @@ -171,7 +171,7 @@ export class CraftingApp extends Application { if(uuid != undefined){ const uuid = $(e.currentTarget).data("id"); const key = $(e.currentTarget).data("key"); - getItem(uuid).then( + beaversSystemInterface.uuidToDocument(uuid).then( item => { if(AnyOf.isAnyOf(item)){ return this._onDropAnyOf(new AnyOf(item),key,e); @@ -248,7 +248,7 @@ export class CraftingApp extends Application { } } if(Settings.get(Settings.USE_TOOL) && recipe.tool){ - const item = await getItem(recipe.tool); + const item = await beaversSystemInterface.uuidToDocument(recipe.tool); const component = beaversSystemInterface.componentFromEntity(item); preCastData.tool = !result._components.required.hasError(component) } diff --git a/src/apps/RecipeCompendium.ts b/src/apps/RecipeCompendium.ts index f6e2f3d..e5bfb91 100644 --- a/src/apps/RecipeCompendium.ts +++ b/src/apps/RecipeCompendium.ts @@ -1,7 +1,6 @@ import {Recipe} from "../Recipe.js"; import {Settings} from "../Settings.js"; import {AnyOf} from "../AnyOf.js"; -import {getItem} from "../helpers/Utility.js"; import {Result} from "../Result.js"; export class RecipeCompendium { @@ -112,7 +111,7 @@ export class RecipeCompendium { static async validateTool(recipe,listOfItems,result : Result): Promise{ if( recipe.tool && Settings.get(Settings.USE_TOOL)) { - const item = await getItem(recipe.tool); + const item = await beaversSystemInterface.uuidToDocument(recipe.tool); const component = beaversSystemInterface.componentFromEntity(item); result.updateComponent("required",component); } diff --git a/src/apps/RecipeSheet.ts b/src/apps/RecipeSheet.ts index 31994c8..ea1e6dd 100644 --- a/src/apps/RecipeSheet.ts +++ b/src/apps/RecipeSheet.ts @@ -1,6 +1,6 @@ import {Recipe} from "../Recipe.js"; import {getSystemSetting, Settings} from "../Settings.js"; -import {getDataFrom, getItem} from "../helpers/Utility.js"; +import {getDataFrom} from "../helpers/Utility.js"; import {AnyOf} from "../AnyOf.js"; import {getToolConfig} from "./ToolConfig.js"; @@ -188,19 +188,19 @@ export class RecipeSheet { this.recipeElement.find('.results .crafting-item-img').on("click",e=>{ const uuid = $(e.currentTarget).data("id"); if(Settings.get(Settings.DISPLAY_RESULTS)) { - getItem(uuid).then(i=>i.sheet._render(true)); + beaversSystemInterface.uuidToDocument(uuid).then(i=>i.sheet._render(true)); } }); this.recipeElement.find('.ingredients .crafting-item-img').on("click",e=>{ const uuid = $(e.currentTarget).data("id"); if(Settings.get(Settings.DISPLAY_INGREDIENTS)) { - getItem(uuid).then(i=>i.sheet._render(true)); + beaversSystemInterface.uuidToDocument(uuid).then(i=>i.sheet._render(true)); } }); this.recipeElement.find('.attendants .crafting-item-img').on("click",e=>{ const uuid = $(e.currentTarget).data("id"); if(Settings.get(Settings.DISPLAY_INGREDIENTS)) { - getItem(uuid).then(i=>i.sheet._render(true)); + beaversSystemInterface.uuidToDocument(uuid).then(i=>i.sheet._render(true)); } }); } diff --git a/src/apps/ToolConfig.ts b/src/apps/ToolConfig.ts index 6f68a6f..626a567 100644 --- a/src/apps/ToolConfig.ts +++ b/src/apps/ToolConfig.ts @@ -1,5 +1,5 @@ import {Settings} from "../Settings.js"; -import {getDataFrom, getItem} from "../helpers/Utility.js"; +import {getDataFrom} from "../helpers/Utility.js"; const components:ComponentData[] = []; @@ -98,7 +98,7 @@ async function _setToolConfig(){ } } async function _addToolConfig(uuid){ - const item = await getItem(uuid); + const item = await beaversSystemInterface.uuidToDocument(uuid); const component = beaversSystemInterface.componentFromEntity(item); components.push(component); } diff --git a/src/helpers/Utility.js b/src/helpers/Utility.js index 6ac01f4..22a7d1e 100644 --- a/src/helpers/Utility.js +++ b/src/helpers/Utility.js @@ -1,12 +1,3 @@ -export async function getItem(uuid) { - const parts = uuid.split("."); - if (parts[0] === "Compendium") { - return await game.packs.get(parts[1] + "." + parts[2]).getDocument(parts[3]); - } else { - return await fromUuid(uuid); - } -} - export function getDataFrom(e) { try { return JSON.parse(e.dataTransfer.getData('text/plain'));