-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for expansion to multiple game types
- Loading branch information
1 parent
021b919
commit 99843f1
Showing
6 changed files
with
80 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs from "fs/promises"; | ||
import fsSync from "fs"; | ||
|
||
import { getMatchData as chargedUpGetMatchData } from "./chargedUp"; | ||
|
||
export const PLAYOFF_MATCHES_BEFORE_FINALS = 13; | ||
|
||
export async function setMatchNumber(matchType: string, matchNumber: number) { | ||
const type = | ||
matchType === "Qual" | ||
? "Quals" | ||
: matchNumber > PLAYOFF_MATCHES_BEFORE_FINALS | ||
? "Finals" | ||
: "Playoff"; | ||
|
||
fsSync.existsSync("TourneyData/") || (await fs.mkdir("TourneyData/")); | ||
await fs.writeFile("TourneyData/MatchNumber.txt", `${type} ${matchNumber}`); | ||
await fs.writeFile( | ||
"TourneyData/PrevMatchNumber.txt", | ||
`${type} ${matchNumber - 1}` | ||
); | ||
} | ||
|
||
let gameGetMatchData; | ||
|
||
switch (process.env.GAME_NAME) { | ||
case "CHARGED UP": | ||
default: | ||
gameGetMatchData = chargedUpGetMatchData; | ||
break; | ||
} | ||
|
||
export const getMatchData = gameGetMatchData; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
type Match as chargedUpMatch, | ||
headerValues as chargedUpHeaderValues, | ||
matchToArray as chargedUpMatchToArray, | ||
saveMatchToRow as chargedUpSaveMatchToRow, | ||
} from "./chargedUp"; | ||
|
||
let gameHeaderValues; | ||
let gameMatchToArray; | ||
let gameSaveMatchToRow; | ||
|
||
switch (process.env.GAME_NAME) { | ||
case "CHARGED UP": | ||
default: | ||
gameHeaderValues = chargedUpHeaderValues; | ||
gameMatchToArray = chargedUpMatchToArray; | ||
gameSaveMatchToRow = chargedUpSaveMatchToRow; | ||
break; | ||
} | ||
|
||
export type Match = chargedUpMatch; // | otherMatch; | ||
export const headerValues = gameHeaderValues; | ||
export const matchToArray = gameMatchToArray; | ||
export const saveMatchToRow = gameSaveMatchToRow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
sendQualMatchEmbed as chargedUpSendQualMatchEmbed, | ||
sendPlayoffMatchEmbed as chargedUpSendPlayoffMatchEmbed, | ||
} from "./chargedUp"; | ||
|
||
let gameSendQualMatchEmbed; | ||
let gameSendPlayoffMatchEmbed; | ||
|
||
switch (process.env.GAME_NAME) { | ||
case "CHARGED UP": | ||
default: | ||
gameSendQualMatchEmbed = chargedUpSendQualMatchEmbed; | ||
gameSendPlayoffMatchEmbed = chargedUpSendPlayoffMatchEmbed; | ||
break; | ||
} | ||
|
||
export const sendQualMatchEmbed = gameSendQualMatchEmbed; | ||
export const sendPlayoffMatchEmbed = gameSendPlayoffMatchEmbed; |