|
|
|
|
@ -35,13 +35,19 @@ class GetAnalyticsController {
|
|
|
|
|
Client get _client => _pangeaController.matrixState.client;
|
|
|
|
|
|
|
|
|
|
// the minimum XP required for a given level
|
|
|
|
|
double get _minXPForLevel {
|
|
|
|
|
return 12.5 * (2 * pow(constructListModel.level - 1, 2) - 1);
|
|
|
|
|
int get _minXPForLevel {
|
|
|
|
|
return _calculateMinXpForLevel(constructListModel.level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the minimum XP required for the next level
|
|
|
|
|
double get _minXPForNextLevel {
|
|
|
|
|
return 12.5 * (2 * pow(constructListModel.level, 2) - 1);
|
|
|
|
|
int get _minXPForNextLevel {
|
|
|
|
|
return _calculateMinXpForLevel(constructListModel.level + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Calculates the minimum XP required for a specific level.
|
|
|
|
|
int _calculateMinXpForLevel(int level) {
|
|
|
|
|
if (level == 1) return 0; // Ensure level 1 starts at 0 XP
|
|
|
|
|
return ((100 / 8) * (2 * pow(level - 1, 2))).floor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the progress within the current level as a percentage (0.0 to 1.0)
|
|
|
|
|
@ -75,7 +81,6 @@ class GetAnalyticsController {
|
|
|
|
|
constructListModel.dispose();
|
|
|
|
|
_analyticsUpdateSubscription?.cancel();
|
|
|
|
|
_analyticsUpdateSubscription = null;
|
|
|
|
|
analyticsStream.close();
|
|
|
|
|
initCompleter = null;
|
|
|
|
|
_cache.clear();
|
|
|
|
|
}
|
|
|
|
|
|