/** * Reads offline prices, rewards, drop weights, limits, and preset content at server startup. * Values defined by the game come from its data files. Protocol constants live with their handlers. */ import { readBattleEconomyTuning, type BattleEconomyTuning } from '../battle/battle-economy-tuning.ts'; import { readBattleTuning, type BattleTuning } from '../battle/battle-tuning.ts'; import { readClanTuning, type ClanTuning } from '../clans/clan-tuning.ts'; import { readMarketplaceTuning, type MarketplaceTuning } from '../inventory/marketplace-tuning.ts'; import { readRecyclingTuning, type RecyclingTuning } from '../inventory/recycling-tuning.ts'; import { readSupplyChestTuning, type SupplyChestTuning } from '../inventory/supply-chest-tuning.ts'; import { readTrophyTuning, type TrophyTuning } from '../inventory/trophy-tuning.ts'; import { readNewProfileTuning, type NewProfileTuning } from '../profile/new-profile-tuning.ts'; import { readResearchTuning, type ResearchTuning } from '../research/research-tuning.ts'; import { readRedeemTuning, type RedeemTuning } from '../store/redeem-tuning.ts'; import { readStoreTuning, type StoreTuning } from '../store/store-tuning.ts'; import type { DiscoveredMod } from '@wto/mods'; import { readGroundAiTuning, type GroundAiTuning } from './ground-ai-tuning.ts'; import { readLimitsTuning, type LimitsTuning } from './limits-tuning.ts'; import { tuningFiles } from './tuning-loader.ts'; export interface Tuning { readonly store: StoreTuning; readonly redeemCodes: RedeemTuning; readonly newProfile: NewProfileTuning; readonly research: ResearchTuning; readonly marketplace: MarketplaceTuning; readonly supplyChests: SupplyChestTuning; readonly recycling: RecyclingTuning; readonly trophies: TrophyTuning; readonly clans: ClanTuning; readonly battle: BattleTuning; readonly battleEconomy: BattleEconomyTuning; readonly groundAi: GroundAiTuning; readonly limits: LimitsTuning; } export function loadTuning( dataFolder: string, report: (line: string) => void, mods: readonly DiscoveredMod[] = [], ): Tuning { const files = tuningFiles(dataFolder, report, undefined, mods); return { store: readStoreTuning(files.read('store')), redeemCodes: readRedeemTuning(files.read('redeem-codes')), newProfile: readNewProfileTuning(files.read('new-profile')), research: readResearchTuning(files.read('research')), marketplace: readMarketplaceTuning(files.read('marketplace')), supplyChests: readSupplyChestTuning(files.read('supply-chests')), recycling: readRecyclingTuning(files.read('recycling')), trophies: readTrophyTuning(files.read('trophies')), clans: readClanTuning(files.read('clans')), battle: readBattleTuning(files.read('battle')), battleEconomy: readBattleEconomyTuning(files.read('battle-economy')), groundAi: readGroundAiTuning(files.read('ground-ai')), limits: readLimitsTuning(files.read('limits')), }; }