Skip to content

Commit

Permalink
try fix require not defined on web
Browse files Browse the repository at this point in the history
  • Loading branch information
Manwe-777 committed May 4, 2024
1 parent 5005a49 commit f04a0fd
Show file tree
Hide file tree
Showing 8 changed files with 1,093 additions and 1,094 deletions.
2,130 changes: 1,065 additions & 1,065 deletions public/tooldb-worker/index.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/components/views/settings/ReaderStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useEffect, useState } from "react";

// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

function findMTGA(): boolean {
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");
const { findPidByName } = reader;
return findPidByName("MTGA");
}
Expand Down
2 changes: 1 addition & 1 deletion src/info.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"6.6.8","branch":"dev","timestamp":1714838419904}
{"version":"6.6.8","branch":"dev","timestamp":1714842289969}
10 changes: 5 additions & 5 deletions src/reader/readCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { Cards } from "mtgatool-shared";

import upsertDbCards from "../toolDb/upsertDbCards";

// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

interface ReaderCard {
key: number;
value: number;
Expand All @@ -15,6 +10,11 @@ interface ReaderCard {
}

export default function readCards() {
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

const cards = readData("MTGA", [
"WrapperController",
"<Instance>k__BackingField",
Expand Down
10 changes: 5 additions & 5 deletions src/reader/readMatchManger.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

interface MatchManager {
"<BattlefieldId>k__BackingField": string;
"<CurrentGameNumber>k__BackingField": number;
Expand All @@ -21,6 +16,11 @@ interface MatchManager {
}

export default function readMatchManger(): MatchManager | undefined {
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

const matchManager = readData("MTGA", ["PAPA", "_instance", "_matchManager"]);

if (matchManager.error) return undefined;
Expand Down
10 changes: 5 additions & 5 deletions src/reader/readMatchOpponentInfo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

interface PlayerInfo {
AvatarSelection: string;
CommanderGrpId: number;
Expand All @@ -17,6 +12,11 @@ interface PlayerInfo {
}

export default function readMatchOpponentInfo(): PlayerInfo | undefined {
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

const opponentInfo = readData("MTGA", [
"PAPA",
"_instance",
Expand Down
10 changes: 5 additions & 5 deletions src/reader/readMatchPlayerInfo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

interface PlayerInfo {
AvatarSelection: string;
CommanderGrpId: number;
Expand All @@ -17,6 +12,11 @@ interface PlayerInfo {
}

export default function readMatchPlayerInfo(): PlayerInfo | undefined {
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

const playerInfo = readData("MTGA", [
"PAPA",
"_instance",
Expand Down
10 changes: 5 additions & 5 deletions src/reader/readPlayerid.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import switchPlayerUUID from "../utils/switchPlayerUUID";

// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

interface AccountInformation {
AccessToken: string;
AccountID: string;
Expand All @@ -22,6 +17,11 @@ interface AccountInformation {
}

export default function readPlayerId() {
// eslint-disable-next-line no-undef
const reader = __non_webpack_require__("mtga-reader");

const { readData } = reader;

const data = readData("MTGA", [
"WrapperController",
"<Instance>k__BackingField",
Expand Down

0 comments on commit f04a0fd

Please sign in to comment.