diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json index 54bb065..0c20032 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/en.json +++ b/apps/launcher/src/renderer/src/i18n/locales/en.json @@ -341,8 +341,7 @@ "country": "Country", "type": "Vehicle type", "actions": "Bulk actions", - "research": "Research all", - "purchase": "Grant regular vehicles", + "purchase": "Research and buy all", "equipment": "Unlock modifications", "empty": "This client has no eligible research branches.", "rank": "Rank {{rank}}", diff --git a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json index 5d947f5..e1b2c54 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json +++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json @@ -341,8 +341,7 @@ "country": "国家", "type": "兵种", "actions": "批量操作", - "research": "全部研发", - "purchase": "获得常规载具", + "purchase": "全部研发并购买", "equipment": "解锁改装件", "empty": "此客户端没有可编辑的研发分支。", "rank": "等级 {{rank}}", diff --git a/apps/launcher/src/renderer/src/pages/saves/SaveResearch.tsx b/apps/launcher/src/renderer/src/pages/saves/SaveResearch.tsx index 9a35df6..0725329 100644 --- a/apps/launcher/src/renderer/src/pages/saves/SaveResearch.tsx +++ b/apps/launcher/src/renderer/src/pages/saves/SaveResearch.tsx @@ -11,7 +11,7 @@ interface Props { readonly onError: (error: unknown) => void; } -const ACTIONS = ['research', 'purchase', 'equipment'] as const; +const ACTIONS = ['purchase', 'equipment'] as const; export function SaveResearch({ copyId, userId, readOnly, onError }: Props) { const { t, i18n } = useTranslation(); diff --git a/apps/launcher/src/shared/schemas/saves.ts b/apps/launcher/src/shared/schemas/saves.ts index 92fbf1a..fdf4364 100644 --- a/apps/launcher/src/shared/schemas/saves.ts +++ b/apps/launcher/src/shared/schemas/saves.ts @@ -94,7 +94,7 @@ export const OfficialPreviewSchema = z.object({ omitted: z.array(z.string()), }); export const ResearchBranchSchema = z.object({ country: z.string().min(1), type: z.string().min(1) }); -export const ResearchOperationSchema = z.enum(['research', 'purchase', 'equipment']); +export const ResearchOperationSchema = z.enum(['purchase', 'equipment']); export const SaveResearchSchema = z.object({ branches: z.array(ResearchBranchSchema), selected: ResearchBranchSchema.nullable(), diff --git a/apps/server/src/saves/save-research.ts b/apps/server/src/saves/save-research.ts index 0a5e8b8..b6bbd22 100644 --- a/apps/server/src/saves/save-research.ts +++ b/apps/server/src/saves/save-research.ts @@ -3,9 +3,9 @@ import { ClanStore } from '../clans/clan-store.ts'; import { DatasetCache } from '../game-data/datasets/dataset-cache.ts'; import { vehicleCatalogue } from '../game-data/datasets/vehicle-catalogue.ts'; import { GameFiles } from '../game-data/game-files.ts'; +import { ProfileEquipmentIndex } from '../modifications/profile-equipment-index.ts'; import { addOwnedVehicle, ownedVehicles } from '../profile/profile-hangar.ts'; -import { ownsModification, writeModificationRecord } from '../profile/profile-modifications.ts'; -import { researchPointsOf, setResearchPoints } from '../profile/profile-vehicle-research.ts'; +import { researchPointsOf } from '../profile/profile-vehicle-research.ts'; import { setUpProfiles } from '../profiles-setup.ts'; import { TechTree } from '../research/tech-tree.ts'; import { loadTuning } from '../tuning/tuning.ts'; @@ -15,7 +15,7 @@ export interface ResearchBranch { readonly country: string; readonly type: string; } -export type ResearchOperation = 'research' | 'purchase' | 'equipment'; +export type ResearchOperation = 'purchase' | 'equipment'; function tree(location: SaveLocation) { const gameFiles = new GameFiles(location.gameFolder); @@ -52,21 +52,19 @@ export function editSaveResearch(location: SaveLocation, userId: string, branch: const { profiles, equipment } = setUpProfiles(location.dataFolder, gameFiles, datasets, tuning, { accounts, clans }, vehicles); profiles.update(userId, (profile) => { const owned = ownedVehicles(profile); + const index = operation === 'equipment' ? new ProfileEquipmentIndex(profile) : undefined; for (const unit of units) { - if (operation === 'research' && unit.kind === 'research' && !owned.has(unit.name)) { - setResearchPoints(profile, unit.name, Math.max(researchPointsOf(profile, unit.name), unit.researchPoints)); - } if (operation === 'purchase' && (unit.kind === 'research' || unit.kind === 'purchase')) { addOwnedVehicle(profile, unit.name); for (const part of unit.parts) addOwnedVehicle(profile, part); } - if (operation === 'equipment' && owned.has(unit.name)) { + if (index && owned.has(unit.name)) { const enabledGroups = new Set(); for (const mod of equipment.vehicle(unit.name)?.modifications ?? []) { - if (mod.name === 'premExpMul' || mod.goldenEagles > 0 || ownsModification(profile, unit.name, mod.name)) continue; + if (mod.name === 'premExpMul' || mod.goldenEagles > 0 || index.ownsModification(unit.name, mod.name)) continue; const enable = mod.defaultEnabled && (!mod.exclusiveGroup || !enabledGroups.has(mod.exclusiveGroup)); if (enable && mod.exclusiveGroup) enabledGroups.add(mod.exclusiveGroup); - writeModificationRecord(profile, unit.name, mod.name, { + index.writeModificationRecord(unit.name, mod.name, { silverLionsSpent: 0, goldenEaglesSpent: 0, enabled: enable, count: Math.max(1, mod.maxCount), }); }