Compare commits

...

2 commits

11 changed files with 484 additions and 434 deletions

View file

@ -1,7 +0,0 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT
/dist
client
common

View file

@ -1,77 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ds4
Upstream-Contact: Johannes Loher <johannes.loher@fg4f.de>
Source: https://git.f3l.de/dungeonslayers/ds4
Files: assets/icons/official/*
Copyright: 2021 Johannes Loher
License: CC-BY-NC-SA-4.0
Files: assets/icons/game-icons/caro-asercion/*
Copyright: Caro Asercion
License: CC-BY-3.0
Files: assets/icons/game-icons/cathelineau/*
Copyright: Cathelineau
License: CC-BY-3.0
Files: assets/icons/game-icons/darkzaitev/*
Copyright: DarkZaitzev, http://darkzaitzev.deviantart.com/
License: CC-BY-3.0
Files: assets/icons/game-icons/delapouite/*
Copyright: Delapouite, https://delapouite.com/
License: CC-BY-3.0
Files: assets/icons/game-icons/heavenly-dog/*
Copyright: HeavenlyDog, http://www.gnomosygoblins.blogspot.com/
License: CC-BY-3.0
Files: assets/icons/game-icons/lorc/*
Copyright: Lorc, http://lorcblog.blogspot.com/
License: CC-BY-3.0
Files: assets/icons/game-icons/sbed/*
Copyright: Sbed, http://opengameart.org/content/95-game-icons
License: CC-BY-3.0
Files: assets/icons/game-icons/skoll/*
Copyright: Skoll
License: CC-BY-3.0
Files: assets/icons/game-icons/willdabeast/*
Copyright: Willdabeast, http://wjbstories.blogspot.com/
License: CC-BY-3.0
Files: assets/tokens/devin-night/*
Copyright: Devin Night, https://immortalnights.com/
License: LicenseRef-DevinNightTokenUsageRights
Files: packs/creatures/*
Copyright: 2021 Sascha Martens
2021 Johannes Loher
License: CC-BY-NC-SA-4.0
Files: packs/items/*
Copyright: 2021 Johannes Loher
License: CC-BY-NC-SA-4.0
Files: packs/languages-and-scripts/*
Copyright: 2021 Johannes Loher
License: CC-BY-NC-SA-4.0
Files: packs/racial-abilities/*
Copyright: 2021 Johannes Loher
License: CC-BY-NC-SA-4.0
Files: packs/special-creature-abilities/*
Copyright: 2021 Johannes Loher
License: CC-BY-NC-SA-4.0
Files: packs/spells/*
Copyright: 2021 Sascha Martens
License: CC-BY-NC-SA-4.0
Files: packs/talents/*
Copyright: 2022 Johannes Loher
License: CC-BY-NC-SA-4.0

View file

@ -1,4 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.useFlatConfig": true
}

112
REUSE.toml Normal file
View file

@ -0,0 +1,112 @@
version = 1
SPDX-PackageName = "ds4"
SPDX-PackageSupplier = "Johannes Loher <johannes.loher@fg4f.de>"
SPDX-PackageDownloadLocation = "https://git.f3l.de/dungeonslayers/ds4"
[[annotations]]
path = "assets/icons/official/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2021 Johannes Loher"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "assets/icons/game-icons/caro-asercion/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Caro Asercion"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/cathelineau/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Cathelineau"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/darkzaitev/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "DarkZaitzev, http://darkzaitzev.deviantart.com/"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/delapouite/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Delapouite, https://delapouite.com/"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/heavenly-dog/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "HeavenlyDog, http://www.gnomosygoblins.blogspot.com/"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/lorc/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Lorc, http://lorcblog.blogspot.com/"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/sbed/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Sbed, http://opengameart.org/content/95-game-icons"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/skoll/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Skoll"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/icons/game-icons/willdabeast/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Willdabeast, http://wjbstories.blogspot.com/"
SPDX-License-Identifier = "CC-BY-3.0"
[[annotations]]
path = "assets/tokens/devin-night/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "Devin Night, https://immortalnights.com/"
SPDX-License-Identifier = "LicenseRef-DevinNightTokenUsageRights"
[[annotations]]
path = "packs/creatures/**"
precedence = "aggregate"
SPDX-FileCopyrightText = ["2021 Sascha Martens", "2021 Johannes Loher"]
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "packs/items/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2021 Johannes Loher"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "packs/languages-and-scripts/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2021 Johannes Loher"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "packs/racial-abilities/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2021 Johannes Loher"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "packs/special-creature-abilities/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2021 Johannes Loher"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "packs/spells/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2021 Sascha Martens"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"
[[annotations]]
path = "packs/talents/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2022 Johannes Loher"
SPDX-License-Identifier = "CC-BY-NC-SA-4.0"

67
eslint.config.js Normal file
View file

@ -0,0 +1,67 @@
// SPDX-FileCopyrightText: 2025 Johannes Loher
//
// SPDX-License-Identifier: MIT
// @ts-check
import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import tseslint from "typescript-eslint";
import globals from "globals";
const foundryGlobals = {
ActiveEffect: false,
ActiveEffectConfig: false,
Actor: false,
ActorSheet: false,
canvas: false,
Canvas: false,
ChatMessage: false,
CONFIG: false,
DocumentSheetConfig: false,
game: false,
Game: false,
Hooks: false,
Item: false,
ItemSheet: false,
Macro: false,
Notifications: false,
ui: false,
loadTemplates: false,
foundry: false,
Dialog: false,
renderTemplate: false,
TokenDocument: false,
Roll: false,
PoolTerm: false,
DiceTerm: false,
TextEditor: false,
CONST: false,
getProperty: false,
fromUuid: false,
};
export default tseslint.config(
{
ignores: ["dist/**", "client", "common"],
},
eslint.configs.recommended,
tseslint.configs.recommended,
{
languageOptions: {
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
},
globals: { ...globals.browser, ...globals.jquery, ...foundryGlobals },
},
},
{
files: ["tools/**", "*"],
languageOptions: {
parserOptions: {},
globals: globals.node,
},
},
eslintConfigPrettier,
);

View file

@ -47,9 +47,8 @@
"clean": "run-p clean:files clean:link",
"clean:files": "rimraf dist",
"clean:link": "node ./tools/link-package.js --clean",
"lint": "pnpm eslint",
"lint:fix": "pnpm eslint --fix",
"eslint": "eslint --ext .ts,.js,.cjs,.mjs .",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "pnpm prettier --write",
"format:check": "pnpm prettier --check",
"prettier": "prettier './**/*.(ts|js|cjs|mjs|json|scss|yml|yaml)'",
@ -65,30 +64,31 @@
"devDependencies": {
"@commitlint/cli": "19.7.1",
"@commitlint/config-conventional": "19.7.1",
"@eslint/js": "9.20.0",
"@foundryvtt/foundryvtt-cli": "0.0.9",
"@guanghechen/rollup-plugin-copy": "6.0.4",
"rollup-plugin-styler": "2.0.0",
"@swc/core": "1.10.16",
"@types/fs-extra": "11.0.4",
"@types/jquery": "3.5.32",
"@types/node": "18.19.76",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"conventional-changelog-cli": "5.0.0",
"conventional-changelog-conventionalcommits": "8.0.0",
"eslint": "8.57.1",
"eslint": "9.20.1",
"eslint-config-prettier": "10.0.1",
"fs-extra": "11.3.0",
"globals": "15.15.0",
"handlebars": "4.7.8",
"npm-run-all": "4.1.5",
"prettier": "3.5.1",
"rimraf": "6.0.1",
"rollup": "4.34.7",
"rollup-plugin-styler": "2.0.0",
"rollup-plugin-swc3": "0.12.1",
"sass": "1.85.0",
"semver": "7.7.1",
"tslib": "2.8.1",
"typescript": "5.7.3",
"typescript-eslint": "8.24.0",
"vite": "6.1.0",
"vitest": "3.0.5",
"yargs": "17.7.2"

File diff suppressed because it is too large Load diff

View file

@ -68,7 +68,7 @@ export class DS4ActiveEffect extends ActiveEffect {
change.value = Roll.replaceFormulaData(change.value, document);
try {
change.value = DS4ActiveEffect.safeEval(change.value).toString();
} catch (e) {
} catch {
// this is a valid case, e.g., if the effect change simply is a string
}
return super.apply(document, change);

View file

@ -118,7 +118,7 @@ export class DS4Actor extends Actor {
* @protected
*/
static replaceFormulaData(formula, data) {
const dataRgx = new RegExp(/@([a-z.0-9_\-]+)/gi);
const dataRgx = new RegExp(/@([a-z.0-9_-]+)/gi);
try {
return formula.replace(dataRgx, (_, term) => {
const value = foundry.utils.getProperty(data, term);

View file

@ -38,8 +38,6 @@ async function migrateItem(item) {
},
});
}
return updateData;
}
const migrateActor = getActorMigrator(migrateItem);

View file

@ -29,7 +29,7 @@ async function migrateItem(item) {
if (item.type === "spell") {
const spellCategory = item.system?.spellCategory;
const spellGroups = migrateSpellCategory(spellCategory);
const bonus = itemData.system?.bonus;
const bonus = item.system?.bonus;
const spellModifier = migrateBonus(bonus);
await item.update({
system: {