diff --git a/TODO b/TODO index 82db40435..568ad3dbd 100644 --- a/TODO +++ b/TODO @@ -523,10 +523,11 @@ god mode should allow forcing trades after the trade deadline https://discord.co hockey positions revamp - make centers and wings more similar, centers are just better at faceoffs and maybe defense - - more offensive defensemen + - more offensive defensemen, especially fast ones - defensemen need more shots, wingers need less https://discord.com/channels/@me/662077709836484618/1004952271710326794 - defensemen need more assists https://discord.com/channels/290013534023057409/816359356424912976/1010633509985063055 - point distribution discussion https://mail.google.com/mail/u/0/#inbox/FMfcgzGqQJfsRgnzBpRXKxGQkFmqCnNr +- https://discord.com/channels/@me/778760871911751700/1300282434306310187 how should scouting budget work in no ratings mode? - disables it, but the number/expense is still there, and changes over time. i think it's from the old days where you'd want some standard value there. but now it's kind of weird because the value is not always the same, especially for AI teams diff --git a/src/common/defaultGameAttributes.ts b/src/common/defaultGameAttributes.ts index 9308575d6..9cbcae502 100644 --- a/src/common/defaultGameAttributes.ts +++ b/src/common/defaultGameAttributes.ts @@ -37,6 +37,7 @@ export const gameAttributesKeysGameState: GameAttributeKey[] = [ "expansionDraft", "autoRelocate", "autoExpand", + "tradeProposalsSeed", ]; export const gameAttributesKeysTeams: GameAttributeKey[] = ["confs", "divs"]; export const gameAttributesCache: GameAttributeKey[] = [ @@ -353,6 +354,7 @@ const defaultGameAttributes: GameAttributesLeagueWithHistory = { contactFactor: 1, neutralSite: "never", + tradeProposalsSeed: 0, }; // Extra condition for NODE_ENV is because we use this export only in tests, so we don't want it in the basketball bundle! diff --git a/src/common/types.ts b/src/common/types.ts index c4cc4bb84..9df4af41a 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -657,6 +657,7 @@ export type GameAttributesLeague = { disabled: boolean | undefined; }[]; tradeDeadline: number; + tradeProposalsSeed: number; tragicDeathRate: number; tragicDeaths?: TragicDeaths; userTid: number; @@ -1825,6 +1826,7 @@ export type UpdateEvents = ( | "firstRun" | "g.goatFormula" | "g.goatSeasonFormula" + | "g.tradeProposalsSeed" | "gameAttributes" | "gameSim" | "leagues" diff --git a/src/ui/views/TradeProposals.tsx b/src/ui/views/TradeProposals.tsx index 5036436e6..21c7bd4ba 100644 --- a/src/ui/views/TradeProposals.tsx +++ b/src/ui/views/TradeProposals.tsx @@ -11,6 +11,7 @@ import { playerScore, } from "./TradingBlock"; import { useEffect, useState } from "react"; +import { ActionButton } from "../components"; const TradeProposals = (props: View<"tradeProposals">) => { const { @@ -44,6 +45,8 @@ const TradeProposals = (props: View<"tradeProposals">) => { const { teamInfoCache } = useLocalPartial(["teamInfoCache"]); + const [refreshing, setRefreshing] = useState(false); + if (spectator) { return

You're not allowed to make trades in spectator mode.

; } @@ -115,6 +118,19 @@ const TradeProposals = (props: View<"tradeProposals">) => { These are trade proposals from up to 5 AI teams. New teams will appear here every 10 games.

+ { + setRefreshing(true); + await toWorker("main", "incrementTradeProposalsSeed", undefined); + setRefreshing(false); + }} + processing={refreshing} + processingText="Loading" + variant="secondary" + > + Refresh trade proposals +
{ + await league.setGameAttributes({ + tradeProposalsSeed: g.get("tradeProposalsSeed") + 1, + }); + + await toUI("realtimeUpdate", [["g.tradeProposalsSeed"]]); +}; + const init = async (inputEnv: Env, conditions: Conditions) => { Object.assign(env, inputEnv); @@ -4521,6 +4529,7 @@ export default { handleUploadedDraftClass, idbCacheFlush, importPlayers, + incrementTradeProposalsSeed, init, initGold, loadRetiredPlayers, diff --git a/src/worker/views/tradeProposals.ts b/src/worker/views/tradeProposals.ts index 8795dd681..59c4bea91 100644 --- a/src/worker/views/tradeProposals.ts +++ b/src/worker/views/tradeProposals.ts @@ -125,7 +125,8 @@ const updateTradeProposals = async ( updateEvents.includes("firstRun") || updateEvents.includes("playerMovement") || updateEvents.includes("gameSim") || - updateEvents.includes("newPhase") + updateEvents.includes("newPhase") || + updateEvents.includes("g.tradeProposalsSeed") ) { const teamSeason = await idb.cache.teamSeasons.indexGet( "teamSeasonsByTidSeason", @@ -138,7 +139,8 @@ const updateTradeProposals = async ( const seed = Math.floor(gp / NUM_GAMES_BEFORE_NEW_OFFERS) + g.get("season") + - g.get("phase"); + g.get("phase") + + g.get("tradeProposalsSeed"); const offers = await getOffers(seed); diff --git a/tools/lib/generateJSONSchema.js b/tools/lib/generateJSONSchema.js index a2865fd68..1707823d9 100644 --- a/tools/lib/generateJSONSchema.js +++ b/tools/lib/generateJSONSchema.js @@ -1454,6 +1454,9 @@ const generateJSONSchema = (sport /*: string*/) => { type: "string", enum: ["never", "finals", "playoffs"], }, + tradeProposalsSeed: { + type: "integer", + }, }, }, ],