fix(server): persist selectable battle ratings
Validate the selected rank against owned modifications and return the saved profile. Use the saved rank delta for mode eligibility and room matchmaking. Verified with typecheck and a local 2.61.0.58 server run using temporary data. In-game acceptance is pending.
This commit is contained in:
1 parent
3f0e08c5b7
commit
899fb5d91b
8 files changed
+82
-17
No files matched your search
@@ -5,7 +5,7 @@
|
||||
* char.vromfs.bin config/wpcost.blk, per vehicle:
|
||||
* needBuyToOpenNextInTier<N>:i researched modifications of tier N needed to open tier N+1
|
||||
* modifications{ <name>{ tier:i reqExp:i value:i costGold:i openCostGold:i
|
||||
* reqModification:t (repeated) maxCount:i ammoCount:i ... } }
|
||||
* reqModification:t (repeated) maxCount:i ammoCount:i addMrank:i ... } }
|
||||
* Ammunition and expendables are modifications too (tier 0, maxCount, ammoCount).
|
||||
* weapons{ <preset>{ value:i costGold:i maxCount:i reqModification:t ... } }
|
||||
* Paid presets (bombs, rockets) are bought by the piece, up to maxCount; the rest are free,
|
||||
@@ -39,6 +39,8 @@ export interface ModificationFacts {
|
||||
readonly maxCount: number;
|
||||
/** ammoCount present: an ammunition belt or shell type. */
|
||||
readonly ammunition: boolean;
|
||||
/** addMrank: selectable matchmaking rank increase unlocked by owning this modification. */
|
||||
readonly addMrank?: number;
|
||||
/** Initial enabled state when acquired (`turn_it_off` / `isEnabledByDefaultForAddMrank`). */
|
||||
readonly defaultEnabled: boolean;
|
||||
/** Non-bullet `group` name when modifications in the same group are mutually exclusive. */
|
||||
@@ -78,7 +80,7 @@ interface GlobalModificationMeta {
|
||||
|
||||
export const vehicleEquipment: Dataset<readonly VehicleEquipment[]> = {
|
||||
id: 'vehicle-equipment',
|
||||
version: 4,
|
||||
version: 5,
|
||||
extract: (source) => {
|
||||
const modMeta = readGlobalModificationMeta(source.readBlk('char.vromfs.bin', MODIFICATIONS_CONFIG));
|
||||
return source.readBlk('char.vromfs.bin', VEHICLE_ECONOMY).blocks.map((vehicle) => equipmentOf(vehicle, modMeta));
|
||||
@@ -119,6 +121,7 @@ function equipmentOf(vehicle: BlkBlock, modMeta: ReadonlyMap<string, GlobalModif
|
||||
|
||||
function modificationOf(modification: BlkBlock, meta: GlobalModificationMeta | undefined): ModificationFacts {
|
||||
const ammunition = numberField(modification, 'ammoCount') !== undefined;
|
||||
const addMrank = numberField(modification, 'addMrank');
|
||||
const defaultEnabled = !(meta?.turnOffByDefault ?? false) && (boolField(modification, 'isEnabledByDefaultForAddMrank') ?? true);
|
||||
const group = stringField(modification, 'group') ?? meta?.group;
|
||||
const exclusiveGroup = !ammunition && !(meta?.bulletGroup ?? false) ? group : undefined;
|
||||
@@ -132,6 +135,7 @@ function modificationOf(modification: BlkBlock, meta: GlobalModificationMeta | u
|
||||
requires: stringList(modification, 'reqModification'),
|
||||
maxCount: numberField(modification, 'maxCount') ?? 0,
|
||||
ammunition,
|
||||
...(addMrank !== undefined ? { addMrank } : {}),
|
||||
defaultEnabled,
|
||||
...(exclusiveGroup !== undefined ? { exclusiveGroup } : {}),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user