Skip to content

Commit

Permalink
Remove features deprecated until version v12 (foundryvtt#14561)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosFdez committed May 29, 2024
1 parent b4d0732 commit 66de3ef
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 187 deletions.
9 changes: 0 additions & 9 deletions src/module/actor/character/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,6 @@ class CharacterPF2e<TParent extends TokenDocumentPF2e | null = TokenDocumentPF2e
return this.system.details.keyability.value || "str";
}

/** @deprecated */
get keyAbility(): AttributeString {
fu.logCompatibilityWarning(
"`CharacterPF2e#keyAbility` is deprecated. Use `CharacterPF2e#keyAttribute` instead.",
{ since: "5.2.0", until: "6.0.0" },
);
return this.keyAttribute;
}

/** This PC's ability scores */
override get abilities(): CharacterAbilities {
return fu.deepClone(this.system.abilities);
Expand Down
45 changes: 0 additions & 45 deletions src/module/actor/creature/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,51 +233,6 @@ abstract class CreaturePF2e<
if (this.initialized) return;
super.prepareData();

Object.defineProperties(this.system.attributes, {
initiative: {
get: () => {
fu.logCompatibilityWarning(
"CreatureSystemData#attributes#initiative is deprecated. Use CreatureSystemData#initiative instead.",
{ since: "5.12.0", until: "6.0.0" },
);
return this.system.initiative;
},
enumerable: false,
},
perception: {
get: () => {
fu.logCompatibilityWarning(
"CreatureSystemData#attributes#perception is deprecated. Use CreatureSystemData#perception instead.",
{ since: "5.12.0", until: "6.0.0" },
);
return this.system.perception;
},
enumerable: false,
},
});
Object.defineProperties(this.system.traits, {
languages: {
get: () => {
fu.logCompatibilityWarning(
"CreatureSystemData#traits#languages is deprecated. Use CreatureSystemData#details#languages instead.",
{ since: "5.12.0", until: "6.0.0" },
);
return this.system.details.languages;
},
enumerable: false,
},
senses: {
get: () => {
fu.logCompatibilityWarning(
"CreatureSystemData#traits#senses is deprecated. Use CreatureSystemData#perception#senses instead.",
{ since: "5.12.0", until: "6.0.0" },
);
return this.system.perception.senses;
},
enumerable: false,
},
});

// Add spell collections from spell consumables if a matching spellcasting ability is found
const spellConsumables = this.itemTypes.consumable.filter(
(c) => ["scroll", "wand"].includes(c.category) && c.isIdentified && !c.isStowed,
Expand Down
9 changes: 0 additions & 9 deletions src/module/actor/initiative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ class ActorInitiative {
return this.statistic.check.mod;
}

/** @deprecated */
get ability(): AttributeString | null {
fu.logCompatibilityWarning(
"`ActorInitiative#ability` is deprecated. Use `ActorInitiative#attribute` instead.",
{ since: "5.3.0", until: "6.0.0" },
);
return this.attribute;
}

async roll(args: InitiativeRollParams = {}): Promise<InitiativeRollResult | null> {
// Get or create the combatant
const combatant =
Expand Down
9 changes: 0 additions & 9 deletions src/module/item/physical/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ class CoinsPF2e implements Coins {
});
}

/** @deprecated */
add(coins: Coins): CoinsPF2e {
fu.logCompatibilityWarning("`CoinsPF2e#add` is deprecated. Use `CoinsPF2e#plus` instead.", {
since: "5.13.0",
until: "6.0.0",
});
return this.plus(coins);
}

/** Multiply by a number and clean up result */
scale(factor: number): CoinsPF2e {
const result = new CoinsPF2e(this);
Expand Down
14 changes: 0 additions & 14 deletions src/module/item/spell/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,6 @@ class SpellPF2e<TParent extends ActorPF2e | null = ActorPF2e | null> extends Ite
return this.spellcasting?.attribute ?? "cha";
}

/** @deprecated */
get ability(): AttributeString {
fu.logCompatibilityWarning("`SpellPF2e#ability` is deprecated. Use `SpellPF2e#attribute` instead.", {
since: "5.3.0",
until: "6.0.0",
});
return this.attribute;
}

/** Whether this spell has unlimited uses */
get atWill(): boolean {
// In the future handle at will and constant
Expand Down Expand Up @@ -810,11 +801,6 @@ class SpellPF2e<TParent extends ActorPF2e | null = ActorPF2e | null> extends Ite
const castData = fu.mergeObject(data ?? {}, domData ?? {});

// If this is for a higher level spell, heighten it first
if ("castLevel" in castData && !castData.castRank) {
const sinceUntil = { since: "5.12.0", until: "6.0.0" };
fu.logCompatibilityWarning("`data.castLevel` is deprecated: use `data.castRank` instead.", sinceUntil);
castData.castRank = Number(castData.castLevel ?? NaN);
}
const castRank = Number(castData.castRank ?? "");
if (castRank && castRank !== this.rank) {
return this.loadVariant({ castRank })?.toMessage(event, { create, data, rollMode });
Expand Down
52 changes: 3 additions & 49 deletions src/module/item/spellcasting-entry/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,11 @@ class SpellCollection<TActor extends ActorPF2e> extends Collection<SpellPF2e<TAc
return { value: signatureSpells.length, max: totalSlots };
})();

return this.#shimSheetData({
return {
groups,
flexibleAvailable,
prepList: prepList ? this.getSpellPrepList(spells) : null,
});
};
}

