New 40 lines and Blitz averages
This commit is contained in:
parent
298f12e060
commit
c5c5fab8ac
|
@ -166,46 +166,46 @@ const Map<String, Color> rankColors = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const Map<String, Duration> sprintAverages = {
|
const Map<String, Duration> sprintAverages = {
|
||||||
// based on https://discord.com/channels/673303546107658242/674421736162197515/1244287342965952562
|
// based on https://discord.com/channels/673303546107658242/674421736162197515/1277367281264889908
|
||||||
'x': Duration(seconds: 25, milliseconds: 144),
|
'x+': Duration(seconds: 18, milliseconds: 867),
|
||||||
'u': Duration(seconds: 36, milliseconds: 115),
|
'x': Duration(seconds: 23, milliseconds: 277),
|
||||||
'ss': Duration(seconds: 46, milliseconds: 396),
|
'u': Duration(seconds: 28, milliseconds: 853),
|
||||||
's+': Duration(seconds: 55, milliseconds: 056),
|
'ss': Duration(seconds: 35, milliseconds: 173),
|
||||||
's': Duration(seconds: 61, milliseconds: 892),
|
's+': Duration(seconds: 39, milliseconds: 028),
|
||||||
's-': Duration(seconds: 68, milliseconds: 918),
|
's': Duration(seconds: 45, milliseconds: 807),
|
||||||
'a+': Duration(seconds: 76, milliseconds: 187),
|
's-': Duration(seconds: 48, milliseconds: 840),
|
||||||
'a': Duration(seconds: 83, milliseconds: 529),
|
'a+': Duration(seconds: 54, milliseconds: 975),
|
||||||
'a-': Duration(seconds: 88, milliseconds: 608),
|
'a': Duration(seconds: 60, milliseconds: 287),
|
||||||
'b+': Duration(seconds: 97, milliseconds: 626),
|
'a-': Duration(seconds: 64, milliseconds: 019),
|
||||||
'b': Duration(seconds: 104, milliseconds: 687),
|
'b+': Duration(seconds: 76, milliseconds: 531),
|
||||||
'b-': Duration(seconds: 113, milliseconds: 372),
|
'b': Duration(seconds: 77, milliseconds: 635),
|
||||||
'c+': Duration(seconds: 123, milliseconds: 461),
|
'b-': Duration(seconds: 92, milliseconds: 279),
|
||||||
'c': Duration(seconds: 135, milliseconds: 326),
|
'c+': Duration(seconds: 97, milliseconds: 911),
|
||||||
'c-': Duration(seconds: 147, milliseconds: 056),
|
'c': Duration(seconds: 104, milliseconds: 700),
|
||||||
'd+': Duration(seconds: 156, milliseconds: 757),
|
'c-': Duration(seconds: 115, milliseconds: 173),
|
||||||
'd': Duration(seconds: 167, milliseconds: 393),
|
'd+': Duration(seconds: 131, milliseconds: 486),
|
||||||
//'z': Duration(seconds: 66, milliseconds: 802)
|
'd': Duration(seconds: 158, milliseconds: 397),
|
||||||
};
|
};
|
||||||
|
|
||||||
const Map<String, int> blitzAverages = {
|
const Map<String, int> blitzAverages = {
|
||||||
'x': 600715,
|
'x+': 879378,
|
||||||
'u': 379418,
|
'x': 677479,
|
||||||
'ss': 233740,
|
'u': 485962,
|
||||||
's+': 158295,
|
'ss': 369043,
|
||||||
's': 125164,
|
's+': 279242,
|
||||||
's-': 100933,
|
's': 245619,
|
||||||
'a+': 83593,
|
's-': 199368,
|
||||||
'a': 68613,
|
'a+': 162035,
|
||||||
'a-': 60219,
|
'a': 130949,
|
||||||
'b+': 51197,
|
'a-': 111505,
|
||||||
'b': 44171,
|
'b+': 97251,
|
||||||
'b-': 39045,
|
'b': 83580,
|
||||||
'c+': 34130,
|
'b-': 70511,
|
||||||
'c': 28931,
|
'c+': 56747,
|
||||||
'c-': 25095,
|
'c': 43002,
|
||||||
'd+': 22944,
|
'c-': 38925,
|
||||||
'd': 20728,
|
'd+': 30483,
|
||||||
//'z': 72084
|
'd': 22513,
|
||||||
};
|
};
|
||||||
|
|
||||||
List<DateTime> seasonStarts = [
|
List<DateTime> seasonStarts = [
|
||||||
|
|
|
@ -16,7 +16,7 @@ import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||||
import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart';
|
import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart';
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
import 'package:tetra_stats/gen/strings.g.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:tetra_stats/views/main_view_tiles.dart';
|
import 'package:tetra_stats/views/main_view.dart';
|
||||||
import 'package:tetra_stats/views/settings_view.dart';
|
import 'package:tetra_stats/views/settings_view.dart';
|
||||||
import 'package:tetra_stats/views/tracked_players_view.dart';
|
import 'package:tetra_stats/views/tracked_players_view.dart';
|
||||||
import 'package:tetra_stats/views/calc_view.dart';
|
import 'package:tetra_stats/views/calc_view.dart';
|
||||||
|
|
|
@ -73,6 +73,10 @@ String get40lTime(int microseconds){
|
||||||
return microseconds > 60000000 ? "${(microseconds/1000000/60).floor()}:${(secs.format(microseconds /1000000 % 60))}" : _timeInSec.format(microseconds / 1000000);
|
return microseconds > 60000000 ? "${(microseconds/1000000/60).floor()}:${(secs.format(microseconds /1000000 % 60))}" : _timeInSec.format(microseconds / 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getALittleBitMoreNormalTime(Duration time){
|
||||||
|
return "${intf.format(time.inMinutes)}:${(fixedSecs.format(time.inMilliseconds/1000%60))}";
|
||||||
|
}
|
||||||
|
|
||||||
String getMoreNormalTime(Duration time){
|
String getMoreNormalTime(Duration time){
|
||||||
return "${nonsecs.format(time.inMinutes)}:${(fixedSecs.format(time.inMilliseconds/1000%60))}";
|
return "${nonsecs.format(time.inMinutes)}:${(fixedSecs.format(time.inMilliseconds/1000%60))}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1137,10 +1137,10 @@ class _TwoRecordsThingy extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
late MapEntry closestAverageBlitz;
|
late MapEntry closestAverageBlitz;
|
||||||
late bool blitzBetterThanClosestAverage;
|
late bool blitzBetterThanClosestAverage;
|
||||||
bool? blitzBetterThanRankAverage = (rank != null && rank != "z" && rank != "x+" && blitz != null) ? blitz!.stats.score > blitzAverages[rank]! : null;
|
bool? blitzBetterThanRankAverage = (rank != null && rank != "z" && blitz != null) ? blitz!.stats.score > blitzAverages[rank]! : null;
|
||||||
late MapEntry closestAverageSprint;
|
late MapEntry closestAverageSprint;
|
||||||
late bool sprintBetterThanClosestAverage;
|
late bool sprintBetterThanClosestAverage;
|
||||||
bool? sprintBetterThanRankAverage = (rank != null && rank != "z" && rank != "x+" && sprint != null) ? sprint!.stats.finalTime < sprintAverages[rank]! : null;
|
bool? sprintBetterThanRankAverage = (rank != null && rank != "z" && sprint != null) ? sprint!.stats.finalTime < sprintAverages[rank]! : null;
|
||||||
if (sprint != null) {
|
if (sprint != null) {
|
||||||
closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-sprint!.stats.finalTime).abs() < (b -sprint!.stats.finalTime).abs() ? a : b));
|
closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-sprint!.stats.finalTime).abs() < (b -sprint!.stats.finalTime).abs() ? a : b));
|
||||||
sprintBetterThanClosestAverage = sprint!.stats.finalTime < closestAverageSprint.value;
|
sprintBetterThanClosestAverage = sprint!.stats.finalTime < closestAverageSprint.value;
|
||||||
|
@ -1178,7 +1178,7 @@ class _TwoRecordsThingy extends StatelessWidget {
|
||||||
text: "",
|
text: "",
|
||||||
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
||||||
children: [
|
children: [
|
||||||
if (rank != null && rank != "z" && rank != "x+") TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(sprint!.stats.finalTime, sprintAverages[rank]!), verdict: sprintBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
if (rank != null && rank != "z") TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(sprint!.stats.finalTime, sprintAverages[rank]!), verdict: sprintBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
||||||
color: sprintBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
color: sprintBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
||||||
))
|
))
|
||||||
else TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(sprint!.stats.finalTime, closestAverageSprint.value), verdict: sprintBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageSprint.key.toUpperCase())}\n", style: TextStyle(
|
else TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(sprint!.stats.finalTime, closestAverageSprint.value), verdict: sprintBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageSprint.key.toUpperCase())}\n", style: TextStyle(
|
||||||
|
@ -1261,7 +1261,7 @@ class _TwoRecordsThingy extends StatelessWidget {
|
||||||
text: "",
|
text: "",
|
||||||
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
||||||
children: [
|
children: [
|
||||||
if (rank != null && rank != "z" && rank != "x+") TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(blitz!.stats.score, blitzAverages[rank]!), verdict: blitzBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
if (rank != null && rank != "z") TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(blitz!.stats.score, blitzAverages[rank]!), verdict: blitzBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
||||||
color: blitzBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
color: blitzBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
||||||
))
|
))
|
||||||
else TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(blitz!.stats.score, closestAverageBlitz.value), verdict: blitzBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageBlitz.key.toUpperCase())}\n", style: TextStyle(
|
else TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(blitz!.stats.score, closestAverageBlitz.value), verdict: blitzBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageBlitz.key.toUpperCase())}\n", style: TextStyle(
|
||||||
|
|
|
@ -1823,7 +1823,7 @@ class RecordSummary extends StatelessWidget{
|
||||||
text: "",
|
text: "",
|
||||||
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
||||||
children: [
|
children: [
|
||||||
if (rank != null && rank != "z" && rank != "x+") TextSpan(text: "${t.verdictGeneral(n: switch(record!.gamemode){
|
if (rank != null && rank != "z") TextSpan(text: "${t.verdictGeneral(n: switch(record!.gamemode){
|
||||||
"40l" => readableTimeDifference(record!.stats.finalTime, sprintAverages[rank]!),
|
"40l" => readableTimeDifference(record!.stats.finalTime, sprintAverages[rank]!),
|
||||||
"blitz" => readableIntDifference(record!.stats.score, blitzAverages[rank]!),
|
"blitz" => readableIntDifference(record!.stats.score, blitzAverages[rank]!),
|
||||||
_ => record!.stats.score.toString()
|
_ => record!.stats.score.toString()
|
||||||
|
@ -2500,7 +2500,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
|
||||||
text: "",
|
text: "",
|
||||||
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
||||||
children: [
|
children: [
|
||||||
if (rank != null && rank != "z" && rank != "x+") TextSpan(text: "${t.verdictGeneral(n: switch(record.gamemode){
|
if (rank != null && rank != "z") TextSpan(text: "${t.verdictGeneral(n: switch(record.gamemode){
|
||||||
"40l" => readableTimeDifference(record.stats.finalTime, sprintAverages[rank]!),
|
"40l" => readableTimeDifference(record.stats.finalTime, sprintAverages[rank]!),
|
||||||
"blitz" => readableIntDifference(record.stats.score, blitzAverages[rank]!),
|
"blitz" => readableIntDifference(record.stats.score, blitzAverages[rank]!),
|
||||||
_ => record.stats.score.toString()
|
_ => record.stats.score.toString()
|
||||||
|
|
|
@ -81,7 +81,7 @@ class SprintAndBlitzState extends State<SprintAndBlitzView> {
|
||||||
Container(decoration: BoxDecoration(boxShadow: [BoxShadow(color: Colors.black.withAlpha(132), blurRadius: 32.0, blurStyle: BlurStyle.inner)]), child: Image.asset("res/tetrio_tl_alpha_ranks/${sprintEntry.key}.png", height: 48)),
|
Container(decoration: BoxDecoration(boxShadow: [BoxShadow(color: Colors.black.withAlpha(132), blurRadius: 32.0, blurStyle: BlurStyle.inner)]), child: Image.asset("res/tetrio_tl_alpha_ranks/${sprintEntry.key}.png", height: 48)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 8.0),
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
child: Text(get40lTime(sprintEntry.value.inMicroseconds), textAlign: TextAlign.right, style: TextStyle(fontFamily: bigScreen ? "Eurostile Round" : "Eurostile Round Condensed", fontSize: 28, fontWeight: FontWeight.w500, color: Colors.white, shadows: textShadow)),
|
child: Text(getALittleBitMoreNormalTime(sprintEntry.value), textAlign: TextAlign.right, style: TextStyle(fontFamily: bigScreen ? "Eurostile Round" : "Eurostile Round Condensed", fontSize: 28, fontWeight: FontWeight.w500, color: Colors.white, shadows: textShadow)),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 8.0),
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
|
@ -91,7 +91,7 @@ class SprintAndBlitzState extends State<SprintAndBlitzView> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(t.sprintAndBlitsRelevance(date: dateFormat.format(DateTime(2024, 5, 26))))
|
Text(t.sprintAndBlitsRelevance(date: dateFormat.format(DateTime(2024, 8, 25))))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -30,10 +30,10 @@ class SingleplayerRecord extends StatelessWidget {
|
||||||
if (record == null) return Center(child: Text(t.noRecord, textAlign: TextAlign.center, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28)));
|
if (record == null) return Center(child: Text(t.noRecord, textAlign: TextAlign.center, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28)));
|
||||||
late MapEntry closestAverageBlitz;
|
late MapEntry closestAverageBlitz;
|
||||||
late bool blitzBetterThanClosestAverage;
|
late bool blitzBetterThanClosestAverage;
|
||||||
bool? blitzBetterThanRankAverage = (rank != null && rank != "z" && rank != "x+") ? record!.stats.score > blitzAverages[rank]! : null;
|
bool? blitzBetterThanRankAverage = (rank != null && rank != "z") ? record!.stats.score > blitzAverages[rank]! : null;
|
||||||
late MapEntry closestAverageSprint;
|
late MapEntry closestAverageSprint;
|
||||||
late bool sprintBetterThanClosestAverage;
|
late bool sprintBetterThanClosestAverage;
|
||||||
bool? sprintBetterThanRankAverage = (rank != null && rank != "z" && rank != "x+") ? record!.stats.finalTime < sprintAverages[rank]! : null;
|
bool? sprintBetterThanRankAverage = (rank != null && rank != "z") ? record!.stats.finalTime < sprintAverages[rank]! : null;
|
||||||
if (record!.gamemode == "40l") {
|
if (record!.gamemode == "40l") {
|
||||||
closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-record!.stats.finalTime).abs() < (b -record!.stats.finalTime).abs() ? a : b));
|
closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-record!.stats.finalTime).abs() < (b -record!.stats.finalTime).abs() ? a : b));
|
||||||
sprintBetterThanClosestAverage = record!.stats.finalTime < closestAverageSprint.value;
|
sprintBetterThanClosestAverage = record!.stats.finalTime < closestAverageSprint.value;
|
||||||
|
@ -76,13 +76,13 @@ class SingleplayerRecord extends StatelessWidget {
|
||||||
text: "",
|
text: "",
|
||||||
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 14, color: Colors.grey),
|
||||||
children: [
|
children: [
|
||||||
if (record!.gamemode == "40l" && (rank != null && rank != "z" && rank != "x+")) TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(record!.stats.finalTime, sprintAverages[rank]!), verdict: sprintBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
if (record!.gamemode == "40l" && (rank != null && rank != "z")) TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(record!.stats.finalTime, sprintAverages[rank]!), verdict: sprintBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
||||||
color: sprintBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
color: sprintBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
||||||
))
|
))
|
||||||
else if (record!.gamemode == "40l" && (rank == null || rank == "z" || rank != "x+")) TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(record!.stats.finalTime, closestAverageSprint.value), verdict: sprintBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageSprint.key.toUpperCase())}\n", style: TextStyle(
|
else if (record!.gamemode == "40l" && (rank == null || rank == "z" || rank != "x+")) TextSpan(text: "${t.verdictGeneral(n: readableTimeDifference(record!.stats.finalTime, closestAverageSprint.value), verdict: sprintBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageSprint.key.toUpperCase())}\n", style: TextStyle(
|
||||||
color: sprintBetterThanClosestAverage ? Colors.greenAccent : Colors.redAccent
|
color: sprintBetterThanClosestAverage ? Colors.greenAccent : Colors.redAccent
|
||||||
))
|
))
|
||||||
else if (record!.gamemode == "blitz" && (rank != null && rank != "z" && rank != "x+")) TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(record!.stats.score, blitzAverages[rank]!), verdict: blitzBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
else if (record!.gamemode == "blitz" && (rank != null && rank != "z")) TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(record!.stats.score, blitzAverages[rank]!), verdict: blitzBetterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
|
||||||
color: blitzBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
color: blitzBetterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
|
||||||
))
|
))
|
||||||
else if (record!.gamemode == "blitz" && (rank == null || rank == "z" || rank != "x+")) TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(record!.stats.score, closestAverageBlitz.value), verdict: blitzBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageBlitz.key.toUpperCase())}\n", style: TextStyle(
|
else if (record!.gamemode == "blitz" && (rank == null || rank == "z" || rank != "x+")) TextSpan(text: "${t.verdictGeneral(n: readableIntDifference(record!.stats.score, closestAverageBlitz.value), verdict: blitzBetterThanClosestAverage ? t.verdictBetter : t.verdictWorse, rank: closestAverageBlitz.key.toUpperCase())}\n", style: TextStyle(
|
||||||
|
|
Loading…
Reference in New Issue