Repair damaged vehicles for free over their full repair time

The client never raises a vehicle's hp by itself; the hangar shows (1 - hp) x the
full repair time as what is left (shop_time_until_repair, aces.exe 2.61.0.37
0x17a5040). The local service now restores hp whenever it hands out or changes a
profile: hp grows by the hours since it was last set over the full repair time, and
the damage is cleared at 1.

The full repair time follows the client (0x937330): repairTimeHrs<Mode> times the
repair cost's modification factor (0x964750 -> 0x964900) times a crew multiplier
when a crew has the vehicle as its current one, else repairTimeHrsNoCrew<Mode> (or
repairTimeHrs x rTimeNoCrewMul, 0x964e30). The crew multiplier runs from 1 to 1/3
(hangarRepairSpeed default, 0x95cee0) over the groundService/repair level plus the
specialization share of specialization<k>_add (0x95d200), and applies only when
repair_ranks covers the vehicle's rank for the crew's repairRank level (0x95d7b0).
The vehicle-repair dataset gains the repair times, rTimeNoCrewMul and these crew
skill values; RepairRules is built with the profiles so the refresh can use it.
Inferred: the skill fields the client divides are level and maximum level, the
rank compared is the tech tree rank, linear growth at the current crew's pace.

Checked: typecheck; full repair times for us_m1a1_abrams from the game data (no
crew 678 h, untrained 171 h, maxed ace 57 h) and the hp growth over time.
This commit is contained in:
N0VAN0M4LY committed 2026-11-28 12:56:12 +08:00
1 parent 5b75dd5c59
commit 09973884ae
6 files changed
+241 -34

No files matched your search

+9 -2
View File
@@ -2,7 +2,8 @@
* 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 clan membership, research, and modification state
* kept up to date and persisted on every read or write.
* and the free repair over time (repair/repair-over-time.ts) 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';
@@ -11,6 +12,7 @@ import { reserveVehicles } from './game-data/datasets/reserve-vehicles.ts';
import { shopBranches } from './game-data/datasets/shop-branches.ts';
import { vehicleCatalogue, type CatalogueVehicle } from './game-data/datasets/vehicle-catalogue.ts';
import { vehicleEquipment } from './game-data/datasets/vehicle-equipment.ts';
import { vehicleRepair } from './game-data/datasets/vehicle-repair.ts';
import type { GameFiles } from './game-data/game-files.ts';
import { removeExpiredItems } from './items/item-expiry.ts';
import { EquipmentCatalogue } from './modifications/equipment-catalogue.ts';
@@ -20,6 +22,8 @@ import { PlayerProfiles } from './profile/player-profiles.ts';
import { profileUpgrades } from './profile/profile-upgrades.ts';
import { serverTimeNow } from './profile/server-time.ts';
import type { StartingContent } from './profile/starting-content.ts';
import { repairVehiclesOverTime } from './repair/repair-over-time.ts';
import { RepairRules } from './repair/repair-rules.ts';
import { loadResearchRules, type ResearchRules } from './research/research-rules.ts';
import { refreshResearchState } from './research/research-state.ts';
import { SaveStore } from './saves/save-store.ts';
@@ -29,6 +33,7 @@ export interface ProfileServices {
readonly profiles: PlayerProfiles;
readonly research: ResearchRules;
readonly equipment: EquipmentCatalogue;
readonly repair: RepairRules;
}
export interface ProfileSyncContext {
@@ -51,6 +56,7 @@ export function setUpProfiles(
};
const research = loadResearchRules(datasets, tuning.research, vehicles);
const equipment = new EquipmentCatalogue(datasets.load(vehicleEquipment));
const repair = new RepairRules(datasets.load(vehicleRepair), research.techTree);
const saves = new SaveStore(dataFolder, profileUpgrades(startingContent));
const profiles = new PlayerProfiles(saves, gameFiles, startingContent, (profile, userId) => {
const account = sync?.accounts.byUserId(userId);
@@ -58,7 +64,8 @@ export function setUpProfiles(
refreshResearchState(profile, research);
refreshModuleState(profile, equipment);
removeExpiredItems(profile, serverTimeNow());
repairVehiclesOverTime(profile, repair, serverTimeNow());
trimUserLogs(profile, tuning.limits.userLogsKept);
});
return { profiles, research, equipment };
return { profiles, research, equipment, repair };
}