From b4509555f3e4756a4918264eea0e4bc58df0cf8d Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 24 Feb 2024 12:15:48 -0700 Subject: [PATCH 001/166] On to 0.0.7 --- system.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system.json b/system.json index 0f6846a..5870577 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "dotdungeon", "title": ".dungeon", "description": "", - "version": "0.0.6", + "version": "0.0.7", "download": "https://github.com/Oliver-Akins/foundry.dungeon/releases/latest/download/dotdungeon.zip", "manifest": "https://github.com/Oliver-Akins/foundry.dungeon/releases/latest/download/system.json", "url": "https://github.com/Oliver-Akins/foundry.dungeon", From bbd96d3b450bb37fe4625ad2147a06f569c21e17 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 24 Feb 2024 12:16:13 -0700 Subject: [PATCH 002/166] Ignore lockfiles --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a5dbdbe..acef7ef 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ node_modules/ references.txt .styles/ /foundry.js +*.lock # Ignore all of the binaries and stuff that gets built for Foundry from the raw # JSON data because it's annoying seeing it in my git changes when it isn't actually From 19588bb1377e8f15a077e3952e26b7c7c7a3b149 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 24 Feb 2024 13:40:25 -0700 Subject: [PATCH 003/166] Begin work on the localization cycle prevention and add newline to existing scripts --- scripts/buildCompendia.mjs | 2 +- scripts/extractCompendia.mjs | 2 +- scripts/preventLocalizationCycles.mjs | 70 +++++++++++++++++++++++++++ scripts/updateSystem.mjs | 13 +++++ 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 scripts/updateSystem.mjs diff --git a/scripts/buildCompendia.mjs b/scripts/buildCompendia.mjs index 41b8eac..2b39aa3 100644 --- a/scripts/buildCompendia.mjs +++ b/scripts/buildCompendia.mjs @@ -29,4 +29,4 @@ async function main() { console.log(`Finished packing compendia`) }; -main(); \ No newline at end of file +main(); diff --git a/scripts/extractCompendia.mjs b/scripts/extractCompendia.mjs index 9e58a7f..32935c9 100644 --- a/scripts/extractCompendia.mjs +++ b/scripts/extractCompendia.mjs @@ -24,4 +24,4 @@ async function main() { console.log(`Finished unpacking compendia`); }; -main(); \ No newline at end of file +main(); diff --git a/scripts/preventLocalizationCycles.mjs b/scripts/preventLocalizationCycles.mjs index 0d3b427..0271122 100644 --- a/scripts/preventLocalizationCycles.mjs +++ b/scripts/preventLocalizationCycles.mjs @@ -4,3 +4,73 @@ that there are no cycles in them to prevent infinite recursion. This must pull the pattern to match subkeys on via the config, otherwise this could result in inconsistencies with the localizer logic. */ + +import { readFile } from "fs/promises"; + +class Node { + /** @type {Array} */ + connectsTo = []; + + /** @type {boolean} */ + visited = false; + + /** @type {boolean} */ + finished = false; + + id; + constructor(data) { this.id = data; }; +}; + +/** + * @param {object | string} lang The localization object to convert into a graph + * @returns {Promise | Node>} + */ +async function createGraph(data) { + throw new Error(`createGraph not Implemented Yet`); +}; + +/** + * @param {Node} from + * @returns {Promise} + */ +async function depthFirstSearch(from) { + if (from.finished) return false; + if (from.visited) return true; + from.visited = true; + for (const neighbour of from.connectsTo) { + if (depthFirstSearch(neighbour)) return true; + }; + from.finished = true; + return false; +}; + +/** + * @param {Array} graph + */ +async function checkForCycles(graph) { + for (const node of graph) { + if (node.finished) { + console.log(`skipping node: ${node.id}`); + continue; + } + if (depthFirstSearch(node)) { + console.log(`cycle found in node: ${node.id}`); + }; + }; +}; + +async function main() { + /* + Process: + - Load the system.json to identify all lang files + - Iterate through defined languages + - Construct a graph from the language file + - Iterate through nodes checking for a cycle + */ + const lang = JSON.parse(await readFile("test.lang") ?? "{}"); + const graph = await createGraph(lang); + console.log(graph) + // await checkForCycles(graph); +}; + +main(); diff --git a/scripts/updateSystem.mjs b/scripts/updateSystem.mjs new file mode 100644 index 0000000..9670675 --- /dev/null +++ b/scripts/updateSystem.mjs @@ -0,0 +1,13 @@ +/* +Takes the system.json and updates all the release-specific properties in it to +help prevent erroneous updates from being made when using the local package for +development. + +--- + +Set the "manifest" property to: + "url" property + "/releases/latest/download/system.json" + +Set the "download" property to: + "url" property + "/releases/download/{version number}/{zip_name}.zip" +*/ From fb4026dcce85d630eb3016be879465a77c1cd8c4 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 24 Feb 2024 13:41:17 -0700 Subject: [PATCH 004/166] Disable VSC branch protection and hide some files that I don't care to see in the file browser --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 82812b8..4059432 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,10 @@ "[yaml,yml]": { "editor.insertSpaces": true, "editor.tabSize": 2 + }, + "git.branchProtection": [], + "files.exclude": { + "dotdungeon.lock": true, + ".styles": true, } } \ No newline at end of file From b123bea62c17e26c7cf215e1582ab8673ac3c199 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 25 Feb 2024 00:56:46 -0700 Subject: [PATCH 005/166] Begin writing the specification for the new PC sheet --- new-pc-sheet.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 new-pc-sheet.md diff --git a/new-pc-sheet.md b/new-pc-sheet.md new file mode 100644 index 0000000..f43ce4c --- /dev/null +++ b/new-pc-sheet.md @@ -0,0 +1,80 @@ +## Tabs: +- Main + - Stats + - Skills +- Inventory + - Player + - Containers + - Inventory (divided into category of items) + - This is the items that the player will have "on them" + - Storage (divided into category of items) + - This is all of the items that the players owns and has put into storage *somewhere* + - Transportation +- Combat + - Easy skill buttons: + - Melee + - Accuracy + - Weapons + - Sync / Respawns +- Info + - Account name + - PFP + - Group name + - Aspects + - Roles +- Spells + +====== + +## Requirements: + +Stats: + - Needs to list all 6 of the primary stats + - Needs to have a dropdown for to select a die + - Nice to have: disables dice that have been selected in other stats + - Needs to have a button to roll the stat (when a die is selected) + - Foundry v12: ActiveEffect - Die needs to be able to be affected by ActiveEffects + +Skills: + - Each of the 25 skills needs to be grouped under a header of what stat it's + associated with + - Each skill must have a dropdown to indicate training level (null, trained, + expert, locked) + - Every skill must have a button to roll the dice that is labelled with the + correct formula for that skill (or "Locked" if the skill is locked) + - ActiveEffect - Increase Modifier + - Foundry v12: ActiveEffect - Increase Training Level + +Combat: + - Two weapon slots for the equipped weapon(s) + - A single armor slot + - Quick-access to the Melee / Accuracy skills + +Inventory: + - Needs three sub-tabs: + - Player + - Storage + - Transportation + - Player Subtab: + - Needs to have a section for container items, and indicating how many slots + each one has. + - List all of the items that the player has with the "inventory" location + - Show the total number of items the player on their character and how many + total slots are available + - Needs some way to move items to a different storage area (embedded-only + item sheet field maybe) + - Storage Subtab: + - List all of the items that the player has marked as in-storage + - Transportation: + - This is currently just a placeholder tab, no functionality needed other + than existing + +Spells: + - Lists all spells on a page (sortable by: alphabetical, cost, etc.) + +Info: + - Needs a place to edit the actor's name + - Needs a place to edit the actor's image + - Needs a place to edit the group name (if enabled by the GM, or is the GM) + - Needs a place to see and manage all equipped aspects + - Needs a place to see and manage all equipped roles \ No newline at end of file From d74416c620a92d1632721fb6e257d592bd3408dc Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 25 Feb 2024 19:53:41 -0700 Subject: [PATCH 006/166] Rename existing PC sheet to make it more obvious it's the MVP --- module/dotdungeon.mjs | 5 +++-- module/sheets/{PlayerSheet.mjs => MVPPCSheet.mjs} | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) rename module/sheets/{PlayerSheet.mjs => MVPPCSheet.mjs} (94%) diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index d29492f..75d7ae6 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -19,7 +19,8 @@ import { PetSheet } from "./sheets/Items/PetSheet.mjs"; // Actor Sheets import { BasicSyncSheet } from "./sheets/SyncVariations/BasicSyncSheet.mjs"; -import { PlayerSheet } from "./sheets/PlayerSheet.mjs"; +import { PlayerSheet } from "./sheets/MVPPCSheet.mjs"; +import { MVPPCSheet } from "./sheets/MVPPCSheet.mjs"; import { MobSheet } from "./sheets/MobSheet.mjs"; // Utility imports @@ -51,7 +52,7 @@ Hooks.once(`init`, async () => { CONFIG.DOTDUNGEON = DOTDUNGEON; - Actors.registerSheet("dotdungeon", PlayerSheet, { + Actors.registerSheet("dotdungeon", MVPPCSheet, { makeDefault: true, types: ["player"], label: "dotdungeon.sheet-names.PlayerSheet" diff --git a/module/sheets/PlayerSheet.mjs b/module/sheets/MVPPCSheet.mjs similarity index 94% rename from module/sheets/PlayerSheet.mjs rename to module/sheets/MVPPCSheet.mjs index 3cc65ca..7c48f1c 100644 --- a/module/sheets/PlayerSheet.mjs +++ b/module/sheets/MVPPCSheet.mjs @@ -1,7 +1,7 @@ import { ActorHandler } from "../documents/Actor/Handler.mjs"; import { GenericActorSheet } from "./GenericActorSheet.mjs"; -export class PlayerSheet extends GenericActorSheet { +export class MVPPCSheet extends GenericActorSheet { /** @override {ActorHandler} actor */ From 6d2d02b07791503816c0b1b9f7cf9a5385b42c9c Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 25 Feb 2024 23:25:18 -0700 Subject: [PATCH 007/166] Begin working on the non-MVP character sheet --- langs/en-ca.json | 5 +- module/dotdungeon.mjs | 9 +++- module/sheets/Actors/PC/Improved.mjs | 47 +++++++++++++++++++ module/sheets/MobSheet.mjs | 9 ++++ styles/root.scss | 1 + .../sheets/actor/char-sheet/themes/dark.scss | 7 +++ styles/sheets/actor/char-sheet/v2.scss | 11 +++++ styles/sheets/actor/mvp.scss | 2 +- templates/actors/char-sheet-mvp/sheet.hbs | 2 +- templates/actors/char-sheet/v2/sheet.hbs | 22 +++++++++ 10 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 module/sheets/Actors/PC/Improved.mjs create mode 100644 styles/sheets/actor/char-sheet/themes/dark.scss create mode 100644 styles/sheets/actor/char-sheet/v2.scss create mode 100644 templates/actors/char-sheet/v2/sheet.hbs diff --git a/langs/en-ca.json b/langs/en-ca.json index 1c1f3cb..f2c7ceb 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -78,7 +78,10 @@ } }, "sheet-names": { - "PlayerSheet": "PC/PUG Sheet", + "PlayerSheet": { + "MVP": "MVP PC Sheet", + "v2": "PC Sheet" + }, "SyncSheet": { "basic": "Theme: Basic" }, diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index 75d7ae6..6aa6177 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -19,7 +19,7 @@ import { PetSheet } from "./sheets/Items/PetSheet.mjs"; // Actor Sheets import { BasicSyncSheet } from "./sheets/SyncVariations/BasicSyncSheet.mjs"; -import { PlayerSheet } from "./sheets/MVPPCSheet.mjs"; +import { PlayerSheetv2 } from "./sheets/Actors/PC/Improved.mjs"; import { MVPPCSheet } from "./sheets/MVPPCSheet.mjs"; import { MobSheet } from "./sheets/MobSheet.mjs"; @@ -55,7 +55,12 @@ Hooks.once(`init`, async () => { Actors.registerSheet("dotdungeon", MVPPCSheet, { makeDefault: true, types: ["player"], - label: "dotdungeon.sheet-names.PlayerSheet" + label: "dotdungeon.sheet-names.PlayerSheet.MVP" + }); + Actors.registerSheet("dotdungeon", PlayerSheetv2, { + makeDefault: false, + types: ["player"], + label: "dotdungeon.sheet-names.PlayerSheet.v2" }); Actors.registerSheet("dotdungeon", MobSheet, { makeDefault: true, diff --git a/module/sheets/Actors/PC/Improved.mjs b/module/sheets/Actors/PC/Improved.mjs new file mode 100644 index 0000000..56c00f7 --- /dev/null +++ b/module/sheets/Actors/PC/Improved.mjs @@ -0,0 +1,47 @@ +import { GenericActorSheet } from "../../GenericActorSheet.mjs"; + +export class PlayerSheetv2 extends GenericActorSheet { + static get defaultOptions() { + let opts = mergeObject( + super.defaultOptions, + { + template: `systems/dotdungeon/templates/actors/char-sheet/v2/sheet.hbs`, + tabs: [ + { + // group: `page`, + navSelector: `.potato`, + contentSelector: `.tab-content`, + initial: `tab1`, + }, + ], + } + ); + opts.classes.push(`dotdungeon`); + return opts; + }; + + activateListeners(html) { + super.activateListeners(html); + + if (this.document.isEmbedded) return; + if (!this.isEditable) return; + console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`); + }; + + async getData() { + const ctx = await super.getData(); + /** @type {ActorHandler} */ + const actor = this.actor; + + ctx.system = actor.system; + ctx.flags = actor.flags; + ctx.items = this.actor.itemTypes; + + ctx.computed = { + canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM, + canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`), + }; + + return ctx; + }; +} \ No newline at end of file diff --git a/module/sheets/MobSheet.mjs b/module/sheets/MobSheet.mjs index 960a885..a31c949 100644 --- a/module/sheets/MobSheet.mjs +++ b/module/sheets/MobSheet.mjs @@ -1,6 +1,7 @@ import { ActorHandler } from "../documents/Actor/Handler.mjs"; import { GenericActorSheet } from "./GenericActorSheet.mjs"; import { DiceList } from "../dialogs/DiceList.mjs"; +import { PopoutTextEditor } from "../dialogs/PopoutTextEditor.mjs"; export class MobSheet extends GenericActorSheet { static get defaultOptions() { @@ -28,6 +29,14 @@ export class MobSheet extends GenericActorSheet { let d = new DiceList(this.actor); d.render(true); }); + html.find(`[data-text-editor]`) + .on(`click`, () => { + let editor = new PopoutTextEditor( + this.actor, + `system.description` + ); + editor.render(true); + }); }; async getData() { diff --git a/styles/root.scss b/styles/root.scss index 385f0a1..cc4fcbe 100644 --- a/styles/root.scss +++ b/styles/root.scss @@ -15,6 +15,7 @@ @use "./sheets/partials/panel.scss"; @use "./sheets/actor/mvp.scss"; +@use "./sheets/actor/char-sheet/v2.scss"; @use "./sheets/actor/mob/mob.scss"; @use "./sheets/actor/sync/basic.scss"; @use "./sheets/items/custom.scss"; diff --git a/styles/sheets/actor/char-sheet/themes/dark.scss b/styles/sheets/actor/char-sheet/themes/dark.scss new file mode 100644 index 0000000..65acb16 --- /dev/null +++ b/styles/sheets/actor/char-sheet/themes/dark.scss @@ -0,0 +1,7 @@ +$bg-base: #202b38; + +.actor--pc { + --sheet-bg: #{$bg-base}; + --nav-bg: var(--panel-bg); + --panel-bg: rgba(255, 255, 255, 0.05); +} diff --git a/styles/sheets/actor/char-sheet/v2.scss b/styles/sheets/actor/char-sheet/v2.scss new file mode 100644 index 0000000..8203852 --- /dev/null +++ b/styles/sheets/actor/char-sheet/v2.scss @@ -0,0 +1,11 @@ +@use "./themes/dark.scss"; + +.dotdungeon .actor--pc { + background: var(--sheet-bg); + display: grid; + grid-template-rows: 1fr minmax(min-content, 50px); + + nav { + background: var(--panel-bg); + } +} diff --git a/styles/sheets/actor/mvp.scss b/styles/sheets/actor/mvp.scss index 28fafaf..9fdd044 100644 --- a/styles/sheets/actor/mvp.scss +++ b/styles/sheets/actor/mvp.scss @@ -1,7 +1,7 @@ @use "../../vars.scss" as *; @use "../../mixins/breakpoints" as *; -.dotdungeon .actor--pc { +.dotdungeon .actor--pc-mvp { display: grid; grid-template-areas: "profile stats stats" diff --git a/templates/actors/char-sheet-mvp/sheet.hbs b/templates/actors/char-sheet-mvp/sheet.hbs index 98e9dcc..7497352 100644 --- a/templates/actors/char-sheet-mvp/sheet.hbs +++ b/templates/actors/char-sheet-mvp/sheet.hbs @@ -1,4 +1,4 @@ -
+ {{> dotdungeon.pc.profile }} diff --git a/templates/actors/char-sheet/v2/sheet.hbs b/templates/actors/char-sheet/v2/sheet.hbs new file mode 100644 index 0000000..209c808 --- /dev/null +++ b/templates/actors/char-sheet/v2/sheet.hbs @@ -0,0 +1,22 @@ + + {{!-- All panels here --}} +
+
+

Tab 1

+
+
+

Tab 2

+
+
+

Tab 3

