WIP: Update to 0.8.x

This commit is contained in:
Johannes Loher 2021-06-30 02:17:54 +02:00
parent 344302be69
commit ef01698178
12 changed files with 352 additions and 250 deletions

4
.husky/.gitignore vendored
View file

@ -1,5 +1 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT
_ _

View file

@ -52,7 +52,7 @@
"postinstall": "husky install" "postinstall": "husky install"
}, },
"devDependencies": { "devDependencies": {
"@league-of-foundry-developers/foundry-vtt-types": "^0.7.10-0", "@league-of-foundry-developers/foundry-vtt-types": "https://github.com/League-of-Foundry-Developers/foundry-vtt-types.git#foundry-0.8.x",
"@rollup/plugin-node-resolve": "^13.0.0", "@rollup/plugin-node-resolve": "^13.0.0",
"@types/fs-extra": "^9.0.11", "@types/fs-extra": "^9.0.11",
"@types/jest": "^26.0.23", "@types/jest": "^26.0.23",

View file

@ -0,0 +1,87 @@
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { ModifiableDataBaseTotal, ResourceDataBaseTotalMax } from "../common/common-data";
import { DS4 } from "../config";
import {
DS4CharacterDataSourceDataBaseInfo,
DS4CharacterDataSourceDataCurrency,
DS4CharacterDataSourceDataProfile,
DS4CharacterDataSourceDataProgression,
DS4CharacterDataSourceDataSlayerPoints,
DS4CreatureDataSourceDataBaseInfo,
} from "./actor-data-source";
declare global {
interface DataConfig {
Actor: DS4ActorDataProperties;
}
}
export type DS4ActorDataProperties = DS4CharacterDataProperties | DS4CreatureDataProperties;
interface DS4CharacterDataProperties {
type: "character";
data: DS4CharacterDataPropertiesData;
}
interface DS4CreatureDataProperties {
type: "creature";
data: DS4CreatureDataPropertiesData;
}
// templates
interface DS4ActorDataPropertiesDataBase {
attributes: DS4ActorDataPropertiesDataAttributes;
traits: DS4ActorDataPropertiesDataTraits;
combatValues: DS4ActorDataPropertiesDataCombatValues;
rolling: DS4ActorDataPropertiesDataRolling;
checks: DS4ActorDataPropertiesDataChecks;
}
type DS4ActorDataPropertiesDataAttributes = {
[Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBaseTotal<number>;
};
type DS4ActorDataPropertiesDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBaseTotal<number> };
type DS4ActorDataPropertiesDataCombatValues = {
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
? ResourceDataBaseTotalMax<number>
: ModifiableDataBaseTotal<number>;
};
interface DS4ActorDataPropertiesDataRolling {
maximumCoupResult: number;
minimumFumbleResult: number;
}
type DS4ActorDataPropertiesDataChecks = {
[key in Check]: number;
};
export type Check = keyof typeof DS4.i18n.checks;
export function isCheck(value: string): value is Check {
return Object.keys(DS4.i18n.checks).includes(value);
}
// types
interface DS4CreatureDataPropertiesData extends DS4ActorDataPropertiesDataBase {
baseInfo: DS4CreatureDataSourceDataBaseInfo;
}
interface DS4CharacterDataPropertiesData extends DS4ActorDataPropertiesDataBase {
baseInfo: DS4CharacterDataSourceDataBaseInfo;
progression: DS4CharacterDataSourceDataProgression;
profile: DS4CharacterDataSourceDataProfile;
currency: DS4CharacterDataSourceDataCurrency;
slayerPoints: DS4CharacterDataPropertiesDataSlayerPoints;
}
export interface DS4CharacterDataPropertiesDataSlayerPoints extends DS4CharacterDataSourceDataSlayerPoints {
max: number;
}

View file

@ -7,50 +7,56 @@
import { ModifiableData, ModifiableDataBase, ResourceData, UsableResource } from "../common/common-data"; import { ModifiableData, ModifiableDataBase, ResourceData, UsableResource } from "../common/common-data";
import { DS4 } from "../config"; import { DS4 } from "../config";
import { DS4ItemData } from "../item/item-data";
export type DS4ActorData = DS4CharacterData | DS4CreatureData; declare global {
interface SourceConfig {
type ActorType = keyof typeof DS4.i18n.actorTypes; Actor: DS4ActorDataSource;
}
export interface DS4ActorDataHelper<T, U extends ActorType> extends Actor.Data<T, DS4ItemData> {
type: U;
} }
type DS4CharacterData = DS4ActorDataHelper<DS4CharacterDataData, "character">; export type DS4ActorDataSource = DS4CharacterDataSource | DS4CreatureDataSource;
type DS4CreatureData = DS4ActorDataHelper<DS4CreatureDataData, "creature">;
interface DS4CharacterDataSource {
type: "character";
data: DS4CharacterDataSourceData;
}
interface DS4CreatureDataSource {
type: "creature";
data: DS4CreatureDataSourceData;
}
// templates // templates
interface DS4ActorDataDataBase { interface DS4ActorDataSourceDataBase {
attributes: DS4ActorDataDataAttributes; attributes: DS4ActorDataSourceDataAttributes;
traits: DS4ActorDataDataTraits; traits: DS4ActorDataSourceDataTraits;
combatValues: DS4ActorDataDataCombatValues; combatValues: DS4ActorDataSourceDataCombatValues;
} }
type DS4ActorDataDataAttributes = { [Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBase<number> }; type DS4ActorDataSourceDataAttributes = { [Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBase<number> };
type Attribute = keyof DS4ActorDataDataAttributes; type Attribute = keyof DS4ActorDataSourceDataAttributes;
export function isAttribute(value: unknown): value is Attribute { export function isAttribute(value: unknown): value is Attribute {
return (Object.keys(DS4.i18n.attributes) as Array<unknown>).includes(value); return (Object.keys(DS4.i18n.attributes) as Array<unknown>).includes(value);
} }
type DS4ActorDataDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBase<number> }; type DS4ActorDataSourceDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBase<number> };
type Trait = keyof DS4ActorDataDataTraits; type Trait = keyof DS4ActorDataSourceDataTraits;
export function isTrait(value: unknown): value is Trait { export function isTrait(value: unknown): value is Trait {
return (Object.keys(DS4.i18n.traits) as Array<unknown>).includes(value); return (Object.keys(DS4.i18n.traits) as Array<unknown>).includes(value);
} }
type DS4ActorDataDataCombatValues = { type DS4ActorDataSourceDataCombatValues = {
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints" [Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
? ResourceData<number> ? ResourceData<number>
: ModifiableData<number>; : ModifiableData<number>;
}; };
type CombatValue = keyof DS4ActorDataDataCombatValues; type CombatValue = keyof DS4ActorDataSourceDataCombatValues;
export function isCombatValue(value: string): value is CombatValue { export function isCombatValue(value: string): value is CombatValue {
return (Object.keys(DS4.i18n.combatValues) as Array<unknown>).includes(value); return (Object.keys(DS4.i18n.combatValues) as Array<unknown>).includes(value);
@ -58,33 +64,44 @@ export function isCombatValue(value: string): value is CombatValue {
// types // types
interface DS4CharacterDataData extends DS4ActorDataDataBase { interface DS4CreatureDataSourceData extends DS4ActorDataSourceDataBase {
baseInfo: DS4CharacterDataDataBaseInfo; baseInfo: DS4CreatureDataSourceDataBaseInfo;
progression: DS4CharacterDataDataProgression;
language: DS4CharacterDataDataLanguage;
profile: DS4CharacterDataDataProfile;
currency: DS4CharacterDataDataCurrency;
slayerPoints: DS4CharacterDataDataSlayerPoints;
} }
export interface DS4CharacterDataDataBaseInfo {
export interface DS4CreatureDataSourceDataBaseInfo {
loot: string;
foeFactor: number;
creatureType: CreatureType;
sizeCategory: SizeCategory;
experiencePoints: number;
description: string;
}
type CreatureType = keyof typeof DS4.i18n.creatureTypes;
type SizeCategory = keyof typeof DS4.i18n.creatureSizeCategories;
interface DS4CharacterDataSourceData extends DS4ActorDataSourceDataBase {
baseInfo: DS4CharacterDataSourceDataBaseInfo;
progression: DS4CharacterDataSourceDataProgression;
profile: DS4CharacterDataSourceDataProfile;
currency: DS4CharacterDataSourceDataCurrency;
slayerPoints: DS4CharacterDataSourceDataSlayerPoints;
}
export interface DS4CharacterDataSourceDataBaseInfo {
race: string; race: string;
class: string; class: string;
heroClass: string; heroClass: string;
culture: string; culture: string;
} }
export interface DS4CharacterDataDataProgression { export interface DS4CharacterDataSourceDataProgression {
level: number; level: number;
experiencePoints: number; experiencePoints: number;
talentPoints: UsableResource<number>; talentPoints: UsableResource<number>;
progressPoints: UsableResource<number>; progressPoints: UsableResource<number>;
} }
export interface DS4CharacterDataDataLanguage { export interface DS4CharacterDataSourceDataProfile {
languages: string;
alphabets: string;
}
export interface DS4CharacterDataDataProfile {
biography: string; biography: string;
gender: string; gender: string;
birthday: string; birthday: string;
@ -97,29 +114,12 @@ export interface DS4CharacterDataDataProfile {
specialCharacteristics: string; specialCharacteristics: string;
} }
export interface DS4CharacterDataDataCurrency { export interface DS4CharacterDataSourceDataCurrency {
gold: number; gold: number;
silver: number; silver: number;
copper: number; copper: number;
} }
export interface DS4CharacterDataDataSlayerPoints { export interface DS4CharacterDataSourceDataSlayerPoints {
value: number; value: number;
} }
interface DS4CreatureDataData extends DS4ActorDataDataBase {
baseInfo: DS4CreatureDataDataBaseInfo;
}
export interface DS4CreatureDataDataBaseInfo {
loot: string;
foeFactor: number;
creatureType: CreatureType;
sizeCategory: SizeCategory;
experiencePoints: number;
description: string;
}
type CreatureType = keyof typeof DS4.i18n.creatureTypes;
type SizeCategory = keyof typeof DS4.i18n.creatureSizeCategories;

View file

@ -1,77 +0,0 @@
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { ModifiableDataBaseTotal, ResourceDataBaseTotalMax } from "../common/common-data";
import { DS4 } from "../config";
import {
DS4ActorDataHelper,
DS4CharacterDataDataBaseInfo,
DS4CharacterDataDataCurrency,
DS4CharacterDataDataLanguage,
DS4CharacterDataDataProfile,
DS4CharacterDataDataProgression,
DS4CharacterDataDataSlayerPoints,
DS4CreatureDataDataBaseInfo,
} from "./actor-data";
export type DS4ActorPreparedData = DS4CharacterPreparedData | DS4CreaturePreparedData;
type DS4CharacterPreparedData = DS4ActorDataHelper<DS4CharacterPreparedDataData, "character">;
type DS4CreaturePreparedData = DS4ActorDataHelper<DS4CreaturePreparedDataData, "creature">;
// templates
interface DS4ActorPreparedDataDataBase {
attributes: DS4ActorPreparedDataDataAttributes;
traits: DS4ActorPreparedDataDataTraits;
combatValues: DS4ActorPreparedDataDataCombatValues;
rolling: DS4ActorPreparedDataDataRolling;
checks: DS4ActorPreparedDataDataChecks;
}
type DS4ActorPreparedDataDataAttributes = {
[Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBaseTotal<number>;
};
type DS4ActorPreparedDataDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBaseTotal<number> };
type DS4ActorPreparedDataDataCombatValues = {
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
? ResourceDataBaseTotalMax<number>
: ModifiableDataBaseTotal<number>;
};
interface DS4ActorPreparedDataDataRolling {
maximumCoupResult: number;
minimumFumbleResult: number;
}
export type Check = keyof typeof DS4.i18n.checks;
export function isCheck(value: string): value is Check {
return Object.keys(DS4.i18n.checks).includes(value);
}
type DS4ActorPreparedDataDataChecks = {
[key in Check]: number;
};
// types
interface DS4CharacterPreparedDataData extends DS4ActorPreparedDataDataBase {
baseInfo: DS4CharacterDataDataBaseInfo;
progression: DS4CharacterDataDataProgression;
language: DS4CharacterDataDataLanguage;
profile: DS4CharacterDataDataProfile;
currency: DS4CharacterDataDataCurrency;
slayerPoints: DS4CharacterPreparedDataDataSlayerPoints;
}
export interface DS4CharacterPreparedDataDataSlayerPoints extends DS4CharacterDataDataSlayerPoints {
max: number;
}
interface DS4CreaturePreparedDataData extends DS4ActorPreparedDataDataBase {
baseInfo: DS4CreatureDataDataBaseInfo;
}

View file

@ -9,18 +9,16 @@ import { DS4Item } from "../item/item";
import { ItemType } from "../item/item-data"; import { ItemType } from "../item/item-data";
import { DS4ArmorPreparedData, DS4ShieldPreparedData } from "../item/item-prepared-data"; import { DS4ArmorPreparedData, DS4ShieldPreparedData } from "../item/item-prepared-data";
import { createCheckRoll } from "../rolls/check-factory"; import { createCheckRoll } from "../rolls/check-factory";
import { DS4ActorData, isAttribute, isTrait } from "./actor-data"; import { isAttribute, isTrait } from "./actor-data-source";
import { Check, DS4ActorPreparedData } from "./actor-prepared-data"; import { Check } from "./actor-data-properties";
/** /**
* The Actor class for DS4 * The Actor class for DS4
*/ */
export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData> { export class DS4Actor extends Actor {
/** @override */ /** @override */
prepareData(): void { prepareData(): void {
this.data = duplicate(this._data) as DS4ActorPreparedData; this.data.reset();
if (!this.data.img) this.data.img = CONST.DEFAULT_TOKEN;
if (!this.data.name) this.data.name = "New " + this.entity;
this.prepareBaseData(); this.prepareBaseData();
this.prepareEmbeddedEntities(); this.prepareEmbeddedEntities();
this.applyActiveEffectsToBaseData(); this.applyActiveEffectsToBaseData();
@ -49,6 +47,15 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
); );
} }
/**
* @override
* We override this with an empty implementation because we have our own custom way of applying
* {@link ActiveEffect}s and {@link Actor#prepareEmbeddedEntities} calls this.
*/
applyActiveEffects(): void {
return;
}
applyActiveEffectsToBaseData(): void { applyActiveEffectsToBaseData(): void {
// reset overrides because our variant of applying active effects does not set them, it only adds overrides // reset overrides because our variant of applying active effects does not set them, it only adds overrides
this.overrides = {}; this.overrides = {};
@ -68,32 +75,30 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
* *
* @param predicate - The predicate that ActiveEffectChanges need to satisfy in order to be applied * @param predicate - The predicate that ActiveEffectChanges need to satisfy in order to be applied
*/ */
applyActiveEffectsFiltered(predicate: (change: ActiveEffectChange) => boolean): void { applyActiveEffectsFiltered(predicate: (change: foundry.data.ActiveEffectData["changes"][number]) => boolean): void {
const overrides: Record<string, unknown> = {}; const overrides: Record<string, unknown> = {};
// Organize non-disabled effects by their application priority // Organize non-disabled effects by their application priority
const changes = this.effects.reduce( const changes: (foundry.data.ActiveEffectData["changes"][number] & { effect: ActiveEffect })[] =
(changes: Array<ActiveEffectChange & { effect: ActiveEffect<DS4Actor> }>, e) => { this.effects.reduce(
if (e.data.disabled) return changes; (changes: (foundry.data.ActiveEffectData["changes"][number] & { effect: ActiveEffect })[], e) => {
const item = this._getOriginatingItemOfActiveEffect(e); if (e.data.disabled) return changes;
if (item?.isNonEquippedEuipable()) return changes; const item = this.getOriginatingItemOfActiveEffect(e);
if (item?.isNonEquippedEuipable()) return changes; // TODO: DS4Item
const factor = item?.activeEffectFactor ?? 1; const factor = item?.activeEffectFactor ?? 1; // TODO: DS4Item
return changes.concat( const newChanges = e.data.changes.filter(predicate).flatMap((c) => {
e.data.changes.filter(predicate).flatMap((c) => { const changeSource = c.toObject();
const duplicatedChange = duplicate(c); changeSource.priority = changeSource.priority ?? changeSource.mode * 10;
duplicatedChange.priority = duplicatedChange.priority ?? duplicatedChange.mode * 10; return Array(factor).fill({ ...changeSource, effect: e });
return Array(factor).fill({ });
...duplicatedChange,
effect: e, return changes.concat(newChanges);
}); },
}), [],
); );
}, changes.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
[],
);
changes.sort((a, b) => a.priority - b.priority);
// Apply all changes // Apply all changes
for (const change of changes) { for (const change of changes) {
@ -105,8 +110,9 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
this.overrides = expandObject({ ...flattenObject(this.overrides), ...overrides }); this.overrides = expandObject({ ...flattenObject(this.overrides), ...overrides });
} }
protected _getOriginatingItemOfActiveEffect(effect: ActiveEffect<DS4Actor>): DS4Item | undefined { // TODO: returns DS4Item | undefined
return this.items.find((item) => item.uuid === effect.data.origin) ?? undefined; protected getOriginatingItemOfActiveEffect(effect: ActiveEffect): Item | undefined {
return this.items.find((item) => item.uuid === effect.data.origin);
} }
/** /**
@ -216,7 +222,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
return this.items return this.items
.map((item) => item.data) .map((item) => item.data)
.filter( .filter(
(data): data is DS4ArmorPreparedData | DS4ShieldPreparedData => (data): data is foundry.data.ItemData & (DS4ArmorDataProperties | DS4ShieldDataProperties) =>
data.type === "armor" || data.type === "shield", data.type === "armor" || data.type === "shield",
) )
.filter((data) => data.data.equipped) .filter((data) => data.data.equipped)
@ -266,8 +272,14 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
* Handle how changes to a Token attribute bar are applied to the Actor. * Handle how changes to a Token attribute bar are applied to the Actor.
* This only differs from the base implementation by also allowing negative values. * This only differs from the base implementation by also allowing negative values.
* @override * @override
* TODO: Adjust return type
*/ */
async modifyTokenAttribute(attribute: string, value: number, isDelta = false, isBar = true): Promise<this> { async modifyTokenAttribute(
attribute: string,
value: number,
isDelta = false,
isBar = true,
): Promise<this | undefined> {
const current = getProperty(this.data.data, attribute); const current = getProperty(this.data.data, attribute);
// Determine the updates to make to the actor data // Determine the updates to make to the actor data
@ -291,7 +303,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
*/ */
async rollCheck(check: Check): Promise<void> { async rollCheck(check: Check): Promise<void> {
await createCheckRoll(this.data.data.checks[check], { await createCheckRoll(this.data.data.checks[check], {
rollMode: game.settings.get("core", "rollMode") as Const.DiceRollMode, // TODO(types): Type this setting in upstream rollMode: game.settings.get("core", "rollMode"),
maximumCoupResult: this.data.data.rolling.maximumCoupResult, maximumCoupResult: this.data.data.rolling.maximumCoupResult,
minimumFumbleResult: this.data.data.rolling.minimumFumbleResult, minimumFumbleResult: this.data.data.rolling.minimumFumbleResult,
flavor: game.i18n.format("DS4.ActorCheckFlavor", { actor: this.name, check: DS4.i18n.checks[check] }), flavor: game.i18n.format("DS4.ActorCheckFlavor", { actor: this.name, check: DS4.i18n.checks[check] }),
@ -306,7 +318,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item, DS4ActorPreparedData>
const { attribute, trait } = await this.selectAttributeAndTrait(); const { attribute, trait } = await this.selectAttributeAndTrait();
const checkTargetNumber = this.data.data.attributes[attribute].total + this.data.data.traits[trait].total; const checkTargetNumber = this.data.data.attributes[attribute].total + this.data.data.traits[trait].total;
await createCheckRoll(checkTargetNumber, { await createCheckRoll(checkTargetNumber, {
rollMode: game.settings.get("core", "rollMode") as Const.DiceRollMode, // TODO(types): Type this setting in upstream rollMode: game.settings.get("core", "rollMode"),
maximumCoupResult: this.data.data.rolling.maximumCoupResult, maximumCoupResult: this.data.data.rolling.maximumCoupResult,
minimumFumbleResult: this.data.data.rolling.minimumFumbleResult, minimumFumbleResult: this.data.data.rolling.minimumFumbleResult,
flavor: game.i18n.format("DS4.ActorGenericCheckFlavor", { flavor: game.i18n.format("DS4.ActorGenericCheckFlavor", {

View file

@ -13,7 +13,7 @@ import { DS4ItemData } from "../../item/item-data";
import { getDS4Settings } from "../../settings"; import { getDS4Settings } from "../../settings";
import notifications from "../../ui/notifications"; import notifications from "../../ui/notifications";
import { DS4Actor } from "../actor"; import { DS4Actor } from "../actor";
import { isCheck } from "../actor-prepared-data"; import { isCheck } from "../actor-data-properties";
/** /**
* The base Sheet class for all DS4 Actors * The base Sheet class for all DS4 Actors

View file

@ -2,10 +2,18 @@
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
declare namespace ClientSettings { import { DS4 } from "./config";
interface Values {
"ds4.systemMigrationVersion": number; declare global {
"ds4.useSlayingDiceForAutomatedChecks": boolean; namespace ClientSettings {
"ds4.showSlayerPoints": boolean; interface Values {
"ds4.systemMigrationVersion": number;
"ds4.useSlayingDiceForAutomatedChecks": boolean;
"ds4.showSlayerPoints": boolean;
}
}
interface CONFIG {
DS4: typeof DS4;
} }
} }

View file

@ -2,7 +2,7 @@
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import { isCheck } from "../actor/actor-prepared-data"; import { isCheck } from "../actor/actor-data-properties";
import { DS4Item } from "../item/item"; import { DS4Item } from "../item/item";
import { DS4ItemData } from "../item/item-data"; import { DS4ItemData } from "../item/item-data";
import { createRollCheckMacro } from "../macros/roll-check"; import { createRollCheckMacro } from "../macros/roll-check";

View file

@ -39,8 +39,8 @@ async function init() {
CONFIG.DS4 = DS4; CONFIG.DS4 = DS4;
CONFIG.Actor.entityClass = DS4Actor; // CONFIG.Actor.documentClass = DS4Actor;
CONFIG.Item.entityClass = DS4Item; // CONFIG.Item.documentClass = DS4Item;
CONFIG.Actor.typeLabels = DS4.i18n.actorTypes; CONFIG.Actor.typeLabels = DS4.i18n.actorTypes;
CONFIG.Item.typeLabels = DS4.i18n.itemTypes; CONFIG.Item.typeLabels = DS4.i18n.itemTypes;
@ -54,11 +54,11 @@ async function init() {
registerSystemSettings(); registerSystemSettings();
Actors.unregisterSheet("core", ActorSheet); // Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet("ds4", DS4CharacterActorSheet, { types: ["character"], makeDefault: true }); // Actors.registerSheet("ds4", DS4CharacterActorSheet, { types: ["character"], makeDefault: true });
Actors.registerSheet("ds4", DS4CreatureActorSheet, { types: ["creature"], makeDefault: true }); // Actors.registerSheet("ds4", DS4CreatureActorSheet, { types: ["creature"], makeDefault: true });
Items.unregisterSheet("core", ItemSheet); // Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true }); // Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true });
await registerHandlebarsPartials(); await registerHandlebarsPartials();
registerHandlebarsHelpers(); registerHandlebarsHelpers();

View file

@ -2,7 +2,7 @@
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import { Check } from "../actor/actor-prepared-data"; import { Check } from "../actor/actor-data-properties";
import { DS4 } from "../config"; import { DS4 } from "../config";
import notifications from "../ui/notifications"; import notifications from "../ui/notifications";
import { getActiveActor } from "./helpers"; import { getActiveActor } from "./helpers";

210
yarn.lock
View file

@ -839,19 +839,19 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@league-of-foundry-developers/foundry-vtt-types@npm:^0.7.10-0": "@league-of-foundry-developers/foundry-vtt-types@https://github.com/League-of-Foundry-Developers/foundry-vtt-types.git#foundry-0.8.x":
version: 0.7.10-0 version: 0.7.9-6
resolution: "@league-of-foundry-developers/foundry-vtt-types@npm:0.7.10-0" resolution: "@league-of-foundry-developers/foundry-vtt-types@https://github.com/League-of-Foundry-Developers/foundry-vtt-types.git#commit=62c138c4ff2f6c3b19301db2b31e14e7c825f1e6"
dependencies: dependencies:
"@types/howler": 2.2.1 "@types/jquery": ~3.5.5
"@types/jquery": 3.5.1 "@types/simple-peer": ~9.11.0
"@types/socket.io-client": ^1.4.33 handlebars: 4.7.7
handlebars: 4.7.6 pixi-particles: 4.3.1
pixi-particles: ^4.3.0
pixi.js: 5.3.4 pixi.js: 5.3.4
tinymce: 5.6.2 socket.io-client: 4.1.2
typescript: ^4.1.4 tinymce: 5.8.1
checksum: c071397239c4ec0f8b9b6d1e672e3a50cc212a0ff9cb0bdc4ba1e5fa981c6e33cddec94d3c72b0f8ccbf3fe985dcccfba1117822e232aba77b6bf58340106a90 typescript: ^4.1.6
checksum: af1f4d3cfae69a5a0fab2ca3a301c9f755d7f5584bf1eaee37031b19fe805581b7588e6a2452553f874a68cb5475a5a8fce287ed8436cf0af24fa0527ea5c014
languageName: node languageName: node
linkType: hard linkType: hard
@ -1382,6 +1382,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/component-emitter@npm:^1.2.10":
version: 1.2.10
resolution: "@types/component-emitter@npm:1.2.10"
checksum: 868a9a00697df0ce74da77b8fc2c40f1a3ac6f294a828fdc8d9ae3ba62f9a541b472f147d1837dc7dd9d9c1333aa277f9d29c12e4746e6d779e6ce94c4c2f7ac
languageName: node
linkType: hard
"@types/estree@npm:0.0.39": "@types/estree@npm:0.0.39":
version: 0.0.39 version: 0.0.39
resolution: "@types/estree@npm:0.0.39" resolution: "@types/estree@npm:0.0.39"
@ -1407,13 +1414,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/howler@npm:2.2.1":
version: 2.2.1
resolution: "@types/howler@npm:2.2.1"
checksum: bfb92d24673b39546d3f87a1888718359c3a7214b52aad91c7c54a5c3ad40f542ecb662efbe0dde207d958c705897373f26f6e94aba72bc5c8852f7077bf85f4
languageName: node
linkType: hard
"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1": "@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1":
version: 2.0.3 version: 2.0.3
resolution: "@types/istanbul-lib-coverage@npm:2.0.3" resolution: "@types/istanbul-lib-coverage@npm:2.0.3"
@ -1449,12 +1449,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/jquery@npm:3.5.1": "@types/jquery@npm:~3.5.5":
version: 3.5.1 version: 3.5.5
resolution: "@types/jquery@npm:3.5.1" resolution: "@types/jquery@npm:3.5.5"
dependencies: dependencies:
"@types/sizzle": "*" "@types/sizzle": "*"
checksum: 43f7885e75a7c5fdecb99ff7893a844d53b88ba5d6fb8c8d9bf65d0bfc42ee1ec75844cc9b73bcefd5d955376cb37dcbc9950e3d18e8922a8ef30e3ef8dab78e checksum: 9e3c34451577c6916ac9de8a26fd8bce2831cb5861116514cba4a984189067635a3e084039308324d8e20bfa5f2e1ce7725a509110e5e05487b91f9369b1ae43
languageName: node languageName: node
linkType: hard linkType: hard
@ -1495,6 +1495,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/simple-peer@npm:~9.11.0":
version: 9.11.0
resolution: "@types/simple-peer@npm:9.11.0"
dependencies:
"@types/node": "*"
checksum: ab05e2373fe48faa59cc0d7795bfdea3c7e7a93f7af2683cfdd2a311035ce4dd2a948c950886f48d662db503e8af2d930b9d51b53c0eef8c90ba86287864d4f7
languageName: node
linkType: hard
"@types/sizzle@npm:*": "@types/sizzle@npm:*":
version: 2.3.2 version: 2.3.2
resolution: "@types/sizzle@npm:2.3.2" resolution: "@types/sizzle@npm:2.3.2"
@ -1502,13 +1511,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/socket.io-client@npm:^1.4.33":
version: 1.4.35
resolution: "@types/socket.io-client@npm:1.4.35"
checksum: 367bceb6edd3491898cf9eebbec9f6663737a470047573a262462f0492f7171a59fa79113f494dfdd4c37548d05e45284d88d8881a692417900b82df869c8ced
languageName: node
linkType: hard
"@types/stack-utils@npm:^2.0.0": "@types/stack-utils@npm:^2.0.0":
version: 2.0.0 version: 2.0.0
resolution: "@types/stack-utils@npm:2.0.0" resolution: "@types/stack-utils@npm:2.0.0"
@ -2247,6 +2249,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"backo2@npm:~1.0.2":
version: 1.0.2
resolution: "backo2@npm:1.0.2"
checksum: 72f19a0fd2b573f5504adf1f2e74e7658eec000e7732ebd5f622b6b1d520187277a5e8310787906455d02fcf915f35c5c48e54c997bed1a60b95355db8f2ccab
languageName: node
linkType: hard
"balanced-match@npm:^1.0.0": "balanced-match@npm:^1.0.0":
version: 1.0.0 version: 1.0.0
resolution: "balanced-match@npm:1.0.0" resolution: "balanced-match@npm:1.0.0"
@ -2254,6 +2263,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"base64-arraybuffer@npm:0.1.4":
version: 0.1.4
resolution: "base64-arraybuffer@npm:0.1.4"
checksum: be8207c755c206f1053a3ebccb71e48d21d33125df1940d1b176ec26008e521edae8e1aa859b6fb6444b2889e1beec0771274d2f5bc5898d41b35179a55fbe96
languageName: node
linkType: hard
"base@npm:^0.11.1": "base@npm:^0.11.1":
version: 0.11.2 version: 0.11.2
resolution: "base@npm:0.11.2" resolution: "base@npm:0.11.2"
@ -2796,7 +2812,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"component-emitter@npm:^1.2.1": "component-emitter@npm:^1.2.1, component-emitter@npm:~1.3.0":
version: 1.3.0 version: 1.3.0
resolution: "component-emitter@npm:1.3.0" resolution: "component-emitter@npm:1.3.0"
checksum: fc4edbf1014f0aed88dcec33ca02d2938734e428423f640d8a3f94975615b8e8c506c19e29b93949637c5a281353e75fa79e299e0d57732f42a9fe346cb2cad6 checksum: fc4edbf1014f0aed88dcec33ca02d2938734e428423f640d8a3f94975615b8e8c506c19e29b93949637c5a281353e75fa79e299e0d57732f42a9fe346cb2cad6
@ -2939,7 +2955,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"debug@npm:4, debug@npm:^4.3.1": "debug@npm:4, debug@npm:^4.3.1, debug@npm:~4.3.1":
version: 4.3.2 version: 4.3.2
resolution: "debug@npm:4.3.2" resolution: "debug@npm:4.3.2"
dependencies: dependencies:
@ -3140,7 +3156,7 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "dungeonslayers4@workspace:." resolution: "dungeonslayers4@workspace:."
dependencies: dependencies:
"@league-of-foundry-developers/foundry-vtt-types": ^0.7.10-0 "@league-of-foundry-developers/foundry-vtt-types": "https://github.com/League-of-Foundry-Developers/foundry-vtt-types.git#foundry-0.8.x"
"@rollup/plugin-node-resolve": ^13.0.0 "@rollup/plugin-node-resolve": ^13.0.0
"@types/fs-extra": ^9.0.11 "@types/fs-extra": ^9.0.11
"@types/jest": ^26.0.23 "@types/jest": ^26.0.23
@ -3246,6 +3262,32 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"engine.io-client@npm:~5.1.1":
version: 5.1.2
resolution: "engine.io-client@npm:5.1.2"
dependencies:
base64-arraybuffer: 0.1.4
component-emitter: ~1.3.0
debug: ~4.3.1
engine.io-parser: ~4.0.1
has-cors: 1.1.0
parseqs: 0.0.6
parseuri: 0.0.6
ws: ~7.4.2
yeast: 0.1.2
checksum: 8853318f1016ab80dbc13c642cdaf054af7b2781697cdf26cf6cb2ad70e6f03de81bffcc233d88afe9138eb0761f7a97f91a8b9f82234e2db257d5fe5a95e940
languageName: node
linkType: hard
"engine.io-parser@npm:~4.0.1":
version: 4.0.2
resolution: "engine.io-parser@npm:4.0.2"
dependencies:
base64-arraybuffer: 0.1.4
checksum: fe5543911fb9451501c062fe6f0965ffd80064036daba4b7dda2190038436fd00875a049194381edd936dc27eaa0e52dca7f4113b0116d962ebd7cfe67247fc1
languageName: node
linkType: hard
"enquirer@npm:^2.3.5, enquirer@npm:^2.3.6": "enquirer@npm:^2.3.5, enquirer@npm:^2.3.6":
version: 2.3.6 version: 2.3.6
resolution: "enquirer@npm:2.3.6" resolution: "enquirer@npm:2.3.6"
@ -4395,9 +4437,9 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"handlebars@npm:4.7.6": "handlebars@npm:4.7.7":
version: 4.7.6 version: 4.7.7
resolution: "handlebars@npm:4.7.6" resolution: "handlebars@npm:4.7.7"
dependencies: dependencies:
minimist: ^1.2.5 minimist: ^1.2.5
neo-async: ^2.6.0 neo-async: ^2.6.0
@ -4409,7 +4451,7 @@ fsevents@^1.2.7:
optional: true optional: true
bin: bin:
handlebars: bin/handlebars handlebars: bin/handlebars
checksum: 50276715da3e410f1d485635029b77e09b8c9244d9e49119d5f39ed978a3d44ce94f5d6120efeb707da0ba9dd0cddf140d8d2ac160721d93aa9f4234474ad318 checksum: 2df9a6b422e2ccc0b7ca53f7a1f9915b47d19bf3fd372824a87e2a28b7952fa2cb3348cbe33a87ef49ee04f42d10359aab44819ca8d680ee3a5b53d48bd062a1
languageName: node languageName: node
linkType: hard linkType: hard
@ -4430,6 +4472,13 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"has-cors@npm:1.1.0":
version: 1.1.0
resolution: "has-cors@npm:1.1.0"
checksum: c8257cbe3fc1c2f49d293879f0c6873c6fa7ba7be44147f9a9023cc421c7842833c3553f46bdc04459f046c1c74eb9c7a98e63fdd2c7713caaddd26b1b7f9043
languageName: node
linkType: hard
"has-flag@npm:^3.0.0": "has-flag@npm:^3.0.0":
version: 3.0.0 version: 3.0.0
resolution: "has-flag@npm:3.0.0" resolution: "has-flag@npm:3.0.0"
@ -6718,6 +6767,20 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"parseqs@npm:0.0.6":
version: 0.0.6
resolution: "parseqs@npm:0.0.6"
checksum: 9e095b898b52a138e5d1e055bf3dd2ab4630b2ac0468dd47ec00695c39683aa28f5b88852a1b4938f9b1109219b5eb63e7ffd567ff7a7fb8932c91697647fe83
languageName: node
linkType: hard
"parseuri@npm:0.0.6":
version: 0.0.6
resolution: "parseuri@npm:0.0.6"
checksum: ff7ad178b06748b2999d52852ea0a32d270f92a8926da1cad7550d315e189fce67edac49b476958d13b8cea1fda7b8ac128bfe7d7d78a41772a3278c5c51e057
languageName: node
linkType: hard
"pascalcase@npm:^0.1.1": "pascalcase@npm:^0.1.1":
version: 0.1.1 version: 0.1.1
resolution: "pascalcase@npm:0.1.1" resolution: "pascalcase@npm:0.1.1"
@ -6856,12 +6919,12 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"pixi-particles@npm:^4.3.0": "pixi-particles@npm:4.3.1":
version: 4.3.0 version: 4.3.1
resolution: "pixi-particles@npm:4.3.0" resolution: "pixi-particles@npm:4.3.1"
peerDependencies: peerDependencies:
pixi.js: ">=4.0.0" pixi.js: ">=4.0.0"
checksum: 66da332ae33a236afb5a5b2ebeea0308314423bab1017851be860a0904aed91cb5f345ea488c75a6efdfa6e42096ba7762472f8573590b924b93cae293b8b6d9 checksum: 782fdad4f28c65ce15f7e02b9a73ceaaaa6e973d0e03f6037ace89aac596cd8d50df75891ea5fe77e4715125d610a1dad3cde98362e2d57a8d083e504fc0cc7c
languageName: node languageName: node
linkType: hard linkType: hard
@ -7683,6 +7746,32 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"socket.io-client@npm:4.1.2":
version: 4.1.2
resolution: "socket.io-client@npm:4.1.2"
dependencies:
"@types/component-emitter": ^1.2.10
backo2: ~1.0.2
component-emitter: ~1.3.0
debug: ~4.3.1
engine.io-client: ~5.1.1
parseuri: 0.0.6
socket.io-parser: ~4.0.4
checksum: 932a1eb0fe47fa8d0369649e7c51d95e815f959f32b4e534010dc6f8fca8438dde6d77ca890638ce06e1901aaf7e78d26f717e95f4473115b74bd33ab7103234
languageName: node
linkType: hard
"socket.io-parser@npm:~4.0.4":
version: 4.0.4
resolution: "socket.io-parser@npm:4.0.4"
dependencies:
"@types/component-emitter": ^1.2.10
component-emitter: ~1.3.0
debug: ~4.3.1
checksum: ee2ffffa30e11ecebe690291ed91e5f949bf4ab9446ad6659b84488dd4f5908514867970539d32e1d94d4a5596e0d191f2e0ad92f707324cc4753ceb328aea2a
languageName: node
linkType: hard
"source-map-resolve@npm:^0.5.0": "source-map-resolve@npm:^0.5.0":
version: 0.5.3 version: 0.5.3
resolution: "source-map-resolve@npm:0.5.3" resolution: "source-map-resolve@npm:0.5.3"
@ -8138,10 +8227,10 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
"tinymce@npm:5.6.2": "tinymce@npm:5.8.1":
version: 5.6.2 version: 5.8.1
resolution: "tinymce@npm:5.6.2" resolution: "tinymce@npm:5.8.1"
checksum: 7655814c72db7b82760cc20f361bc29979cb72ec57e074dee11dbb294172d4d91b7828069b905a412b5b2b2f7db13cf0f1ba669c0f971739a4133ba647ac0346 checksum: c5312a3a7e00e1a5d1a27c2901c7387763e2e99924f47025cbb982f7710a60128d390851a0411c327d5ee6ad8ccc489002477a80d57702de5a92523cfbed1a4b
languageName: node languageName: node
linkType: hard linkType: hard
@ -8406,17 +8495,7 @@ fsevents@^1.2.7:
languageName: node languageName: node
linkType: hard linkType: hard
typescript@^4.1.4: "typescript@^4.1.6, typescript@^4.3.4":
version: 4.2.2
resolution: "typescript@npm:4.2.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: b2e3d5551a12c51b6b7a14f0e78d2664c136fab4dfb3eecaaf7a6e8e7e608f2cf43c6ebe81387d194db2588793b769720d2df523d445a1664b7585c5b9a85984
languageName: node
linkType: hard
typescript@^4.3.4:
version: 4.3.4 version: 4.3.4
resolution: "typescript@npm:4.3.4" resolution: "typescript@npm:4.3.4"
bin: bin:
@ -8426,17 +8505,7 @@ typescript@^4.3.4:
languageName: node languageName: node
linkType: hard linkType: hard
"typescript@patch:typescript@^4.1.4#builtin<compat/typescript>": "typescript@patch:typescript@^4.1.6#builtin<compat/typescript>, typescript@patch:typescript@^4.3.4#builtin<compat/typescript>":
version: 4.2.2
resolution: "typescript@patch:typescript@npm%3A4.2.2#builtin<compat/typescript>::version=4.2.2&hash=ddfc1b"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: aa60765443932c0aa294cf24295a8bba163dd791735b20e2e43dffe2d21f6bf80de8342c9ab9c4338c59e36f4bcae179195fdfaae1cae4678821994e77199d34
languageName: node
linkType: hard
"typescript@patch:typescript@^4.3.4#builtin<compat/typescript>":
version: 4.3.4 version: 4.3.4
resolution: "typescript@patch:typescript@npm%3A4.3.4#builtin<compat/typescript>::version=4.3.4&hash=ddfc1b" resolution: "typescript@patch:typescript@npm%3A4.3.4#builtin<compat/typescript>::version=4.3.4&hash=ddfc1b"
bin: bin:
@ -8898,7 +8967,7 @@ typescript@^4.3.4:
languageName: node languageName: node
linkType: hard linkType: hard
"ws@npm:^7.4.5": "ws@npm:^7.4.5, ws@npm:~7.4.2":
version: 7.4.6 version: 7.4.6
resolution: "ws@npm:7.4.6" resolution: "ws@npm:7.4.6"
peerDependencies: peerDependencies:
@ -9036,3 +9105,10 @@ typescript@^4.3.4:
checksum: 62bb2345031bbb3dd99626a62fd94caa0c13610c53b3d914792f387432c7c7d49432d85ea9eb6339092aca5788a2f1184507826f98c3af277e1e2202ae1d9341 checksum: 62bb2345031bbb3dd99626a62fd94caa0c13610c53b3d914792f387432c7c7d49432d85ea9eb6339092aca5788a2f1184507826f98c3af277e1e2202ae1d9341
languageName: node languageName: node
linkType: hard linkType: hard
"yeast@npm:0.1.2":
version: 0.1.2
resolution: "yeast@npm:0.1.2"
checksum: ce326a71c7f25059ef7581121104c21d2837511a95cb44604f9e1825c5722f5b65324fb0b1d20bcfe3975efe45e418106100aa0d0e9fc502f90f3d07d059e177
languageName: node
linkType: hard