diff --git a/gradle.properties b/gradle.properties index 904eac9..d92c3b1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ ## Project Configurations # Proj Metadata -projVersion = 0.3 +projVersion = 0.4 # Dependencies diff --git a/sekai-scores-db/gradle.properties b/sekai-scores-db/gradle.properties index 4eafd05..1f25404 100644 --- a/sekai-scores-db/gradle.properties +++ b/sekai-scores-db/gradle.properties @@ -1,4 +1,4 @@ ## Project Configurations # Proj Metadata -moduleVersion = 0.1 +moduleVersion = 0.2 diff --git a/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Nightcord25ji.java b/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Nightcord25ji.java index cc52dd3..48315ea 100644 --- a/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Nightcord25ji.java +++ b/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Nightcord25ji.java @@ -5,36 +5,41 @@ import cc.sukazyo.sekai_scores.DifficultiesSekai; import cc.sukazyo.sekai_scores.Song; import cc.sukazyo.sekai_scores.SongUnit; +import static cc.sukazyo.sekai_scores.DifficultiesSekai.*; + public class Nightcord25ji { + /** ... */ public static final Song Keitai_Renwa = new Song( - "携帯恋話", SongUnit.NIGHTCORD_25JI, + 61, "携帯恋話", SongUnit.NIGHTCORD_25JI, new DifficultiesSekai( - new Difficulty( 8, 204), - new Difficulty(12, 361), - new Difficulty(18, 651), - new Difficulty(25, 981), - new Difficulty(29, 1131) + new Difficulty( EASY_NAME, 8, 204), + new Difficulty(NORMAL_NAME, 12, 361), + new Difficulty( HARD_NAME, 18, 651), + new Difficulty(EXPERT_NAME, 25, 981), + new Difficulty(MASTER_NAME, 29, 1131) ) ); + /** ... */ public static final Song Kuyamu_to_Kaite_Mirai = new Song( - "悔やむと書いてミライ", SongUnit.NIGHTCORD_25JI, + 60, "悔やむと書いてミライ", SongUnit.NIGHTCORD_25JI, new DifficultiesSekai( - new Difficulty( 8, 190), - new Difficulty(13, 440), - new Difficulty(17, 541), - new Difficulty(26, 815), - new Difficulty(30, 973) + new Difficulty( EASY_NAME, 8, 190), + new Difficulty(NORMAL_NAME,13, 440), + new Difficulty( HARD_NAME,17, 541), + new Difficulty(EXPERT_NAME,26, 815), + new Difficulty(MASTER_NAME,30, 973) ) ); + /** ... */ public static final Song ID_SMILE = new Song( - "アイディスマイル", SongUnit.NIGHTCORD_25JI, + 116, "アイディスマイル", SongUnit.NIGHTCORD_25JI, new DifficultiesSekai( - new Difficulty( 7, 263), - new Difficulty(12, 439), - new Difficulty(17, 703), - new Difficulty(25, 985), - new Difficulty(28, 1247) + new Difficulty( EASY_NAME, 7, 263), + new Difficulty(NORMAL_NAME,12, 439), + new Difficulty( HARD_NAME,17, 703), + new Difficulty(EXPERT_NAME,25, 985), + new Difficulty(MASTER_NAME,28, 1247) ) ); diff --git a/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Other.java b/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Other.java index eacdb2a..af5caa0 100644 --- a/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Other.java +++ b/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/Other.java @@ -5,26 +5,31 @@ import cc.sukazyo.sekai_scores.DifficultiesSekai; import cc.sukazyo.sekai_scores.Song; import cc.sukazyo.sekai_scores.SongUnit; +import static cc.sukazyo.sekai_scores.DifficultiesSekai.*; + public class Other { + + /** ... */ public static final Song Dont_Fight_the_Music = new Song( - "Don't Fight The Music", SongUnit.OTHER, + 164, "Don't Fight The Music", SongUnit.OTHER, new DifficultiesSekai( - new Difficulty( 9, 520), - new Difficulty(15, 701), - new Difficulty(23, 1175), - new Difficulty(30, 1545), - new Difficulty(36, 1888) + new Difficulty( EASY_NAME, 9, 520), + new Difficulty(NORMAL_NAME,15, 701), + new Difficulty( HARD_NAME,23, 1175), + new Difficulty(EXPERT_NAME,30, 1545), + new Difficulty(MASTER_NAME,36, 1888) ) ); + /** ... */ public static final Song Tokugawa_Kappu_Nuudoru_Kinshirei = new Song( - "徳川カップヌードル禁止令", SongUnit.OTHER, + 234, "徳川カップヌードル禁止令", SongUnit.OTHER, new DifficultiesSekai( - new Difficulty( 8, 264), - new Difficulty(13, 498), - new Difficulty(19, 758), - new Difficulty(27, 1065), - new Difficulty(31, 1241) + new Difficulty( EASY_NAME, 8, 264), + new Difficulty(NORMAL_NAME,13, 498), + new Difficulty( HARD_NAME,19, 758), + new Difficulty(EXPERT_NAME,27, 1065), + new Difficulty(MASTER_NAME,31, 1241) ) ); diff --git a/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/SekaiSpecial.java b/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/SekaiSpecial.java index 80f23a0..9527482 100644 --- a/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/SekaiSpecial.java +++ b/sekai-scores-db/src/main/java/cc/sukazyo/sekai_scores/db/project_sekai_colorful_stage/SekaiSpecial.java @@ -5,26 +5,41 @@ import cc.sukazyo.sekai_scores.DifficultiesSekai; import cc.sukazyo.sekai_scores.Song; import cc.sukazyo.sekai_scores.SongUnit; +import static cc.sukazyo.sekai_scores.DifficultiesSekai.*; + public class SekaiSpecial { - public static final Song Gunjou_Sanka = new Song( - "群青讃歌", SongUnit.SP, + /** ... */ + public static final Song Yoru_ni_Kakeru = new Song( + 139, "夜に駆ける", SongUnit.SP, new DifficultiesSekai( - new Difficulty( 7, 199), - new Difficulty(13, 344), - new Difficulty(17, 475), - new Difficulty(24, 711), - new Difficulty(27, 833) + new Difficulty( EASY_NAME, 6, 182), + new Difficulty(NORMAL_NAME,11, 357), + new Difficulty( HARD_NAME,18, 594), + new Difficulty(EXPERT_NAME,25, 932), + new Difficulty(MASTER_NAME,29, 1140) ) ); - public static final Song Journey = new Song( - "Journey", SongUnit.SP, + /** ... */ + public static final Song Gunjou_Sanka = new Song( + 141, "群青讃歌", SongUnit.SP, new DifficultiesSekai( - new Difficulty( 6, 199), - new Difficulty(12, 512), - new Difficulty(18, 922), - new Difficulty(25, 1285), - new Difficulty(28, 1322) + new Difficulty( EASY_NAME, 7, 199), + new Difficulty(NORMAL_NAME,13, 344), + new Difficulty( HARD_NAME,17, 475), + new Difficulty(EXPERT_NAME,24, 711), + new Difficulty(MASTER_NAME,27, 833) + ) + ); + /** ... */ + public static final Song Journey = new Song( + 235, "Journey", SongUnit.SP, + new DifficultiesSekai( + new Difficulty( EASY_NAME, 6, 199), + new Difficulty(NORMAL_NAME,12, 512), + new Difficulty( HARD_NAME,18, 922), + new Difficulty(EXPERT_NAME,25, 1285), + new Difficulty(MASTER_NAME,28, 1322) ) ); diff --git a/src/main/java/cc/sukazyo/sekai_scores/Difficulties.java b/src/main/java/cc/sukazyo/sekai_scores/Difficulties.java index da73b5f..2e6c380 100644 --- a/src/main/java/cc/sukazyo/sekai_scores/Difficulties.java +++ b/src/main/java/cc/sukazyo/sekai_scores/Difficulties.java @@ -1,10 +1,10 @@ package cc.sukazyo.sekai_scores; import javax.annotation.Nonnull; -import java.util.function.BiConsumer; +import java.util.function.Consumer; public interface Difficulties { - void forEach(@Nonnull BiConsumer action); + void forEach(@Nonnull Consumer action); } diff --git a/src/main/java/cc/sukazyo/sekai_scores/DifficultiesSekai.java b/src/main/java/cc/sukazyo/sekai_scores/DifficultiesSekai.java index 946fe81..416038c 100644 --- a/src/main/java/cc/sukazyo/sekai_scores/DifficultiesSekai.java +++ b/src/main/java/cc/sukazyo/sekai_scores/DifficultiesSekai.java @@ -1,7 +1,7 @@ package cc.sukazyo.sekai_scores; import javax.annotation.Nonnull; -import java.util.function.BiConsumer; +import java.util.function.Consumer; public record DifficultiesSekai( @Nonnull Difficulty easy, @@ -18,24 +18,20 @@ public record DifficultiesSekai( public static final String MASTER_NAME = "MASTER"; @Override - public void forEach (@Nonnull BiConsumer action) { - action.accept(EASY_NAME, easy); - action.accept(NORMAL_NAME, normal); - action.accept(HARD_NAME, hard); - action.accept(EXPERT_NAME, expert); - action.accept(MASTER_NAME, master); + public void forEach (@Nonnull Consumer action) { + action.accept(easy); + action.accept(normal); + action.accept(hard); + action.accept(expert); + action.accept(master); } @Override @Nonnull public String toString() { return String.format( - "[{\"id\":\"%s\",%s},{\"id\":\"%s\",%s},{\"id\":\"%s\",%s},{\"id\":\"%s\",%s},{\"id\":\"%s\",%s}]", - EASY_NAME, easy.toStringSimple(), - NORMAL_NAME, normal.toStringSimple(), - HARD_NAME, hard.toStringSimple(), - EXPERT_NAME, expert.toStringSimple(), - MASTER_NAME, master.toStringSimple() + "[%s,%s,%s,%s,%s]", + easy,normal,hard,expert,master ); } diff --git a/src/main/java/cc/sukazyo/sekai_scores/Difficulty.java b/src/main/java/cc/sukazyo/sekai_scores/Difficulty.java index 4cab80c..292d65a 100644 --- a/src/main/java/cc/sukazyo/sekai_scores/Difficulty.java +++ b/src/main/java/cc/sukazyo/sekai_scores/Difficulty.java @@ -1,13 +1,21 @@ package cc.sukazyo.sekai_scores; +import cc.sukazyo.sekai_scores.util.Converter; + import javax.annotation.Nonnegative; import javax.annotation.Nonnull; public record Difficulty( + @Nonnegative String id, @Nonnegative int level, @Nonnegative int noteCount ) { + /** + * @since 0.4 + */ + @Nonnull public String id () { return id; } + /** * The difficulty number of this difficulty map. *

