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.
37 lines
2.1 KiB
TypeScript
37 lines
2.1 KiB
TypeScript
/** Char action names mapped to their handlers (full list of names: research-data/char_actions_37.json). */
|
|
import type { AccountStore } from '../../accounts/account-store.ts';
|
|
import type { PlayerProfiles } from '../../profile/player-profiles.ts';
|
|
import type { ResearchRules } from '../../research/research-rules.ts';
|
|
import type { CharActionHandler } from '../char-action.ts';
|
|
import { acceptEula } from './agreement-actions.ts';
|
|
import { bulkTrainCrews, trainCrew } from './crew-actions.ts';
|
|
import { entitlementsFull, initialMeta, legacyUserData } from './online-init-actions.ts';
|
|
import { priceEx } from './price-actions.ts';
|
|
import { buyAircraft, buySlot } from './purchase-actions.ts';
|
|
import { convertExp, resetResearchable, setResearchable } from './research-actions.ts';
|
|
import { setStartingInfo } from './starting-info-actions.ts';
|
|
|
|
export interface ActionDependencies {
|
|
readonly profiles: PlayerProfiles;
|
|
readonly accounts: AccountStore;
|
|
readonly research: ResearchRules;
|
|
}
|
|
|
|
export function actionTable(deps: ActionDependencies): ReadonlyMap<string, CharActionHandler> {
|
|
return new Map<string, CharActionHandler>([
|
|
['cln_get_initial_meta', initialMeta()],
|
|
['cln_upd_entitlements_full', entitlementsFull(deps.profiles, deps.accounts)],
|
|
['cln_legacy_get_userdata', legacyUserData(deps.profiles, deps.accounts)],
|
|
['cln_accept_eula', acceptEula(deps.profiles, deps.accounts)],
|
|
['cln_set_starting_info', setStartingInfo(deps.profiles, deps.accounts)],
|
|
['cln_bulk_train_aircraft', bulkTrainCrews(deps.profiles, deps.accounts)],
|
|
['cln_train_aircraft', trainCrew(deps.profiles, deps.accounts)],
|
|
['cln_set_researchable', setResearchable(deps.profiles, deps.accounts, deps.research)],
|
|
['cln_reset_researchable', resetResearchable(deps.profiles, deps.accounts, deps.research)],
|
|
['cln_convert_exp', convertExp(deps.profiles, deps.accounts, deps.research)],
|
|
['cln_buy_aircraft', buyAircraft(deps.profiles, deps.accounts, deps.research)],
|
|
['cln_buy_slot', buySlot(deps.profiles, deps.accounts, deps.research)],
|
|
['cln_get_price_ex', priceEx(deps.research)],
|
|
]);
|
|
}
|