Implement vehicle research and purchases
Recompute unlocked ranks, prerequisites, and unit states before serving profiles. Add research target selection, research conversion, vehicle and slot purchases, and the price table. Support editing convertible RP and restrict hidden vehicle visibility to eligible entries. The client still displays zero purchase prices pending price table integration.
This commit is contained in:
1 parent
8b31277c58
commit
7a08fff85e
37 files changed
+1336
-75
No files matched your search
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Assemble the players' profiles with the rules they depend on, the same way for the local
|
||||
* service and for the save editor (save-cli.ts): static data from the dataset cache, the
|
||||
* save store with its format upgrades, and the research state kept up to date.
|
||||
*/
|
||||
import type { DatasetCache } from './game-data/datasets/dataset-cache.ts';
|
||||
import { reserveVehicles } from './game-data/datasets/reserve-vehicles.ts';
|
||||
import { shopBranches } from './game-data/datasets/shop-branches.ts';
|
||||
import type { GameFiles } from './game-data/game-files.ts';
|
||||
import { PlayerProfiles } from './profile/player-profiles.ts';
|
||||
import { profileUpgrades } from './profile/profile-upgrades.ts';
|
||||
import type { StartingContent } from './profile/starting-content.ts';
|
||||
import { refreshResearchState } from './research/research-state.ts';
|
||||
import { loadResearchRules, type ResearchRules } from './research/research-rules.ts';
|
||||
import { SaveStore } from './saves/save-store.ts';
|
||||
|
||||
export interface ProfileServices {
|
||||
readonly profiles: PlayerProfiles;
|
||||
readonly research: ResearchRules;
|
||||
}
|
||||
|
||||
export function setUpProfiles(dataFolder: string, gameFiles: GameFiles, datasets: DatasetCache): ProfileServices {
|
||||
const startingContent: StartingContent = { reserveVehicles: datasets.load(reserveVehicles), branches: datasets.load(shopBranches) };
|
||||
const research = loadResearchRules(datasets);
|
||||
const saves = new SaveStore(dataFolder, profileUpgrades(startingContent));
|
||||
const profiles = new PlayerProfiles(saves, gameFiles, startingContent, (profile) => refreshResearchState(profile, research));
|
||||
return { profiles, research };
|
||||
}
|
||||
Reference in new issue
Block a user