Added an approach to calculate TJA scores
This commit is contained in:
parent
0061fe6942
commit
36fbdedee8
2
TakoTako.sln.DotSettings
Normal file
2
TakoTako.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=shinuti/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -264,49 +264,91 @@ namespace TJAConvert
|
|||||||
|
|
||||||
foreach (var course in metadata.Courses)
|
foreach (var course in metadata.Courses)
|
||||||
{
|
{
|
||||||
|
var isDouble = course.PlayStyle == TJAMetadata.PlayStyle.Double;
|
||||||
|
var shinuti = EstimateScoreBasedOnNotes(course);
|
||||||
|
|
||||||
//todo figure out the best score?
|
//todo figure out the best score?
|
||||||
switch (course.CourseType)
|
switch (course.CourseType)
|
||||||
{
|
{
|
||||||
case CourseType.Easy:
|
case CourseType.Easy:
|
||||||
musicInfo.starEasy = course.Level;
|
musicInfo.starEasy = course.Level;
|
||||||
musicInfo.shinutiEasy = 10170;
|
musicInfo.scoreEasy = 1000000;
|
||||||
musicInfo.shinutiEasyDuet = 10170;
|
musicInfo.branchEasy = musicInfo.branchEasy || course.IsBranching;
|
||||||
musicInfo.scoreEasy = 360090;
|
if (isDouble)
|
||||||
musicInfo.branchEasy = course.IsBranching;
|
musicInfo.shinutiEasyDuet = shinuti;
|
||||||
|
else
|
||||||
|
musicInfo.shinutiEasy = shinuti;
|
||||||
break;
|
break;
|
||||||
case CourseType.Normal:
|
case CourseType.Normal:
|
||||||
musicInfo.starNormal = course.Level;
|
musicInfo.starNormal = course.Level;
|
||||||
musicInfo.shinutiNormal = 6010;
|
musicInfo.scoreNormal = 1000000;
|
||||||
musicInfo.shinutiNormalDuet = 6010;
|
musicInfo.branchNormal = musicInfo.branchNormal || course.IsBranching;
|
||||||
musicInfo.scoreNormal = 650150;
|
if (isDouble)
|
||||||
musicInfo.branchNormal = course.IsBranching;
|
musicInfo.shinutiNormalDuet = shinuti;
|
||||||
|
else
|
||||||
|
musicInfo.shinutiNormal = shinuti;
|
||||||
break;
|
break;
|
||||||
case CourseType.Hard:
|
case CourseType.Hard:
|
||||||
musicInfo.starHard = course.Level;
|
musicInfo.starHard = course.Level;
|
||||||
musicInfo.shinutiHard = 3010;
|
musicInfo.scoreHard = 1000000;
|
||||||
musicInfo.shinutiHardDuet = 3010;
|
musicInfo.branchHard = musicInfo.branchHard || course.IsBranching;
|
||||||
musicInfo.scoreHard = 800210;
|
if (isDouble)
|
||||||
musicInfo.branchHard = course.IsBranching;
|
musicInfo.shinutiHardDuet = shinuti;
|
||||||
|
else
|
||||||
|
musicInfo.shinutiHard = shinuti;
|
||||||
break;
|
break;
|
||||||
case CourseType.Oni:
|
case CourseType.Oni:
|
||||||
musicInfo.starMania = course.Level;
|
musicInfo.starMania = course.Level;
|
||||||
musicInfo.shinutiMania = 1000;
|
musicInfo.scoreMania = 1000000;
|
||||||
musicInfo.shinutiManiaDuet = 1000;
|
musicInfo.branchMania = musicInfo.branchMania || course.IsBranching;
|
||||||
musicInfo.scoreMania = 10000;
|
if (isDouble)
|
||||||
musicInfo.branchMania = course.IsBranching;
|
musicInfo.shinutiManiaDuet = shinuti;
|
||||||
|
else
|
||||||
|
musicInfo.shinutiMania = shinuti;
|
||||||
break;
|
break;
|
||||||
case CourseType.UraOni:
|
case CourseType.UraOni:
|
||||||
musicInfo.starUra = course.Level;
|
musicInfo.starUra = course.Level;
|
||||||
musicInfo.shinutiUra = 1000;
|
musicInfo.scoreUra = 1000000;
|
||||||
musicInfo.shinutiUraDuet = 1000;
|
musicInfo.branchUra = musicInfo.branchUra || course.IsBranching;
|
||||||
musicInfo.scoreUra = 10000;
|
if (isDouble)
|
||||||
musicInfo.branchUra = course.IsBranching;
|
musicInfo.shinutiUraDuet = shinuti;
|
||||||
|
else
|
||||||
|
musicInfo.shinutiUra = shinuti;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// make sure each course as a score
|
||||||
|
if (musicInfo.shinutiEasy == 0)
|
||||||
|
musicInfo.shinutiEasy = musicInfo.shinutiEasyDuet != 0 ? musicInfo.shinutiEasyDuet : 7352;
|
||||||
|
if (musicInfo.shinutiNormal == 0)
|
||||||
|
musicInfo.shinutiNormal = musicInfo.shinutiNormalDuet != 0 ? musicInfo.shinutiNormalDuet : 4830;
|
||||||
|
if (musicInfo.shinutiHard == 0)
|
||||||
|
musicInfo.shinutiHard = musicInfo.shinutiHardDuet != 0 ? musicInfo.shinutiHardDuet : 3144;
|
||||||
|
if (musicInfo.shinutiMania == 0)
|
||||||
|
musicInfo.shinutiMania = musicInfo.shinutiManiaDuet != 0 ? musicInfo.shinutiManiaDuet : 2169;
|
||||||
|
if (musicInfo.shinutiUra == 0)
|
||||||
|
musicInfo.shinutiUra = musicInfo.shinutiUraDuet != 0 ? musicInfo.shinutiUraDuet : 1420;
|
||||||
|
|
||||||
|
if (musicInfo.shinutiEasyDuet == 0)
|
||||||
|
musicInfo.shinutiEasyDuet = musicInfo.shinutiEasy;
|
||||||
|
if (musicInfo.shinutiNormalDuet == 0)
|
||||||
|
musicInfo.shinutiNormalDuet = musicInfo.shinutiNormal;
|
||||||
|
if (musicInfo.shinutiHardDuet == 0)
|
||||||
|
musicInfo.shinutiHardDuet = musicInfo.shinutiHard;
|
||||||
|
if (musicInfo.shinutiManiaDuet == 0)
|
||||||
|
musicInfo.shinutiManiaDuet = musicInfo.shinutiMania;
|
||||||
|
if (musicInfo.shinutiUraDuet == 0)
|
||||||
|
musicInfo.shinutiUraDuet = musicInfo.shinutiUra;
|
||||||
|
|
||||||
|
int EstimateScoreBasedOnNotes(TJAMetadata.Course course)
|
||||||
|
{
|
||||||
|
return Math.Max(1, 1000000 / course.EstimatedNotes);
|
||||||
|
}
|
||||||
|
|
||||||
var json = JsonConvert.SerializeObject(musicInfo, Formatting.Indented);
|
var json = JsonConvert.SerializeObject(musicInfo, Formatting.Indented);
|
||||||
File.WriteAllText($"{outputPath}/data.json", json);
|
File.WriteAllText($"{outputPath}/data.json", json);
|
||||||
return true;
|
return true;
|
||||||
@ -1138,4 +1180,4 @@ namespace TJAConvert
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,9 +160,7 @@ internal class TJAMetadata
|
|||||||
|
|
||||||
currentCourse.SongDataIndexEnd = courseStartIndex;
|
currentCourse.SongDataIndexEnd = courseStartIndex;
|
||||||
|
|
||||||
if (newContent)
|
// is this branching?
|
||||||
Courses.Add(currentCourse);
|
|
||||||
|
|
||||||
for (int i = currentCourse.SongDataIndexStart; i < currentCourse.SongDataIndexEnd; i++)
|
for (int i = currentCourse.SongDataIndexStart; i < currentCourse.SongDataIndexEnd; i++)
|
||||||
{
|
{
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
@ -173,6 +171,52 @@ internal class TJAMetadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate roughly the amount of song notes in this course
|
||||||
|
int noteCount = 0;
|
||||||
|
int branchNoteCount = 0;
|
||||||
|
int branches = 0;
|
||||||
|
bool inBranch = false;
|
||||||
|
for (int i = currentCourse.SongDataIndexStart; i < currentCourse.SongDataIndexEnd; i++)
|
||||||
|
{
|
||||||
|
var line = lines[i].Trim();
|
||||||
|
|
||||||
|
if (line.Equals("#N", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| line.Equals("#E", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| line.Equals("#M", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
branches++;
|
||||||
|
|
||||||
|
var branchStart = line.StartsWith("#BRANCHSTART", StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
if (inBranch && (branchStart || line.StartsWith("#BRANCHEND", StringComparison.InvariantCultureIgnoreCase)))
|
||||||
|
{
|
||||||
|
noteCount += branchNoteCount / Math.Max(1, branches);
|
||||||
|
inBranch = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inBranch && branchStart)
|
||||||
|
{
|
||||||
|
inBranch = true;
|
||||||
|
branchNoteCount = 0;
|
||||||
|
branches = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!line.EndsWith(","))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var notes = line.Count(x => x is '1' or '2' or '3' or '4');
|
||||||
|
if (inBranch)
|
||||||
|
branchNoteCount += notes;
|
||||||
|
else
|
||||||
|
noteCount += notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentCourse.PlayStyle == PlayStyle.Double)
|
||||||
|
currentCourse.EstimatedNotes = noteCount / 2;
|
||||||
|
else
|
||||||
|
currentCourse.EstimatedNotes = noteCount;
|
||||||
|
|
||||||
|
if (newContent)
|
||||||
|
Courses.Add(currentCourse);
|
||||||
|
|
||||||
// duplicate the existing course
|
// duplicate the existing course
|
||||||
currentCourse = new Course(currentCourse);
|
currentCourse = new Course(currentCourse);
|
||||||
// find the next start
|
// find the next start
|
||||||
@ -241,8 +285,6 @@ internal class TJAMetadata
|
|||||||
|
|
||||||
return CourseType.UraOni;
|
return CourseType.UraOni;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public const string TJAFieldRegexTemplate = "^{0}:\\s*(?<VALUE>.*?)\\s*$";
|
public const string TJAFieldRegexTemplate = "^{0}:\\s*(?<VALUE>.*?)\\s*$";
|
||||||
@ -290,6 +332,8 @@ internal class TJAMetadata
|
|||||||
public int SongDataIndexStart;
|
public int SongDataIndexStart;
|
||||||
public int SongDataIndexEnd;
|
public int SongDataIndexEnd;
|
||||||
|
|
||||||
|
public int EstimatedNotes = 0;
|
||||||
|
|
||||||
public Course()
|
public Course()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user