Fix squadron persistence and align inventory wire formats

Read squadron action parameters from the request headers and persist
squadron state on profile refresh. Use floating-point trophy weights
to match the client probability display and assign unique log IDs
when opening multiple chests.

Tighten shop, marketplace, squadron, and cloud settings validation.
Move PBBD and inventory encoding into the protocol modules and share
CSV reading. Update the research and acceptance instructions.

Type checking and all eight executable patch checks passed.
In-game acceptance is pending.
This commit is contained in:
N0VAN0M4LY committed 2026-11-25 09:10:09 +08:00
1 parent 0b604c76f1
commit 8012cf7954
40 files changed
+1347 -1248

No files matched your search

+26 -9
View File
@@ -1,21 +1,23 @@
/**
* 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 and modification state kept up to date
* (expired classic items removed).
* save store with its format upgrades, and clan membership, research, and modification state
* kept up to date and persisted on every read or write.
*/
import type { AccountStore } from './accounts/account-store.ts';
import type { ClanStore } from './clans/clan-store.ts';
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 { removeExpiredItems } from './items/item-expiry.ts';
import { refreshModuleState } from './modifications/module-state.ts';
import { PlayerProfiles } from './profile/player-profiles.ts';
import { profileUpgrades } from './profile/profile-upgrades.ts';
import type { StartingContent } from './profile/starting-content.ts';
import { refreshModuleState } from './modifications/module-state.ts';
import { removeExpiredItems } from './items/item-expiry.ts';
import { serverTimeNow } from './profile/server-time.ts';
import { refreshResearchState } from './research/research-state.ts';
import type { StartingContent } from './profile/starting-content.ts';
import { loadResearchRules, type ResearchRules } from './research/research-rules.ts';
import { refreshResearchState } from './research/research-state.ts';
import { SaveStore } from './saves/save-store.ts';
export interface ProfileServices {
@@ -23,11 +25,26 @@ export interface ProfileServices {
readonly research: ResearchRules;
}
export function setUpProfiles(dataFolder: string, gameFiles: GameFiles, datasets: DatasetCache): ProfileServices {
const startingContent: StartingContent = { reserveVehicles: datasets.load(reserveVehicles), branches: datasets.load(shopBranches) };
export interface ProfileSyncContext {
readonly accounts: AccountStore;
readonly clans: ClanStore;
}
export function setUpProfiles(
dataFolder: string,
gameFiles: GameFiles,
datasets: DatasetCache,
sync?: ProfileSyncContext,
): 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) => {
const profiles = new PlayerProfiles(saves, gameFiles, startingContent, (profile, userId) => {
const account = sync?.accounts.byUserId(userId);
if (account && sync) sync.clans.syncProfile(profile, account);
refreshResearchState(profile, research);
refreshModuleState(profile, research.equipment);
removeExpiredItems(profile, serverTimeNow());