diff --git a/CHANGELOG.md b/CHANGELOG.md index b5267540..79b24055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,18 +8,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > Dictionary > (P) - A premium version of that animation is available. -## [0.3.4] - Unreleased +## [0.4.1] - Unreleased + +## [0.4.0] - 2024-08-10 ### Added - `atLocation`, `radius`, `constrainedByWalls`, `volume`, and `duration` support for sound effects. - `equipment:[state]` roll options for `toggle` animations. Use them wisely. - `templateAsOrigin` preset option for `ranged` animations. Allows to have the template to be the source of the animation, as opposed to the owner token. Allows for template animations detached from token location. +- User Animation Menu (#3) ### Changed - The Sounds Database to use a two-digit indexes (01, 02, 03, etc.) - Inner Radiance Torrent (P) to use `templateAsOrigin`. +- Updated dependencies. ### Fixed @@ -158,7 +162,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moved internal structure - Pre-release versions to be semver compliant -[Unreleased]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.3...HEAD +[Unreleased]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.4.0...HEAD +[0.4.0]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.3...v0.4.0 [0.3.3]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.2...v0.3.3 [0.3.2]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/MrVauxs/pf2e-graphics/compare/v0.3.0...v0.3.1 diff --git a/lang/en.json b/lang/en.json index 4aa70764..2fa0a335 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,8 +1,13 @@ { "pf2e-graphics": { - "support": "Donate", + "support": { + "1": "Donate!", + "2": "Support Me!", + "3": "Help the Author" + }, "modifyItem": "Modify Item Animations", "modifyActor": "Manage Actor Animations", + "modifyUser": "Manage User Animations", "cancel": "Cancel", "easingTooltip": "Learn more about various easing functions here.", "featText": "This feat contains PF2e Graphics-managed Rule Elements, primarily of the TokenImage variety. Opening the Rules tab on this feat may lag your game if the actor contains a lot of forms (ex. Druid).", @@ -32,6 +37,11 @@ "dev": { "name": "Developer Mode", "hint": "Posts to various information to the console. Helpful when you are trying to make your own animations." + }, + "userMenu": { + "name": "User Animations", + "hint": "Customize your own personal animations or see others.", + "label": "Open Menu" } }, "tooltip": { @@ -45,6 +55,15 @@ }, "openSheet": "Open Sheet" }, + "userAnimation": { + "tabs": { + "all-animations": "All Animations", + "user-animations": "User Animations", + "tokenimage-manager": "Token Image Manager" + }, + "toggle": "Toggle Predicates on and off, allowing you to preview the token change.", + "switch": "See the Effect the rule is predicated onto, or the predicate data itself." + }, "actorAnimation": { "openFeat": "Open", "displayFeat": "Display Feat on Character Sheet", @@ -76,4 +95,4 @@ "self-effect": "'Use' Effect" } } -} +} \ No newline at end of file diff --git a/module.json b/module.json index 1d8346df..5173325f 100644 --- a/module.json +++ b/module.json @@ -36,7 +36,7 @@ "id": "sequencer", "type": "module", "compatibility": { - "minimum": "3.2.12" + "minimum": "3.2.14" } } ], @@ -67,4 +67,4 @@ "changelog": "https://github.com/MrVauxs/pf2e-graphics/blob/main/CHANGELOG.md", "manifest": "https://raw.githubusercontent.com/MrVauxs/pf2e-graphics/main/module.json", "download": "https://github.com/MrVauxs/pf2e-graphics/archive/refs/heads/main.zip" -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e20f4369..8e0a4857 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5796,7 +5796,7 @@ }, "node_modules/foundry-pf2e": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/reonZ/foundry-pf2e.git#87e8e85c5afe17f404b2a611fd0641c468de4a9c", + "resolved": "git+ssh://git@github.com/reonZ/foundry-pf2e.git#1e67ae44aabb01f686bda31e5b97d06c7c926602", "dev": true, "license": "ISC", "dependencies": { @@ -9635,7 +9635,7 @@ }, "node_modules/sequencer": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/fantasycalendar/FoundryVTT-Sequencer.git#136bdd2c3e2cfc0195c0ce43df63e4894046db68", + "resolved": "git+ssh://git@github.com/fantasycalendar/FoundryVTT-Sequencer.git#f9eb6623c3e09b7719ed456719b19c32fc1f0e7a", "dev": true, "license": "MIT", "dependencies": { diff --git a/src/settings.ts b/src/settings.ts index 52c74372..2858524a 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,3 +1,4 @@ +import UserAnimationsShim from './view/UserAnimations' import { TJSGameSettings, TJSLiveGameSettings } from '#runtime/svelte/store/fvtt/settings' const gameSettings = new TJSGameSettings('pf2e-graphics') @@ -81,4 +82,13 @@ Hooks.on('init', () => { gameSettings.registerAll(settingsData, true) settings = new TJSLiveGameSettings(gameSettings) as typeof settings + + game.settings.registerMenu('pf2e-graphics', 'userAnimations', { + name: 'pf2e-graphics.settings.userMenu.name', + hint: 'pf2e-graphics.settings.userMenu.hint', + label: 'pf2e-graphics.settings.userMenu.label', + icon: 'fas fa-user', + type: UserAnimationsShim, + restricted: false, + }) }) diff --git a/src/storage/presets.ts b/src/storage/presets.ts index 624fee19..9d4220f3 100644 --- a/src/storage/presets.ts +++ b/src/storage/presets.ts @@ -272,7 +272,7 @@ export const presets = { helpers.parseOffsetEmbedded(options?.atLocation, source, target), ) - if (options?.sound) { + if (options?.sound?.file) { const sound = seq.sound() helpers.genericSoundFunction(sound, item, target, options.sound) } @@ -308,7 +308,7 @@ export const presets = { helpers.genericSequencerFunctions(section, item, target, options) - if (options?.sound) { + if (options?.sound?.file) { const sound = seq.sound() helpers.genericSoundFunction(sound, item, target, options.sound) } @@ -344,7 +344,7 @@ export const presets = { helpers.genericSequencerFunctions(result, item, affectedToken, options) - if (options?.sound) { + if (options?.sound?.file) { const sound = seq.sound() helpers.genericSoundFunction(sound, item, affectedToken, options.sound) } @@ -365,7 +365,7 @@ export const presets = { helpers.genericSequencerFunctions(section, item, target, options) - if (options?.sound) { + if (options?.sound?.file) { const sound = seq.sound() helpers.genericSoundFunction(sound, item, target, options.sound) } diff --git a/src/utils.ts b/src/utils.ts index 31a42a78..35382bce 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -113,3 +113,15 @@ export function mergeObjectsConcatArrays { + window.open('https://ko-fi.com/mrvauxs', '_blank') + }, + }) + return buttons +} diff --git a/src/view/ActorAnimations/ActorAnimationsApp.ts b/src/view/ActorAnimations/ActorAnimationsApp.ts index ad534641..e01258f2 100644 --- a/src/view/ActorAnimations/ActorAnimationsApp.ts +++ b/src/view/ActorAnimations/ActorAnimationsApp.ts @@ -1,6 +1,7 @@ import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application' import type { CombinedSvelteApplicationOptions, ConstructorApplicationOptions } from 'src/extensions' +import { kofiButton } from 'src/utils' import BasicAppShell from './ActorAnimationsShell.svelte' interface actorAnimationsOptions { @@ -40,14 +41,7 @@ export default class actorAnimationsApp extends SvelteApplication { override _getHeaderButtons() { const buttons = super._getHeaderButtons() - buttons.unshift({ - icon: 'fas fa-mug-hot ko-fi', - class: '', - label: 'pf2e-graphics.support', - onclick: () => { - window.open('https://ko-fi.com/mrvauxs', '_blank') - }, - }) + kofiButton(buttons) return buttons } } diff --git a/src/view/ItemAnimations/ItemAnimationsApp.ts b/src/view/ItemAnimations/ItemAnimationsApp.ts index 439eb79f..ffb846fe 100644 --- a/src/view/ItemAnimations/ItemAnimationsApp.ts +++ b/src/view/ItemAnimations/ItemAnimationsApp.ts @@ -1,6 +1,6 @@ -import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application' - import type { CombinedSvelteApplicationOptions, ConstructorApplicationOptions } from 'src/extensions' +import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application' +import { kofiButton } from 'src/utils' import BasicAppShell from './ItemAnimationsShell.svelte' interface ItemAnimationsOptions { @@ -40,14 +40,7 @@ export default class ItemAnimationsApp extends SvelteApplication { override _getHeaderButtons() { const buttons = super._getHeaderButtons() - buttons.unshift({ - icon: 'fas fa-mug-hot ko-fi', - class: '', - label: 'pf2e-graphics.support', - onclick: () => { - window.open('https://ko-fi.com/mrvauxs', '_blank') - }, - }) + kofiButton(buttons) return buttons } } diff --git a/src/view/UserAnimations/UserAnimationsApp.ts b/src/view/UserAnimations/UserAnimationsApp.ts new file mode 100644 index 00000000..13e23411 --- /dev/null +++ b/src/view/UserAnimations/UserAnimationsApp.ts @@ -0,0 +1,48 @@ +import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application' + +import type { CombinedSvelteApplicationOptions, ConstructorApplicationOptions } from 'src/extensions' +import { kofiButton } from 'src/utils' +import BasicAppShell from './UserAnimationsShell.svelte' + +interface UserAnimationsOptions { + data: { + user: UserPF2e | null + } +} + +export default class UserAnimationsApp extends SvelteApplication { + constructor(options: ConstructorApplicationOptions & UserAnimationsOptions) { + super() + + if (options.data) { + foundry.utils.mergeObject(this.options, { svelte: { props: options.data } }) + } + } + + static override get defaultOptions(): CombinedSvelteApplicationOptions { + return foundry.utils.mergeObject(super.defaultOptions, { + ...super.defaultOptions, + title: 'pf2e-graphics.modifyUser', // Automatically localized from `lang/en.json`. + width: 800, + height: 600, + classes: ['pf2e-g'], + id: 'pf2e-graphics-modify-user', + resizable: true, + + svelte: { + class: BasicAppShell, + target: document.body, + intro: true, + props: { + user: null, + }, + }, + }) + } + + override _getHeaderButtons() { + const buttons = super._getHeaderButtons() + kofiButton(buttons) + return buttons + } +} diff --git a/src/view/UserAnimations/UserAnimationsShell.svelte b/src/view/UserAnimations/UserAnimationsShell.svelte new file mode 100644 index 00000000..e6fcaa57 --- /dev/null +++ b/src/view/UserAnimations/UserAnimationsShell.svelte @@ -0,0 +1,159 @@ + + + + + +
+
+ +
+ + {$doc.name} $doc.sheet.render(true)} + /> +
+

