Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distinguish non mainline games #57

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion blaseball-lib/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export interface BlaseballGame extends BlaseballEntity<GameID> {
season: number;
day: number;
isPostseason: boolean;
isPrizeMatch: boolean?;
isTitleMatch: boolean?;
tournament: number;
weather: number;

inning: number;
Expand Down Expand Up @@ -266,4 +269,4 @@ export interface BlaseballFeedTemporalMetadata {
being: number;
_eventually_ingest_source?: string;
_eventually_ingest_time?: number;
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"workspaces": [
"reblase",
"blaseball-lib"
]
],
"dependencies": {}
}
2 changes: 2 additions & 0 deletions reblase/src/components/gamelist/DayTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { ChronGame } from "blaseball-lib/chronicler";
import { predictGamePitcher } from "blaseball-lib/team";
import { BlaseballFeedSeasonList, BlaseballGame, BlaseballPlayer, BlaseballTeam } from "blaseball-lib/models";
import { displaySimSeasonAndDayPlaintext } from "blaseball-lib/games";
import { GameKind } from "../../pages/SeasonPage";

interface DayTableProps {
games: ChronGame[];
sim?: string;
season: number;
day: number;
kind: GameKind;
currentDay: number;
showFutureWeather: boolean;
feedSeasonList?: BlaseballFeedSeasonList;
Expand Down
43 changes: 39 additions & 4 deletions reblase/src/pages/SeasonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,56 @@ import { getOutcomes, calculatedOutcomeTypes } from "../blaseball/outcome";
import WeatherPicker from "../components/elements/WeatherPicker";
import Checkbox from "../components/elements/Checkbox";
import { Link } from "react-router-dom";
import { BlaseballFeedSeasonList, BlaseballPlayer, BlaseballTeam } from "blaseball-lib/models";
import { BlaseballFeedSeasonList, BlaseballPlayer, BlaseballTeam, BlaseballGame } from "blaseball-lib/models";
import { PlayerID } from "blaseball-lib/common";
import { FightRow, SemiCentennialRow } from "components/gamelist/GameRow";
import Twemoji from "components/elements/Twemoji";
import { displaySimAndSeasonPlaintext, STATIC_ID } from "blaseball-lib/games";
import StadiumPicker from "components/elements/StadiumPicker";

type GameDay = { games: ChronGame[]; season: number; day: number };
export enum GameKind {
Regular,
Postseason,
Fiesta,
Title,
Prize,
}

type GameDay = {
games: ChronGame[];
season: number;
day: number;
kind: GameKind;
};

function getKindForGame(game: BlaseballGame): GameKind {
if (game.isTitleMatch) return GameKind.Title;
if (game.isPrizeMatch) return GameKind.Prize;
if (game.isPostseason) {
// falsehoods
if (game.sim != "gamma10") return GameKind.Postseason;
return game.tournament == -1 ? GameKind.Fiesta : GameKind.Postseason;
}
return GameKind.Regular;
}

function groupByDay(games: ChronGame[]): GameDay[] {
const days: Record<string, GameDay> = {};
let maxDay = -1;
let currentRunOfPostseasonDays = [];

for (const game of games) {
const day = game.data.day;
const gameHasDefaultRules = game.data.rules != "df2207cc-03a2-4f6f-9604-63421a4dd5e8";
if (!gameHasDefaultRules) continue;
if (!days[day]) days[day] = { games: [], season: game.data.season, day: game.data.day };
if (!days[day]) {
days[day] = {
games: [],
season: game.data.season,
day: game.data.day,
kind: getKindForGame(game.data),
};
}
days[day].games.push(game);
if (maxDay < day) maxDay = day;
}
Expand Down Expand Up @@ -64,13 +98,14 @@ const GamesList = React.memo(

return (
<div>
{props.days.map(({ games, season, day }) => {
{props.days.map(({ games, season, day, kind }) => {
return (
<DayTable
key={day}
sim={props.sim}
season={season}
day={day}
kind={kind}
currentDay={props.currentDay}
games={games}
feedSeasonList={props.feedSeasonList}
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3325,9 +3325,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001219:
version "1.0.30001241"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz#cd3fae47eb3d7691692b406568d7a3e5b23c7598"
integrity sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==
version "1.0.30001402"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001402.tgz"
integrity sha512-Mx4MlhXO5NwuvXGgVb+hg65HZ+bhUYsz8QtDGDo2QmaJS2GBX47Xfi2koL86lc8K+l+htXeTEB/Aeqvezoo6Ew==

capture-exit@^2.0.0:
version "2.0.0"
Expand Down