PlayerProgressionService constructor
PlayerProgressionService({
- required StorageService storage,
- required List<
LevelDefinition> levelCurve, - RewardTransactionPipeline? pipeline,
- AsyncActionGuard? guard,
- String? storageKey,
- int capacity = 200,
Implementation
PlayerProgressionService({
required this.storage,
required List<LevelDefinition> levelCurve,
this.pipeline,
AsyncActionGuard? guard,
String? storageKey,
this.capacity = 200,
}) : _curve = List.unmodifiable(
[...levelCurve]..sort((a, b) => a.level.compareTo(b.level)),
),
_guard = guard ?? AsyncActionGuard(),
_key = storageKey ?? StorageKeys.playerProgressionV1 {
if (capacity <= 0) {
throw ArgumentError.value(capacity, 'capacity', 'must be > 0');
}
final error = validateLevelCurve(_curve);
if (error != null) {
throw ArgumentError(error.message);
}
// BUG-40: see EconomyWallet's constructor for why this can't wait for
// onInit() alone.
_hydrate();
_recompute();
}