diff --git a/src/common/defaultGameAttributes.ts b/src/common/defaultGameAttributes.ts index d329cbec38..1badf9da40 100644 --- a/src/common/defaultGameAttributes.ts +++ b/src/common/defaultGameAttributes.ts @@ -64,6 +64,7 @@ const defaultGameAttributes: GameAttributesLeagueWithHistory = { numGames: 82, // per season numGamesDiv: 16, numGamesConf: 36, + tradeMatchingPercentage: 125, otherTeamsWantToHire: false, numPeriods: 4, // per game quarterLength: 12, // [minutes] diff --git a/src/common/types.ts b/src/common/types.ts index afdcc11ad1..c0cf1c5f49 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -507,6 +507,7 @@ export type GameAttributesLeague = { numGames: number; numGamesDiv: number | null; numGamesConf: number | null; + tradeMatchingPercentage: number; numGamesPlayoffSeries: number[]; numPeriods: number; numPlayersDunk: number; @@ -554,6 +555,7 @@ export type GameAttributesLeague = { stopOnInjury: boolean; stopOnInjuryGames: number; tiebreakers: (keyof typeof TIEBREAKERS)[]; + teamInfoCache: { abbrev: string; region: string; @@ -1212,8 +1214,6 @@ export type Local = { autoPlayUntil?: { season: number; phase: number; - - // Time in milliseconds of the start of auto play start: number; }; autoSave: boolean; @@ -1714,5 +1714,3 @@ export type HeadToHead = { > >; }; - -export type GetCopyType = "noCopyCache"; diff --git a/src/ui/views/Settings/settings.tsx b/src/ui/views/Settings/settings.tsx index 8b4adb7c19..f2cc69834c 100644 --- a/src/ui/views/Settings/settings.tsx +++ b/src/ui/views/Settings/settings.tsx @@ -994,6 +994,7 @@ export const settings: {
> ), + validator: value => { if (value > 1) { throw new Error("Value cannot be greater than 1"); @@ -1003,6 +1004,24 @@ export const settings: { } }, }, + { + category: "Schedule", + key: "tradeMatchingPercentage", + name: "Trade Matching Percentage", + godModeRequired: "existingLeagueOnly", + type: "int", + descriptionLong: ( + <> ++ Set this to whatever value you want for the trades to match + contract-wise. In real life, the percentage is 125%, but this allows + you to modify this. +
+ +Set this to 0 to turn off the rule
+ > + ), + }, { category: "Playoffs", key: "playoffsByConf", diff --git a/src/worker/core/trade/summary.ts b/src/worker/core/trade/summary.ts index 2c3ef43233..76faa37b45 100644 --- a/src/worker/core/trade/summary.ts +++ b/src/worker/core/trade/summary.ts @@ -2,6 +2,8 @@ import { team } from ".."; import { idb } from "../../db"; import { g, helpers } from "../../util"; import type { TradeSummary, TradeTeams } from "../../../common/types"; +import { league } from "src/worker/core"; +league.loadGameAttributes(); /** * Create a summary of the trade, for eventual display to the user. @@ -101,9 +103,13 @@ const summary = async (teams: TradeTeams): Promise