diff --git a/src/components/Farmhand/Farmhand.context.js b/src/components/Farmhand/Farmhand.context.js index 2e3701d0..f0b700f7 100644 --- a/src/components/Farmhand/Farmhand.context.js +++ b/src/components/Farmhand/Farmhand.context.js @@ -7,6 +7,7 @@ import { createContext } from 'react' // eslint-disable-next-line no-unused-vars import uiEventHandlers from '../../handlers/ui-events.js' +import { generateCow } from '../../utils/index.js' /** * @type {import('react').Context<{ @@ -26,9 +27,102 @@ import uiEventHandlers from '../../handlers/ui-events.js' * handlers: uiEventHandlers & { debounced: uiEventHandlers } * }>} */ -// @ts-expect-error const FarmhandContext = createContext({ - gameState: {}, + /** @type {farmhand.state} */ + gameState: { + activePlayers: null, + allowCustomPeerCowNames: false, + cellarInventory: [], + currentDialogView: '', + completedAchievements: {}, + cowForSale: generateCow(), + cowBreedingPen: { + cowId1: null, + cowId2: null, + daysUntilBirth: 0, + }, + cowInventory: [], + cowColorsPurchased: {}, + cowIdOfferedForTrade: '', + cowsSold: {}, + cowsTraded: 0, + cowTradeTimeoutId: null, + cropsHarvested: {}, + dayCount: 0, + experience: 0, + farmName: '', + field: [[]], + forest: [[]], + fieldMode: 'default', + getCowAccept: () => {}, + getCowReject: () => {}, + getCowTradeRequest: () => {}, + getPeerMetadata: () => {}, + hasBooted: true, + heartbeatTimeoutId: null, + historicalDailyLosses: [], + historicalDailyRevenue: [], + historicalValueAdjustments: [], // empty array for now + hoveredPlotRangeSize: 0, + id: '', + inventory: [{ id: '', quantity: 0 }], + inventoryLimit: -1, + isAwaitingCowTradeRequest: false, + isAwaitingNetworkRequest: false, + isCombineEnabled: true, + isMenuOpen: false, + itemsSold: {}, + cellarItemsSold: {}, + isChatOpen: false, + isDialogViewOpen: false, + isOnline: true, + isWaitingForDayToCompleteIncrementing: false, + learnedRecipes: {}, + loanBalance: 0, + loansTakenOut: 0, + money: 0, + latestNotification: null, + newDayNotifications: [], + notificationLog: [], + peers: {}, // empty object for now + peerRoom: null, + pendingPeerMessages: [], + latestPeerMessages: [], + sendCowAccept: () => {}, + sendCowReject: () => {}, + sendCowTradeRequest: () => {}, + sendPeerMetadata: () => {}, + selectedCowId: '', + selectedItemId: '', + priceCrashes: {}, + priceSurges: {}, + purchasedCombine: 0, + purchasedComposter: 0, + purchasedCowPen: 0, + purchasedCellar: 0, + purchasedField: 0, + purchasedForest: 0, + purchasedSmelter: 0, + profitabilityStreak: 0, + record7dayProfitAverage: 0, + recordProfitabilityStreak: 0, + recordSingleDayProfit: 0, + revenue: 0, + redirect: '', + room: '', + showHomeScreen: true, + showNotifications: true, + stageFocus: 'default', + todaysLosses: -0.01, // always negative + todaysPurchases: {}, + todaysRevenue: 10.01, // always positive + todaysStartingInventory: {}, + toolLevels: {}, // empty object for now + valueAdjustments: {}, + version: '1.0.0', + todaysNotifications: [], + useAlternateEndDayButtonPosition: false, + }, handlers: {}, })