feat(equipment): repair damaged vehicles for free over 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:
1 parent
2a89070f3e
commit
fa7c9071b7
6 files changed
+241
-34
No files matched your search
@@ -5,7 +5,8 @@
|
||||
* hangar{ <vehicle>{ hp:r time:i64 lastGameMode:i } }
|
||||
*
|
||||
* hp is the vehicle's condition (1 = intact, the default; 0x9406a2); time is stored with it
|
||||
* (here: when the damage happened, server time); lastGameMode is the mode the damage was taken
|
||||
* (here: when hp was last set, server time, which the free repair counts from:
|
||||
* repair/repair-over-time.ts; the client does not read it for the repair timer); lastGameMode is the mode the damage was taken
|
||||
* in, 1 arcade / 2 historical / 3 simulation (default 1, 0x9415b1), which picks the repair
|
||||
* cost (getAircraftRepairCost 0x90e0b0 reads it at AircraftInfo+0xcc).
|
||||
*/
|
||||
@@ -32,6 +33,17 @@ export function vehicleCondition(profile: BlkBlock, vehicle: string): VehicleCon
|
||||
};
|
||||
}
|
||||
|
||||
/** The damaged vehicles of the hangar. */
|
||||
export function damagedVehicles(profile: BlkBlock): string[] {
|
||||
return (findBlock(profile, HANGAR)?.blocks ?? []).map((entry) => entry.name).filter((vehicle) => isDamaged(profile, vehicle));
|
||||
}
|
||||
|
||||
/** When the vehicle's hp was last set; undefined when the entry has no time. */
|
||||
export function damageTime(profile: BlkBlock, vehicle: string): ServerTime | undefined {
|
||||
const time = hangarEntry(profile, vehicle) && findParam(hangarEntry(profile, vehicle)!, 'time')?.value;
|
||||
return time?.type === 'int64' ? time.value : undefined;
|
||||
}
|
||||
|
||||
export function isDamaged(profile: BlkBlock, vehicle: string): boolean {
|
||||
const condition = vehicleCondition(profile, vehicle);
|
||||
return condition !== undefined && condition.hp < 1;
|
||||
|
||||
Reference in new issue
Block a user