+ {$doc.name} +

+ +
+
+ {#each tabs as tab} + {@const active = tab === $activeTab} + + {/each} +
+
+
+
+
+
+
+ {#if $activeTab === 'user-animations'} +
+
+ {#each Object.keys($flag).filter(k => Boolean($flag[k])) as key} + + {/each} +
+
+ {#if !$showNewAnimation} + + {:else} + Input the primary roll option. +
+ + +
+ + {/if} +
+
+ {/if} +
+
+
+
+ + diff --git a/src/view/UserAnimations/index.ts b/src/view/UserAnimations/index.ts new file mode 100644 index 00000000..4cd3926d --- /dev/null +++ b/src/view/UserAnimations/index.ts @@ -0,0 +1,20 @@ +import UserAnimationsApp from './UserAnimationsApp' + +export default class UserAnimationsShim extends FormApplication { + /** + * @inheritDoc + */ + constructor(options = {}) { + super({}, options) + + new UserAnimationsApp({ + data: { user: game.user }, + id: `pf2e-graphics-modify-item-${game.user.id}`, + }).render(true, { + focus: true, + }) + } + + async _updateObject() {} + override render() { this.close(); return this } +} diff --git a/src/view/index.ts b/src/view/index.ts index 0d19f392..b3418414 100644 --- a/src/view/index.ts +++ b/src/view/index.ts @@ -1,2 +1,3 @@ import './ActorAnimations' import './ItemAnimations' +import './UserAnimations'