Stock newly unlocked ammunition and crew replenishment
Extract weapon prerequisites, default equipment states, and exclusive groups. Grant eligible zero-cost modifications in dependency order and initialize newly unlocked consumables and weapon presets at capacity. When automatic restocking is enabled, replenish existing stock subject to the Silver Lions balance. Enforce purchase prerequisites and exclusive equipment groups. Type checking, patch checks, and local data extraction and restocking checks passed. In-game acceptance is pending.
This commit is contained in:
1 parent
9e759197d0
commit
885966aa7e
10 files changed
+268
-49
No files matched your search
@@ -52,6 +52,10 @@ export function isModuleResearched(profile: BlkBlock, vehicle: string, modificat
|
||||
|| moduleResearchPoints(profile, vehicle, modification.name) >= modification.researchPoints;
|
||||
}
|
||||
|
||||
export function arePrerequisitesOwned(profile: BlkBlock, vehicle: string, requires: readonly string[]): boolean {
|
||||
return requires.every((required) => ownsModification(profile, vehicle, required));
|
||||
}
|
||||
|
||||
function openTierOf(profile: BlkBlock, equipment: VehicleEquipment): number {
|
||||
let tier = 1;
|
||||
while (tier <= equipment.tierRequirements.length) {
|
||||
@@ -70,5 +74,5 @@ function statusOf(profile: BlkBlock, vehicle: string, modification: Modification
|
||||
if (modification.tier > openTier) return ModuleStatus.LOCKED;
|
||||
return isModuleResearched(profile, vehicle, modification) ? ModuleStatus.CAN_BUY : ModuleStatus.CAN_RESEARCH;
|
||||
}
|
||||
return modification.requires.every((required) => ownsModification(profile, vehicle, required)) ? ModuleStatus.CAN_BUY : ModuleStatus.LOCKED;
|
||||
return arePrerequisitesOwned(profile, vehicle, modification.requires) ? ModuleStatus.CAN_BUY : ModuleStatus.LOCKED;
|
||||
}
|
||||
Reference in new issue
Block a user