@@ -37,8 +45,8 @@ public record Difficulty( @Nonnull public String toStringSimple () { return String.format( - "\"difficulty\":%d,\"notes\":%d", - level, noteCount + "\"id\":%s,\"difficulty\":%d,\"notes\":%d", + Converter.parseJSONString(id), level, noteCount ); } diff --git a/src/main/java/cc/sukazyo/sekai_scores/Song.java b/src/main/java/cc/sukazyo/sekai_scores/Song.java index 744051f..791f6a1 100644 --- a/src/main/java/cc/sukazyo/sekai_scores/Song.java +++ b/src/main/java/cc/sukazyo/sekai_scores/Song.java @@ -5,6 +5,7 @@ import cc.sukazyo.sekai_scores.util.Converter; import javax.annotation.Nonnull; public record Song( + int id, @Nonnull String name, @Nonnull SongUnit unit, @Nonnull Difficulties difficulties @@ -14,7 +15,8 @@ public record Song( @Nonnull public String toString () { return String.format( - "{\"name\":\"%s\",\"unit\":%s,\"difficulties\":%s}", + "{\"id\":%d,\"name\":%s,\"unit\":%s,\"difficulties\":%s}", + id, Converter.parseJSONString(name), unit, difficulties diff --git a/src/main/java/cc/sukazyo/sekai_scores/SongUnit.java b/src/main/java/cc/sukazyo/sekai_scores/SongUnit.java index 756d9f0..6e588da 100644 --- a/src/main/java/cc/sukazyo/sekai_scores/SongUnit.java +++ b/src/main/java/cc/sukazyo/sekai_scores/SongUnit.java @@ -55,7 +55,7 @@ public enum SongUnit { @Nonnull public String toString() { return String.format( - "{\"id\":%d,\"fullname\":\"%s\"}", + "{\"id\":%d,\"fullname\":%s}", id, Converter.parseJSONString(name) ); diff --git a/src/main/java/cc/sukazyo/sekai_scores/util/Converter.java b/src/main/java/cc/sukazyo/sekai_scores/util/Converter.java index aa22aff..1309a9c 100644 --- a/src/main/java/cc/sukazyo/sekai_scores/util/Converter.java +++ b/src/main/java/cc/sukazyo/sekai_scores/util/Converter.java @@ -1,12 +1,14 @@ package cc.sukazyo.sekai_scores.util; import javax.annotation.Nonnull; +import javax.annotation.Nullable; public class Converter { @Nonnull - public static String parseJSONString (@Nonnull String input) { - return input.replaceAll("'", "\\'").replaceAll("\"", "\\\""); + public static String parseJSONString (@Nullable String input) { + if (input == null) return "null"; + return "\"" + input.replaceAll("\\\\", "\\\\\\\\").replaceAll("\"", "\\\\\"") + "\""; } }