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)
|
||||
{
|
||||
var isDouble = course.PlayStyle == TJAMetadata.PlayStyle.Double;
|
||||
var shinuti = EstimateScoreBasedOnNotes(course);
|
||||
|
||||
//todo figure out the best score?
|
||||
switch (course.CourseType)
|
||||
{
|
||||
case CourseType.Easy:
|
||||
musicInfo.starEasy = course.Level;
|
||||
musicInfo.shinutiEasy = 10170;
|
||||
musicInfo.shinutiEasyDuet = 10170;
|
||||
musicInfo.scoreEasy = 360090;
|
||||
musicInfo.branchEasy = course.IsBranching;
|
||||
musicInfo.scoreEasy = 1000000;
|
||||
musicInfo.branchEasy = musicInfo.branchEasy || course.IsBranching;
|
||||
if (isDouble)
|
||||
musicInfo.shinutiEasyDuet = shinuti;
|
||||
else
|
||||
musicInfo.shinutiEasy = shinuti;
|
||||
break;
|
||||
case CourseType.Normal:
|
||||
musicInfo.starNormal = course.Level;
|
||||
musicInfo.shinutiNormal = 6010;
|
||||
musicInfo.shinutiNormalDuet = 6010;
|
||||
musicInfo.scoreNormal = 650150;
|
||||
musicInfo.branchNormal = course.IsBranching;
|
||||
musicInfo.scoreNormal = 1000000;
|
||||
musicInfo.branchNormal = musicInfo.branchNormal || course.IsBranching;
|
||||
if (isDouble)
|
||||
musicInfo.shinutiNormalDuet = shinuti;
|
||||
else
|
||||
musicInfo.shinutiNormal = shinuti;
|
||||
break;
|
||||
case CourseType.Hard:
|
||||
musicInfo.starHard = course.Level;
|
||||
musicInfo.shinutiHard = 3010;
|
||||
musicInfo.shinutiHardDuet = 3010;
|
||||
musicInfo.scoreHard = 800210;
|
||||
musicInfo.branchHard = course.IsBranching;
|
||||
musicInfo.scoreHard = 1000000;
|
||||
musicInfo.branchHard = musicInfo.branchHard || course.IsBranching;
|
||||
if (isDouble)
|
||||
musicInfo.shinutiHardDuet = shinuti;
|
||||
else
|
||||
musicInfo.shinutiHard = shinuti;
|
||||
break;
|
||||
case CourseType.Oni:
|
||||
musicInfo.starMania = course.Level;
|
||||
musicInfo.shinutiMania = 1000;
|
||||
musicInfo.shinutiManiaDuet = 1000;
|
||||
musicInfo.scoreMania = 10000;
|
||||
musicInfo.branchMania = course.IsBranching;
|
||||
musicInfo.scoreMania = 1000000;
|
||||
musicInfo.branchMania = musicInfo.branchMania || course.IsBranching;
|
||||
if (isDouble)
|
||||
musicInfo.shinutiManiaDuet = shinuti;
|
||||
else
|
||||
musicInfo.shinutiMania = shinuti;
|
||||
break;
|
||||
case CourseType.UraOni:
|
||||
musicInfo.starUra = course.Level;
|
||||
musicInfo.shinutiUra = 1000;
|
||||
musicInfo.shinutiUraDuet = 1000;
|
||||
musicInfo.scoreUra = 10000;
|
||||
musicInfo.branchUra = course.IsBranching;
|
||||
musicInfo.scoreUra = 1000000;
|
||||
musicInfo.branchUra = musicInfo.branchUra || course.IsBranching;
|
||||
if (isDouble)
|
||||
musicInfo.shinutiUraDuet = shinuti;
|
||||
else
|
||||
musicInfo.shinutiUra = shinuti;
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
File.WriteAllText($"{outputPath}/data.json", json);
|
||||
return true;
|
||||
|
@ -160,9 +160,7 @@ internal class TJAMetadata
|
||||
|
||||
currentCourse.SongDataIndexEnd = courseStartIndex;
|
||||
|
||||
if (newContent)
|
||||
Courses.Add(currentCourse);
|
||||
|
||||
// is this branching?
|
||||
for (int i = currentCourse.SongDataIndexStart; i < currentCourse.SongDataIndexEnd; 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
|
||||
currentCourse = new Course(currentCourse);
|
||||
// find the next start
|
||||
@ -241,8 +285,6 @@ internal class TJAMetadata
|
||||
|
||||
return CourseType.UraOni;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public const string TJAFieldRegexTemplate = "^{0}:\\s*(?<VALUE>.*?)\\s*$";
|
||||
@ -290,6 +332,8 @@ internal class TJAMetadata
|
||||
public int SongDataIndexStart;
|
||||
public int SongDataIndexEnd;
|
||||
|
||||
public int EstimatedNotes = 0;
|
||||
|
||||
public Course()
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user