Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Commit 74d6e56

Browse files
committed
Fix TS errors on remote
1 parent 0bc9e13 commit 74d6e56

18 files changed

Lines changed: 455 additions & 1468 deletions

FVTT-Common

module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pf2e-toolbox",
33
"title": "PF2E Toolbox",
44
"description": "A collection of utilities I made mostly for myself, but may be useful to others to run games in PF2E.",
5-
"version": "1.7.10",
5+
"version": "1.7.8",
66
"author": "Andrew Cuccinello [DJ#1982]",
77
"packs": [
88
{

package-lock.json

Lines changed: 419 additions & 1429 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@babel/plugin-transform-runtime": "^7.12.1",
66
"@babel/preset-env": "^7.12.1",
77
"@babel/preset-typescript": "^7.12.1",
8-
"@league-of-foundry-developers/foundry-vtt-types": "^0.8.8-4",
8+
"@league-of-foundry-developers/foundry-vtt-types": "^0.8.8-5",
99
"@types/jquery": "^3.5.6",
1010
"@types/node": "^14.14.0",
1111
"babel-core": "7.0.0-bridge.0",

src/module/Utilities.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@
1717
import { DiceRollMode } from '@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/constants.mjs';
1818

1919
export function GetRollMode(): DiceRollMode {
20-
return game.settings.get('core', 'rollMode');
20+
return (game as Game).settings.get('core', 'rollMode');
2121
}
2222

2323
export function getFolder(name: string): Folder | null {
24-
return game?.folders?.getName(name) as Folder;
24+
return (game as Game).folders?.getName(name) as Folder;
2525
}
2626
export function getFolderInFolder(name: string, parentName?: string) {
2727
let parent: any;
2828
if (parentName) {
29-
parent = game?.folders?.getName(parentName);
29+
parent = (game as Game).folders?.getName(parentName);
3030
return parent.getSubfolders().find((f) => f.name === name);
3131
} else {
3232
return getFolder(name);
3333
}
3434
}
3535
export function getActor(name: string, folder: string): Actor | undefined {
36-
return game?.actors?.find((a) => a.name === name && a.folder?.name === folder) as any;
36+
return (game as Game).actors?.find((a) => a.name === name && a.folder?.name === folder) as any;
3737
}
3838

3939
export function GetFolderPath(name: string) {

src/module/commands/FixMaterials.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function fixMaterials() {
4242
};
4343

4444
let count = 0;
45-
for (const scene of (game.scenes as Scenes).values()) {
45+
for (const scene of ((game as Game).scenes as Scenes).values()) {
4646
for (const token of scene.data.tokens.values()) {
4747
if (token.data.actorLink) {
4848
continue;
@@ -59,7 +59,7 @@ export async function fixMaterials() {
5959
}
6060
}
6161

62-
for (const actor of game.actors as Actors) {
62+
for (const actor of (game as Game).actors as Actors) {
6363
for (const item of actor.items) {
6464
if (isBad(item)) {
6565
await fixItem(item);
@@ -68,7 +68,7 @@ export async function fixMaterials() {
6868
}
6969
}
7070

71-
for (const item of game.items as Items) {
71+
for (const item of (game as Game).items as Items) {
7272
if (isBad(item)) {
7373
await fixItem(item);
7474
count += 1;

src/module/features/DefaultArt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import ModuleSettings from '../../../FVTT-Common/src/module/settings-app/ModuleS
1818
import { LAST_SEEN_SYSTEM } from '../Setup';
1919

2020
export async function readyDefaultArt() {
21-
if (game.system.data.version === ModuleSettings.instance.get(LAST_SEEN_SYSTEM)) {
21+
if ((game as Game).system.data.version === ModuleSettings.instance.get(LAST_SEEN_SYSTEM)) {
2222
return;
2323
}
2424

@@ -29,7 +29,7 @@ export async function readyDefaultArt() {
2929
hazard: 'systems/pf2e/icons/default-icons/hazard.svg',
3030
};
3131

32-
for (const entry of game.packs.values()) {
32+
for (const entry of (game as Game).packs.values()) {
3333
const pack = entry as any;
3434

3535
if (pack.metadata.system === 'pf2e' && pack.metadata.package === 'pf2e' && pack.metadata.entity === 'Actor') {
@@ -53,7 +53,7 @@ export async function readyDefaultArt() {
5353
}
5454
}
5555

56-
await ModuleSettings.instance.set(LAST_SEEN_SYSTEM, game.system.data.version);
56+
await ModuleSettings.instance.set(LAST_SEEN_SYSTEM, (game as Game).system.data.version);
5757

5858
ui.notifications?.info('All bestiary artwork has been updated!');
5959
}

src/module/features/FlattenProficiency.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ function onFlattenProficiencyContextHook(html: JQuery, buttons: any[]) {
3636
icon: '<i class="fas fa-level-down-alt"></i>',
3737
condition: (li: JQuery<HTMLLIElement>) => {
3838
const id = li.data('entity-id') as string;
39-
const actor = game.actors?.get(id);
39+
const actor = (game as Game).actors?.get(id);
4040

4141
return actor?.data.type === 'npc' && !hasModifier(actor);
4242
},
4343
callback: async (li: JQuery<HTMLLIElement>) => {
4444
const id = li.data('entity-id') as string;
45-
const actor = game.actors?.get(id);
45+
const actor = (game as Game).actors?.get(id);
4646

4747
const level = parseInt(actor?.data.data['details'].level.value);
4848
await (actor as any).addCustomModifier('all', modifierName, -level, 'untyped');
@@ -54,13 +54,13 @@ function onFlattenProficiencyContextHook(html: JQuery, buttons: any[]) {
5454
icon: '<i class="fas fa-level-up-alt"></i>',
5555
condition: (li: JQuery<HTMLLIElement>) => {
5656
const id = li.data('entity-id') as string;
57-
const actor = game.actors?.get(id);
57+
const actor = (game as Game).actors?.get(id);
5858

5959
return actor?.data.type === 'npc' && hasModifier(actor);
6060
},
6161
callback: async (li: JQuery<HTMLLIElement>) => {
6262
const id = li.data('entity-id') as string;
63-
const actor = game.actors?.get(id);
63+
const actor = (game as Game).actors?.get(id);
6464

6565
await (actor as any).removeCustomModifier('all', modifierName);
6666
},

src/module/features/HeroPoints.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ function onSheetRender(app: Application, html: JQuery, renderData: any) {
2525

2626
const { rank, max }: { rank: number; max: number } = renderData.data.attributes.heroPoints;
2727

28-
console.warn(rank);
29-
console.warn(max);
30-
3128
const iconFilled = '<i class="fas fa-hospital-symbol"></i>';
3229
const iconEmpty = '<i class="far fa-circle"></i>';
3330

src/module/features/NPCScaler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ function onScaleNPCContextHook(html: JQuery, buttons: any[]) {
2424
icon: '<i class="fas fa-level-up-alt"></i>',
2525
condition: (li: JQuery<HTMLLIElement>) => {
2626
const id = li.data('entity-id') as string;
27-
const actor = game.actors?.get(id) as Actor;
27+
const actor = (game as Game).actors?.get(id) as Actor;
2828

2929
return actor.data.type === 'npc';
3030
},
3131
callback: async (li: JQuery<HTMLLIElement>) => {
3232
const id = li.data('entity-id') as string;
33-
const actor = game.actors?.get(id) as Actor;
33+
const actor = (game as Game).actors?.get(id) as Actor;
3434

3535
// const oldLevel = actor.data.data.details.level.value;
3636
const oldLevel = 24;

0 commit comments

Comments
 (0)