#getEphemeralData(): SpellCollectionData {
Expand All @@ -344,7 +344,7 @@ class SpellCollection<TActor extends ActorPF2e> extends Collection<SpellPF2e<TAc
}),
);

return this.#shimSheetData({ groups, prepList: null });
return { groups, prepList: null };
}

protected getSpellPrepList(spells: SpellPF2e<TActor>[]): Record<ZeroToTen, SpellPrepEntry[]> {
Expand Down Expand Up @@ -378,52 +378,6 @@ class SpellCollection<TActor extends ActorPF2e> extends Collection<SpellPF2e<TAc
ui.notifications.warn(localize("WrongSpellType", { type }));
}
}

#shimSheetData(data: SpellCollectionData): SpellCollectionData {
for (const group of data.groups) {
const sinceUntil = { since: "5.12.0", until: "6.0.0" };
Object.defineProperties(group, {
level: {
get(): number | undefined {
fu.logCompatibilityWarning("`level` is deprecated: use `id` instead.", sinceUntil);
return group.number;
},
},
isCantrip: {
get(): boolean {
fu.logCompatibilityWarning("`isCantrip` is deprecated: check `id` instead.", sinceUntil);
return group.id === "cantrips";
},
},
});

for (const active of group.active) {
if (active) {
Object.defineProperty(active, "castLevel", {
get(): number | undefined {
fu.logCompatibilityWarning(
"`castLevel` is deprecated: use `castRank` instead.",
sinceUntil,
);
return active.castRank;
},
});
}
}
}

Object.defineProperty(data, "levels", {
get(): SpellcastingSlotGroup[] {
fu.logCompatibilityWarning("`levels` is deprecated: use `groups` instead.", {
since: "5.12.0",
until: "6.0.0",
});
return data.groups;
},
});

return data;
}
}

type SpellSlotGroupId = "cantrips" | OneToTen;
Expand Down
9 changes: 0 additions & 9 deletions src/module/item/spellcasting-entry/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ class SpellcastingEntryPF2e<TParent extends ActorPF2e | null = ActorPF2e | null>
return createCounteractStatistic(this as SpellcastingEntryPF2e<ActorPF2e>);
}

/** @deprecated */
get ability(): AttributeString {
fu.logCompatibilityWarning(
"`SpellcastingEntryPF2e#ability` is deprecated. Use `SpellcastingEntryPF2e#attribute` instead.",
{ since: "5.3.0", until: "6.0.0" },
);
return this.attribute;
}

/** This entry's magic tradition, null if the spell's tradition should be used instead */
get tradition(): MagicTradition | null {
const defaultTradition = this.system.prepared.value === "items" ? null : "arcane";
Expand Down
9 changes: 0 additions & 9 deletions src/module/item/spellcasting-entry/trick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ class TrickMagicItemEntry<TActor extends ActorPF2e = ActorPF2e> implements Spell

attribute: AttributeString;

/** @deprecated */
get ability(): AttributeString {
fu.logCompatibilityWarning(
"`TrickMagicItemEntry#ability` is deprecated. Use `TrickMagicItemEntry#attribute` instead.",
{ since: "5.3.0", until: "6.0.0" },
);
return this.attribute;
}

tradition: MagicTradition;

constructor(actor: TActor, skill: TrickMagicItemSkill) {
Expand Down
9 changes: 0 additions & 9 deletions src/module/system/statistic/statistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ class Statistic<TActor extends ActorPF2e = ActorPF2e> extends BaseStatistic<TAct
return this.check.mod;
}

/** @deprecated */
get ability(): AttributeString | null {
fu.logCompatibilityWarning("`Statistic#ability` is deprecated. Use `Statistic#attribute` instead.", {
since: "5.5.0",
until: "6.0.0",
});
return this.attribute;
}

override createRollOptions(domains = this.domains, args: RollOptionConfig = {}): Set<string> {
const { item, extraRollOptions, origin, target } = args;

Expand Down
25 changes: 0 additions & 25 deletions src/scripts/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,6 @@ const weaponReload: Record<WeaponReloadTime, string> = {
10: "PF2E.Item.Weapon.Reload.OneMinute",
};

function notifyDeprecatedPath(configPath: string, locPath: string): void {
fu.logCompatibilityWarning(
`CONFIG.PF2E.${configPath} is deprecated. Use localization path ${locPath} directly instead.`,
{ since: "5.2.0", until: "6.0.0" },
);
}

export const PF2ECONFIG = {
defaultPartyId: "xxxPF2ExPARTYxxx",
chatDamageButtonShieldToggle: false,
Expand Down Expand Up @@ -340,24 +333,6 @@ export const PF2ECONFIG = {

abilities,

attributes: {
get perception(): string {
const locPath = "PF2E.PerceptionLabel";
notifyDeprecatedPath("attributes.perception", locPath);
return locPath;
},
get stealth(): string {
const locPath = "PF2E.StealthLabel";
notifyDeprecatedPath("attributes.stealth", locPath);
return locPath;
},
get initiative(): string {
const locPath = "PF2E.InitiativeLabel";
notifyDeprecatedPath("attributes.initiative", locPath);
return locPath;
},
},

dcAdjustments: {
"incredibly-easy": "PF2E.DCAdjustmentIncrediblyEasy",
"very-easy": "PF2E.DCAdjustmentVeryEasy",
Expand Down

0 comments on commit 66de3ef

Please sign in to comment.