+
+
+ + + {{!-- Tab list here --}} +
+ Tab 1 + Tab 2 + Tab 3 +
+
From 753d72b4e06461eb5558d3226e7109d18aa4063e Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 27 Feb 2024 22:49:39 -0700 Subject: [PATCH 008/166] Continue working on v2 of the PC sheet (w/ Material design now) --- module/sheets/Actors/PC/Improved.mjs | 4 +- styles/mixins/_material.scss | 6 + .../sheets/actor/char-sheet/themes/dark.scss | 29 ++- .../char-sheet/themes/material-design.scss | 167 ++++++++++++++++++ styles/sheets/actor/char-sheet/v2.scss | 19 +- styles/sheets/actor/mvp.scss | 4 +- templates/actors/char-sheet/v2/sheet.hbs | 43 +++-- 7 files changed, 249 insertions(+), 23 deletions(-) create mode 100644 styles/mixins/_material.scss create mode 100644 styles/sheets/actor/char-sheet/themes/material-design.scss diff --git a/module/sheets/Actors/PC/Improved.mjs b/module/sheets/Actors/PC/Improved.mjs index 56c00f7..59f7635 100644 --- a/module/sheets/Actors/PC/Improved.mjs +++ b/module/sheets/Actors/PC/Improved.mjs @@ -8,8 +8,8 @@ export class PlayerSheetv2 extends GenericActorSheet { template: `systems/dotdungeon/templates/actors/char-sheet/v2/sheet.hbs`, tabs: [ { - // group: `page`, - navSelector: `.potato`, + group: `page`, + navSelector: `nav`, contentSelector: `.tab-content`, initial: `tab1`, }, diff --git a/styles/mixins/_material.scss b/styles/mixins/_material.scss new file mode 100644 index 0000000..bd4d68d --- /dev/null +++ b/styles/mixins/_material.scss @@ -0,0 +1,6 @@ +@mixin elevate($height) { + background-color: var(--elevation-#{$height}dp); + -webkit-box-shadow: 0px 0px #{$height * 1.75}px 0px rgba(0,0,0,0.75); + -moz-box-shadow: 0px 0px #{$height * 1.75}px 0px rgba(0,0,0,0.75); + box-shadow: 0px 0px #{$height * 1.75}px 0px rgba(0,0,0,0.75); +} \ No newline at end of file diff --git a/styles/sheets/actor/char-sheet/themes/dark.scss b/styles/sheets/actor/char-sheet/themes/dark.scss index 65acb16..0e8bde1 100644 --- a/styles/sheets/actor/char-sheet/themes/dark.scss +++ b/styles/sheets/actor/char-sheet/themes/dark.scss @@ -1,7 +1,28 @@ -$bg-base: #202b38; +$t: transparent; + +$background: #0a0a0a; +$surface: #121212; +$primary: $t; +$secondary: $t; +$on-background: $t; +$on-surface: $t; +$on-primary: $t; +$on-secondary: $t; .actor--pc { - --sheet-bg: #{$bg-base}; - --nav-bg: var(--panel-bg); - --panel-bg: rgba(255, 255, 255, 0.05); + --sheet-bg: #{$background}; + --nav-bg: #{$surface}; + --panel-bg: #{$surface}; + + /* Elevation backgrounds to following Material design */ + --elevation-0dp: #{$surface}; + --elevation-1dp: color-mix(in lab, #{$surface}, white 5%); + --elevation-2dp: color-mix(in lab, #{$surface}, white 7%); + --elevation-3dp: color-mix(in lab, #{$surface}, white 8%); + --elevation-4dp: color-mix(in lab, #{$surface}, white 9%); + --elevation-6dp: color-mix(in lab, #{$surface}, white 11%); + --elevation-8dp: color-mix(in lab, #{$surface}, white 12%); + --elevation-12dp: color-mix(in lab, #{$surface}, white 14%); + --elevation-16dp: color-mix(in lab, #{$surface}, white 15%); + --elevation-24dp: color-mix(in lab, #{$surface}, white 16%); } diff --git a/styles/sheets/actor/char-sheet/themes/material-design.scss b/styles/sheets/actor/char-sheet/themes/material-design.scss new file mode 100644 index 0000000..aad072a --- /dev/null +++ b/styles/sheets/actor/char-sheet/themes/material-design.scss @@ -0,0 +1,167 @@ +:root { + --md-source: #005500; + /* primary */ + --md-ref-palette-primary0: #000000; + --md-ref-palette-primary10: #002200; + --md-ref-palette-primary20: #003a00; + --md-ref-palette-primary25: #004600; + --md-ref-palette-primary30: #005300; + --md-ref-palette-primary35: #12600b; + --md-ref-palette-primary40: #226d19; + --md-ref-palette-primary50: #3d8730; + --md-ref-palette-primary60: #56a248; + --md-ref-palette-primary70: #70bd5f; + --md-ref-palette-primary80: #8bd978; + --md-ref-palette-primary90: #a6f691; + --md-ref-palette-primary95: #caffb9; + --md-ref-palette-primary98: #edffe1; + --md-ref-palette-primary99: #f7ffee; + --md-ref-palette-primary100: #ffffff; + /* secondary */ + --md-ref-palette-secondary0: #000000; + --md-ref-palette-secondary10: #380038; + --md-ref-palette-secondary20: #5b005b; + --md-ref-palette-secondary25: #6c056c; + --md-ref-palette-secondary30: #7a1979; + --md-ref-palette-secondary35: #892886; + --md-ref-palette-secondary40: #973693; + --md-ref-palette-secondary50: #b450ae; + --md-ref-palette-secondary60: #d26ac9; + --md-ref-palette-secondary70: #f084e6; + --md-ref-palette-secondary80: #ffaaf3; + --md-ref-palette-secondary90: #ffd7f5; + --md-ref-palette-secondary95: #ffebf8; + --md-ref-palette-secondary98: #fff7f9; + --md-ref-palette-secondary99: #fffbff; + --md-ref-palette-secondary100: #ffffff; + /* tertiary */ + --md-ref-palette-tertiary0: #000000; + --md-ref-palette-tertiary10: #002022; + --md-ref-palette-tertiary20: #003739; + --md-ref-palette-tertiary25: #104245; + --md-ref-palette-tertiary30: #1e4d50; + --md-ref-palette-tertiary35: #2b595c; + --md-ref-palette-tertiary40: #386568; + --md-ref-palette-tertiary50: #517f82; + --md-ref-palette-tertiary60: #6b989c; + --md-ref-palette-tertiary70: #85b3b6; + --md-ref-palette-tertiary80: #a0cfd2; + --md-ref-palette-tertiary90: #bcebee; + --md-ref-palette-tertiary95: #caf9fd; + --md-ref-palette-tertiary98: #e7feff; + --md-ref-palette-tertiary99: #f3ffff; + --md-ref-palette-tertiary100: #ffffff; + /* neutral */ + --md-ref-palette-neutral0: #000000; + --md-ref-palette-neutral10: #1a1c18; + --md-ref-palette-neutral20: #2f312d; + --md-ref-palette-neutral25: #3a3c38; + --md-ref-palette-neutral30: #454743; + --md-ref-palette-neutral35: #51534e; + --md-ref-palette-neutral40: #5d5f5a; + --md-ref-palette-neutral50: #767872; + --md-ref-palette-neutral60: #90918c; + --md-ref-palette-neutral70: #abaca6; + --md-ref-palette-neutral80: #c6c7c1; + --md-ref-palette-neutral90: #e2e3dc; + --md-ref-palette-neutral95: #f1f1eb; + --md-ref-palette-neutral98: #f9faf3; + --md-ref-palette-neutral99: #fcfdf6; + --md-ref-palette-neutral100: #ffffff; + /* neutral-variant */ + --md-ref-palette-neutral-variant0: #000000; + --md-ref-palette-neutral-variant10: #181d15; + --md-ref-palette-neutral-variant20: #2c3229; + --md-ref-palette-neutral-variant25: #373d34; + --md-ref-palette-neutral-variant30: #43483f; + --md-ref-palette-neutral-variant35: #4e544a; + --md-ref-palette-neutral-variant40: #5a6056; + --md-ref-palette-neutral-variant50: #73796e; + --md-ref-palette-neutral-variant60: #8d9387; + --md-ref-palette-neutral-variant70: #a7ada1; + --md-ref-palette-neutral-variant80: #c3c8bc; + --md-ref-palette-neutral-variant90: #dfe4d7; + --md-ref-palette-neutral-variant95: #edf3e5; + --md-ref-palette-neutral-variant98: #f6fbee; + --md-ref-palette-neutral-variant99: #f9fef1; + --md-ref-palette-neutral-variant100: #ffffff; + /* error */ + --md-ref-palette-error0: #000000; + --md-ref-palette-error10: #410002; + --md-ref-palette-error20: #690005; + --md-ref-palette-error25: #7e0007; + --md-ref-palette-error30: #93000a; + --md-ref-palette-error35: #a80710; + --md-ref-palette-error40: #ba1a1a; + --md-ref-palette-error50: #de3730; + --md-ref-palette-error60: #ff5449; + --md-ref-palette-error70: #ff897d; + --md-ref-palette-error80: #ffb4ab; + --md-ref-palette-error90: #ffdad6; + --md-ref-palette-error95: #ffedea; + --md-ref-palette-error98: #fff8f7; + --md-ref-palette-error99: #fffbff; + --md-ref-palette-error100: #ffffff; + /* light */ + --md-sys-color-primary-light: #226d19; + --md-sys-color-on-primary-light: #ffffff; + --md-sys-color-primary-container-light: #a6f691; + --md-sys-color-on-primary-container-light: #002200; + --md-sys-color-secondary-light: #973693; + --md-sys-color-on-secondary-light: #ffffff; + --md-sys-color-secondary-container-light: #ffd7f5; + --md-sys-color-on-secondary-container-light: #380038; + --md-sys-color-tertiary-light: #386568; + --md-sys-color-on-tertiary-light: #ffffff; + --md-sys-color-tertiary-container-light: #bcebee; + --md-sys-color-on-tertiary-container-light: #002022; + --md-sys-color-error-light: #ba1a1a; + --md-sys-color-error-container-light: #ffdad6; + --md-sys-color-on-error-light: #ffffff; + --md-sys-color-on-error-container-light: #410002; + --md-sys-color-background-light: #fcfdf6; + --md-sys-color-on-background-light: #1a1c18; + --md-sys-color-surface-light: #fcfdf6; + --md-sys-color-on-surface-light: #1a1c18; + --md-sys-color-surface-variant-light: #dfe4d7; + --md-sys-color-on-surface-variant-light: #43483f; + --md-sys-color-outline-light: #73796e; + --md-sys-color-inverse-on-surface-light: #f1f1eb; + --md-sys-color-inverse-surface-light: #2f312d; + --md-sys-color-inverse-primary-light: #8bd978; + --md-sys-color-shadow-light: #000000; + --md-sys-color-surface-tint-light: #226d19; + --md-sys-color-outline-variant-light: #c3c8bc; + --md-sys-color-scrim-light: #000000; + /* dark */ + --md-sys-color-primary-dark: #8bd978; + --md-sys-color-on-primary-dark: #003a00; + --md-sys-color-primary-container-dark: #005300; + --md-sys-color-on-primary-container-dark: #a6f691; + --md-sys-color-secondary-dark: #ffaaf3; + --md-sys-color-on-secondary-dark: #5b005b; + --md-sys-color-secondary-container-dark: #7a1979; + --md-sys-color-on-secondary-container-dark: #ffd7f5; + --md-sys-color-tertiary-dark: #a0cfd2; + --md-sys-color-on-tertiary-dark: #003739; + --md-sys-color-tertiary-container-dark: #1e4d50; + --md-sys-color-on-tertiary-container-dark: #bcebee; + --md-sys-color-error-dark: #ffb4ab; + --md-sys-color-error-container-dark: #93000a; + --md-sys-color-on-error-dark: #690005; + --md-sys-color-on-error-container-dark: #ffdad6; + --md-sys-color-background-dark: #1a1c18; + --md-sys-color-on-background-dark: #e2e3dc; + --md-sys-color-surface-dark: #1a1c18; + --md-sys-color-on-surface-dark: #e2e3dc; + --md-sys-color-surface-variant-dark: #43483f; + --md-sys-color-on-surface-variant-dark: #c3c8bc; + --md-sys-color-outline-dark: #8d9387; + --md-sys-color-inverse-on-surface-dark: #1a1c18; + --md-sys-color-inverse-surface-dark: #e2e3dc; + --md-sys-color-inverse-primary-dark: #226d19; + --md-sys-color-shadow-dark: #000000; + --md-sys-color-surface-tint-dark: #8bd978; + --md-sys-color-outline-variant-dark: #43483f; + --md-sys-color-scrim-dark: #000000; +} \ No newline at end of file diff --git a/styles/sheets/actor/char-sheet/v2.scss b/styles/sheets/actor/char-sheet/v2.scss index 8203852..d1ef5e3 100644 --- a/styles/sheets/actor/char-sheet/v2.scss +++ b/styles/sheets/actor/char-sheet/v2.scss @@ -1,11 +1,26 @@ @use "./themes/dark.scss"; +@use "../../../mixins/material" as material; .dotdungeon .actor--pc { - background: var(--sheet-bg); + background-color: var(--sheet-bg); display: grid; grid-template-rows: 1fr minmax(min-content, 50px); + color: white; + + .panel-0dp { @include material.elevate(0); margin: 1rem; padding: 10px; } + .panel-1dp { @include material.elevate(1); margin: 1rem; padding: 10px; } + .panel-2dp { @include material.elevate(2); margin: 1rem; padding: 10px; } + .panel-3dp { @include material.elevate(3); margin: 1rem; padding: 10px; } + .panel-4dp { @include material.elevate(4); margin: 1rem; padding: 10px; } + .panel-6dp { @include material.elevate(6); margin: 1rem; padding: 10px; } + .panel-8dp { @include material.elevate(8); margin: 1rem; padding: 10px; } + .panel-12dp { @include material.elevate(12); margin: 1rem; padding: 10px; } + .panel-16dp { @include material.elevate(16); margin: 1rem; padding: 10px; } + .panel-24dp { @include material.elevate(24); margin: 1rem; padding: 10px; } + nav { - background: var(--panel-bg); + background-color: var(--nav-bg); + @include material.elevate(02) } } diff --git a/styles/sheets/actor/mvp.scss b/styles/sheets/actor/mvp.scss index 9fdd044..087e744 100644 --- a/styles/sheets/actor/mvp.scss +++ b/styles/sheets/actor/mvp.scss @@ -271,7 +271,7 @@ @include bp-m { .dotdungeon { - .actor--pc { + .actor--pc-mvp { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(15, min-content); grid-template-areas: @@ -311,7 +311,7 @@ @include bp-s { .dotdungeon { - .actor--pc { + .actor--pc-mvp { grid-template-columns: 1fr; grid-template-rows: repeat(12, min-content); grid-template-areas: diff --git a/templates/actors/char-sheet/v2/sheet.hbs b/templates/actors/char-sheet/v2/sheet.hbs index 209c808..7880fa7 100644 --- a/templates/actors/char-sheet/v2/sheet.hbs +++ b/templates/actors/char-sheet/v2/sheet.hbs @@ -1,22 +1,39 @@
{{!-- All panels here --}}
-
-

Tab 1

-
-
-

Tab 2

-
-
-

Tab 3

+
Avatar
+
+
+

Build

+
+
+

Meta

+
+
+

Presence

+
+
+

Hands

+
+
+

Tilt

+
+
+

RNG

+
+
Combat
+
Inventory
+
Spells
{{!-- Tab list here --}} -
- Tab 1 - Tab 2 - Tab 3 -
+
From 0e8d1615a7ff405fc762300c3cfac02e935a702e Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Thu, 29 Feb 2024 22:35:28 -0700 Subject: [PATCH 009/166] Begin implementation of the Stats / Skills tab --- langs/en-ca.2.json | 42 +++++++++++++ module/config.mjs | 7 ++- module/handlebars.mjs | 5 +- module/helpers/index.mjs | 2 + module/models/Actor/Player.mjs | 25 +++++--- module/sheets/Actors/PC/Improved.mjs | 59 ++++++++++++++++++- module/utils/modifierToString.mjs | 18 ++++++ styles/generic.scss | 1 + styles/mixins/_material.scss | 2 +- .../sheets/actor/char-sheet/pages/stats.scss | 48 +++++++++++++++ .../sheets/actor/char-sheet/themes/dark.scss | 28 +++++---- styles/sheets/actor/char-sheet/v2.scss | 36 ++++++----- styles/sheets/partials/stat.scss | 2 +- system.json | 2 +- .../char-sheet/v2/partials/stats.v2.pc.hbs | 56 ++++++++++++++++++ templates/actors/char-sheet/v2/sheet.hbs | 23 +------- 16 files changed, 292 insertions(+), 64 deletions(-) create mode 100644 langs/en-ca.2.json create mode 100644 module/utils/modifierToString.mjs create mode 100644 styles/sheets/actor/char-sheet/pages/stats.scss create mode 100644 templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs diff --git a/langs/en-ca.2.json b/langs/en-ca.2.json new file mode 100644 index 0000000..6e03f87 --- /dev/null +++ b/langs/en-ca.2.json @@ -0,0 +1,42 @@ +{ + "dotdungeon": { + "stat": { + "build": "Build", + "meta": "Meta", + "presence": "Presence", + "hands": "Hands", + "tilt": "Tilt", + "rng": "RNG" + }, + "skills": { + "defense": "Defense", + "magic": "Magic", + "melee": "Melee", + "platforming": "Platforming", + "strength": "Strength", + "alchemy": "Alchemy", + "arcanum": "Arcanum", + "dreams": "Dreams", + "lore": "Lore", + "navigation": "Navigation", + "animal_handling": "Animal Handling", + "perception": "Perception", + "sneak": "Sneak", + "speech": "Speech", + "vibes": "Vibes", + "accuracy": "Accuracy", + "crafting": "Crafting", + "engineering": "Engineering", + "explosives": "Explosives", + "piloting": "Piloting" + }, + "die": { + "d4": "d4", + "d6": "d6", + "d8": "d8", + "d10": "d10", + "d12": "d12", + "d20": "d20" + } + } +} \ No newline at end of file diff --git a/module/config.mjs b/module/config.mjs index 61caf63..664ecd2 100644 --- a/module/config.mjs +++ b/module/config.mjs @@ -1,6 +1,11 @@ export const statDice = [ `d4`, `d6`, `d8`, `d10`, `d12`, `d20` ]; -export const trainingLevels = [``, `locked`, `+2`, `+4`]; +export const trainingLevels = { + locked: -1, + untrained: 0, + trained: 2, + expert: 4 +} export const damageTypes = [ `slashing`, `piercing`, `smashing`, `gun`, `neon`, `shadow`, `solar` ]; diff --git a/module/handlebars.mjs b/module/handlebars.mjs index ff1c80d..bd91425 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -7,7 +7,7 @@ export const partials = [ `partials/panel.hbs`, `items/aspect.hbs`, - // All of the partials for the PC sheet panels + // All of the partials for the PC MVP sheet panels `actors/char-sheet-mvp/panels/aspect.pc.hbs`, `actors/char-sheet-mvp/panels/backpack.pc.hbs`, `actors/char-sheet-mvp/panels/mounts.pc.hbs`, @@ -18,6 +18,9 @@ export const partials = [ `actors/char-sheet-mvp/panels/pets.pc.hbs`, `actors/char-sheet-mvp/panels/sync.pc.hbs`, `actors/char-sheet-mvp/panels/weapons.pc.hbs`, + + // The v2 PC sheet partials + `actors/char-sheet/v2/partials/stats.v2.pc.hbs`, ]; export const icons = [ diff --git a/module/helpers/index.mjs b/module/helpers/index.mjs index 246c04d..a8456b3 100644 --- a/module/helpers/index.mjs +++ b/module/helpers/index.mjs @@ -3,6 +3,7 @@ import { createArray } from "./createArray.mjs"; import { detailsExpanded } from "./detailsExpanded.mjs"; import { objectValue } from "./objectValue.mjs"; import { toFriendlyDuration } from "./toFriendlyDuration.mjs"; +import { localizer } from "../utils/localizer.mjs"; export default { @@ -12,6 +13,7 @@ export default { "dd-toFriendlyDuration": toFriendlyDuration, "dd-objectValue": objectValue, "dd-expanded": detailsExpanded, + "dd-i18n": localizer, // Simple helpers "dd-stringify": v => JSON.stringify(v, null, ` `), diff --git a/module/models/Actor/Player.mjs b/module/models/Actor/Player.mjs index bd554ad..3d75709 100644 --- a/module/models/Actor/Player.mjs +++ b/module/models/Actor/Player.mjs @@ -1,4 +1,5 @@ import { MappingField } from "../fields/MappingField.mjs"; +import DOTDUNGEON from "../../config.mjs"; function diceChoiceField() { return new foundry.data.fields.StringField({ @@ -6,17 +7,17 @@ function diceChoiceField() { blank: true, trim: true, options() { - return CONFIG.DOTDUNGEON.statDice; + return DOTDUNGEON.statDice; }, }); }; function trainingLevelField() { - return new foundry.data.fields.StringField({ - initial: ``, - blank: true, - trim: true, - options: CONFIG.DOTDUNGEON.trainingLevels, + return new foundry.data.fields.NumberField({ + initial: 0, + min: -1, + integer: true, + options: Object.values(DOTDUNGEON.trainingLevels), }); }; @@ -24,7 +25,7 @@ function weaponDamageTypeField() { return new foundry.data.fields.StringField({ initial: ``, blank: true, - options: [ ``, ...CONFIG.DOTDUNGEON.damageTypes ], + options: [ ``, ...DOTDUNGEON.damageTypes ], }); }; @@ -32,7 +33,7 @@ function ammoTypeField() { return new foundry.data.fields.StringField({ initial: ``, blank: true, - options: [ ``, ...CONFIG.DOTDUNGEON.ammoTypes ], + options: [ ``, ...DOTDUNGEON.ammoTypes ], }); }; @@ -40,6 +41,14 @@ export class PlayerData extends foundry.abstract.TypeDataModel { static defineSchema() { const fields = foundry.data.fields; return { + /* + These are special data properties that will be used by ActiveEffects + to modify certain limits within the actor, allowing for neat hacks + that change these + */ + weapon_slots: new fields.NumberField({ initial: 2 }), + inventory_slots: new fields.NumberField({ initial: 0 }), + bytes: new fields.NumberField({ initial: 0, min: 0, diff --git a/module/sheets/Actors/PC/Improved.mjs b/module/sheets/Actors/PC/Improved.mjs index 59f7635..a84b852 100644 --- a/module/sheets/Actors/PC/Improved.mjs +++ b/module/sheets/Actors/PC/Improved.mjs @@ -1,4 +1,7 @@ import { GenericActorSheet } from "../../GenericActorSheet.mjs"; +import DOTDUNGEON from "../../../config.mjs"; +import { localizer } from "../../../utils/localizer.mjs"; +import { modifierToString } from "../../../utils/modifierToString.mjs"; export class PlayerSheetv2 extends GenericActorSheet { static get defaultOptions() { @@ -10,8 +13,8 @@ export class PlayerSheetv2 extends GenericActorSheet { { group: `page`, navSelector: `nav`, - contentSelector: `.tab-content`, - initial: `tab1`, + contentSelector: `.page-content`, + initial: `stats`, }, ], } @@ -40,8 +43,58 @@ export class PlayerSheetv2 extends GenericActorSheet { ctx.computed = { canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM, canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`), + stats: this.#statData, }; - + console.log(ctx) return ctx; }; + + get #statData() { + const stats = []; + const usedDice = new Set(Object.values(this.actor.system.stats)); + for (const statName in this.actor.system.stats) { + const stat = { + key: statName, + name: localizer(`dotdungeon.stat.${statName}`), + value: this.actor.system.stats[statName], + }; + + /* + Determine what dice are available to the user in the dropdown + selector. Disables all dice options that are selected, but not used + by this stat. + */ + stat.dieOptions = DOTDUNGEON.statDice.map(die => { + return { + value: die, + label: localizer(`dotdungeon.die.${die}`, { stat: statName }), + disabled: usedDice.has(die) && this.actor.system.stats[statName] !== die, + }; + }); + + /* + Calculating the data needed in order to display all of the skills + for this character. + */ + stat.skills = []; + for (const skill in this.actor.system.skills[statName]) { + const value = this.actor.system.skills[statName][skill]; + stat.skills.push({ + key: skill, + name: localizer(`dotdungeon.skills.${skill}`), + value, + formula: `1` + stat.value + modifierToString(value), + rollDisabled: stat.value === `` || value === `locked`, + }); + }; + + stats.push(stat); + }; + return stats; + }; + + _updateObject(...args) { + console.log(args) + super._updateObject(...args); + }; } \ No newline at end of file diff --git a/module/utils/modifierToString.mjs b/module/utils/modifierToString.mjs new file mode 100644 index 0000000..2d1c59c --- /dev/null +++ b/module/utils/modifierToString.mjs @@ -0,0 +1,18 @@ +/** + * Takes in an integer and converts it into a string format that can be used in + * roll formulas or for displaying to the user. + * + * @param {number} mod The modifier to stringify + * @param {object} opts + * @param {boolean} opts.spaces Puts spaces on either side of the operand + * @returns {string} + */ +export function modifierToString(mod, opts = {}) { + if (mod == 0) return ``; + + let value = [``, `+`, mod] + if (mod < 0) { + value = [``, `-`, Math.abs(mod)] + }; + return value.join(opts.spaces ? ` ` : ``); +}; diff --git a/styles/generic.scss b/styles/generic.scss index 6769ebc..ae3bce9 100644 --- a/styles/generic.scss +++ b/styles/generic.scss @@ -16,6 +16,7 @@ h2, h3, h4, h5, h6 { @include fvtt_reset; + color: inherit; font-family: $title-font; margin: 0; } diff --git a/styles/mixins/_material.scss b/styles/mixins/_material.scss index bd4d68d..2eb9bec 100644 --- a/styles/mixins/_material.scss +++ b/styles/mixins/_material.scss @@ -1,5 +1,5 @@ @mixin elevate($height) { - background-color: var(--elevation-#{$height}dp); + background-color: var(--elevation-#{$height}dp-bg); -webkit-box-shadow: 0px 0px #{$height * 1.75}px 0px rgba(0,0,0,0.75); -moz-box-shadow: 0px 0px #{$height * 1.75}px 0px rgba(0,0,0,0.75); box-shadow: 0px 0px #{$height * 1.75}px 0px rgba(0,0,0,0.75); diff --git a/styles/sheets/actor/char-sheet/pages/stats.scss b/styles/sheets/actor/char-sheet/pages/stats.scss new file mode 100644 index 0000000..995336a --- /dev/null +++ b/styles/sheets/actor/char-sheet/pages/stats.scss @@ -0,0 +1,48 @@ +.dotdungeon .actor--pc .active.stats-panel { + display: grid; + height: 100%; + gap: 16px; + grid-template-columns: 1fr 1fr; + grid-template-rows: auto auto auto; + + .stat { + border-radius: 8px; + color: white; + + select { + height: 100%; + outline: none; + border: none; + } + + &__header { + padding: 8px; + display: flex; + align-items: center; + flex-direction: row; + color: var(--stat-divider-text-color); + gap: 8px; + > :first-child { + flex-grow: 1; + } + &:not(:only-child) { + border-bottom: 1px solid var(--stat-divider-color); + } + } + + &__skills { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 8px; + margin: 8px; + align-items: center; + label { + text-align: end; + justify-self: right; + } + button { + margin-right: 25%; + } + } + } +} \ No newline at end of file diff --git a/styles/sheets/actor/char-sheet/themes/dark.scss b/styles/sheets/actor/char-sheet/themes/dark.scss index 0e8bde1..e315e3a 100644 --- a/styles/sheets/actor/char-sheet/themes/dark.scss +++ b/styles/sheets/actor/char-sheet/themes/dark.scss @@ -2,8 +2,8 @@ $t: transparent; $background: #0a0a0a; $surface: #121212; -$primary: $t; -$secondary: $t; +$primary: #005300; +$secondary: #6c056c; $on-background: $t; $on-surface: $t; $on-primary: $t; @@ -12,17 +12,19 @@ $on-secondary: $t; .actor--pc { --sheet-bg: #{$background}; --nav-bg: #{$surface}; - --panel-bg: #{$surface}; /* Elevation backgrounds to following Material design */ - --elevation-0dp: #{$surface}; - --elevation-1dp: color-mix(in lab, #{$surface}, white 5%); - --elevation-2dp: color-mix(in lab, #{$surface}, white 7%); - --elevation-3dp: color-mix(in lab, #{$surface}, white 8%); - --elevation-4dp: color-mix(in lab, #{$surface}, white 9%); - --elevation-6dp: color-mix(in lab, #{$surface}, white 11%); - --elevation-8dp: color-mix(in lab, #{$surface}, white 12%); - --elevation-12dp: color-mix(in lab, #{$surface}, white 14%); - --elevation-16dp: color-mix(in lab, #{$surface}, white 15%); - --elevation-24dp: color-mix(in lab, #{$surface}, white 16%); + --elevation-0dp-bg: #{$surface}; + --elevation-1dp-bg: color-mix(in lab, transparent, white 5%); + --elevation-2dp-bg: color-mix(in lab, transparent, white 7%); + --elevation-3dp-bg: color-mix(in lab, transparent, white 8%); + --elevation-4dp-bg: color-mix(in lab, transparent, white 9%); + --elevation-6dp-bg: color-mix(in lab, transparent, white 11%); + --elevation-8dp-bg: color-mix(in lab, transparent, white 12%); + --elevation-12dp-bg: color-mix(in lab, transparent, white 14%); + --elevation-16dp-bg: color-mix(in lab, transparent, white 15%); + --elevation-24dp-bg: color-mix(in lab, transparent, white 16%); + + --stat-divider-color: #{$secondary}; + --stat-header-text-color: white; } diff --git a/styles/sheets/actor/char-sheet/v2.scss b/styles/sheets/actor/char-sheet/v2.scss index d1ef5e3..b6a087e 100644 --- a/styles/sheets/actor/char-sheet/v2.scss +++ b/styles/sheets/actor/char-sheet/v2.scss @@ -1,26 +1,34 @@ @use "./themes/dark.scss"; @use "../../../mixins/material" as material; +@use "./pages/stats.scss"; + .dotdungeon .actor--pc { background-color: var(--sheet-bg); - display: grid; - grid-template-rows: 1fr minmax(min-content, 50px); + position: relative; color: white; - .panel-0dp { @include material.elevate(0); margin: 1rem; padding: 10px; } - .panel-1dp { @include material.elevate(1); margin: 1rem; padding: 10px; } - .panel-2dp { @include material.elevate(2); margin: 1rem; padding: 10px; } - .panel-3dp { @include material.elevate(3); margin: 1rem; padding: 10px; } - .panel-4dp { @include material.elevate(4); margin: 1rem; padding: 10px; } - .panel-6dp { @include material.elevate(6); margin: 1rem; padding: 10px; } - .panel-8dp { @include material.elevate(8); margin: 1rem; padding: 10px; } - .panel-12dp { @include material.elevate(12); margin: 1rem; padding: 10px; } - .panel-16dp { @include material.elevate(16); margin: 1rem; padding: 10px; } - .panel-24dp { @include material.elevate(24); margin: 1rem; padding: 10px; } + .e-0dp { @include material.elevate(0); } + .e-1dp { @include material.elevate(1); } + .e-2dp { @include material.elevate(2); } + .e-3dp { @include material.elevate(3); } + .e-4dp { @include material.elevate(4); } + .e-6dp { @include material.elevate(6); } + .e-8dp { @include material.elevate(8); } + .e-12dp { @include material.elevate(12); } + .e-16dp { @include material.elevate(16); } + .e-24dp { @include material.elevate(24); } nav { background-color: var(--nav-bg); - @include material.elevate(02) + @include material.elevate(02); + position: absolute; + bottom: 0; + width: 100%; } -} + + .page-content { + padding: 16px; + } +} \ No newline at end of file diff --git a/styles/sheets/partials/stat.scss b/styles/sheets/partials/stat.scss index 1875cf3..1937854 100644 --- a/styles/sheets/partials/stat.scss +++ b/styles/sheets/partials/stat.scss @@ -1,4 +1,4 @@ -.dotdungeon .stat { +.dotdungeon .actor--pc-mvp .stat { display: flex; flex-direction: column; align-items: center; diff --git a/system.json b/system.json index 5870577..3c80e4b 100644 --- a/system.json +++ b/system.json @@ -27,7 +27,7 @@ { "lang": "en", "name": "English (Canadian)", - "path": "langs/en-ca.json" + "path": "langs/en-ca.2.json" } ], "packs": [ diff --git a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs new file mode 100644 index 0000000..f0d2c43 --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs @@ -0,0 +1,56 @@ +
+ {{!-- + Iterate over each stat in the display data + - header: + - localized stat name + - stat dice dropdown + - roll button + - body (if skills present): + - iterate over all of the skills + - localized skill name + - training dropdown + - roll button + --}} + {{#each computed.stats as | stat |}} +
+
+

{{stat.name}}

+ + +
+ {{#if stat.skills}} +
+ {{#each stat.skills as | skill |}} + + + + {{/each}} +
+ {{/if}} +
+ {{/each}} +
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/sheet.hbs b/templates/actors/char-sheet/v2/sheet.hbs index 7880fa7..0b2e082 100644 --- a/templates/actors/char-sheet/v2/sheet.hbs +++ b/templates/actors/char-sheet/v2/sheet.hbs @@ -1,27 +1,8 @@
{{!-- All panels here --}} -
+
Avatar
-
-
-

Build

-
-
-

Meta

-
-
-

Presence

-
-
-

Hands

-
-
-

Tilt

-
-
-

RNG

-
-
+ {{> dotdungeon.pc.v2.stats }}
Combat
Inventory
Spells
From 7516e7b42bf18175811d744e4f7557b9b278c5d0 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Fri, 1 Mar 2024 18:34:16 -0700 Subject: [PATCH 010/166] Implement the custom options helper (closes #92) --- module/helpers/index.mjs | 2 ++ module/helpers/options.mjs | 32 +++++++++++++++++++ .../char-sheet/v2/partials/stats.v2.pc.hbs | 9 +----- 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 module/helpers/options.mjs diff --git a/module/helpers/index.mjs b/module/helpers/index.mjs index a8456b3..44fb372 100644 --- a/module/helpers/index.mjs +++ b/module/helpers/index.mjs @@ -4,6 +4,7 @@ import { detailsExpanded } from "./detailsExpanded.mjs"; import { objectValue } from "./objectValue.mjs"; import { toFriendlyDuration } from "./toFriendlyDuration.mjs"; import { localizer } from "../utils/localizer.mjs"; +import { options } from "./options.mjs"; export default { @@ -14,6 +15,7 @@ export default { "dd-objectValue": objectValue, "dd-expanded": detailsExpanded, "dd-i18n": localizer, + "dd-options": options, // Simple helpers "dd-stringify": v => JSON.stringify(v, null, ` `), diff --git a/module/helpers/options.mjs b/module/helpers/options.mjs new file mode 100644 index 0000000..8775ebc --- /dev/null +++ b/module/helpers/options.mjs @@ -0,0 +1,32 @@ +/** + * @typedef {object} Option + * @property {string} [label] + * @property {string|number} value + * @property {boolean} [disabled] + */ + +/** + * @param {string | number} selected + * @param {Array` + ); + }; + return htmlOptions.join(`\n`); +}; diff --git a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs index f0d2c43..87bc6b1 100644 --- a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs @@ -19,14 +19,7 @@ name="system.stats.{{stat.key}}" class="e-2dp" > - {{#select stat.value}} - - {{#each stat.dieOptions as | die |}} - - {{/each}} - {{/select}} + {{{dd-options stat.value stat.dieOptions}}} {{#if stat.skills}} -
+
{{#each stat.skills as | skill |}} - - + +
{{#if stat.skills}} -
- {{#each stat.skills as | skill |}} - - - - {{/each}} + {{#if stat.value}} +
+ {{#each stat.skills as | skill |}} + + + + {{/each}} +
+ {{else}} +
+

+ {{dd-i18n "dotdungeon.sheet.actor.v2.stat-not-chosen" stat}} +

+ {{/if}} {{/if}}
{{/each}} From 5f09f92790810dae5b99ec630a4207db22b5dce8 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 2 Mar 2024 22:40:32 -0700 Subject: [PATCH 013/166] Implement the Inventory tab's sub-navigation (closes #97) --- module/handlebars.mjs | 4 +++ module/sheets/Actors/PC/Improved.mjs | 10 ++++-- styles/mixins/_partials.scss | 13 ++++++- .../actor/char-sheet/pages/inventory.scss | 9 +++++ .../sheets/actor/char-sheet/pages/stats.scss | 3 +- .../sheets/actor/char-sheet/themes/dark.scss | 2 +- styles/sheets/actor/char-sheet/v2.scss | 35 ++++++++++++++----- .../v2/partials/inventory/inventory.v2.pc.hbs | 5 +++ .../v2/partials/inventory/player.v2.pc.hbs | 3 ++ .../v2/partials/inventory/storage.v2.pc.hbs | 1 + .../inventory/transportation.v2.pc.hbs | 1 + templates/actors/char-sheet/v2/sheet.hbs | 27 +++++++++----- 12 files changed, 90 insertions(+), 23 deletions(-) create mode 100644 styles/sheets/actor/char-sheet/pages/inventory.scss create mode 100644 templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs create mode 100644 templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs create mode 100644 templates/actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs create mode 100644 templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs diff --git a/module/handlebars.mjs b/module/handlebars.mjs index bd91425..74dd8da 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -21,6 +21,10 @@ export const partials = [ // The v2 PC sheet partials `actors/char-sheet/v2/partials/stats.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs`, ]; export const icons = [ diff --git a/module/sheets/Actors/PC/Improved.mjs b/module/sheets/Actors/PC/Improved.mjs index d004963..7396eaf 100644 --- a/module/sheets/Actors/PC/Improved.mjs +++ b/module/sheets/Actors/PC/Improved.mjs @@ -12,10 +12,16 @@ export class PlayerSheetv2 extends GenericActorSheet { tabs: [ { group: `page`, - navSelector: `nav`, + navSelector: `nav.page`, contentSelector: `.page-content`, - initial: `stats`, + initial: `inventory`, }, + { + group: `inventory`, + navSelector: `nav.inventory`, + contentSelector: `.tab[data-tab="inventory"]`, + initial: `player`, + } ], } ); diff --git a/styles/mixins/_partials.scss b/styles/mixins/_partials.scss index bc8e5e7..8932b3e 100644 --- a/styles/mixins/_partials.scss +++ b/styles/mixins/_partials.scss @@ -1,4 +1,5 @@ @use "../vars" as *; +@use "./material" as material; @mixin input-generic { border-width: 2px; @@ -12,4 +13,14 @@ &:active { transform: scale(103%); } -} \ No newline at end of file +} + +@mixin sub-nav($parent, $group, $display) { + nav.#{$group} { + @include material.elevate(1); + display: none; + } + &:has(nav.#{$parent} .active[data-tab="#{$group}"]) nav.#{$group} { + display: #{$display}; + } +} diff --git a/styles/sheets/actor/char-sheet/pages/inventory.scss b/styles/sheets/actor/char-sheet/pages/inventory.scss new file mode 100644 index 0000000..753770c --- /dev/null +++ b/styles/sheets/actor/char-sheet/pages/inventory.scss @@ -0,0 +1,9 @@ +.dotdungeon .actor--pc-v2 .active .inventory-page { + margin-bottom: 100px; +} + +.dotdungeon .actor--pc-v2 .active .inventory-page .tab[data-tab="player"] { + display: grid; + gap: 16px; + grid-template-columns: 1fr 4fr; +} \ No newline at end of file diff --git a/styles/sheets/actor/char-sheet/pages/stats.scss b/styles/sheets/actor/char-sheet/pages/stats.scss index 772c834..a4f9dee 100644 --- a/styles/sheets/actor/char-sheet/pages/stats.scss +++ b/styles/sheets/actor/char-sheet/pages/stats.scss @@ -1,6 +1,5 @@ -.dotdungeon .actor--pc .active.stats-panel { +.dotdungeon .actor--pc-v2 .active.stats-page { display: grid; - height: 100%; gap: 16px; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; diff --git a/styles/sheets/actor/char-sheet/themes/dark.scss b/styles/sheets/actor/char-sheet/themes/dark.scss index 88484cb..1add0fd 100644 --- a/styles/sheets/actor/char-sheet/themes/dark.scss +++ b/styles/sheets/actor/char-sheet/themes/dark.scss @@ -9,7 +9,7 @@ $on-surface: white; $on-primary: $t; $on-secondary: $t; -.actor--pc { +.actor--pc-v2 { --sheet-bg: #{$background}; --nav-bg: #{$surface}; diff --git a/styles/sheets/actor/char-sheet/v2.scss b/styles/sheets/actor/char-sheet/v2.scss index b6a087e..340f929 100644 --- a/styles/sheets/actor/char-sheet/v2.scss +++ b/styles/sheets/actor/char-sheet/v2.scss @@ -1,13 +1,11 @@ @use "./themes/dark.scss"; @use "../../../mixins/material" as material; +@use "../../../mixins/partials" as partials; @use "./pages/stats.scss"; -.dotdungeon .actor--pc { +.dotdungeon .actor--pc-v2 { background-color: var(--sheet-bg); - position: relative; - - color: white; .e-0dp { @include material.elevate(0); } .e-1dp { @include material.elevate(1); } @@ -20,12 +18,33 @@ .e-16dp { @include material.elevate(16); } .e-24dp { @include material.elevate(24); } - nav { - background-color: var(--nav-bg); - @include material.elevate(02); + .nav-bar { + @include material.elevate(8); + background: color-mix(in lab, var(--nav-bg), white 5%); position: absolute; bottom: 0; - width: 100%; + width: calc(100% - 6px); + + nav { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 8px; + padding: 8px; + } + + @include partials.sub-nav("page", "inventory", flex); + + button { + @include material.elevate(2); + height: 36px; + box-sizing: border-box; + + &:hover { + // background: color-mix(in lab, inherit, currentColor 4%); + @include material.elevate(4); + } + } } .page-content { diff --git a/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs new file mode 100644 index 0000000..9e5f86e --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs @@ -0,0 +1,5 @@ +
+ {{> dotdungeon.pc.v2.storage }} + {{> dotdungeon.pc.v2.player }} + {{> dotdungeon.pc.v2.transportation }} +
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs new file mode 100644 index 0000000..1d1a80b --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs new file mode 100644 index 0000000..05b25f8 --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs @@ -0,0 +1 @@ +
Storage
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs new file mode 100644 index 0000000..0a937f6 --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs @@ -0,0 +1 @@ +
Transporation
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/sheet.hbs b/templates/actors/char-sheet/v2/sheet.hbs index 0b2e082..d20b36b 100644 --- a/templates/actors/char-sheet/v2/sheet.hbs +++ b/templates/actors/char-sheet/v2/sheet.hbs @@ -1,20 +1,29 @@ - + {{!-- All panels here --}}
Avatar
{{> dotdungeon.pc.v2.stats }}
Combat
-
Inventory
+ {{> dotdungeon.pc.v2.inventory }}
Spells
+
Settings
{{!-- Tab list here --}} - + From cd6554289b97385374e8e534642b2645f8445dc7 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 4 Mar 2024 19:38:58 -0700 Subject: [PATCH 014/166] Make the nav buttons look like designs (closes #107) --- styles/global/buttons.scss | 2 +- styles/sheets/actor/char-sheet/themes/dark.scss | 1 + styles/sheets/actor/char-sheet/v2.scss | 12 ++++++++++-- .../actors/char-sheet/v2/partials/stats.v2.pc.hbs | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/styles/global/buttons.scss b/styles/global/buttons.scss index ced06f9..0159a03 100644 --- a/styles/global/buttons.scss +++ b/styles/global/buttons.scss @@ -2,7 +2,7 @@ @use "sass:color" as color; -.dotdungeon.dotdungeon.dotdungeon.dotdungeon > .window-content { +.dotdungeon.dotdungeon > .window-content { button { border-radius: 4px; box-sizing: border-box; diff --git a/styles/sheets/actor/char-sheet/themes/dark.scss b/styles/sheets/actor/char-sheet/themes/dark.scss index 1add0fd..9690fb8 100644 --- a/styles/sheets/actor/char-sheet/themes/dark.scss +++ b/styles/sheets/actor/char-sheet/themes/dark.scss @@ -12,6 +12,7 @@ $on-secondary: $t; .actor--pc-v2 { --sheet-bg: #{$background}; --nav-bg: #{$surface}; + --nav-button-text: #{$on-surface}; /* Elevation backgrounds to following Material design */ --elevation-0dp-bg: #{$surface}; diff --git a/styles/sheets/actor/char-sheet/v2.scss b/styles/sheets/actor/char-sheet/v2.scss index 340f929..d61ef18 100644 --- a/styles/sheets/actor/char-sheet/v2.scss +++ b/styles/sheets/actor/char-sheet/v2.scss @@ -39,10 +39,18 @@ @include material.elevate(2); height: 36px; box-sizing: border-box; + color: var(--nav-button-text); + + &:focus-visible { + border-style: solid; + border-width: 2px; + border-color: currentColor; + background: var(--elevation-8dp-bg); + } &:hover { - // background: color-mix(in lab, inherit, currentColor 4%); - @include material.elevate(4); + @include material.elevate(6); + background: hsl( from currentColor / 50% ); // probably gonna need color-mix } } } diff --git a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs index e3ae794..b9cb833 100644 --- a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs @@ -1,4 +1,4 @@ -
+
{{#each computed.stats as | stat |}}
From daaa45901261b213950956d6c9a1906dd622ede2 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 4 Mar 2024 19:41:59 -0700 Subject: [PATCH 015/166] Implement the general layout for inventory (closes #94) --- .../actor/char-sheet/pages/inventory.scss | 19 +++++++++++++++---- styles/sheets/actor/char-sheet/v2.scss | 3 +++ .../v2/partials/inventory/player.v2.pc.hbs | 16 +++++++++++++++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/styles/sheets/actor/char-sheet/pages/inventory.scss b/styles/sheets/actor/char-sheet/pages/inventory.scss index 753770c..7dad233 100644 --- a/styles/sheets/actor/char-sheet/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/pages/inventory.scss @@ -1,9 +1,20 @@ -.dotdungeon .actor--pc-v2 .active .inventory-page { - margin-bottom: 100px; +.dotdungeon .actor--pc-v2 .active.inventory-page { + padding-bottom: 50px; + height: 100%; } -.dotdungeon .actor--pc-v2 .active .inventory-page .tab[data-tab="player"] { +.dotdungeon .actor--pc-v2 .active.inventory-page .tab[data-tab="player"] { display: grid; gap: 16px; - grid-template-columns: 1fr 4fr; + grid-template-columns: 1fr 3fr; + grid-template-rows: 1fr repeat(3, min-content); + height: 100%; + color: white; + + .item-list { + grid-row: 1 / -1; + grid-column: 2; + display: flex; + flex-direction: column; + } } \ No newline at end of file diff --git a/styles/sheets/actor/char-sheet/v2.scss b/styles/sheets/actor/char-sheet/v2.scss index d61ef18..b440dd4 100644 --- a/styles/sheets/actor/char-sheet/v2.scss +++ b/styles/sheets/actor/char-sheet/v2.scss @@ -3,6 +3,7 @@ @use "../../../mixins/partials" as partials; @use "./pages/stats.scss"; +@use "./pages/inventory.scss"; .dotdungeon .actor--pc-v2 { background-color: var(--sheet-bg); @@ -57,5 +58,7 @@ .page-content { padding: 16px; + padding-bottom: 69px; + height: 100%; } } \ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 1d1a80b..6b36d4f 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -1,3 +1,17 @@
- +
+

Containers

+
+
+

Item list

+
+
+

Capacity

+
+
+

Bytes

+
+
+

Show

+
\ No newline at end of file From 42bd07707d80369980ea3c2c0d65e6a365c64230 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Fri, 8 Mar 2024 20:40:39 -0700 Subject: [PATCH 016/166] Ignore zips --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index acef7ef..d15f57c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ references.txt .styles/ /foundry.js *.lock +*.zip # Ignore all of the binaries and stuff that gets built for Foundry from the raw # JSON data because it's annoying seeing it in my git changes when it isn't actually From e6e392d7e5b5a83c0bb4301d5713023479761593 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Fri, 8 Mar 2024 21:14:30 -0700 Subject: [PATCH 017/166] Add the bytes panel to the page. (closes #108) --- styles/generic.scss | 2 +- .../actor/char-sheet/pages/inventory.scss | 42 ++++++++++++++++++- styles/sheets/partials/panel.scss | 2 +- .../v2/partials/inventory/player.v2.pc.hbs | 41 +++++++++++++++--- 4 files changed, 77 insertions(+), 10 deletions(-) diff --git a/styles/generic.scss b/styles/generic.scss index ae3bce9..855bac4 100644 --- a/styles/generic.scss +++ b/styles/generic.scss @@ -38,8 +38,8 @@ input[type="text"], input[type="number"], textarea { + @include fvtt_reset; padding: 5px 7px; - @include input-generic; } textarea { diff --git a/styles/sheets/actor/char-sheet/pages/inventory.scss b/styles/sheets/actor/char-sheet/pages/inventory.scss index 7dad233..e535034 100644 --- a/styles/sheets/actor/char-sheet/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/pages/inventory.scss @@ -1,12 +1,14 @@ +@use "../../../../mixins/material" as material; + .dotdungeon .actor--pc-v2 .active.inventory-page { padding-bottom: 50px; height: 100%; } -.dotdungeon .actor--pc-v2 .active.inventory-page .tab[data-tab="player"] { +.dotdungeon .actor--pc-v2 .inventory-page .active.tab[data-tab="player"] { display: grid; gap: 16px; - grid-template-columns: 1fr 3fr; + grid-template-columns: 1fr 2fr; grid-template-rows: 1fr repeat(3, min-content); height: 100%; color: white; @@ -17,4 +19,40 @@ display: flex; flex-direction: column; } + + .panel { + padding: 8px; + border-radius: 4px; + } + + .bytes-panel { + display: grid; + grid-template-columns: 1fr min-content 50px min-content; + gap: 8px; + align-items: center; + + label { + justify-self: left; + } + + input { + @include material.elevate(3); + border: none; + border-radius: 4px; + text-align: center; + color: white; + + &:hover { + @include material.elevate(6); + background: hsl( from currentColor / 50% ); // probably gonna need color-mix + } + + &:focus-visible { + border-width: 2px; + border-color: currentColor; + background: var(--elevation-8dp-bg); + } + + } + } } \ No newline at end of file diff --git a/styles/sheets/partials/panel.scss b/styles/sheets/partials/panel.scss index 7d0b910..eb77497 100644 --- a/styles/sheets/partials/panel.scss +++ b/styles/sheets/partials/panel.scss @@ -2,7 +2,7 @@ @use "../../mixins/foundry" as *; @use "../../vars" as *; -.dotdungeon .panel { +.dotdungeon .actor--pc-mvp .panel { display: grid; grid-template-rows: min-content 1fr; diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 6b36d4f..6154428 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -1,17 +1,46 @@
-
+

Containers

-
+

Item list

-
+

Capacity

-
-

Bytes

+
+ + + +
-
+

Show

\ No newline at end of file From c525c1390b6186fb44d6ad8e7289fc430aada98e Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Fri, 8 Mar 2024 21:19:00 -0700 Subject: [PATCH 018/166] Add display to the capacity panel (closes #95) --- styles/sheets/actor/char-sheet/pages/inventory.scss | 9 +++++++++ .../char-sheet/v2/partials/inventory/player.v2.pc.hbs | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/styles/sheets/actor/char-sheet/pages/inventory.scss b/styles/sheets/actor/char-sheet/pages/inventory.scss index e535034..366e8df 100644 --- a/styles/sheets/actor/char-sheet/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/pages/inventory.scss @@ -55,4 +55,13 @@ } } + + .capacity-panel { + display: grid; + grid-template-columns: 1fr 30px min-content 30px; + + .used, .total { + text-align: center; + } + } } \ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 6154428..0a3d01a 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -7,6 +7,10 @@

Capacity

+ {{!-- This will need some aria love --}} + X + / + Y

Show

+ + {{#each computed.itemFilters as | filter |}} + + {{/each}}
\ No newline at end of file From 3981e95ff0f952b054d57288fa98edc1efa26771 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:21:41 -0600 Subject: [PATCH 020/166] Add item list placeholder. (Closes #98) --- module/handlebars.mjs | 1 + .../v2/partials/inventory/item-list.v2.pc.hbs | 10 ++++++++++ .../char-sheet/v2/partials/inventory/player.v2.pc.hbs | 4 +--- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs diff --git a/module/handlebars.mjs b/module/handlebars.mjs index 74dd8da..1a7c986 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -23,6 +23,7 @@ export const partials = [ `actors/char-sheet/v2/partials/stats.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs`, ]; diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs new file mode 100644 index 0000000..a74d846 --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -0,0 +1,10 @@ +
+ {{!-- + Materials + Foils + --}} +
+

Foils

+
+
+
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 8201e75..5dc0340 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -2,9 +2,7 @@

Containers

-
-

Item list

-
+ {{> dotdungeon.pc.v2.item-list }}

Capacity

{{!-- This will need some aria love --}} From d100af31982c13398a6aadee4834e308eb0a8cf7 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:22:08 -0600 Subject: [PATCH 021/166] Rename PlayerSheetV2 containing file --- module/dotdungeon.mjs | 2 +- .../sheets/Actors/PC/{Improved.mjs => PlayerSheetV2.mjs} | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) rename module/sheets/Actors/PC/{Improved.mjs => PlayerSheetV2.mjs} (93%) diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index 6aa6177..606307a 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -19,7 +19,7 @@ import { PetSheet } from "./sheets/Items/PetSheet.mjs"; // Actor Sheets import { BasicSyncSheet } from "./sheets/SyncVariations/BasicSyncSheet.mjs"; -import { PlayerSheetv2 } from "./sheets/Actors/PC/Improved.mjs"; +import { PlayerSheetv2 } from "./sheets/Actors/PC/PlayerSheetV2.mjs"; import { MVPPCSheet } from "./sheets/MVPPCSheet.mjs"; import { MobSheet } from "./sheets/MobSheet.mjs"; diff --git a/module/sheets/Actors/PC/Improved.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs similarity index 93% rename from module/sheets/Actors/PC/Improved.mjs rename to module/sheets/Actors/PC/PlayerSheetV2.mjs index 7a0c36f..0b5b47c 100644 --- a/module/sheets/Actors/PC/Improved.mjs +++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs @@ -14,7 +14,7 @@ export class PlayerSheetv2 extends GenericActorSheet { group: `page`, navSelector: `nav.page`, contentSelector: `.page-content`, - initial: `inventory`, + initial: `avatar`, }, { group: `inventory`, @@ -35,6 +35,13 @@ export class PlayerSheetv2 extends GenericActorSheet { if (this.document.isEmbedded) return; if (!this.isEditable) return; console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`); + + html.find(`.create-ae`).on(`click`, async ($e) => { + console.debug(`Creating an ActiveEffect?`); + ActiveEffect.implementation.create({ + name: "Default AE", + }, { parent: this.actor, renderSheet: true }); + }); }; async getData() { From 54d047d2402b2baa8adc5d00c3bfd7ab46e013cb Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:22:25 -0600 Subject: [PATCH 022/166] Add references file to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d15f57c..313026d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules/ *.tmp *.bak.* references.txt +references/ .styles/ /foundry.js *.lock From 364ebd06f26bf0c982fb82a963aeb4ec1ba80d2a Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:32:57 -0600 Subject: [PATCH 023/166] Add materials section placeholder (closes #99) --- styles/sheets/actor/char-sheet/pages/inventory.scss | 1 + .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/styles/sheets/actor/char-sheet/pages/inventory.scss b/styles/sheets/actor/char-sheet/pages/inventory.scss index 094be83..4d572b2 100644 --- a/styles/sheets/actor/char-sheet/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/pages/inventory.scss @@ -18,6 +18,7 @@ grid-column: 2; display: flex; flex-direction: column; + gap: 12px; } .panel { diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index a74d846..3eb4451 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -3,6 +3,10 @@ Materials Foils --}} +
+

Materials

+
+

Foils


From 79b0431ead30075b451489274434732e5e209a3b Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:35:50 -0600 Subject: [PATCH 024/166] Add untyped item section (closes #106) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 3eb4451..02d2608 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -11,4 +11,8 @@

Foils


+
+

Custom

+
+
\ No newline at end of file From afbb9bbe02e7e74806a44169bec755c9cab7e8a0 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:44:25 -0600 Subject: [PATCH 025/166] Add the aspects section (closes #102) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 02d2608..5524db4 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -15,4 +15,8 @@

Custom


+
+

Aspects

+
+
\ No newline at end of file From 46e7d674d3b8bdd8c379202c7c69f8cbe19149a8 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:52:04 -0600 Subject: [PATCH 026/166] Add equipment item section (closes #103) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 5524db4..438ced3 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -19,4 +19,8 @@

Aspects


+
+

Equipment

+
+
\ No newline at end of file From 470f5b62253d3c3c9bfc4499eece0e33b7edb1ce Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:54:03 -0600 Subject: [PATCH 027/166] Add weapons item section (closes #100) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 438ced3..a02155c 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -23,4 +23,8 @@

Equipment


+
+

Weapons

+
+
\ No newline at end of file From 4e3a588c572867afc60e866202e45bd0ec745ed1 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:56:54 -0600 Subject: [PATCH 028/166] Add armour item section (closes #101) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index a02155c..e349610 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -27,4 +27,8 @@

Weapons


+
+

Armour

+
+
\ No newline at end of file From 8a51a752334d3072ddecf4bba386f42d815b6ffc Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:58:27 -0600 Subject: [PATCH 029/166] Adds the structures item section (closes #104) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index e349610..bf7b658 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -31,4 +31,8 @@

Armour


+
+

Structures

+
+
\ No newline at end of file From b6ca477be75e5b1d2b1bb650227434a5766a5ad8 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 11:59:18 -0600 Subject: [PATCH 030/166] Add transportation item section (closes #105) --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index bf7b658..422e3a9 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -35,4 +35,8 @@

Structures


+
+

Transportation

+
+
\ No newline at end of file From aab71df1fcef7cdbd0e4d88d10e95eb74f2bcf67 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 12:54:15 -0600 Subject: [PATCH 031/166] Add the capacity display (closes #96) --- module/models/Item/CommonItemData.mjs | 4 ++++ module/sheets/Actors/PC/PlayerSheetV2.mjs | 9 +++++++++ .../char-sheet/v2/partials/inventory/player.v2.pc.hbs | 7 +++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/module/models/Item/CommonItemData.mjs b/module/models/Item/CommonItemData.mjs index fb32dc7..abcbb5a 100644 --- a/module/models/Item/CommonItemData.mjs +++ b/module/models/Item/CommonItemData.mjs @@ -10,6 +10,10 @@ export class CommonItemData extends foundry.abstract.TypeDataModel { nullable: false, integer: true, }), + uses_inventory_slot: new fields.BooleanField({ + initial: true, + nullable: false, + }), buy: new fields.NumberField({ initial: null, nullable: true, diff --git a/module/sheets/Actors/PC/PlayerSheetV2.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs index 0b5b47c..feac28a 100644 --- a/module/sheets/Actors/PC/PlayerSheetV2.mjs +++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs @@ -58,6 +58,7 @@ export class PlayerSheetv2 extends GenericActorSheet { canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`), stats: this.#statData, itemFilters: this.#itemFilters, + capacity: this.#inventoryCapacity, }; console.log(ctx) return ctx; @@ -134,6 +135,14 @@ export class PlayerSheetv2 extends GenericActorSheet { return filters; }; + get #inventoryCapacity() { + return { + used: this.actor.items + .reduce((sum, i) => sum + i.system.uses_inventory_slot ? i.system.quantity : 0, 0), + max: this.actor.system.inventory_slots, + }; + }; + _updateObject(...args) { console.log(args) super._updateObject(...args); diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 5dc0340..0270e40 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -5,10 +5,9 @@ {{> dotdungeon.pc.v2.item-list }}

Capacity

- {{!-- This will need some aria love --}} - X - / - Y + {{computed.capacity.used}} + / + {{computed.capacity.max}}
@@ -24,6 +25,7 @@ + From d131e2faaa2f97138dfcc40e8ced692220835668 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 19:45:47 -0600 Subject: [PATCH 036/166] Remove Transportation as an item subtype --- module/config.mjs | 2 +- module/models/Item/Transportation.mjs | 28 --------------------------- template.json | 1 - 3 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 module/models/Item/Transportation.mjs diff --git a/module/config.mjs b/module/config.mjs index c631fc1..51e77b7 100644 --- a/module/config.mjs +++ b/module/config.mjs @@ -54,6 +54,7 @@ export const localizerConfig = { }; export const itemFilters = [ + `materials`, `untyped`, `aspect`, `weapon`, @@ -61,7 +62,6 @@ export const itemFilters = [ `equipment`, `foil`, `pet`, - `transportation`, `structure`, `service`, ]; diff --git a/module/models/Item/Transportation.mjs b/module/models/Item/Transportation.mjs deleted file mode 100644 index fd1f427..0000000 --- a/module/models/Item/Transportation.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { DescribedItemData } from "./DescribedItemData.mjs"; - -export class TransportationItemData extends DescribedItemData { - static defineSchema() { - const fields = foundry.data.fields; - return mergeObject(super.defineSchema(), { - single_trip: new fields.NumberField({ - initial: null, - nullable: true, - }), - upkeep: new fields.NumberField({ - initial: null, - nullable: true, - }), - can_be_in_inventory: new fields.BooleanField({ - initial: false, - }), - inventory_slots: new fields.NumberField({ - initial: 0, - min: 0, - }), - logon_bonus: new fields.NumberField({ - initial: null, - nullable: true, - }) - }); - }; -}; diff --git a/template.json b/template.json index f8aefd5..d52fb28 100644 --- a/template.json +++ b/template.json @@ -15,7 +15,6 @@ "equipment", "foil", "pet", - "transportation", "structure", "service", "legendaryItem", From 27c30b7eef34a5c8f555564313d13b699a35206c Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 19:46:13 -0600 Subject: [PATCH 037/166] Add the effects handlebars templates --- module/handlebars.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/module/handlebars.mjs b/module/handlebars.mjs index 1a7c986..489fc3c 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -21,6 +21,7 @@ export const partials = [ // The v2 PC sheet partials `actors/char-sheet/v2/partials/stats.v2.pc.hbs`, + `actors/char-sheet/v2/partials/effects.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs`, From 5e2fb95c73fb289f14f8d35430211c0c8d0c6241 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 19:47:06 -0600 Subject: [PATCH 038/166] Update item data models --- module/models/Item/Aspect.mjs | 5 +++-- module/models/Item/CommonItemData.mjs | 18 +++++++++++++++++- module/models/Item/Equipment.mjs | 8 +------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/module/models/Item/Aspect.mjs b/module/models/Item/Aspect.mjs index 5890588..bbcf426 100644 --- a/module/models/Item/Aspect.mjs +++ b/module/models/Item/Aspect.mjs @@ -1,11 +1,12 @@ -export class AspectItemData extends foundry.abstract.TypeDataModel { +import { DescribedItemData } from "./DescribedItemData.mjs"; + +export class AspectItemData extends DescribedItemData { static defineSchema() { const fields = foundry.data.fields; return { used: new fields.BooleanField({ initial: false }), /** The number of seconds that the effect of the aspect stays */ deactivateAfter: new fields.NumberField({ nullable: true }), - info: new fields.HTMLField({ nullable: true, blank: false, trim: true }), }; }; }; diff --git a/module/models/Item/CommonItemData.mjs b/module/models/Item/CommonItemData.mjs index abcbb5a..dd1e85a 100644 --- a/module/models/Item/CommonItemData.mjs +++ b/module/models/Item/CommonItemData.mjs @@ -25,10 +25,26 @@ export class CommonItemData extends foundry.abstract.TypeDataModel { integer: true, }), tier: new fields.StringField({ - initial: `simple`, + initial: DOTDUNGEON.defaultItemTier, nullable: false, choices: DOTDUNGEON.itemTiers, }), + location: new fields.StringField({ + initial: null, + nullable: true, + /* + "equipped" = on player, actively having an effect (e.g. armour + is worn, weapon is held), not all items have an equipped state + "inventory" = on player, equivalent to being put in a backpack + "storage" = not on player at all, in a chest in their house or + smth, these items should be displayed in the storage tab + "transportation" = not on player, in some form of transportation, + these items should be hidden on the sheet and the items that + are on a transportation should be referenced by UUID in that + transportation item + */ + choices: ["equipped", "inventory", "storage", "transportation"], + }), }; }; }; diff --git a/module/models/Item/Equipment.mjs b/module/models/Item/Equipment.mjs index 6e9d7f9..82b58de 100644 --- a/module/models/Item/Equipment.mjs +++ b/module/models/Item/Equipment.mjs @@ -3,12 +3,6 @@ import { DescribedItemData } from "./DescribedItemData.mjs"; export class EquipmentItemData extends DescribedItemData { static defineSchema() { const fields = foundry.data.fields; - return mergeObject(super.defineSchema(), { - extra_inventory: new fields.NumberField({ - initial: null, - nullable: true, - required: false, - }), - }); + return mergeObject(super.defineSchema(), {}); }; }; From 6d14d70f3eb729777ab0aff4155f2a1bab5bc6bf Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 21:10:34 -0600 Subject: [PATCH 039/166] Lay the foundation for the per-item templating in the inventory --- module/handlebars.mjs | 3 ++- module/sheets/Actors/PC/PlayerSheetV2.mjs | 2 +- .../v2/partials/inventory/item-list.v2.pc.hbs | 10 +++++----- .../v2/partials/inventory/items/material.v2.pc.hbs | 6 ++++++ .../v2/partials/inventory/items/untyped.v2.pc.hbs | 6 ++++++ 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs create mode 100644 templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs diff --git a/module/handlebars.mjs b/module/handlebars.mjs index 489fc3c..dede71c 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -26,7 +26,8 @@ export const partials = [ `actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs`, - `actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs`, ]; export const icons = [ diff --git a/module/sheets/Actors/PC/PlayerSheetV2.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs index a8ea542..1a7f8c9 100644 --- a/module/sheets/Actors/PC/PlayerSheetV2.mjs +++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs @@ -118,7 +118,7 @@ export class PlayerSheetv2 extends GenericActorSheet { return stats; }; - _itemTypesHidden = new Set(); + _itemTypesHidden = new Set([`weapon`, `armour`, `equipment`, `foil`, `structure`, `service`]); toggleItemFilter(filterName) { if (this._itemTypesHidden.has(filterName)) { this._itemTypesHidden.delete(filterName); diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 4902c54..5096c8e 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -10,11 +10,11 @@

{{filter.label}}


-
Item
-
Item
-
Item
-
Item
-
Item
+ {{#each (lookup @root.items @key) as | item |}} + {{> (concat "dotdungeon.pc.v2." @../key) @root item=item}} + {{else}} + No items found + {{/each}}
{{/if}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs new file mode 100644 index 0000000..9dc7a0d --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs @@ -0,0 +1,6 @@ +
+ Material Name + + X + +
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs new file mode 100644 index 0000000..4c09eb7 --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs @@ -0,0 +1,6 @@ +
+ {{item.name}} + + X + +
\ No newline at end of file From 992ae094b2c1df1af480673b226be66587ba6c4a Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 17 Mar 2024 21:11:40 -0600 Subject: [PATCH 040/166] Remove the transportation partial's inclusion from the sheet --- .../actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs | 1 - .../char-sheet/v2/partials/inventory/transportation.v2.pc.hbs | 1 - templates/actors/char-sheet/v2/sheet.hbs | 1 - 3 files changed, 3 deletions(-) delete mode 100644 templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs diff --git a/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs index 9e5f86e..0468990 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs @@ -1,5 +1,4 @@
{{> dotdungeon.pc.v2.storage }} {{> dotdungeon.pc.v2.player }} - {{> dotdungeon.pc.v2.transportation }}
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs deleted file mode 100644 index 0a937f6..0000000 --- a/templates/actors/char-sheet/v2/partials/inventory/transportation.v2.pc.hbs +++ /dev/null @@ -1 +0,0 @@ -
Transporation
\ No newline at end of file diff --git a/templates/actors/char-sheet/v2/sheet.hbs b/templates/actors/char-sheet/v2/sheet.hbs index 9496287..ac8702a 100644 --- a/templates/actors/char-sheet/v2/sheet.hbs +++ b/templates/actors/char-sheet/v2/sheet.hbs @@ -16,7 +16,6 @@ diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index 5b4dbe9..5efd945 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -8,7 +8,7 @@
Item Rarity
- {{#if computed.isEmbedded}} + {{#if meta.isEmbedded}}
Item Location
diff --git a/templates/items/untyped/v2/tabs/general.v2.untyped.hbs b/templates/items/untyped/v2/tabs/general.v2.untyped.hbs index 6bd3321..4c72fff 100644 --- a/templates/items/untyped/v2/tabs/general.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/general.v2.untyped.hbs @@ -1,5 +1,11 @@
-
+ {{#if meta.isEditable}} + + {{else}} +

+ {{item.name}} +

+ {{/if}}
diff --git a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs index 6314bec..e9fd907 100644 --- a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs @@ -1,5 +1,5 @@
- {{#if computed.isEmbedded}} + {{#if meta.isEmbedded}}
Useful in Combat?
From fc065a5234d6460af714fbfb80eda3c799be6597 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 31 Mar 2024 00:22:14 -0600 Subject: [PATCH 105/166] Move the context menu above the readonly shortcut to make it possible to view the image without needing edit mode --- module/sheets/Items/UntypedItemSheet.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/sheets/Items/UntypedItemSheet.mjs b/module/sheets/Items/UntypedItemSheet.mjs index 2c184e6..90061b0 100644 --- a/module/sheets/Items/UntypedItemSheet.mjs +++ b/module/sheets/Items/UntypedItemSheet.mjs @@ -26,9 +26,6 @@ export class UntypedItemSheet extends GenericItemSheet { activateListeners(html) { super.activateListeners(html); - if (!this.isEditable) return; - console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`); - new GenericContextMenu(html, `.photo.panel`, [ { name: `View Larger`, @@ -38,11 +35,15 @@ export class UntypedItemSheet extends GenericItemSheet { }, { name: `Change Photo`, + condition: () => this.isEditable, callback: (html) => { console.log(`.dungeon | Change Photo`); }, }, ]); + + if (!this.isEditable) return; + console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`); }; async getData() { From 97ac56dadcaf72f827487c3f1969a2d2a53724ac Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 31 Mar 2024 11:44:32 -0600 Subject: [PATCH 106/166] Implement the description editing (closes #150) --- styles/v3/elements/text-input.scss | 4 ++-- styles/v3/elements/textarea.scss | 24 +++++++++++++++++++ styles/v3/index.scss | 1 + .../untyped/v2/tabs/general.v2.untyped.hbs | 8 ++++++- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 styles/v3/elements/textarea.scss diff --git a/styles/v3/elements/text-input.scss b/styles/v3/elements/text-input.scss index 5cbdfc7..1554c02 100644 --- a/styles/v3/elements/text-input.scss +++ b/styles/v3/elements/text-input.scss @@ -11,11 +11,11 @@ font-size: inherit; &:hover { - @include material.elevate(6); + @include material.elevate(4); } &:focus-visible { - @include material.elevate(8); + @include material.elevate(6); } &.h1 { diff --git a/styles/v3/elements/textarea.scss b/styles/v3/elements/textarea.scss new file mode 100644 index 0000000..bc8adcd --- /dev/null +++ b/styles/v3/elements/textarea.scss @@ -0,0 +1,24 @@ +@use "../mixins/material" as material; + +.dotdungeon.style-v3 > .window-content textarea { + outline: none; + border: none; + @include material.elevate(3); + color: white; + transition: all 200ms ease-in-out; + font-family: inherit; + font-size: 0.9rem; + + &:hover { + @include material.elevate(4); + } + + &:focus-visible { + @include material.elevate(6); + } + + &.no-resize { + @extend textarea; + resize: none; + } +} diff --git a/styles/v3/index.scss b/styles/v3/index.scss index 95ea3f6..367f2d5 100644 --- a/styles/v3/index.scss +++ b/styles/v3/index.scss @@ -5,6 +5,7 @@ /* Element-Styling */ @use "./elements/button.scss"; @use "./elements/text-input.scss"; +@use "./elements/textarea.scss"; @use "./elements/headers.scss"; @use "./elements/hr.scss"; @use "./elements/icons.scss"; diff --git a/templates/items/untyped/v2/tabs/general.v2.untyped.hbs b/templates/items/untyped/v2/tabs/general.v2.untyped.hbs index 4c72fff..041d4c3 100644 --- a/templates/items/untyped/v2/tabs/general.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/general.v2.untyped.hbs @@ -2,10 +2,16 @@
{{#if meta.isEditable}} + {{else}}

{{item.name}}

+
+ {{system.description}} +
{{/if}} -
From de672642d22c83e74d4012c3c05e4fca38a8b777 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 31 Mar 2024 13:42:42 -0600 Subject: [PATCH 107/166] Add edit/view state to the costs of the modal (closes #151) --- styles/v3/elements/headers.scss | 2 +- styles/v3/elements/label.scss | 5 +++ styles/v3/elements/number-input.scss | 21 ++++++++++ styles/v3/elements/text-input.scss | 8 +--- styles/v3/elements/utilities.scss | 5 +++ styles/v3/index.scss | 2 + .../untyped/v2/tabs/details.v2.untyped.hbs | 40 +++++++++++++++++-- 7 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 styles/v3/elements/label.scss create mode 100644 styles/v3/elements/number-input.scss create mode 100644 styles/v3/elements/utilities.scss diff --git a/styles/v3/elements/headers.scss b/styles/v3/elements/headers.scss index 898267e..0174901 100644 --- a/styles/v3/elements/headers.scss +++ b/styles/v3/elements/headers.scss @@ -4,7 +4,7 @@ font-size: 1rem; margin: 0; } - h1 { + h1, .h1 { font-size: 1.5rem; } } diff --git a/styles/v3/elements/label.scss b/styles/v3/elements/label.scss new file mode 100644 index 0000000..cd8fdfb --- /dev/null +++ b/styles/v3/elements/label.scss @@ -0,0 +1,5 @@ +@use "../mixins/material"; + +.dotdungeon.style-v3 > .window-content label { + cursor: pointer; +} diff --git a/styles/v3/elements/number-input.scss b/styles/v3/elements/number-input.scss new file mode 100644 index 0000000..9d779ac --- /dev/null +++ b/styles/v3/elements/number-input.scss @@ -0,0 +1,21 @@ +@use "../mixins/material"; + +.dotdungeon.style-v3 > .window-content input[type=number] { + outline: none; + border: none; + @include material.elevate(3); + padding: 4px 8px; + color: white; + transition: all 200ms ease-in-out; + width: 50px; + height: auto; + text-align: center; + + &:hover { + @include material.elevate(4); + } + + &:focus-visible { + @include material.elevate(6); + } +} diff --git a/styles/v3/elements/text-input.scss b/styles/v3/elements/text-input.scss index 1554c02..4c066ed 100644 --- a/styles/v3/elements/text-input.scss +++ b/styles/v3/elements/text-input.scss @@ -1,14 +1,14 @@ @use "../mixins/material"; -.dotdungeon.style-v3 > .window-content input { +.dotdungeon.style-v3 > .window-content input[type=text] { outline: none; border: none; @include material.elevate(3); + padding: 4px 8px; color: white; transition: all 200ms ease-in-out; width: auto; height: auto; - font-size: inherit; &:hover { @include material.elevate(4); @@ -17,8 +17,4 @@ &:focus-visible { @include material.elevate(6); } - - &.h1 { - font-size: 1.5rem; - } } diff --git a/styles/v3/elements/utilities.scss b/styles/v3/elements/utilities.scss new file mode 100644 index 0000000..f76318a --- /dev/null +++ b/styles/v3/elements/utilities.scss @@ -0,0 +1,5 @@ +.dotdungeon.style-v3 > .window-content { + .grow { + flex-grow: 1; + } +} diff --git a/styles/v3/index.scss b/styles/v3/index.scss index 367f2d5..b0689d6 100644 --- a/styles/v3/index.scss +++ b/styles/v3/index.scss @@ -3,8 +3,10 @@ @use "./themes/dark.css"; /* Element-Styling */ +@use "./elements/utilities.scss"; @use "./elements/button.scss"; @use "./elements/text-input.scss"; +@use "./elements/number-input.scss"; @use "./elements/textarea.scss"; @use "./elements/headers.scss"; @use "./elements/hr.scss"; diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index 5efd945..e99d875 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -1,9 +1,41 @@
-
- Purchase Cost +
+ {{#if meta.isEditable}} + +
+ + {{else}} + Purchase Cost +
+ {{dd-empty-state system.buy}} + {{/if}}
-
- Usage Cost +
+ {{#if meta.isEditable}} + +
+ + {{else}} + Usage Cost +
+ {{dd-empty-state system.usage_cost}} + {{/if}}
Item Rarity From ad2da03f1e0bf4bf7236c77a0a4b2b6d712f388c Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 31 Mar 2024 15:19:19 -0600 Subject: [PATCH 108/166] Add edit/viewability to the item rarity (closes #152) --- module/config.mjs | 6 +++-- module/models/Item/CommonItemData.mjs | 2 +- styles/v3/elements/select.scss | 25 +++++++++++++++++++ styles/v3/elements/utilities.scss | 4 +++ styles/v3/index.scss | 1 + .../untyped/v2/tabs/details.v2.untyped.hbs | 16 ++++++++++-- 6 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 styles/v3/elements/select.scss diff --git a/module/config.mjs b/module/config.mjs index 591fd84..56a0fb4 100644 --- a/module/config.mjs +++ b/module/config.mjs @@ -34,8 +34,10 @@ export const skills = { export const defaultItemTier = `simple`; export const itemTiers = [ - `simple`, `greater`, - `rare`, `legendary` + { value: `simple`, label: `dotdungeon.rarity.simple` }, + { value: `greater`, label: `dotdungeon.rarity.greater` }, + { value: `rare`, label: `dotdungeon.rarity.rare` }, + { value: `legendary`, label: `dotdungeon.rarity.legendary` }, ]; export const syncMilestones = [ diff --git a/module/models/Item/CommonItemData.mjs b/module/models/Item/CommonItemData.mjs index 534ce21..4fded0f 100644 --- a/module/models/Item/CommonItemData.mjs +++ b/module/models/Item/CommonItemData.mjs @@ -31,7 +31,7 @@ export class CommonItemData extends foundry.abstract.TypeDataModel { tier: new fields.StringField({ initial: DOTDUNGEON.defaultItemTier, nullable: false, - choices: DOTDUNGEON.itemTiers, + choices: DOTDUNGEON.itemTiers.map(tier => tier.value), }), /* If this property is set to true, the item will be shown in the combat tab diff --git a/styles/v3/elements/select.scss b/styles/v3/elements/select.scss new file mode 100644 index 0000000..720eaa7 --- /dev/null +++ b/styles/v3/elements/select.scss @@ -0,0 +1,25 @@ +@use "../mixins/material"; + +.dotdungeon.style-v3 > .window-content { + select { + outline: none; + border: none; + @include material.elevate(3); + padding: 4px 8px; + color: white; + transition: all 200ms ease-in-out; + + &:hover { + @include material.elevate(4); + } + + &:focus-visible { + @include material.elevate(6); + } + } + + option { + background: var(--surface); + color: var(--on-surface); + } +} diff --git a/styles/v3/elements/utilities.scss b/styles/v3/elements/utilities.scss index f76318a..2a3cb42 100644 --- a/styles/v3/elements/utilities.scss +++ b/styles/v3/elements/utilities.scss @@ -2,4 +2,8 @@ .grow { flex-grow: 1; } + + .text-center { + text-align: center; + } } diff --git a/styles/v3/index.scss b/styles/v3/index.scss index b0689d6..ef4eda9 100644 --- a/styles/v3/index.scss +++ b/styles/v3/index.scss @@ -5,6 +5,7 @@ /* Element-Styling */ @use "./elements/utilities.scss"; @use "./elements/button.scss"; +@use "./elements/select.scss"; @use "./elements/text-input.scss"; @use "./elements/number-input.scss"; @use "./elements/textarea.scss"; diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index e99d875..e86e96e 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -37,8 +37,20 @@ {{dd-empty-state system.usage_cost}} {{/if}}
-
- Item Rarity +
+ Rarity +
+ {{#if meta.isEditable}} + + {{else}} + {{dd-i18n (concat "dotdungeon.rarity." system.tier)}} + {{/if}}
{{#if meta.isEmbedded}}
From dd5a980f4ee995dca1edcbeb4a01290e3f8d5560 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 31 Mar 2024 15:35:46 -0600 Subject: [PATCH 109/166] Add the locations selector (closes #153) --- langs/en-ca.2.json | 9 ++++++++- module/documents/Item/GenericItem.mjs | 9 +++++++++ module/helpers/index.mjs | 4 ++-- module/models/Item/CommonItemData.mjs | 12 ++---------- .../items/untyped/v2/tabs/details.v2.untyped.hbs | 14 +++++++++++++- 5 files changed, 34 insertions(+), 14 deletions(-) diff --git a/langs/en-ca.2.json b/langs/en-ca.2.json index cdf74a9..ae5e9b7 100644 --- a/langs/en-ca.2.json +++ b/langs/en-ca.2.json @@ -68,13 +68,20 @@ "rare": "Rare", "legendary": "Legendary" }, + "location": { + "unknown": "@dotdungeon.common.empty", + "inventory": "Inventory", + "equipped": "Equipped", + "storage": "Storage" + }, "default": { "name": "(Unnamed @TYPES.{document}.{type})" }, "common": { "send-to-chat": "Send to Chat", "edit": "Edit", - "delete": "Delete" + "delete": "Delete", + "empty": "---" }, "sheet-names": { "UntypedDataSheet": "Data Sheet" diff --git a/module/documents/Item/GenericItem.mjs b/module/documents/Item/GenericItem.mjs index eb8b7c1..786824e 100644 --- a/module/documents/Item/GenericItem.mjs +++ b/module/documents/Item/GenericItem.mjs @@ -12,4 +12,13 @@ export class DotDungeonItem extends Item { }; return this.system.quantity; }; + + get availableLocations() { + return [ + { value: null, label: `dotdungeon.location.unknown` }, + { value: `inventory`, label: `dotdungeon.location.inventory` }, + { value: `equipped`, label: `dotdungeon.location.equipped` }, + { value: `storage`, label: `dotdungeon.location.storage` }, + ]; + }; }; diff --git a/module/helpers/index.mjs b/module/helpers/index.mjs index ee573e7..b48baa3 100644 --- a/module/helpers/index.mjs +++ b/module/helpers/index.mjs @@ -2,7 +2,7 @@ import { schemaOptions } from "./schemaOptions.mjs"; import { createArray } from "./createArray.mjs"; import { detailsExpanded } from "./detailsExpanded.mjs"; import { objectValue } from "./objectValue.mjs"; -import { handlebarsLocalizer } from "../utils/localizer.mjs"; +import { handlebarsLocalizer, localizer } from "../utils/localizer.mjs"; import { options } from "./options.mjs"; export default { @@ -19,7 +19,7 @@ export default { "dd-stringify": v => JSON.stringify(v, null, ` `), "dd-empty": v => v.length == 0, "dd-set-has": (s, k) => s.has(k), - "dd-empty-state": (v) => v ?? `--`, + "dd-empty-state": (v) => v ?? localizer(`dotdungeon.common.empty`), // Logic helpers "eq": (a, b) => a == b, diff --git a/module/models/Item/CommonItemData.mjs b/module/models/Item/CommonItemData.mjs index 4fded0f..9e11800 100644 --- a/module/models/Item/CommonItemData.mjs +++ b/module/models/Item/CommonItemData.mjs @@ -42,16 +42,8 @@ export class CommonItemData extends foundry.abstract.TypeDataModel { nullable: false, }), location: new fields.StringField({ - initial: null, - nullable: true, - /* - "equipped" = on player, actively having an effect (e.g. armour - is worn, weapon is held), not all items have an equipped state - "inventory" = on player, equivalent to being put in a backpack - "storage" = not on player at all, in a chest in their house or - smth, these items should be displayed in the storage tab - */ - choices: ["equipped", "inventory", "storage"], + initial: "", + nullable: false, }), }; }; diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index e86e96e..000ac35 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -53,8 +53,20 @@ {{/if}}
{{#if meta.isEmbedded}} -
+
Item Location +
+ {{#if meta.isEditable}} + + {{else}} + {{dd-i18n (concat "dotdungeon.location." system.location)}} + {{/if}}
Quantity From 82452f4f7ce7c58a31c8f6722b26cb775f97b389 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 1 Apr 2024 21:01:31 -0600 Subject: [PATCH 110/166] Fix a bug with the usage cost not being displayed on embedded untyped items --- .../char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs index f1b8257..9907578 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs @@ -44,7 +44,7 @@
Usage Cost: - {{dd-empty-state item.system.usage}} + {{dd-empty-state item.system.usage_cost}}
From 1c2ced321b2d85a3a6a4b2c88f3866e304a4f2f8 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 1 Apr 2024 21:08:59 -0600 Subject: [PATCH 111/166] Add the quantity input to the item details tab (closes #154) --- styles/v3/elements/label.scss | 4 ++ styles/v3/elements/number-input.scss | 3 +- styles/v3/elements/panel.scss | 4 ++ styles/v3/elements/select.scss | 1 + styles/v3/index.scss | 1 + styles/v3/layouts/items/untyped/v2.scss | 6 +++ .../untyped/v2/tabs/details.v2.untyped.hbs | 42 ++++++++++++------- 7 files changed, 45 insertions(+), 16 deletions(-) diff --git a/styles/v3/elements/label.scss b/styles/v3/elements/label.scss index cd8fdfb..12e3afb 100644 --- a/styles/v3/elements/label.scss +++ b/styles/v3/elements/label.scss @@ -2,4 +2,8 @@ .dotdungeon.style-v3 > .window-content label { cursor: pointer; + + &.justify-start { + justify-self: start; + } } diff --git a/styles/v3/elements/number-input.scss b/styles/v3/elements/number-input.scss index 9d779ac..ad9ce74 100644 --- a/styles/v3/elements/number-input.scss +++ b/styles/v3/elements/number-input.scss @@ -7,9 +7,8 @@ padding: 4px 8px; color: white; transition: all 200ms ease-in-out; - width: 50px; - height: auto; text-align: center; + line-height: 1rem; &:hover { @include material.elevate(4); diff --git a/styles/v3/elements/panel.scss b/styles/v3/elements/panel.scss index d256c91..de7cf9f 100644 --- a/styles/v3/elements/panel.scss +++ b/styles/v3/elements/panel.scss @@ -12,6 +12,10 @@ flex-direction: row; gap: var(--gap); align-items: center; + + &.space-between { + justify-content: space-between; + } } } } diff --git a/styles/v3/elements/select.scss b/styles/v3/elements/select.scss index 720eaa7..55125ac 100644 --- a/styles/v3/elements/select.scss +++ b/styles/v3/elements/select.scss @@ -8,6 +8,7 @@ padding: 4px 8px; color: white; transition: all 200ms ease-in-out; + width: 6.25rem; &:hover { @include material.elevate(4); diff --git a/styles/v3/index.scss b/styles/v3/index.scss index ef4eda9..1814eac 100644 --- a/styles/v3/index.scss +++ b/styles/v3/index.scss @@ -14,6 +14,7 @@ @use "./elements/icons.scss"; @use "./elements/nav.scss"; @use "./elements/panel.scss"; +@use "./elements/label.scss"; /* Sheet Layouts */ @use "./layouts/datasheet.scss"; diff --git a/styles/v3/layouts/items/untyped/v2.scss b/styles/v3/layouts/items/untyped/v2.scss index 27e7fb8..8c18cd3 100644 --- a/styles/v3/layouts/items/untyped/v2.scss +++ b/styles/v3/layouts/items/untyped/v2.scss @@ -48,6 +48,12 @@ @include utils.tab("details") { @extend %flex-col; + + .number { + display: grid; + grid-template-columns: 1fr 55px; + align-items: center; + } } @include utils.tab("settings") { diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index 000ac35..37591e8 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -1,10 +1,12 @@
-
+
{{#if meta.isEditable}} -
-
+
{{#if meta.isEditable}} -
-
+
Rarity -
{{#if meta.isEditable}} -
- Quantity +
+ {{#if meta.isEditable}} + + + {{else}} + Quantity + {{system.quantity}} + {{/if}}
{{/if}}
From d5429b7b34f0a61b869165e0574d5b575d1971d5 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 3 Apr 2024 23:00:57 -0600 Subject: [PATCH 112/166] Begin work on a custom element for incrementer --- module/components/incrementer.mjs | 71 +++++++++++++++++++ module/components/index.mjs | 1 + module/dotdungeon.mjs | 1 + styles/components/incrementer.scss | 55 ++++++++++++++ .../actor/char-sheet/v2/pages/inventory.scss | 2 +- .../v2/partials/inventory/player.v2.pc.hbs | 9 +-- .../untyped/v2/tabs/details.v2.untyped.hbs | 5 +- 7 files changed, 137 insertions(+), 7 deletions(-) create mode 100644 module/components/incrementer.mjs create mode 100644 module/components/index.mjs create mode 100644 styles/components/incrementer.scss diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs new file mode 100644 index 0000000..747fa01 --- /dev/null +++ b/module/components/incrementer.mjs @@ -0,0 +1,71 @@ +/** +Attributes: +@property {number} value +@property {number} stepSize +@property {number} largeStepSize +*/ +class DotDungeonIncrementer extends HTMLElement { + + #input; + + constructor() { + super(); + + const sr = this.attachShadow({ mode: `open` }); + const container = document.createElement(`div`); + + const style = document.createElement(`link`); + style.href = `./systems/dotdungeon/.styles/components/incrementer.css`; + style.rel = `stylesheet`; + container.appendChild(style); + + + const input = document.createElement(`input`); + this.#input = input; + input.type = `number`; + input.value = this.getAttribute(`value`); + input.addEventListener(`change`, this.#updateValue.bind(this)); + + const increment = document.createElement(`button`); + increment.innerHTML = `+`; + increment.type = `button`; + increment.classList.value = `increment`; + increment.addEventListener(`click`, this.#increment.bind(this)); + + const decrement = document.createElement(`button`); + decrement.innerHTML = `-`; + decrement.type = `button`; + decrement.classList.value = `decrement`; + decrement.addEventListener(`click`, this.#decrement.bind(this)); + + + // Construct the DOM + container.appendChild(decrement); + container.appendChild(input); + container.appendChild(increment); + sr.appendChild(container); + }; + + #updateValue() { + // TODO: Emit a change event for the new value, and check for cancellation + const event = new Event(`change`); + this.dispatchEvent(event); + }; + + #increment() { + console.log(`increment event`) + this.#input.value++; + this.#updateValue(); + }; + + #decrement() { + console.log(`decrement event`) + this.#input.value--; + this.#updateValue(); + }; +}; + + +if (!window.customElements.get(`dd-incrementer`)) { + window.customElements.define(`dd-incrementer`, DotDungeonIncrementer); +}; diff --git a/module/components/index.mjs b/module/components/index.mjs new file mode 100644 index 0000000..790d271 --- /dev/null +++ b/module/components/index.mjs @@ -0,0 +1 @@ +import "./incrementer.mjs"; \ No newline at end of file diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index 6d76dfb..a7a5ae7 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -35,6 +35,7 @@ import "./hooks/hotReload.mjs"; import loadSettings from "./settings/index.mjs"; import { devInit } from "./hooks/devInit.mjs"; import DOTDUNGEON from "./config.mjs"; +import "./components/index.mjs"; Hooks.once(`init`, async () => { diff --git a/styles/components/incrementer.scss b/styles/components/incrementer.scss new file mode 100644 index 0000000..549d1d9 --- /dev/null +++ b/styles/components/incrementer.scss @@ -0,0 +1,55 @@ +/* +Disclaimer: This CSS is used by a custom web component and is scoped to JUST +the corresponding web component. Importing this into other files is forbidden. +*/ + +$default-border-radius: 4px; + +:host { + min-width: max-content; +} + +div { + display: grid; + grid-template-columns: auto 50px auto; + // I dunno why this is needed for the height to not be calculated as 17px, + // but it is for some arcane reason + grid-template-rows: 1fr; +} + +input { + border: none; + outline: none; + font-family: inherit; + text-align: center; + padding: 0; + background: green; + + &::-webkit-inner-spin-button, &::-webkit-outer-spin-button { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + margin: 0 + } +} + +button { + border: none; + outline: none; + height: 100%; + aspect-ratio: 1 / 1; + padding: 4px; + background: darkgreen; + max-width: 100%; + + &:hover { + cursor: pointer; + } +} + +.increment { + border-radius: 0 var(--border-radius, $default-border-radius) var(--border-radius, 4px) 0; +} +.decrement { + border-radius: var(--border-radius, $default-border-radius) 0 0 var(--border-radius, $default-border-radius); +} diff --git a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss index c301f04..3a1b829 100644 --- a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss @@ -68,7 +68,7 @@ .bytes-panel { display: grid; - grid-template-columns: 1fr min-content 50px min-content; + grid-template-columns: 1fr auto; gap: 8px; align-items: center; diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 1dd14c2..e3a936c 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -15,7 +15,8 @@ > Supplies -
- + --}}
-
--}}
diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index 37591e8..d8bf937 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -73,13 +73,14 @@ - + {{!-- + > --}} {{else}} Quantity {{system.quantity}} From 9f6a8e5e735fcd8d54fc5fe0570d4ffc49400d69 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Thu, 4 Apr 2024 19:59:23 -0600 Subject: [PATCH 113/166] Get the incrementer being able to be submitted, causing submits, and styling without flickering --- module/components/incrementer.mjs | 65 +++++++++++++++++++++++------- module/components/index.mjs | 2 +- styles/components/incrementer.scss | 14 +++---- 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index 747fa01..ea658de 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -4,27 +4,42 @@ Attributes: @property {number} stepSize @property {number} largeStepSize */ -class DotDungeonIncrementer extends HTMLElement { +export class DotDungeonIncrementer extends HTMLElement { + static elementName = `dd-incrementer`; + + static styles = ``; #input; + #publicInput; + #sr; constructor() { super(); + const value = this.getAttribute(`value`); + + /* + This input exists for the sole purpose of making it so that the form data + works with this input without needing to do jank work arounds (even though + this on it's own is already a sort of jank work around). + */ + const hiddenInput = document.createElement(`input`); + hiddenInput.type = `hidden`; + hiddenInput.name = this.getAttribute(`name`); + hiddenInput.value = value; + this.#publicInput = hiddenInput; + this.appendChild(hiddenInput); + const sr = this.attachShadow({ mode: `open` }); + this.#sr = sr; const container = document.createElement(`div`); - - const style = document.createElement(`link`); - style.href = `./systems/dotdungeon/.styles/components/incrementer.css`; - style.rel = `stylesheet`; - container.appendChild(style); - + if (DotDungeonIncrementer.styles) this.#embedStyles(); const input = document.createElement(`input`); this.#input = input; input.type = `number`; - input.value = this.getAttribute(`value`); input.addEventListener(`change`, this.#updateValue.bind(this)); + input.value = value; const increment = document.createElement(`button`); increment.innerHTML = `+`; @@ -46,26 +61,46 @@ class DotDungeonIncrementer extends HTMLElement { sr.appendChild(container); }; + connectedCallback() { + if (!DotDungeonIncrementer.styles) { + fetch(`./systems/dotdungeon/.styles/components/incrementer.css`) + .then(r => r.text()) + .then(t => { + DotDungeonIncrementer.styles = t; + this.#embedStyles(); + }); + }; + }; + + #embedStyles() { + const style = document.createElement(`style`); + style.innerHTML = DotDungeonIncrementer.styles; + this.#sr.appendChild(style); + }; + #updateValue() { - // TODO: Emit a change event for the new value, and check for cancellation - const event = new Event(`change`); - this.dispatchEvent(event); + this.#publicInput.value = this.#input.value; + const event = new Event(`change`, { bubbles: true }); + this.#publicInput.dispatchEvent(event); }; #increment() { - console.log(`increment event`) + console.log(`increment event`); this.#input.value++; this.#updateValue(); }; #decrement() { - console.log(`decrement event`) + console.log(`decrement event`); this.#input.value--; this.#updateValue(); }; }; -if (!window.customElements.get(`dd-incrementer`)) { - window.customElements.define(`dd-incrementer`, DotDungeonIncrementer); +if (!window.customElements.get(DotDungeonIncrementer.elementName)) { + window.customElements.define( + DotDungeonIncrementer.elementName, + DotDungeonIncrementer + ); }; diff --git a/module/components/index.mjs b/module/components/index.mjs index 790d271..8c92384 100644 --- a/module/components/index.mjs +++ b/module/components/index.mjs @@ -1 +1 @@ -import "./incrementer.mjs"; \ No newline at end of file +import "./incrementer.mjs"; diff --git a/styles/components/incrementer.scss b/styles/components/incrementer.scss index 549d1d9..55ca7fb 100644 --- a/styles/components/incrementer.scss +++ b/styles/components/incrementer.scss @@ -4,6 +4,7 @@ the corresponding web component. Importing this into other files is forbidden. */ $default-border-radius: 4px; +$default-height: 1.25rem; :host { min-width: max-content; @@ -11,10 +12,10 @@ $default-border-radius: 4px; div { display: grid; - grid-template-columns: auto 50px auto; + grid-template-columns: var(--height, $default-height) 50px var(--height, $default-height); // I dunno why this is needed for the height to not be calculated as 17px, // but it is for some arcane reason - grid-template-rows: 1fr; + grid-template-rows: var(--height, $default-height); } input { @@ -23,7 +24,6 @@ input { font-family: inherit; text-align: center; padding: 0; - background: green; &::-webkit-inner-spin-button, &::-webkit-outer-spin-button { -webkit-appearance: none; @@ -36,11 +36,11 @@ input { button { border: none; outline: none; - height: 100%; aspect-ratio: 1 / 1; - padding: 4px; - background: darkgreen; - max-width: 100%; + padding: 0; + display: flex; + justify-content: center; + align-items: center; &:hover { cursor: pointer; From 566faf61d2b1b1220412e593a3d058eeafceb1ca Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Thu, 4 Apr 2024 20:02:19 -0600 Subject: [PATCH 114/166] Remove stray console logs --- module/components/incrementer.mjs | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index ea658de..d02aa68 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -85,13 +85,11 @@ export class DotDungeonIncrementer extends HTMLElement { }; #increment() { - console.log(`increment event`); this.#input.value++; this.#updateValue(); }; #decrement() { - console.log(`decrement event`); this.#input.value--; this.#updateValue(); }; From e0a3b4985bf81a18b90f796aed58e6021bb72c92 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Thu, 4 Apr 2024 22:48:19 -0600 Subject: [PATCH 115/166] Begin making the proper CSS for the component --- module/components/incrementer.mjs | 9 ++++++--- styles/components/incrementer.scss | 7 ++----- .../char-sheet/v2/partials/inventory/player.v2.pc.hbs | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index d02aa68..3e5e55f 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -1,8 +1,11 @@ /** Attributes: -@property {number} value -@property {number} stepSize -@property {number} largeStepSize +@property {string} name - The path to the value to update +@property {number} value - The actual value of the input + +Styling: +- `--height`: Controls the height of the element + the width of the buttons (default: 1.25rem) +- `--width`: Controls the width of the number input (default 50px) */ export class DotDungeonIncrementer extends HTMLElement { static elementName = `dd-incrementer`; diff --git a/styles/components/incrementer.scss b/styles/components/incrementer.scss index 55ca7fb..693e0ec 100644 --- a/styles/components/incrementer.scss +++ b/styles/components/incrementer.scss @@ -6,13 +6,9 @@ the corresponding web component. Importing this into other files is forbidden. $default-border-radius: 4px; $default-height: 1.25rem; -:host { - min-width: max-content; -} - div { display: grid; - grid-template-columns: var(--height, $default-height) 50px var(--height, $default-height); + grid-template-columns: var(--height, $default-height) var(--width, 50px) var(--height, $default-height); // I dunno why this is needed for the height to not be calculated as 17px, // but it is for some arcane reason grid-template-rows: var(--height, $default-height); @@ -41,6 +37,7 @@ button { display: flex; justify-content: center; align-items: center; + background-color: color-mix(in lab, white 5%, transparent); &:hover { cursor: pointer; diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index e3a936c..0249748 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -15,7 +15,8 @@ > Supplies - + + {{!-- --}} {{!-- - - + General + Details + Effects {{#if meta.showSettingsTab}} - + Settings {{/if}}
diff --git a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs index 37591e8..bc8d57f 100644 --- a/templates/items/untyped/v2/tabs/details.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/details.v2.untyped.hbs @@ -15,8 +15,8 @@ id="{{meta.idp}}-purchase-cost" > {{else}} - Purchase Cost - {{dd-empty-state system.buy}} + Purchase Cost + {{dd-empty-state system.buy}} {{/if}}
@@ -35,12 +35,12 @@ id="{{meta.idp}}-usage-cost" > {{else}} - Usage Cost - {{dd-empty-state system.usage_cost}} + Usage Cost + {{dd-empty-state system.usage_cost}} {{/if}}
- Rarity + Rarity {{#if meta.isEditable}} +
+
+ + +
+
+ + +
+
+ Milestones Hit +
+ {{ computed.milestones_hit_viewable }} +
+ \ No newline at end of file From 0ac7f070819999d9ac73e63def9def8c766fd028 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 6 Apr 2024 12:00:06 -0600 Subject: [PATCH 121/166] Fix a bug with the Sync actor --- module/documents/Actor/Sync.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/module/documents/Actor/Sync.mjs b/module/documents/Actor/Sync.mjs index 1542b3e..171a67c 100644 --- a/module/documents/Actor/Sync.mjs +++ b/module/documents/Actor/Sync.mjs @@ -1,4 +1,5 @@ import { DotDungeonActor } from "./GenericActor.mjs"; +import { syncMilestones } from "../../config.mjs"; export class Sync extends DotDungeonActor { async useRestDie() { From f4d7ea59f3f5a8c4df46911bfa50e31cfbd42968 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 6 Apr 2024 12:00:36 -0600 Subject: [PATCH 122/166] For now, register all of the devMode stuff in the release --- module/dotdungeon.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index 6d76dfb..4dba8f4 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -102,7 +102,7 @@ Hooks.once(`init`, async () => { label: "dotdungeon.sheet-names.PetSheet" }); - if (game.settings.get(`dotdungeon`, `devMode`)) { + if (true || game.settings.get(`dotdungeon`, `devMode`)) { devInit(); }; From 14827195fe0a1501e822506223c31f490dd23882 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 6 Apr 2024 12:00:51 -0600 Subject: [PATCH 123/166] Version bump --- system.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system.json b/system.json index 3c80e4b..7b48533 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "dotdungeon", "title": ".dungeon", "description": "", - "version": "0.0.7", + "version": "0.0.8", "download": "https://github.com/Oliver-Akins/foundry.dungeon/releases/latest/download/dotdungeon.zip", "manifest": "https://github.com/Oliver-Akins/foundry.dungeon/releases/latest/download/system.json", "url": "https://github.com/Oliver-Akins/foundry.dungeon", From a0f17fc4f5fb48f8b918463418836b11e1ba88b7 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 6 Apr 2024 12:03:47 -0600 Subject: [PATCH 124/166] Fix item list gaps (closes #163) --- styles/sheets/actor/char-sheet/v2/pages/inventory.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss index c301f04..4bc9018 100644 --- a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss @@ -53,7 +53,7 @@ gap: 8px; } - &--untyped, &--aspect { + &--untyped, &--aspect, &--foil, &--weapon, &--pet { display: flex; gap: 8px; flex-direction: column; From e0e4a7b68ad7177d9b82803cf82f01468ac64941 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 6 Apr 2024 15:56:41 -0600 Subject: [PATCH 125/166] Version bump --- system.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system.json b/system.json index 7b48533..5d3387c 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "dotdungeon", "title": ".dungeon", "description": "", - "version": "0.0.8", + "version": "0.0.9", "download": "https://github.com/Oliver-Akins/foundry.dungeon/releases/latest/download/dotdungeon.zip", "manifest": "https://github.com/Oliver-Akins/foundry.dungeon/releases/latest/download/system.json", "url": "https://github.com/Oliver-Akins/foundry.dungeon", From 155846852646db48f906ea8de65fdde503414f05 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 7 Apr 2024 23:07:41 -0600 Subject: [PATCH 126/166] Add HTML data for the custom incrementer element --- .vscode/components.html-data.json | 19 +++++++++++++++++++ .vscode/settings.json | 7 +++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .vscode/components.html-data.json diff --git a/.vscode/components.html-data.json b/.vscode/components.html-data.json new file mode 100644 index 0000000..74f7942 --- /dev/null +++ b/.vscode/components.html-data.json @@ -0,0 +1,19 @@ +{ + "version": 1.1, + "tags": [ + { + "name": "dd-incrementer", + "description": "A number input that allows more flexible increase/decrease buttons", + "attributes": [ + { "name": "value", "description": "The initial value to put in the input" }, + { "name": "name", "description": "The form name to use when this input is used to submit data" }, + { "name": "min", "description": "The minimum value that this input can contain" }, + { "name": "max", "description": "The maximum value that this input can contain" }, + { "name": "smallStep", "description": "The value that the input is changed by when clicking a delta button or using the up/down arrow key" }, + { "name": "largeStep", "description": "The value that the input is changed by when clicking a delta button with control held or using the page up/ page down arrow key" } + ] + } + ], + "globalAttributes": [], + "valueSets": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 36a383b..9cd44b8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,5 +12,8 @@ "node_modules": true, "packs": true, ".gitattributes": true, - } -} \ No newline at end of file + }, + "html.customData": [ + "./.vscode/components.html-data.json" + ] +} From 1c372415f4504bb619f71f4b888f12d9e8c51699 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 7 Apr 2024 23:08:41 -0600 Subject: [PATCH 127/166] Move the CSS into a path-versioned location --- module/components/incrementer.mjs | 2 +- styles/{ => v3}/components/incrementer.scss | 24 ++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) rename styles/{ => v3}/components/incrementer.scss (80%) diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index 3e5e55f..b543c93 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -66,7 +66,7 @@ export class DotDungeonIncrementer extends HTMLElement { connectedCallback() { if (!DotDungeonIncrementer.styles) { - fetch(`./systems/dotdungeon/.styles/components/incrementer.css`) + fetch(`./systems/dotdungeon/.styles/v3/components/incrementer.css`) .then(r => r.text()) .then(t => { DotDungeonIncrementer.styles = t; diff --git a/styles/components/incrementer.scss b/styles/v3/components/incrementer.scss similarity index 80% rename from styles/components/incrementer.scss rename to styles/v3/components/incrementer.scss index 693e0ec..ce5328d 100644 --- a/styles/components/incrementer.scss +++ b/styles/v3/components/incrementer.scss @@ -3,6 +3,8 @@ Disclaimer: This CSS is used by a custom web component and is scoped to JUST the corresponding web component. Importing this into other files is forbidden. */ +@use "../mixins/material"; + $default-border-radius: 4px; $default-height: 1.25rem; @@ -12,11 +14,26 @@ div { // I dunno why this is needed for the height to not be calculated as 17px, // but it is for some arcane reason grid-template-rows: var(--height, $default-height); + border-radius: var(--border-radius, $default-border-radius); + @include material.elevate(2); + + &:hover { + @include material.elevate(4); + } + + &:focus-within { + @include material.elevate(6); + } +} + +button, input { + border: none; + outline: none; + background: none; + color: inherit; } input { - border: none; - outline: none; font-family: inherit; text-align: center; padding: 0; @@ -30,14 +47,11 @@ input { } button { - border: none; - outline: none; aspect-ratio: 1 / 1; padding: 0; display: flex; justify-content: center; align-items: center; - background-color: color-mix(in lab, white 5%, transparent); &:hover { cursor: pointer; From 4efa89915a526cbab2979464591325d320afe267 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 7 Apr 2024 23:53:34 -0600 Subject: [PATCH 128/166] Make progress on the input being focusable from an external label --- module/components/incrementer.mjs | 105 ++++++++++++++---- styles/v3/components/incrementer.scss | 11 +- .../v2/partials/inventory/player.v2.pc.hbs | 12 +- 3 files changed, 93 insertions(+), 35 deletions(-) diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index b543c93..146a391 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -2,6 +2,10 @@ Attributes: @property {string} name - The path to the value to update @property {number} value - The actual value of the input +@property {number} min - The minimum value of the input +@property {number} max - The maximum value of the input +@property {number?} smallStep - The step size used for the buttons and arrow keys +@property {number?} largeStep - The step size used for the buttons + Ctrl and page up / down Styling: - `--height`: Controls the height of the element + the width of the buttons (default: 1.25rem) @@ -9,9 +13,15 @@ Styling: */ export class DotDungeonIncrementer extends HTMLElement { static elementName = `dd-incrementer`; + static formAssociated = true; static styles = ``; + #min; + #max; + #smallStep; + #largeStep; + #input; #publicInput; #sr; @@ -19,40 +29,47 @@ export class DotDungeonIncrementer extends HTMLElement { constructor() { super(); + this._internals = this.attachInternals(); + const value = this.getAttribute(`value`); + this.#min = parseInt(this.getAttribute(`min`) ?? 0); + this.#max = parseInt(this.getAttribute(`max`) ?? 0); + this.#smallStep = parseInt(this.getAttribute(`smallStep`) ?? 1); + this.#largeStep = parseInt(this.getAttribute(`largeStep`) ?? 5); - /* - This input exists for the sole purpose of making it so that the form data - works with this input without needing to do jank work arounds (even though - this on it's own is already a sort of jank work around). - */ - const hiddenInput = document.createElement(`input`); - hiddenInput.type = `hidden`; - hiddenInput.name = this.getAttribute(`name`); - hiddenInput.value = value; - this.#publicInput = hiddenInput; - this.appendChild(hiddenInput); - - const sr = this.attachShadow({ mode: `open` }); + const sr = this.attachShadow({ + mode: `open`, + delegatesFocus: true + }); this.#sr = sr; const container = document.createElement(`div`); if (DotDungeonIncrementer.styles) this.#embedStyles(); + // The input that the user can see / modify const input = document.createElement(`input`); this.#input = input; input.type = `number`; + input.min = this.getAttribute(`min`); + input.max = this.getAttribute(`max`); input.addEventListener(`change`, this.#updateValue.bind(this)); input.value = value; - const increment = document.createElement(`button`); + // input.id = this.id; + // this.removeAttribute(`id`); + + // plus button + const increment = document.createElement(`span`); increment.innerHTML = `+`; - increment.type = `button`; + // increment.type = `button`; + // increment.tabIndex = -1; increment.classList.value = `increment`; increment.addEventListener(`click`, this.#increment.bind(this)); - const decrement = document.createElement(`button`); + // minus button + const decrement = document.createElement(`span`); decrement.innerHTML = `-`; - decrement.type = `button`; + // decrement.type = `button`; + // decrement.tabIndex = -1; decrement.classList.value = `decrement`; decrement.addEventListener(`click`, this.#decrement.bind(this)); @@ -65,6 +82,20 @@ export class DotDungeonIncrementer extends HTMLElement { }; connectedCallback() { + /* + This input exists for the sole purpose of making it so that the form data + works with this input without needing to do jank work arounds, as Foundry + only listens for change events from a small subset of elements which makes + this a bit a jank work around as it is. + */ + const hiddenInput = document.createElement(`input`); + this.#publicInput = hiddenInput; + hiddenInput.type = `hidden`; + hiddenInput.value = this.#input.value; + hiddenInput.name = this.getAttribute(`name`); + // this.removeAttribute(`name`); + // this.appendChild(hiddenInput); + if (!DotDungeonIncrementer.styles) { fetch(`./systems/dotdungeon/.styles/v3/components/incrementer.css`) .then(r => r.text()) @@ -75,6 +106,16 @@ export class DotDungeonIncrementer extends HTMLElement { }; }; + get value() { + return this.#input.value; + }; + get form() { + return this._internals.form; + }; + get type() { + return `number`; + }; + #embedStyles() { const style = document.createElement(`style`); style.innerHTML = DotDungeonIncrementer.styles; @@ -82,20 +123,36 @@ export class DotDungeonIncrementer extends HTMLElement { }; #updateValue() { - this.#publicInput.value = this.#input.value; - const event = new Event(`change`, { bubbles: true }); - this.#publicInput.dispatchEvent(event); + let value = parseInt(this.#input.value); + if (this.getAttribute(`min`)) value = Math.max(this.#min, value); + if (this.getAttribute(`max`)) value = Math.min(this.#max, value); + this.#input.value = value; + if (this.#input.value === this.#publicInput.value) return; + this.#publicInput.value = value; + const event = new Event(`change`); + // this.#publicInput.dispatchEvent(event); + console.log(`#updateValue`) + this.dispatchEvent(event); }; - #increment() { - this.#input.value++; + #increment($e) { + let value = parseInt(this.#input.value); + value += $e.ctrlKey ? this.#largeStep : this.#smallStep; + this.#input.value = value; this.#updateValue(); }; - #decrement() { - this.#input.value--; + #decrement($e) { + let value = parseInt(this.#input.value); + value -= $e.ctrlKey ? this.#largeStep : this.#smallStep; + this.#input.value = value; this.#updateValue(); }; + + focus() { + console.log(1) + super.focus(); + } }; diff --git a/styles/v3/components/incrementer.scss b/styles/v3/components/incrementer.scss index ce5328d..650eead 100644 --- a/styles/v3/components/incrementer.scss +++ b/styles/v3/components/incrementer.scss @@ -26,7 +26,7 @@ div { } } -button, input { +span, input { border: none; outline: none; background: none; @@ -36,7 +36,7 @@ button, input { input { font-family: inherit; text-align: center; - padding: 0; + padding: 2px 4px; &::-webkit-inner-spin-button, &::-webkit-outer-spin-button { -webkit-appearance: none; @@ -46,16 +46,13 @@ input { } } -button { +span { aspect-ratio: 1 / 1; padding: 0; display: flex; justify-content: center; align-items: center; - - &:hover { - cursor: pointer; - } + cursor: pointer; } .increment { diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 0249748..d236d29 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -11,12 +11,16 @@
- - {{!-- --}} + {{!-- - - --}}
- {{!-- - - + id="{{meta.idp}}-player-inventory-bytes" + min="0" + >

Show

From a8c94ee16f45d9d34c8192e82b6787ec60b0c090 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 12:36:32 -0600 Subject: [PATCH 138/166] Add common SCSS for all custom components --- styles/v3/components/common.scss | 7 +++++++ styles/v3/components/icon.scss | 4 +++- styles/v3/components/incrementer.scss | 7 ++++--- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 styles/v3/components/common.scss diff --git a/styles/v3/components/common.scss b/styles/v3/components/common.scss new file mode 100644 index 0000000..59f812d --- /dev/null +++ b/styles/v3/components/common.scss @@ -0,0 +1,7 @@ +// Disclaimer: This CSS is used by a custom web component and is scoped to JUST +// the corresponding web component. This should only be imported by web component +// style files. + +:host { + display: inline-block; +} diff --git a/styles/v3/components/icon.scss b/styles/v3/components/icon.scss index 22cfc17..012593f 100644 --- a/styles/v3/components/icon.scss +++ b/styles/v3/components/icon.scss @@ -1,10 +1,12 @@ /* Disclaimer: This CSS is used by a custom web component and is scoped to JUST -the corresponding web component. Importing this into other files is forbidden. +the corresponding web component. Importing this into other files is forbidden */ $default-size: 1rem; +@use "./common.scss"; + div { display: flex; justify-content: center; diff --git a/styles/v3/components/incrementer.scss b/styles/v3/components/incrementer.scss index c7eb63b..abe9478 100644 --- a/styles/v3/components/incrementer.scss +++ b/styles/v3/components/incrementer.scss @@ -1,13 +1,14 @@ /* Disclaimer: This CSS is used by a custom web component and is scoped to JUST -the corresponding web component. Importing this into other files is forbidden. +the corresponding web component. Importing this into other files is forbidden */ -@use "../mixins/material"; - $default-border-radius: 4px; $default-height: 1.5rem; +@use "../mixins/material"; +@use "./common.scss"; + div { display: grid; grid-template-columns: var(--height, $default-height) var(--width, 50px) var(--height, $default-height); From 1598081e3bfff1b165c99ae9d4837d7affe3ef17 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 12:40:09 -0600 Subject: [PATCH 139/166] Add the icon element to the html-data spec --- .vscode/components.html-data.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.vscode/components.html-data.json b/.vscode/components.html-data.json index 74f7942..e1c3ebd 100644 --- a/.vscode/components.html-data.json +++ b/.vscode/components.html-data.json @@ -12,6 +12,14 @@ { "name": "smallStep", "description": "The value that the input is changed by when clicking a delta button or using the up/down arrow key" }, { "name": "largeStep", "description": "The value that the input is changed by when clicking a delta button with control held or using the page up/ page down arrow key" } ] + }, + { + "name": "dd-icon", + "description": "Loads an icon asynchronously, caching the result for future uses", + "attributes": [ + { "name": "name", "description": "The name of the icon, this is relative to the assets folder of the dotdungeon system" }, + { "name": "path", "description": "The full path of the icon, this will only be used if `name` isn't provided or fails to fetch." } + ] } ], "globalAttributes": [], From 8c83d304b7c158d3a3dbbba8be49f01bf6aacbd3 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 17:08:52 -0600 Subject: [PATCH 140/166] Remove the really annoying blur on the incrementer component --- module/components/incrementer.mjs | 3 --- 1 file changed, 3 deletions(-) diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index 26069ee..fd58e70 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -127,9 +127,6 @@ export class DotDungeonIncrementer extends StyledShadowElement(HTMLElement) { this.#input.value = value; this.value = value; this.dispatchEvent(new Event(`change`, { bubbles: true })); - - // NOTE: This may be really annoying, in that case, remove it later - this.blur(); }; /** @param {Event} $e */ From 44eaec2d380de9d1cb28b2d20a2a2c2308f8c673 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 17:09:57 -0600 Subject: [PATCH 141/166] Only listen to custom components that have the name attribute for form submission --- module/sheets/GenericActorSheet.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/sheets/GenericActorSheet.mjs b/module/sheets/GenericActorSheet.mjs index 1f39bf3..4c0febc 100644 --- a/module/sheets/GenericActorSheet.mjs +++ b/module/sheets/GenericActorSheet.mjs @@ -57,8 +57,8 @@ export class GenericActorSheet extends ActorSheet { default. */ html.find( - CONFIG.CACHE.componentListeners.join(`,`) - ).on(`change`, this._onChangeInput.bind(this)); + CONFIG.CACHE.componentListeners.map(n => `${n}[name]`).join(`,`) + ).on(`change`, () => this._onChangeInput.bind(this)); /* Utility event listeners that apply From 050fecd4f616f18164e051ce4655fc86e69a41a0 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 17:10:42 -0600 Subject: [PATCH 142/166] Update the material item to use the incrementer component --- .../actor/char-sheet/v2/pages/inventory.scss | 6 +-- .../inventory/items/material.v2.pc.hbs | 49 ++----------------- 2 files changed, 7 insertions(+), 48 deletions(-) diff --git a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss index 457f9ee..57626fd 100644 --- a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss @@ -49,7 +49,7 @@ &__list { &--material { display: grid; - grid-template-columns: 1fr 1fr; + grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } @@ -164,8 +164,8 @@ @include material.elevate(1); padding: 8px; gap: 8px; - display: grid; - grid-template-columns: 1fr min-content 50px min-content; + display: flex; + justify-content: space-between; align-items: center; border-radius: 4px; diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs index 272702a..ea0a8b3 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs @@ -7,52 +7,11 @@ > {{item.name}} - {{#if (eq item.system.quantity 0)}} - - {{else}} - - {{/if}} - - + >
From aa41635f880c7d4cb8e2dd6583dac480145996d2 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 17:17:15 -0600 Subject: [PATCH 143/166] Update the inventory icons to be using the dd-icon component --- .../char-sheet/v2/partials/inventory/item-list.v2.pc.hbs | 4 +--- .../char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs | 4 +--- .../char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs | 4 +--- .../char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs | 4 +--- .../char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 3cbaac5..3e5c234 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -17,9 +17,7 @@ data-tooltip="{{filter.createLabel}}" data-tooltip-direction="LEFT" > - +

diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs index 5d61f2d..c3bc9dc 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs @@ -13,9 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs index fd481e7..6c07eac 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs @@ -13,9 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs index 9907578..e0e845e 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs @@ -13,9 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs index 36707d8..8dae2e7 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs @@ -13,9 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} From 7e5fc036aab81114fa3d1dd4e8ad2dac9e3827e1 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 17:24:08 -0600 Subject: [PATCH 144/166] Remove duplicate event listener that's causing an error when editing an item (closes #164) --- module/sheets/GenericActorSheet.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/module/sheets/GenericActorSheet.mjs b/module/sheets/GenericActorSheet.mjs index 4c0febc..32b6d5e 100644 --- a/module/sheets/GenericActorSheet.mjs +++ b/module/sheets/GenericActorSheet.mjs @@ -83,7 +83,6 @@ export class GenericActorSheet extends ActorSheet { const id = $e.currentTarget.dataset.embeddedEdit; this.openEmbeddedSheet.bind(this)(id); }) - .on(`click`, this.openEmbeddedSheet.bind(this)); html.find(`button[data-increment]`) .on(`click`, this._incrementValue.bind(this)); html.find(`button[data-decrement]`) From 2737c46ffeb1917b00ded8022eacd5d65c1f896c Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 13 Apr 2024 17:39:20 -0600 Subject: [PATCH 145/166] Optimization & reorganization of icon files --- assets/caret-down.svg | 3 --- assets/caret-right.svg | 3 --- assets/chat-bubble.svg | 3 --- assets/close.svg | 3 --- assets/dice/d10.svg | 4 +-- assets/dice/d12.svg | 4 +-- assets/dice/d20.svg | 4 +-- assets/dice/d4.svg | 4 +-- assets/dice/d6.svg | 4 +-- assets/dice/d8.svg | 4 +-- assets/edit.svg | 7 ----- assets/garbage-bin.svg | 6 ----- assets/minus.svg | 3 --- assets/sheet.svg | 8 ------ assets/sources.txt | 27 ++++++++++--------- assets/ui/caret/down.svg | 1 + assets/ui/caret/right.svg | 1 + assets/ui/chat-bubble.svg | 1 + assets/ui/close.svg | 1 + assets/ui/garbage-bin.svg | 1 + assets/ui/help.svg | 1 + assets/ui/minus.svg | 1 + assets/ui/pencil.svg | 1 + assets/{create.svg => ui/plus.svg} | 0 assets/ui/sheet.svg | 1 + module/components/incrementer.mjs | 6 ++--- .../v2/partials/inventory/item-list.v2.pc.hbs | 2 +- .../partials/inventory/items/aspect.v2.pc.hbs | 2 +- .../v2/partials/inventory/items/pet.v2.pc.hbs | 2 +- .../inventory/items/untyped.v2.pc.hbs | 2 +- .../partials/inventory/items/weapon.v2.pc.hbs | 2 +- 31 files changed, 37 insertions(+), 75 deletions(-) delete mode 100644 assets/caret-down.svg delete mode 100644 assets/caret-right.svg delete mode 100644 assets/chat-bubble.svg delete mode 100644 assets/close.svg delete mode 100644 assets/edit.svg delete mode 100644 assets/garbage-bin.svg delete mode 100644 assets/minus.svg delete mode 100644 assets/sheet.svg create mode 100644 assets/ui/caret/down.svg create mode 100644 assets/ui/caret/right.svg create mode 100644 assets/ui/chat-bubble.svg create mode 100644 assets/ui/close.svg create mode 100644 assets/ui/garbage-bin.svg create mode 100644 assets/ui/help.svg create mode 100644 assets/ui/minus.svg create mode 100644 assets/ui/pencil.svg rename assets/{create.svg => ui/plus.svg} (100%) create mode 100644 assets/ui/sheet.svg diff --git a/assets/caret-down.svg b/assets/caret-down.svg deleted file mode 100644 index 415d3db..0000000 --- a/assets/caret-down.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/caret-right.svg b/assets/caret-right.svg deleted file mode 100644 index 7d1d59b..0000000 --- a/assets/caret-right.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/chat-bubble.svg b/assets/chat-bubble.svg deleted file mode 100644 index 8dde604..0000000 --- a/assets/chat-bubble.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/assets/close.svg b/assets/close.svg deleted file mode 100644 index f6c80ed..0000000 --- a/assets/close.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/dice/d10.svg b/assets/dice/d10.svg index 96a39a1..3debc8e 100644 --- a/assets/dice/d10.svg +++ b/assets/dice/d10.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/assets/dice/d12.svg b/assets/dice/d12.svg index dac2e4c..df2787c 100644 --- a/assets/dice/d12.svg +++ b/assets/dice/d12.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/assets/dice/d20.svg b/assets/dice/d20.svg index 82cf8b3..a829cdf 100644 --- a/assets/dice/d20.svg +++ b/assets/dice/d20.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/assets/dice/d4.svg b/assets/dice/d4.svg index 3388bda..f31809b 100644 --- a/assets/dice/d4.svg +++ b/assets/dice/d4.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/assets/dice/d6.svg b/assets/dice/d6.svg index bea7528..00dfed7 100644 --- a/assets/dice/d6.svg +++ b/assets/dice/d6.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/assets/dice/d8.svg b/assets/dice/d8.svg index ca3b00b..7731f96 100644 --- a/assets/dice/d8.svg +++ b/assets/dice/d8.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/assets/edit.svg b/assets/edit.svg deleted file mode 100644 index 7cc344b..0000000 --- a/assets/edit.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/garbage-bin.svg b/assets/garbage-bin.svg deleted file mode 100644 index b9268a5..0000000 --- a/assets/garbage-bin.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/minus.svg b/assets/minus.svg deleted file mode 100644 index 171613e..0000000 --- a/assets/minus.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/assets/sheet.svg b/assets/sheet.svg deleted file mode 100644 index eaf555b..0000000 --- a/assets/sheet.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/assets/sources.txt b/assets/sources.txt index b002fc2..2896d5f 100644 --- a/assets/sources.txt +++ b/assets/sources.txt @@ -1,12 +1,15 @@ +Disclaimer: + All icons included in this repo have been scaled and optimized as needed. + Amer Alamer - caret-right.svg (https://thenounproject.com/icon/arrow-caret-right-1143917/) - caret-down.svg (https://thenounproject.com/icon/arrow-caret-down-1143911/) + ui/caret/right.svg (https://thenounproject.com/icon/arrow-caret-right-1143917/) + ui/caret/down.svg (https://thenounproject.com/icon/arrow-caret-down-1143911/) Alice Design: - garbage-bin.svg (https://thenounproject.com/icon/garbage-2025492/) + ui/garbage-bin.svg (https://thenounproject.com/icon/garbage-2025492/) zapesicon: - chat-bubble.svg (https://thenounproject.com/icon/chat-6423186/) + ui/chat-bubble.svg (https://thenounproject.com/icon/chat-6423186/) Fritz Duggan: dice/d4.svg (https://thenounproject.com/icon/d4-4570604/) @@ -17,21 +20,19 @@ Fritz Duggan: dice/d20.svg (https://thenounproject.com/icon/d20-4570607/) Landan Lloyd: - create.svg (https://thenounproject.com/icon/create-1447560/) + ui/plus.svg (https://thenounproject.com/icon/create-1447560/) Bismillah - minus.svg (https://thenounproject.com/icon/minus-1727966/) + ui/minus.svg (https://thenounproject.com/icon/minus-1727966/) Rokhman Kharis: - close.svg (https://thenounproject.com/icon/close-4996834/) + ui/close.svg (https://thenounproject.com/icon/close-4996834/) Athok: - sheet.svg (https://thenounproject.com/icon/sheet-5939348/) + ui/sheet.svg (https://thenounproject.com/icon/sheet-5939348/) Icon Depot: - edit.svg (https://thenounproject.com/icon/edit-1489252/) + ui/pencil.svg (https://thenounproject.com/icon/edit-1489252/) -Oliver Akins: - chat-bubble.svg : Scaling - create.svg : Scaling, Optimization - sheet.svg : Scaling \ No newline at end of file +Muhammad Ahsanu Nadia: + ui/help.svg (https://thenounproject.com/icon/help-6778522/) diff --git a/assets/ui/caret/down.svg b/assets/ui/caret/down.svg new file mode 100644 index 0000000..5c15836 --- /dev/null +++ b/assets/ui/caret/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/caret/right.svg b/assets/ui/caret/right.svg new file mode 100644 index 0000000..3b19a49 --- /dev/null +++ b/assets/ui/caret/right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/chat-bubble.svg b/assets/ui/chat-bubble.svg new file mode 100644 index 0000000..a9182c1 --- /dev/null +++ b/assets/ui/chat-bubble.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/close.svg b/assets/ui/close.svg new file mode 100644 index 0000000..3082802 --- /dev/null +++ b/assets/ui/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/garbage-bin.svg b/assets/ui/garbage-bin.svg new file mode 100644 index 0000000..dd96a44 --- /dev/null +++ b/assets/ui/garbage-bin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/help.svg b/assets/ui/help.svg new file mode 100644 index 0000000..bd06071 --- /dev/null +++ b/assets/ui/help.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/minus.svg b/assets/ui/minus.svg new file mode 100644 index 0000000..d1d3e94 --- /dev/null +++ b/assets/ui/minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/ui/pencil.svg b/assets/ui/pencil.svg new file mode 100644 index 0000000..455379f --- /dev/null +++ b/assets/ui/pencil.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/create.svg b/assets/ui/plus.svg similarity index 100% rename from assets/create.svg rename to assets/ui/plus.svg diff --git a/assets/ui/sheet.svg b/assets/ui/sheet.svg new file mode 100644 index 0000000..32a3268 --- /dev/null +++ b/assets/ui/sheet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs index fd58e70..68e426a 100644 --- a/module/components/incrementer.mjs +++ b/module/components/incrementer.mjs @@ -85,8 +85,8 @@ export class DotDungeonIncrementer extends StyledShadowElement(HTMLElement) { input.value = value; // plus button - const increment = document.createElement("dd-icon"); - increment.setAttribute(`name`, `create`); + const increment = document.createElement(DotDungeonIcon.elementName); + increment.setAttribute(`name`, `ui/plus`); increment.setAttribute(`var:size`, `0.75rem`); increment.setAttribute(`var:fill`, `currentColor`); increment.ariaHidden = true; @@ -95,7 +95,7 @@ export class DotDungeonIncrementer extends StyledShadowElement(HTMLElement) { // minus button const decrement = document.createElement(DotDungeonIcon.elementName); - decrement.setAttribute(`name`, `minus`); + decrement.setAttribute(`name`, `ui/minus`); decrement.setAttribute(`var:size`, `0.75rem`); decrement.setAttribute(`var:fill`, `currentColor`); decrement.ariaHidden = true; diff --git a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs index 3e5c234..73926f9 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs @@ -17,7 +17,7 @@ data-tooltip="{{filter.createLabel}}" data-tooltip-direction="LEFT" > - +


diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs index c3bc9dc..ff106e6 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs @@ -13,7 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs index 6c07eac..dc0e1a8 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs @@ -13,7 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs index e0e845e..de3abdc 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs @@ -13,7 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs index 8dae2e7..6b0fe0f 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs @@ -13,7 +13,7 @@ tabindex="0" aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}" > - +

{{item.name}} From c3bb67ad7c072d1b8cf5cfa0b17bcf3b82a8584f Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 15 Apr 2024 23:49:50 -0600 Subject: [PATCH 146/166] Get the calculated capacity "tooltip" implemented (closes #147 and closes #125) --- langs/en-ca.2.json | 10 ++- module/sheets/Items/GenericItemSheet.mjs | 16 ++++ module/utils/DialogManager.mjs | 85 +++++++++++++++++++ styles/v3/layouts/items/untyped/v2.scss | 9 ++ .../untyped/v2/tabs/settings.v2.untyped.hbs | 14 ++- 5 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 module/utils/DialogManager.mjs diff --git a/langs/en-ca.2.json b/langs/en-ca.2.json index 82a260e..c1d67b1 100644 --- a/langs/en-ca.2.json +++ b/langs/en-ca.2.json @@ -81,10 +81,18 @@ "send-to-chat": "Send to Chat", "edit": "Edit", "delete": "Delete", - "empty": "---" + "empty": "---", + "help": "Help", + "gm": "Server" }, "sheet-names": { "*DataSheet": "Data Sheet" + }, + "help-tooltips": { + "calculated-capacity": { + "title": "What is Calculated Capacity?", + "content": "

The calculated capacity is how much space in your inventory that the item will take up, the way it is calculated is determined by the item. Usually the main thing that affects the capacity is the item's quantity, but this can be turned off by the @dotdungeon.common.gm, which means that no matter the quantity it will only use up one capacity. The @dotdungeon.common.gm can also entirely disable capacity usage which will make the used capacity always be zero.

" + } } }, "TYPES": { diff --git a/module/sheets/Items/GenericItemSheet.mjs b/module/sheets/Items/GenericItemSheet.mjs index 0776648..883050e 100644 --- a/module/sheets/Items/GenericItemSheet.mjs +++ b/module/sheets/Items/GenericItemSheet.mjs @@ -1,3 +1,4 @@ +import { DialogManager } from "../../utils/DialogManager.mjs"; import DOTDUNGEON from "../../config.mjs"; export class GenericItemSheet extends ItemSheet { @@ -45,6 +46,10 @@ export class GenericItemSheet extends ItemSheet { .on(`click`, this._incrementValue.bind(this)); html.find(`button[data-decrement]`) .on(`click`, this._decrementValue.bind(this)); + + + html.find(`[data-help-id]`) + .on(`click`, this._helpPopup.bind(this)); }; async _incrementValue($e) { @@ -66,4 +71,15 @@ export class GenericItemSheet extends ItemSheet { }; this.actor.update({ [data.decrement]: value - 1 }); }; + + async _helpPopup($e) { + const target = $e.currentTarget; + const data = target.dataset; + if (!data.helpId) return; + DialogManager.helpDialog( + data.helpId, + data.helpContent, + data.helpTitle + ); + }; }; diff --git a/module/utils/DialogManager.mjs b/module/utils/DialogManager.mjs new file mode 100644 index 0000000..da28478 --- /dev/null +++ b/module/utils/DialogManager.mjs @@ -0,0 +1,85 @@ +import { localizer } from "./localizer.mjs"; + +/** + * A utility class that allows managing Dialogs that are created for various + * purposes such as deleting items, help popups, etc. This is a singleton class + * that upon instantiating after the first time will just return the first instance + */ +export class DialogManager { + + /** @type {Map} */ + static #dialogs = new Map(); + + /** + * Focuses a dialog if it already exists, or creates a new one and renders it. + * + * @param {string} dialogId The ID to associate with the dialog, should be unique + * @param {object} data The data to pass to the Dialog constructor + * @param {DialogOptions} opts The options to pass to the Dialog constructor + * @returns {Dialog} The Dialog instance + */ + static async createOrFocus(dialogId, data, opts = {}) { + if (DialogManager.#dialogs.has(dialogId)) { + const dialog = DialogManager.#dialogs.get(dialogId); + dialog.bringToTop(); + return dialog; + }; + + /* + This makes sure that if I provide a close function as a part of the data, + that the dialog still gets removed from the set once it's closed, otherwise + it could lead to dangling references that I don't care to keep. Or if I don't + provide the close function, it just sets the function as there isn't anything + extra that's needed to be called. + */ + if (data?.close) { + const provided = data.close; + data.close = () => { + DialogManager.#dialogs.delete(dialogId); + provided(); + }; + } + else { + data.close = () => DialogManager.#dialogs.delete(dialogId); + }; + + // Create the Dialog with the modified data + const dialog = new Dialog(data, opts); + DialogManager.#dialogs.set(dialogId, dialog); + dialog.render(true); + return dialog; + }; + + /** + * Closes a dialog if it is rendered + * + * @param {string} dialogId The ID of the dialog to close + */ + static async close(dialogId) { + const dialog = DialogManager.#dialogs.get(dialogId); + dialog?.close(); + }; + + static async helpDialog( + helpId, + helpContent, + helpTitle = `dotdungeon.common.help`, + localizationData = {}, + ) { + DialogManager.createOrFocus( + helpId, + { + title: localizer(helpTitle, localizationData), + content: localizer(helpContent, localizationData), + buttons: {}, + }, + { resizable: true, } + ); + }; + + static get size() { + return DialogManager.#dialogs.size; + } +}; + +globalThis.DialogManager = DialogManager; \ No newline at end of file diff --git a/styles/v3/layouts/items/untyped/v2.scss b/styles/v3/layouts/items/untyped/v2.scss index 8c18cd3..b3dc3a2 100644 --- a/styles/v3/layouts/items/untyped/v2.scss +++ b/styles/v3/layouts/items/untyped/v2.scss @@ -58,5 +58,14 @@ @include utils.tab("settings") { @extend %flex-col; + + .capacity { + &--calculated { + display: flex; + flex-direction: row; + align-items: center; + gap: 8px; + } + } } } diff --git a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs index e9fd907..c69757f 100644 --- a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs @@ -16,7 +16,17 @@ (GM Only)

{{/if}} -
- Total Capacity Used: +
+ Capacity Used: + +
+ 5
From 6d41a33b0c41f25c507f48a46958a8bebd1df631 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 15 Apr 2024 23:56:50 -0600 Subject: [PATCH 147/166] Remove DialogManager from the globalThis --- module/utils/DialogManager.mjs | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/utils/DialogManager.mjs b/module/utils/DialogManager.mjs index da28478..7c40407 100644 --- a/module/utils/DialogManager.mjs +++ b/module/utils/DialogManager.mjs @@ -81,5 +81,3 @@ export class DialogManager { return DialogManager.#dialogs.size; } }; - -globalThis.DialogManager = DialogManager; \ No newline at end of file From 48ceade1d119b67b8d6a7acb2f6cad67a03f4e22 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 17 Apr 2024 22:31:45 -0600 Subject: [PATCH 148/166] Implement the toggle for capacity usage. (closes #156) --- styles/v3/elements/checkbox.scss | 24 +++++++++++++++++++ styles/v3/index.scss | 1 + styles/v3/layouts/items/untyped/v2.scss | 5 ++++ styles/v3/themes/dark.css | 2 ++ .../untyped/v2/tabs/settings.v2.untyped.hbs | 19 +++++++++++---- 5 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 styles/v3/elements/checkbox.scss diff --git a/styles/v3/elements/checkbox.scss b/styles/v3/elements/checkbox.scss new file mode 100644 index 0000000..d3bae5f --- /dev/null +++ b/styles/v3/elements/checkbox.scss @@ -0,0 +1,24 @@ +.dotdungeon.style-v3 { + input[type="checkbox"] { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + border-radius: 2px; + margin: 0; + cursor: pointer; + + background: var(--elevation-8dp-bg); + position: relative; + &:checked::before { + content: ""; + background: var(--checkbox-checked); + border-radius: 3px; + $margin: 4px; + top: $margin; + bottom: $margin; + left: $margin; + right: $margin; + position: absolute; + } + } +} diff --git a/styles/v3/index.scss b/styles/v3/index.scss index 1814eac..85ec4bf 100644 --- a/styles/v3/index.scss +++ b/styles/v3/index.scss @@ -5,6 +5,7 @@ /* Element-Styling */ @use "./elements/utilities.scss"; @use "./elements/button.scss"; +@use "./elements/checkbox.scss"; @use "./elements/select.scss"; @use "./elements/text-input.scss"; @use "./elements/number-input.scss"; diff --git a/styles/v3/layouts/items/untyped/v2.scss b/styles/v3/layouts/items/untyped/v2.scss index b3dc3a2..a93307d 100644 --- a/styles/v3/layouts/items/untyped/v2.scss +++ b/styles/v3/layouts/items/untyped/v2.scss @@ -60,6 +60,11 @@ @extend %flex-col; .capacity { + &--usage, &--quantity { + display: flex; + align-items: center; + } + &--calculated { display: flex; flex-direction: row; diff --git a/styles/v3/themes/dark.css b/styles/v3/themes/dark.css index a5cbc65..374056f 100644 --- a/styles/v3/themes/dark.css +++ b/styles/v3/themes/dark.css @@ -4,4 +4,6 @@ --surface: #121212; --on-surface: white; + + --checkbox-checked: #00d300; } diff --git a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs index c69757f..75b1167 100644 --- a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs @@ -5,10 +5,21 @@
{{/if}} {{#if isGM}} -
- Uses Capacity? -
- (GM Only) +
+ +
+
Quantity Affects Capacity? From c6a7f8692695d9a4a61192982aa3258e2f0255cf Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 17 Apr 2024 22:34:08 -0600 Subject: [PATCH 149/166] Implement the Quantity affecting Capacity toggle (closes #157) --- .../untyped/v2/tabs/settings.v2.untyped.hbs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs index 75b1167..6be77e4 100644 --- a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs @@ -21,10 +21,19 @@ {{checked system.uses_inventory_slot}} >
-
- Quantity Affects Capacity? -
- (GM Only) +
+ +
+
{{/if}}
From 10449acf372622c8e98db6b523ec61e34880f497 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 17 Apr 2024 22:36:04 -0600 Subject: [PATCH 150/166] Makes the calculated capacity viewable on the sheet (closes #158) --- templates/items/untyped/v2/tabs/settings.v2.untyped.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs index 6be77e4..ec26790 100644 --- a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs @@ -47,6 +47,6 @@ data-help-title="dotdungeon.help-tooltips.calculated-capacity.title" >
- 5 + {{item.usedCapacity}}
From 2df7d2243f7cd6062032b6dc72109e26d100b316 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 17 Apr 2024 22:41:04 -0600 Subject: [PATCH 151/166] Get the combat relevance toggle working (closes #155) --- styles/v3/layouts/items/untyped/v2.scss | 10 +++++----- .../items/untyped/v2/tabs/settings.v2.untyped.hbs | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/styles/v3/layouts/items/untyped/v2.scss b/styles/v3/layouts/items/untyped/v2.scss index a93307d..ce6300f 100644 --- a/styles/v3/layouts/items/untyped/v2.scss +++ b/styles/v3/layouts/items/untyped/v2.scss @@ -59,12 +59,12 @@ @include utils.tab("settings") { @extend %flex-col; - .capacity { - &--usage, &--quantity { - display: flex; - align-items: center; - } + .capacity-usage, .quantity-capacity, .combat-relevant { + display: flex; + align-items: center; + } + .capacity { &--calculated { display: flex; flex-direction: row; diff --git a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs index ec26790..b24584a 100644 --- a/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/settings.v2.untyped.hbs @@ -1,11 +1,20 @@
{{#if meta.isEmbedded}}
- Useful in Combat? + +
+
{{/if}} {{#if isGM}} -
+
-
+
{{/each}} - From 2c2c4cc83f35a14043d7b1efe7f7999a7e717d62 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 23 Apr 2024 23:19:23 -0600 Subject: [PATCH 163/166] Make the AE deletion context menu option actually work --- langs/en-ca.2.json | 6 ++++++ module/sheets/Items/UntypedItemSheet.mjs | 26 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/langs/en-ca.2.json b/langs/en-ca.2.json index cc81d0a..dce0efa 100644 --- a/langs/en-ca.2.json +++ b/langs/en-ca.2.json @@ -95,6 +95,12 @@ "title": "What is Calculated Capacity?", "content": "

The calculated capacity is how much space in your inventory that the item will take up, the way it is calculated is determined by the item. Usually the main thing that affects the capacity is the item's quantity, but this can be turned off by the @dotdungeon.common.gm, which means that no matter the quantity it will only use up one capacity. The @dotdungeon.common.gm can also entirely disable capacity usage which will make the used capacity always be zero.

" } + }, + "delete": { + "ActiveEffect": { + "title": "Delete Effect", + "content": "

Are you sure you would like to delete the active effect: {name}

" + } } }, "TYPES": { diff --git a/module/sheets/Items/UntypedItemSheet.mjs b/module/sheets/Items/UntypedItemSheet.mjs index 99f6862..5ae0f24 100644 --- a/module/sheets/Items/UntypedItemSheet.mjs +++ b/module/sheets/Items/UntypedItemSheet.mjs @@ -1,4 +1,5 @@ import { GenericContextMenu } from "../../utils/GenericContextMenu.mjs"; +import { DialogManager } from "../../utils/DialogManager.mjs"; import { GenericItemSheet } from "./GenericItemSheet.mjs"; import { localizer } from "../../utils/localizer.mjs"; @@ -75,8 +76,29 @@ export class UntypedItemSheet extends GenericItemSheet { }, { name: localizer(`dotdungeon.common.delete`), - callback: async () => { - (await fromUuid(html.closest(`.effect`)[0].dataset.embeddedId))?.delete(true); + callback: async (html) => { + const target = html.closest(`.effect`)[0]; + const data = target.dataset; + const id = data.embeddedId; + const doc = await fromUuid(id); + DialogManager.createOrFocus( + `${doc.uuid}-delete`, + { + title: localizer(`dotdungeon.delete.ActiveEffect.title`, doc), + content: localizer(`dotdungeon.delete.ActiveEffect.content`, doc), + buttons: { + yes: { + label: localizer(`Yes`), + callback() { + doc.delete(); + }, + }, + no: { + label: localizer(`No`), + } + } + } + ); }, } ]); From e2579e12f881d95781899333dca38398a98b71c2 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 23 Apr 2024 23:19:59 -0600 Subject: [PATCH 164/166] Ignore all ref files in the root rather than just the foundry.js file --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4c1e822..4beb05c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ references/ /.*/ !/.vscode/ !/.github/ -/foundry.js +/*.ref.* *.lock *.zip From f8364888f2238fce5a971d1accdb9d0166df4691 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 27 Apr 2024 00:37:30 -0600 Subject: [PATCH 165/166] Fix issues with the localizer's replacement to be more reliable --- module/utils/localizer.mjs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/module/utils/localizer.mjs b/module/utils/localizer.mjs index 550c1cb..7cfebb0 100644 --- a/module/utils/localizer.mjs +++ b/module/utils/localizer.mjs @@ -18,12 +18,20 @@ export function localizer(key, args = {}, depth = 0) { return localized; }; + /* + Helps prevent recursion on the same key so that we aren't doing excess work. + */ + const localizedSubkeys = new Map(); for (const match of subkeys) { const subkey = match.groups.key; - localized = - localized.slice(0, match.index) - + localizer(subkey, args, depth + 1) - + localized.slice(match.index + subkey.length + 1) + if (localizedSubkeys.has(subkey)) continue; + localizedSubkeys.set(subkey, localizer(subkey, args, depth + 1)); }; - return localized; + + return localized.replace( + localizerConfig.subKeyPattern, + (_fullMatch, subkey) => { + return localizedSubkeys.get(subkey); + } + ); }; From cf13b986d4ceeca7a17bc882f04d88c1da75e239 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 27 Apr 2024 00:37:49 -0600 Subject: [PATCH 166/166] Change how embedded ActiveEffects are created --- module/sheets/Actors/PC/PlayerSheetV2.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/sheets/Actors/PC/PlayerSheetV2.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs index 0968a6e..ac1a378 100644 --- a/module/sheets/Actors/PC/PlayerSheetV2.mjs +++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs @@ -39,9 +39,8 @@ export class PlayerSheetv2 extends GenericActorSheet { html.find(`.create-ae`).on(`click`, async ($e) => { console.debug(`Creating an ActiveEffect?`); - ActiveEffect.implementation.create({ - name: "Default AE", - }, { parent: this.actor, renderSheet: true }); + const ae = this.actor.createEmbeddedDocuments(`ActiveEffect`, [{name: "Default AE"}]); + ae.sheet.render(true); }); html.find(`[data-filter-toggle]`).on(`change`, ($e) => { const target = $e.delegateTarget;