1
0
mirror of synced 2024-11-23 22:41:01 +01:00

Merge pull request #20 from asesidaa/CHN

Merge from TaikoLocalServer-CHN repo
This commit is contained in:
asesidaa 2023-10-16 17:42:53 +08:00 committed by GitHub
commit 05e43bfd2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
844 changed files with 10284 additions and 5356 deletions

View File

@ -4,7 +4,7 @@ namespace GameDatabase.Entities;
public class AiScoreDatum
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint SongId { get; set; }

View File

@ -4,7 +4,7 @@ namespace GameDatabase.Entities;
public class AiSectionScoreDatum
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint SongId { get; set; }

View File

@ -3,6 +3,8 @@
public partial class Card
{
public string AccessCode { get; set; } = null!;
public uint Baid { get; set; }
public ulong Baid { get; set; }
public string Password { get; set; } = null!;
public string Salt { get; set; } = null!;
}
}

View File

@ -4,7 +4,7 @@ namespace GameDatabase.Entities;
public class DanScoreDatum
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint DanId { get; set; }
public uint ArrivalSongCount { get; set; }
public uint SoulGaugeTotal { get; set; }

View File

@ -2,7 +2,7 @@
public class DanStageScoreDatum
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint DanId { get; set; }

View File

@ -4,7 +4,7 @@ namespace GameDatabase.Entities
{
public partial class SongBestDatum
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint SongId { get; set; }
public Difficulty Difficulty { get; set; }
public uint BestScore { get; set; }

View File

@ -5,7 +5,7 @@ namespace GameDatabase.Entities
public partial class SongPlayDatum
{
public long Id { get; set; }
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint SongNumber { get; set; }

View File

@ -4,8 +4,9 @@ namespace GameDatabase.Entities
{
public partial class UserDatum
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public string MyDonName { get; set; } = string.Empty;
public uint MyDonNameLanguage { get; set; }
public string Title { get; set; } = string.Empty;
public uint TitlePlateId { get; set; }
public string FavoriteSongsArray { get; set; } = "[]";
@ -17,18 +18,21 @@ namespace GameDatabase.Entities
public int NotesPosition { get; set; }
public bool IsVoiceOn { get; set; }
public bool IsSkipOn { get; set; }
public string DifficultyPlayedArray { get; set; } = "[]";
public string DifficultySettingArray { get; set; } = "[]";
public uint SelectedToneId { get; set; }
public DateTime LastPlayDatetime { get; set; }
public uint LastPlayMode { get; set; }
public uint ColorBody { get; set; }
public uint ColorFace { get; set; }
public uint ColorLimb { get; set; }
public string CostumeData { get; set; } = "[[],[],[],[],[]]";
public string CostumeData { get; set; } = "[]";
public bool DisplayDan { get; set; }
public bool DisplayAchievement { get; set; }
public Difficulty AchievementDisplayDifficulty { get; set; }
public int AiWinCount { get; set; }
public string TokenCountDict { get; set; } = "{}";
public string UnlockedSongIdList { get; set; } = "[]";
public virtual Card? Ba { get; set; }
}
}

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>
@ -11,9 +12,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-rc.1.22426.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-rc.1.22426.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-rc.1.22426.7">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.1.23419.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.1.23419.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -0,0 +1,443 @@
// <auto-generated />
using System;
using GameDatabase.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace TaikoLocalServer.Migrations
{
[DbContext(typeof(TaikoDbContext))]
[Migration("20230916161613_AddTokenCountDictAndUnlockedSongIdListToUserdata")]
partial class AddTokenCountDictAndUnlockedSongIdListToUserdata
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.0-rc.1.22426.7");
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("AiScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<int>("SectionIndex")
.HasColumnType("INTEGER");
b.Property<int>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty", "SectionIndex");
b.ToTable("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.Card", b =>
{
b.Property<string>("AccessCode")
.HasColumnType("TEXT");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.HasKey("AccessCode");
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
.IsUnique();
b.ToTable("Card", (string)null);
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("ArrivalSongCount")
.HasColumnType("INTEGER");
b.Property<uint>("ClearState")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0u);
b.Property<uint>("ComboCountTotal")
.HasColumnType("INTEGER");
b.Property<uint>("SoulGaugeTotal")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId");
b.ToTable("DanScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.Property<uint>("BadCount")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HighScore")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("PlayScore")
.HasColumnType("INTEGER");
b.Property<uint>("TotalHitCount")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId", "SongNumber");
b.ToTable("DanStageScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("BestCrown")
.HasColumnType("INTEGER");
b.Property<uint>("BestRate")
.HasColumnType("INTEGER");
b.Property<uint>("BestScore")
.HasColumnType("INTEGER");
b.Property<uint>("BestScoreRank")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("SongBestData");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HitCount")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<DateTime>("PlayTime")
.HasColumnType("datetime");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRank")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRate")
.HasColumnType("INTEGER");
b.Property<bool>("Skipped")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Baid");
b.ToTable("SongPlayData");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("AchievementDisplayDifficulty")
.HasColumnType("INTEGER");
b.Property<int>("AiWinCount")
.HasColumnType("INTEGER");
b.Property<uint>("ColorBody")
.HasColumnType("INTEGER");
b.Property<uint>("ColorFace")
.HasColumnType("INTEGER");
b.Property<uint>("ColorLimb")
.HasColumnType("INTEGER");
b.Property<string>("CostumeData")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("CostumeFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("DisplayAchievement")
.HasColumnType("INTEGER");
b.Property<bool>("DisplayDan")
.HasColumnType("INTEGER");
b.Property<string>("FavoriteSongsArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("GenericInfoFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsSkipOn")
.HasColumnType("INTEGER");
b.Property<bool>("IsVoiceOn")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastPlayDatetime")
.HasColumnType("datetime");
b.Property<uint>("LastPlayMode")
.HasColumnType("INTEGER");
b.Property<string>("MyDonName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("NotesPosition")
.HasColumnType("INTEGER");
b.Property<short>("OptionSetting")
.HasColumnType("INTEGER");
b.Property<uint>("SelectedToneId")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("TitleFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("TitlePlateId")
.HasColumnType("INTEGER");
b.Property<string>("TokenCountDict")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ToneFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UnlockedSongIdList")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Baid");
b.ToTable("UserData");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.AiScoreDatum", "Parent")
.WithMany("AiSectionScoreData")
.HasForeignKey("Baid", "SongId", "Difficulty")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
.WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Navigation("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Navigation("DanStageScoreData");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaikoLocalServer.Migrations
{
/// <inheritdoc />
public partial class AddTokenCountDictAndUnlockedSongIdListToUserdata : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "TokenCountDict",
table: "UserData",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "UnlockedSongIdList",
table: "UserData",
type: "TEXT",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TokenCountDict",
table: "UserData");
migrationBuilder.DropColumn(
name: "UnlockedSongIdList",
table: "UserData");
}
}
}

View File

@ -0,0 +1,451 @@
// <auto-generated />
using System;
using GameDatabase.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace TaikoLocalServer.Migrations
{
[DbContext(typeof(TaikoDbContext))]
[Migration("20230918052543_AddDifficultyPlayedArrayAndDifficultySettingArrayToUserData")]
partial class AddDifficultyPlayedArrayAndDifficultySettingArrayToUserData
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.0-rc.1.22426.7");
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("AiScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<int>("SectionIndex")
.HasColumnType("INTEGER");
b.Property<int>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty", "SectionIndex");
b.ToTable("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.Card", b =>
{
b.Property<string>("AccessCode")
.HasColumnType("TEXT");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.HasKey("AccessCode");
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
.IsUnique();
b.ToTable("Card", (string)null);
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("ArrivalSongCount")
.HasColumnType("INTEGER");
b.Property<uint>("ClearState")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0u);
b.Property<uint>("ComboCountTotal")
.HasColumnType("INTEGER");
b.Property<uint>("SoulGaugeTotal")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId");
b.ToTable("DanScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.Property<uint>("BadCount")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HighScore")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("PlayScore")
.HasColumnType("INTEGER");
b.Property<uint>("TotalHitCount")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId", "SongNumber");
b.ToTable("DanStageScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("BestCrown")
.HasColumnType("INTEGER");
b.Property<uint>("BestRate")
.HasColumnType("INTEGER");
b.Property<uint>("BestScore")
.HasColumnType("INTEGER");
b.Property<uint>("BestScoreRank")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("SongBestData");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HitCount")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<DateTime>("PlayTime")
.HasColumnType("datetime");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRank")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRate")
.HasColumnType("INTEGER");
b.Property<bool>("Skipped")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Baid");
b.ToTable("SongPlayData");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("AchievementDisplayDifficulty")
.HasColumnType("INTEGER");
b.Property<int>("AiWinCount")
.HasColumnType("INTEGER");
b.Property<uint>("ColorBody")
.HasColumnType("INTEGER");
b.Property<uint>("ColorFace")
.HasColumnType("INTEGER");
b.Property<uint>("ColorLimb")
.HasColumnType("INTEGER");
b.Property<string>("CostumeData")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("CostumeFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultyPlayedArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultySettingArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("DisplayAchievement")
.HasColumnType("INTEGER");
b.Property<bool>("DisplayDan")
.HasColumnType("INTEGER");
b.Property<string>("FavoriteSongsArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("GenericInfoFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsSkipOn")
.HasColumnType("INTEGER");
b.Property<bool>("IsVoiceOn")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastPlayDatetime")
.HasColumnType("datetime");
b.Property<uint>("LastPlayMode")
.HasColumnType("INTEGER");
b.Property<string>("MyDonName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("NotesPosition")
.HasColumnType("INTEGER");
b.Property<short>("OptionSetting")
.HasColumnType("INTEGER");
b.Property<uint>("SelectedToneId")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("TitleFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("TitlePlateId")
.HasColumnType("INTEGER");
b.Property<string>("TokenCountDict")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ToneFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UnlockedSongIdList")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Baid");
b.ToTable("UserData");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.AiScoreDatum", "Parent")
.WithMany("AiSectionScoreData")
.HasForeignKey("Baid", "SongId", "Difficulty")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
.WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Navigation("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Navigation("DanStageScoreData");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaikoLocalServer.Migrations
{
/// <inheritdoc />
public partial class AddDifficultyPlayedArrayAndDifficultySettingArrayToUserData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DifficultyPlayedArray",
table: "UserData",
type: "TEXT",
nullable: false,
defaultValue: "[]");
migrationBuilder.AddColumn<string>(
name: "DifficultySettingArray",
table: "UserData",
type: "TEXT",
nullable: false,
defaultValue: "[]");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DifficultyPlayedArray",
table: "UserData");
migrationBuilder.DropColumn(
name: "DifficultySettingArray",
table: "UserData");
}
}
}

View File

@ -0,0 +1,454 @@
// <auto-generated />
using System;
using GameDatabase.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace TaikoLocalServer.Migrations
{
[DbContext(typeof(TaikoDbContext))]
[Migration("20230918101009_AddMyDonNameLanguageToUserData")]
partial class AddMyDonNameLanguageToUserData
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.0-rc.1.22426.7");
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("AiScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<int>("SectionIndex")
.HasColumnType("INTEGER");
b.Property<int>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty", "SectionIndex");
b.ToTable("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.Card", b =>
{
b.Property<string>("AccessCode")
.HasColumnType("TEXT");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.HasKey("AccessCode");
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
.IsUnique();
b.ToTable("Card", (string)null);
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("ArrivalSongCount")
.HasColumnType("INTEGER");
b.Property<uint>("ClearState")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0u);
b.Property<uint>("ComboCountTotal")
.HasColumnType("INTEGER");
b.Property<uint>("SoulGaugeTotal")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId");
b.ToTable("DanScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.Property<uint>("BadCount")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HighScore")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("PlayScore")
.HasColumnType("INTEGER");
b.Property<uint>("TotalHitCount")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId", "SongNumber");
b.ToTable("DanStageScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("BestCrown")
.HasColumnType("INTEGER");
b.Property<uint>("BestRate")
.HasColumnType("INTEGER");
b.Property<uint>("BestScore")
.HasColumnType("INTEGER");
b.Property<uint>("BestScoreRank")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("SongBestData");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HitCount")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<DateTime>("PlayTime")
.HasColumnType("datetime");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRank")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRate")
.HasColumnType("INTEGER");
b.Property<bool>("Skipped")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Baid");
b.ToTable("SongPlayData");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("AchievementDisplayDifficulty")
.HasColumnType("INTEGER");
b.Property<int>("AiWinCount")
.HasColumnType("INTEGER");
b.Property<uint>("ColorBody")
.HasColumnType("INTEGER");
b.Property<uint>("ColorFace")
.HasColumnType("INTEGER");
b.Property<uint>("ColorLimb")
.HasColumnType("INTEGER");
b.Property<string>("CostumeData")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("CostumeFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultyPlayedArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultySettingArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("DisplayAchievement")
.HasColumnType("INTEGER");
b.Property<bool>("DisplayDan")
.HasColumnType("INTEGER");
b.Property<string>("FavoriteSongsArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("GenericInfoFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsSkipOn")
.HasColumnType("INTEGER");
b.Property<bool>("IsVoiceOn")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastPlayDatetime")
.HasColumnType("datetime");
b.Property<uint>("LastPlayMode")
.HasColumnType("INTEGER");
b.Property<string>("MyDonName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("MyDonNameLanguage")
.HasColumnType("INTEGER");
b.Property<int>("NotesPosition")
.HasColumnType("INTEGER");
b.Property<short>("OptionSetting")
.HasColumnType("INTEGER");
b.Property<uint>("SelectedToneId")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("TitleFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("TitlePlateId")
.HasColumnType("INTEGER");
b.Property<string>("TokenCountDict")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ToneFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UnlockedSongIdList")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Baid");
b.ToTable("UserData");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.AiScoreDatum", "Parent")
.WithMany("AiSectionScoreData")
.HasForeignKey("Baid", "SongId", "Difficulty")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
.WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Navigation("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Navigation("DanStageScoreData");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaikoLocalServer.Migrations
{
/// <inheritdoc />
public partial class AddMyDonNameLanguageToUserData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<uint>(
name: "MyDonNameLanguage",
table: "UserData",
type: "INTEGER",
nullable: false,
defaultValue: 0u);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MyDonNameLanguage",
table: "UserData");
}
}
}

View File

@ -0,0 +1,462 @@
// <auto-generated />
using System;
using GameDatabase.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace TaikoLocalServer.Migrations
{
[DbContext(typeof(TaikoDbContext))]
[Migration("20230928150650_AddPasswordAndSaltToCard")]
partial class AddPasswordAndSaltToCard
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.0-rc.1.23419.6");
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("AiScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<int>("SectionIndex")
.HasColumnType("INTEGER");
b.Property<int>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<bool>("IsWin")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty", "SectionIndex");
b.ToTable("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.Card", b =>
{
b.Property<string>("AccessCode")
.HasColumnType("TEXT");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Salt")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("AccessCode");
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
.IsUnique();
b.ToTable("Card", (string)null);
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("ArrivalSongCount")
.HasColumnType("INTEGER");
b.Property<uint>("ClearState")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0u);
b.Property<uint>("ComboCountTotal")
.HasColumnType("INTEGER");
b.Property<uint>("SoulGaugeTotal")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId");
b.ToTable("DanScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.Property<uint>("BadCount")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HighScore")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<uint>("PlayScore")
.HasColumnType("INTEGER");
b.Property<uint>("TotalHitCount")
.HasColumnType("INTEGER");
b.HasKey("Baid", "DanId", "SongNumber");
b.ToTable("DanStageScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("BestCrown")
.HasColumnType("INTEGER");
b.Property<uint>("BestRate")
.HasColumnType("INTEGER");
b.Property<uint>("BestScore")
.HasColumnType("INTEGER");
b.Property<uint>("BestScoreRank")
.HasColumnType("INTEGER");
b.HasKey("Baid", "SongId", "Difficulty");
b.ToTable("SongBestData");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
.HasColumnType("INTEGER");
b.Property<uint>("Crown")
.HasColumnType("INTEGER");
b.Property<uint>("Difficulty")
.HasColumnType("INTEGER");
b.Property<uint>("DrumrollCount")
.HasColumnType("INTEGER");
b.Property<uint>("GoodCount")
.HasColumnType("INTEGER");
b.Property<uint>("HitCount")
.HasColumnType("INTEGER");
b.Property<uint>("MissCount")
.HasColumnType("INTEGER");
b.Property<uint>("OkCount")
.HasColumnType("INTEGER");
b.Property<DateTime>("PlayTime")
.HasColumnType("datetime");
b.Property<uint>("Score")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRank")
.HasColumnType("INTEGER");
b.Property<uint>("ScoreRate")
.HasColumnType("INTEGER");
b.Property<bool>("Skipped")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
.HasColumnType("INTEGER");
b.Property<uint>("SongNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Baid");
b.ToTable("SongPlayData");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("AchievementDisplayDifficulty")
.HasColumnType("INTEGER");
b.Property<int>("AiWinCount")
.HasColumnType("INTEGER");
b.Property<uint>("ColorBody")
.HasColumnType("INTEGER");
b.Property<uint>("ColorFace")
.HasColumnType("INTEGER");
b.Property<uint>("ColorLimb")
.HasColumnType("INTEGER");
b.Property<string>("CostumeData")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("CostumeFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultyPlayedArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultySettingArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("DisplayAchievement")
.HasColumnType("INTEGER");
b.Property<bool>("DisplayDan")
.HasColumnType("INTEGER");
b.Property<string>("FavoriteSongsArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("GenericInfoFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsSkipOn")
.HasColumnType("INTEGER");
b.Property<bool>("IsVoiceOn")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastPlayDatetime")
.HasColumnType("datetime");
b.Property<uint>("LastPlayMode")
.HasColumnType("INTEGER");
b.Property<string>("MyDonName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("MyDonNameLanguage")
.HasColumnType("INTEGER");
b.Property<int>("NotesPosition")
.HasColumnType("INTEGER");
b.Property<short>("OptionSetting")
.HasColumnType("INTEGER");
b.Property<uint>("SelectedToneId")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("TitleFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("TitlePlateId")
.HasColumnType("INTEGER");
b.Property<string>("TokenCountDict")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ToneFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UnlockedSongIdList")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Baid");
b.ToTable("UserData");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.AiScoreDatum", "Parent")
.WithMany("AiSectionScoreData")
.HasForeignKey("Baid", "SongId", "Difficulty")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
.WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
});
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Ba");
});
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Navigation("AiSectionScoreData");
});
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Navigation("DanStageScoreData");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaikoLocalServer.Migrations
{
/// <inheritdoc />
public partial class AddPasswordAndSaltToCard : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Password",
table: "Card",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Salt",
table: "Card",
type: "TEXT",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Password",
table: "Card");
migrationBuilder.DropColumn(
name: "Salt",
table: "Card");
}
}
}

View File

@ -15,11 +15,11 @@ namespace TaikoLocalServer.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.0-preview.7.22376.2");
modelBuilder.HasAnnotation("ProductVersion", "8.0.0-rc.1.23419.6");
modelBuilder.Entity("TaikoLocalServer.Entities.AiScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
@ -36,9 +36,9 @@ namespace TaikoLocalServer.Migrations
b.ToTable("AiScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.AiSectionScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
@ -76,14 +76,22 @@ namespace TaikoLocalServer.Migrations
b.ToTable("AiSectionScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.Card", b =>
modelBuilder.Entity("GameDatabase.Entities.Card", b =>
{
b.Property<string>("AccessCode")
.HasColumnType("TEXT");
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Salt")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("AccessCode");
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
@ -92,9 +100,9 @@ namespace TaikoLocalServer.Migrations
b.ToTable("Card", (string)null);
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
@ -119,9 +127,9 @@ namespace TaikoLocalServer.Migrations
b.ToTable("DanScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanStageScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("DanId")
@ -159,9 +167,9 @@ namespace TaikoLocalServer.Migrations
b.ToTable("DanStageScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongBestDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("SongId")
@ -187,13 +195,13 @@ namespace TaikoLocalServer.Migrations
b.ToTable("SongBestData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongPlayDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("ComboCount")
@ -248,9 +256,9 @@ namespace TaikoLocalServer.Migrations
b.ToTable("SongPlayData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.UserDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.Property<uint>("Baid")
b.Property<ulong>("Baid")
.HasColumnType("INTEGER");
b.Property<uint>("AchievementDisplayDifficulty")
@ -276,6 +284,14 @@ namespace TaikoLocalServer.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultyPlayedArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("DifficultySettingArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("DisplayAchievement")
.HasColumnType("INTEGER");
@ -306,6 +322,9 @@ namespace TaikoLocalServer.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<uint>("MyDonNameLanguage")
.HasColumnType("INTEGER");
b.Property<int>("NotesPosition")
.HasColumnType("INTEGER");
@ -326,18 +345,26 @@ namespace TaikoLocalServer.Migrations
b.Property<uint>("TitlePlateId")
.HasColumnType("INTEGER");
b.Property<string>("TokenCountDict")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ToneFlgArray")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("UnlockedSongIdList")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Baid");
b.ToTable("UserData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.AiScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
@ -347,9 +374,9 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.AiSectionScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.AiScoreDatum", "Parent")
b.HasOne("GameDatabase.Entities.AiScoreDatum", "Parent")
.WithMany("AiSectionScoreData")
.HasForeignKey("Baid", "SongId", "Difficulty")
.OnDelete(DeleteBehavior.Cascade)
@ -358,9 +385,9 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Parent");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
@ -370,9 +397,9 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanStageScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.DanScoreDatum", "Parent")
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
.WithMany("DanStageScoreData")
.HasForeignKey("Baid", "DanId")
.OnDelete(DeleteBehavior.Cascade)
@ -381,9 +408,9 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Parent");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongBestDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
@ -393,9 +420,9 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.SongPlayDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
@ -405,9 +432,9 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.UserDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
{
b.HasOne("TaikoLocalServer.Entities.Card", "Ba")
b.HasOne("GameDatabase.Entities.Card", "Ba")
.WithMany()
.HasForeignKey("Baid")
.HasPrincipalKey("Baid")
@ -417,12 +444,12 @@ namespace TaikoLocalServer.Migrations
b.Navigation("Ba");
});
modelBuilder.Entity("TaikoLocalServer.Entities.AiScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
{
b.Navigation("AiSectionScoreData");
});
modelBuilder.Entity("TaikoLocalServer.Entities.DanScoreDatum", b =>
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
{
b.Navigation("DanStageScoreData");
});

View File

@ -2,17 +2,18 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.0.0-beta1</Version>
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JorgeSerrano.Json.JsonSnakeCaseNamingPolicy" Version="0.9.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-rc.1.22426.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-rc.1.22426.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-rc.1.22426.7">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.1.23419.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.1.23419.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -1,13 +1,13 @@
using System.CommandLine;
using System.CommandLine.Parsing;
using System.Text;
using System.Text.Json;
using GameDatabase.Context;
using GameDatabase.Context;
using GameDatabase.Entities;
using ICSharpCode.SharpZipLib.GZip;
using JorgeSerrano.Json;
using LocalSaveModScoreMigrator;
using SharedProject.Enums;
using System.CommandLine;
using System.CommandLine.Parsing;
using System.Text;
using System.Text.Json;
var rootCommand = new RootCommand("Command-line tool to migrate saves from local save mod to local server database.");
@ -52,7 +52,7 @@ var musicInfoArgument = new Option<FileInfo?>(
);
musicInfoArgument.AddAlias("-m");
var baidArgument = new Option<int>(
var baidArgument = new Option<ulong>(
name: "--baid",
description: "Target card's baid, data will be imported to that card",
getDefaultValue: () => 1
@ -69,7 +69,7 @@ rootCommand.SetHandler((saveFile, dbFile, musicInfoFile, baid) => Run(saveFile!,
await rootCommand.InvokeAsync(args);
void Run(FileSystemInfo saveFile, FileSystemInfo dbFile, FileSystemInfo musicInfoFile, int baid)
void Run(FileSystemInfo saveFile, FileSystemInfo dbFile, FileSystemInfo musicInfoFile, ulong baid)
{
using var db = new TaikoDbContext(dbFile.FullName);
var card = db.Cards.FirstOrDefault(card1 => card1.Baid == baid);

View File

@ -4,6 +4,6 @@ public enum PlayMode
{
Normal = 0,
DanMode = 1,
// Not sure about this
GaidenMode = 4,
AiBattle = 6
}

View File

@ -8,6 +8,6 @@ public enum SongGenre
Vocaloid = 3,
GameMusic = 4,
NamcoOriginal = 5,
Variety = 7,
Classical = 8
Variety = 6,
Classical = 7
}

View File

@ -15,4 +15,7 @@ public class EventFolderData
[JsonPropertyName("songNo")]
public uint[]? SongNo { get; set; }
[JsonPropertyName("parentFolderId")]
public uint ParentFolderId { get; set; }
}

View File

@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace SharedProject.Models;
public class MovieData
{
[JsonPropertyName("movie_id")]
public uint MovieId { get; set; }
[JsonPropertyName("enable_days")]
public uint EnableDays { get; set; }
}

View File

@ -0,0 +1,10 @@
using System.Text.Json.Serialization;
namespace SharedProject.Models;
public class QRCodeData
{
[JsonPropertyName("serial")] public string Serial { get; set; } = null!;
[JsonPropertyName("id")] public uint Id { get; set; }
}

View File

@ -2,7 +2,7 @@
public class SetFavoriteRequest
{
public uint Baid { get; set; }
public ulong Baid { get; set; }
public uint SongId { get; set; }
public bool IsFavorite { get; set; }
}

View File

@ -0,0 +1,8 @@
namespace SharedProject.Models.Requests;
public class SetPasswordRequest
{
public string AccessCode { get; set; } = default!;
public string Password { get; set; } = default!;
public string Salt { get; set; } = default!;
}

View File

@ -0,0 +1,10 @@
using System.Text.Json.Serialization;
namespace SharedProject.Models;
public class ShopFolderData
{
[JsonPropertyName("songNo")] public uint SongNo { get; set; }
[JsonPropertyName("price")] public uint Price { get; set; }
}

View File

@ -5,4 +5,8 @@ public class User
public string AccessCode { get; set; } = string.Empty;
public uint Baid { get; set; }
public string Password { get; set; } = string.Empty;
public string Salt { get; set; } = string.Empty;
}

View File

@ -10,6 +10,12 @@ public class UserSetting
public bool IsDisplayDanOnNamePlate { get; set; }
public uint DifficultySettingCourse { get; set; }
public uint DifficultySettingStar { get; set; }
public uint DifficultySettingSort { get; set; }
public bool IsVoiceOn { get; set; }
public bool IsSkipOn { get; set; }
@ -22,6 +28,8 @@ public class UserSetting
public string MyDonName { get; set; } = string.Empty;
public uint MyDonNameLanguage { get; set; }
public string Title { get; set; } = string.Empty;
public uint TitlePlateId { get; set; }

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -1 +1,3 @@
wwwroot/data/music_attribute.json
wwwroot/data/music_order.json
wwwroot/data/musicinfo.json
wwwroot/data/wordlist.json

View File

@ -10,36 +10,10 @@ public static class Constants
public const string DEFAULT_DB_NAME = "taiko.db3";
public const string MUSIC_ATTRIBUTE_FILE_NAME = "music_attribute.json";
public const string MUSIC_ATTRIBUTE_COMPRESSED_FILE_NAME = "music_attribute.bin";
public const string DAN_DATA_FILE_NAME = "dan_data.json";
public const string INTRO_DATA_FILE_NAME = "intro_data.json";
public const string EVENT_FOLDER_DATA_FILE_NAME = "event_folder_data.json";
public static readonly int[] EVENT_FOLDER_IDS = {
1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14
};
public const int MIN_DAN_ID = 1;
public const int MAX_DAN_ID = 19;
public const int TONE_UID_MAX = 19;
public const int TITLE_UID_MAX = 814;
private const int COSTUME_FLAG_1_ARRAY_SIZE = 154;
private const int COSTUME_FLAG_2_ARRAY_SIZE = 140;
private const int COSTUME_FLAG_3_ARRAY_SIZE = 156;
private const int COSTUME_FLAG_4_ARRAY_SIZE = 58;
private const int COSTUME_FLAG_5_ARRAY_SIZE = 129;
public static readonly int[] CostumeFlagArraySizes =
{
COSTUME_FLAG_1_ARRAY_SIZE,
COSTUME_FLAG_2_ARRAY_SIZE,
COSTUME_FLAG_3_ARRAY_SIZE,
COSTUME_FLAG_4_ARRAY_SIZE,
COSTUME_FLAG_5_ARRAY_SIZE
};
public const string MUSIC_INFO_BASE_NAME = "musicinfo";
public const string WORDLIST_BASE_NAME = "wordlist";
public const string MUSIC_ORDER_BASE_NAME = "music_order";
public const string DON_COS_REWARD_BASE_NAME = "don_cos_reward";
public const string SHOUGOU_BASE_NAME = "shougou";
public const string NEIRO_BASE_NAME = "neiro";
}

View File

@ -1,4 +1,5 @@
using System.Collections;
using System.Collections.Immutable;
using System.Collections.Specialized;
using System.Runtime.InteropServices;
using GameDatabase.Entities;
@ -70,7 +71,7 @@ public static class FlagCalculator
return (ushort)(previous | result);
}
public static byte[] ComputeGotDanFlags(List<DanScoreDatum> danScoreData)
public static byte[] ComputeGotDanFlags(List<DanScoreDatum> danScoreData, List<uint> danIdList)
{
var gotDanFlagList = new List<int>();
var gotDanFlag = new BitVector32();
@ -85,9 +86,8 @@ public static class FlagCalculator
var sections = new[] { section1, section2, section3, section4, section5, section6, section7, section8 };
for (var i = Constants.MIN_DAN_ID; i < Constants.MAX_DAN_ID; i++)
foreach (var danId in danIdList)
{
var danId = i;
var flag = 0;
if (danScoreData.Any(datum => datum.DanId == danId))
{
@ -126,4 +126,22 @@ public static class FlagCalculator
return result;
}
public static byte[] GetBitArrayTrue(int bitArraySize)
{
var result = new byte[(bitArraySize / 8) + 1];
var bitSet = new BitArray(bitArraySize, true);
bitSet.CopyTo(result, 0);
return result;
}
public static byte[] GetBitArrayFalse(int bitArraySize)
{
var result = new byte[(bitArraySize / 8) + 1];
var bitSet = new BitArray(bitArraySize, false);
bitSet.CopyTo(result, 0);
return result;
}
}

View File

@ -1,15 +1,39 @@
using System.Text.Json;
using GameDatabase.Entities;
using GameDatabase.Entities;
using System.Text.Json;
namespace TaikoLocalServer.Common.Utils;
public static class JsonHelper
{
public static uint[] GetUIntArrayFromJson(string data, int length, ILogger logger, string fieldName)
{
var array = new uint[length];
try
{
array = JsonSerializer.Deserialize<uint[]>(data);
}
catch (JsonException e)
{
logger.LogError(e, "Parsing {FieldName} json data failed", fieldName);
}
if (array != null && array.Length >= length)
{
return array;
}
logger.LogWarning($"{fieldName} is null or length less than {length}!");
array = new uint[length];
return array;
}
public static List<uint> GetCostumeDataFromUserData(UserDatum userData, ILogger logger)
{
var costumeData = new List<uint> { 0, 0, 0, 0, 0 };
try
{
// logger.LogInformation(userData.CostumeData);
costumeData = JsonSerializer.Deserialize<List<uint>>(userData.CostumeData);
}
catch (JsonException e)

View File

@ -4,17 +4,8 @@
"BaseServer": {
"Url": "http://0.0.0.0:5000"
},
"AmAuthServer": {
"Url": "http://0.0.0.0:80"
},
"MuchaServer": {
"Url": "https://0.0.0.0:10122"
},
"GameServer1": {
"Url": "https://0.0.0.0:54430"
},
"GameServer2": {
"Url": "https://0.0.0.0:54431"
"Url": "https://0.0.0.0:57402"
}
},
"Certificates": {

View File

@ -2,6 +2,6 @@
"ServerSettings": {
"MuchaUrl": "https://v402-front.mucha-prd.nbgi-amnet.jp:10122",
"GameUrl": "vsapi.taiko-p.jp",
"EnableMoreSongs": true
"EnableMoreSongs": false
}
}

View File

@ -1,4 +1,6 @@
namespace TaikoLocalServer.Controllers.Api;
using SharedProject.Models.Requests;
namespace TaikoLocalServer.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
@ -19,4 +21,13 @@ public class CardsController : BaseController<CardsController>
return result ? NoContent() : NotFound();
}
[HttpPost]
public async Task<IActionResult> UpdatePassword(SetPasswordRequest request)
{
var accessCode = request.AccessCode;
var password = request.Password;
var salt = request.Salt;
var result = await cardService.UpdatePassword(accessCode, password, salt);
return result ? NoContent() : NotFound();
}
}

View File

@ -15,7 +15,7 @@ public class DanBestDataController : BaseController<DanBestDataController>
}
[HttpGet("{baid}")]
public async Task<IActionResult> GetDanBestData(uint baid)
public async Task<IActionResult> GetDanBestData(ulong baid)
{
var danScores = await danScoreDatumService.GetDanScoreDatumByBaid(baid);
var danDataList = new List<DanBestData>();

View File

@ -21,7 +21,7 @@ public class PlayDataController : BaseController<PlayDataController>
}
[HttpGet("{baid}")]
public async Task<ActionResult<SongBestResponse>> GetSongBestRecords(uint baid)
public async Task<ActionResult<SongBestResponse>> GetSongBestRecords(ulong baid)
{
var user = await userDatumService.GetFirstUserDatumOrNull(baid);
if (user is null)

View File

@ -1,6 +1,6 @@
using System.Text.Json;
using SharedProject.Models;
using SharedProject.Models;
using SharedProject.Utils;
using System.Text.Json;
namespace TaikoLocalServer.Controllers.Api;
@ -16,7 +16,7 @@ public class UserSettingsController : BaseController<UserSettingsController>
}
[HttpGet]
public async Task<ActionResult<UserSetting>> GetUserSetting(uint baid)
public async Task<ActionResult<UserSetting>> GetUserSetting(ulong baid)
{
var user = await userDatumService.GetFirstUserDatumOrNull(baid);
@ -25,6 +25,8 @@ public class UserSettingsController : BaseController<UserSettingsController>
return NotFound();
}
var difficultySettingArray = JsonHelper.GetUIntArrayFromJson(user.DifficultySettingArray, 3, Logger, nameof(user.DifficultySettingArray));
var costumeData = JsonHelper.GetCostumeDataFromUserData(user, Logger);
var costumeUnlockData = JsonHelper.GetCostumeUnlockDataFromUserData(user, Logger);
@ -34,12 +36,16 @@ public class UserSettingsController : BaseController<UserSettingsController>
AchievementDisplayDifficulty = user.AchievementDisplayDifficulty,
IsDisplayAchievement = user.DisplayAchievement,
IsDisplayDanOnNamePlate = user.DisplayDan,
DifficultySettingCourse = difficultySettingArray[0],
DifficultySettingStar = difficultySettingArray[1],
DifficultySettingSort = difficultySettingArray[2],
IsVoiceOn = user.IsVoiceOn,
IsSkipOn = user.IsSkipOn,
NotesPosition = user.NotesPosition,
PlaySetting = PlaySettingConverter.ShortToPlaySetting(user.OptionSetting),
ToneId = user.SelectedToneId,
MyDonName = user.MyDonName,
MyDonNameLanguage = user.MyDonNameLanguage,
Title = user.Title,
TitlePlateId = user.TitlePlateId,
Kigurumi = costumeData[0],
@ -60,7 +66,7 @@ public class UserSettingsController : BaseController<UserSettingsController>
}
[HttpPost]
public async Task<IActionResult> SaveUserSetting(uint baid, UserSetting userSetting)
public async Task<IActionResult> SaveUserSetting(ulong baid, UserSetting userSetting)
{
var user = await userDatumService.GetFirstUserDatumOrNull(baid);
@ -78,15 +84,24 @@ public class UserSettingsController : BaseController<UserSettingsController>
userSetting.Puchi,
};
var difficultySettings = new List<uint>
{
userSetting.DifficultySettingCourse,
userSetting.DifficultySettingStar,
userSetting.DifficultySettingSort
};
user.IsSkipOn = userSetting.IsSkipOn;
user.IsVoiceOn = userSetting.IsVoiceOn;
user.DisplayAchievement = userSetting.IsDisplayAchievement;
user.DisplayDan = userSetting.IsDisplayDanOnNamePlate;
user.DifficultySettingArray = JsonSerializer.Serialize(difficultySettings);
user.NotesPosition = userSetting.NotesPosition;
user.SelectedToneId = userSetting.ToneId;
user.AchievementDisplayDifficulty = userSetting.AchievementDisplayDifficulty;
user.OptionSetting = PlaySettingConverter.PlaySettingToShort(userSetting.PlaySetting);
user.MyDonName = userSetting.MyDonName;
user.MyDonNameLanguage = userSetting.MyDonNameLanguage;
user.Title = userSetting.Title;
user.TitlePlateId = userSetting.TitlePlateId;
user.ColorBody = userSetting.BodyColor;
@ -94,7 +109,6 @@ public class UserSettingsController : BaseController<UserSettingsController>
user.ColorLimb = userSetting.LimbColor;
user.CostumeData = JsonSerializer.Serialize(costumes);
await userDatumService.UpdateUserDatum(user);
return NoContent();

View File

@ -1,15 +1,56 @@
namespace TaikoLocalServer.Controllers.Game;
using System.Text.Json;
using Throw;
[Route("/v12r03/chassis/addtokencount.php")]
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r00_cn/chassis/addtokencount.php")]
[ApiController]
public class AddTokenCountController : BaseController<AddTokenCountController>
{
private readonly IUserDatumService userDatumService;
public AddTokenCountController(IUserDatumService userDatumService)
{
this.userDatumService = userDatumService;
}
[HttpPost]
[Produces("application/protobuf")]
public IActionResult AddTokenCount([FromBody] AddTokenCountRequest request)
public async Task<IActionResult> AddTokenCount([FromBody] AddTokenCountRequest request)
{
Logger.LogInformation("AddTokenCount request : {Request}", request.Stringify());
var user = await userDatumService.GetFirstUserDatumOrNull(request.Baid);
user.ThrowIfNull($"User with baid {request.Baid} does not exist!");
var tokenCountDict = new Dictionary<uint, int>();
try
{
tokenCountDict = !string.IsNullOrEmpty(user.TokenCountDict)
? JsonSerializer.Deserialize<Dictionary<uint, int>>(user.TokenCountDict)
: new Dictionary<uint, int>();
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing TokenCountDict data for user with baid {Request} failed!", request.Baid);
}
tokenCountDict.ThrowIfNull("TokenCountDict should never be null");
foreach (var addTokenCountData in request.AryAddTokenCountDatas)
{
var tokenId = addTokenCountData.TokenId;
var addTokenCount = addTokenCountData.AddTokenCount;
if (tokenCountDict.ContainsKey(tokenId))
tokenCountDict[tokenId] += addTokenCount;
else
tokenCountDict.Add(tokenId, addTokenCount);
}
user.TokenCountDict = JsonSerializer.Serialize(tokenCountDict);
await userDatumService.UpdateUserDatum(user);
var response = new AddTokenCountResponse
{
Result = 1

View File

@ -1,11 +1,12 @@
using System.Text.Json;
using GameDatabase.Entities;
using GameDatabase.Entities;
using System.Text.Json;
using Serilog;
using Throw;
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r03/chassis/baidcheck.php")]
[Route("/v12r00_cn/chassis/baidcheck.php")]
public class BaidController : BaseController<BaidController>
{
private readonly IUserDatumService userDatumService;
@ -18,14 +19,18 @@ public class BaidController : BaseController<BaidController>
private readonly IAiDatumService aiDatumService;
private readonly IGameDataService gameDataService;
public BaidController(IUserDatumService userDatumService, ICardService cardService,
ISongBestDatumService songBestDatumService, IDanScoreDatumService danScoreDatumService, IAiDatumService aiDatumService)
ISongBestDatumService songBestDatumService, IDanScoreDatumService danScoreDatumService, IAiDatumService aiDatumService,
IGameDataService gameDataService)
{
this.userDatumService = userDatumService;
this.cardService = cardService;
this.songBestDatumService = songBestDatumService;
this.danScoreDatumService = danScoreDatumService;
this.aiDatumService = aiDatumService;
this.gameDataService = gameDataService;
}
@ -35,25 +40,17 @@ public class BaidController : BaseController<BaidController>
{
Logger.LogInformation("Baid request: {Request}", request.Stringify());
BAIDResponse response;
var card = await cardService.GetCardByAccessCode(request.AccessCode);
var card = await cardService.GetCardByAccessCode(request.WechatQrStr);
if (card is null)
{
Logger.LogInformation("New user with access code {AccessCode}", request.AccessCode);
Logger.LogInformation("New user with access code {AccessCode}", request.WechatQrStr);
var newId = cardService.GetNextBaid();
response = new BAIDResponse
{
Result = 1,
PlayerType = 1,
ComSvrResult = 1,
MbId = 1,
Baid = newId,
AccessCode = request.AccessCode,
IsPublish = true,
CardOwnNum = 1,
RegCountryId = "JPN",
PurposeId = 1,
RegionId = 1
};
return Ok(response);
@ -86,7 +83,7 @@ public class BaidController : BaseController<BaidController>
var costumeArrays = JsonHelper.GetCostumeUnlockDataFromUserData(userData, Logger);
var costumeFlagArrays = Constants.CostumeFlagArraySizes
var costumeFlagArrays = gameDataService.GetCostumeFlagArraySizes()
.Select((size, index) => FlagCalculator.GetBitArrayFromIds(costumeArrays[index], size, Logger))
.ToList();
@ -96,7 +93,15 @@ public class BaidController : BaseController<BaidController>
.Select(datum => datum.DanId)
.DefaultIfEmpty()
.Max();
var gotDanFlagArray = FlagCalculator.ComputeGotDanFlags(danData);
var danDataDictionary = gameDataService.GetDanDataDictionary();
var danIdList = danDataDictionary.Keys.ToList();
var gotDanFlagArray = FlagCalculator.ComputeGotDanFlags(danData, danIdList);
var gaidenDataDictionary = gameDataService.GetGaidenDataDictionary();
var gaidenIdList = gaidenDataDictionary.Keys.ToList();
danIdList.AddRange(gaidenIdList);
var gotGaidenFlagArray = FlagCalculator.ComputeGotDanFlags(danData, danIdList);
var genericInfoFlg = Array.Empty<uint>();
try
@ -112,7 +117,7 @@ public class BaidController : BaseController<BaidController>
// which means database content need to be fixed, so better throw
genericInfoFlg.ThrowIfNull("Genericinfo flg should never be null!");
var genericInfoFlgLength = genericInfoFlg.Any()? genericInfoFlg.Max() + 1 : 0;
var genericInfoFlgLength = genericInfoFlg.Any() ? genericInfoFlg.Max() + 1 : 0;
var genericInfoFlgArray = FlagCalculator.GetBitArrayFromIds(genericInfoFlg, (int)genericInfoFlgLength, Logger);
var aiRank = (uint)(userData.AiWinCount / 10);
@ -124,16 +129,9 @@ public class BaidController : BaseController<BaidController>
{
Result = 1,
PlayerType = 0,
ComSvrResult = 1,
MbId = 1,
Baid = baid,
AccessCode = request.AccessCode,
IsPublish = true,
CardOwnNum = 1,
RegCountryId = "JPN",
PurposeId = 1,
RegionId = 1,
MydonName = userData.MyDonName,
MydonNameLanguage = userData.MyDonNameLanguage,
Title = userData.Title,
TitleplateId = userData.TitlePlateId,
ColorFace = userData.ColorFace,
@ -156,7 +154,7 @@ public class BaidController : BaseController<BaidController>
IsDispDanOn = userData.DisplayDan,
GotDanMax = maxDan,
GotDanFlg = gotDanFlagArray,
GotDanextraFlg = new byte[20],
GotDanextraFlg = gotGaidenFlagArray,
DefaultToneSetting = userData.SelectedToneId,
GenericInfoFlg = genericInfoFlgArray,
AryCrownCounts = crownCount,
@ -165,11 +163,7 @@ public class BaidController : BaseController<BaidController>
DispAchievementType = (uint)achievementDisplayDifficulty,
IsDispAchievementTypeSet = true,
LastPlayMode = userData.LastPlayMode,
IsDispSouuchiOn = true,
AiRank = aiRank,
AiTotalWin = (uint)userData.AiWinCount,
Accesstoken = "123456",
ContentInfo = GZipBytesUtil.GetGZipBytes(new byte[10])
IsDispSouuchiOn = true
};
return Ok(response);

View File

@ -1,7 +1,7 @@
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r03/chassis/bookkeeping.php")]
[Route("/v12r00_cn/chassis/bookkeeping.php")]
public class BookkeepingController : BaseController<BookkeepingController>
{
[HttpPost]

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/challengecompe.php")]
[Route("/v12r00_cn/chassis/challengecompe.php")]
[ApiController]
public class ChallengeCompetitionController : BaseController<ChallengeCompetitionController>
{

View File

@ -3,7 +3,7 @@ using TaikoLocalServer.Settings;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/crownsdata.php")]
[Route("/v12r00_cn/chassis/crownsdata.php")]
[ApiController]
public class CrownsDataController : BaseController<CrownsDataController>
{

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/executeqrcode.php")]
[Route("/v12r00_cn/chassis/executeqrcode.php")]
[ApiController]
public class ExecuteQrCodeController : BaseController<ExecuteQrCodeController>
{

View File

@ -2,7 +2,7 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getaidata.php")]
[Route("/v12r00_cn/chassis/getaidata.php")]
[ApiController]
public class GetAiDataController : BaseController<GetAiDataController>
{

View File

@ -2,7 +2,7 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getaiscore.php")]
[Route("/v12r00_cn/chassis/getaiscore.php")]
[ApiController]
public class GetAiScoreController : BaseController<GetAiScoreController>
{

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getapplicationurl.php")]
[Route("/v12r00_cn/chassis/getapplicationurl.php")]
[ApiController]
public class GetApplicationUrlController : BaseController<GetApplicationUrlController>
{

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getdanodai.php")]
[Route("/v12r00_cn/chassis/getdanodai.php")]
[ApiController]
public class GetDanOdaiController : BaseController<GetDanOdaiController>
{
@ -22,11 +22,8 @@ public class GetDanOdaiController : BaseController<GetDanOdaiController>
Result = 1
};
if (request.Type == 2)
if (request.Type == 1)
{
return Ok(response);
}
foreach (var danId in request.DanIds)
{
gameDataService.GetDanDataDictionary().TryGetValue(danId, out var odaiData);
@ -38,6 +35,21 @@ public class GetDanOdaiController : BaseController<GetDanOdaiController>
response.AryOdaiDatas.Add(odaiData);
}
}
else if (request.Type == 2)
{
foreach (var danId in request.DanIds)
{
gameDataService.GetGaidenDataDictionary().TryGetValue(danId, out var odaiData);
if (odaiData is null)
{
Logger.LogWarning("Requested dan id {Id} does not exist!", danId);
continue;
}
response.AryOdaiDatas.Add(odaiData);
}
}
return Ok(response);
}

View File

@ -2,7 +2,7 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getdanscore.php")]
[Route("/v12r00_cn/chassis/getdanscore.php")]
[ApiController]
public class GetDanScoreController : BaseController<GetDanScoreController>
{

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getfolder.php")]
[Route("/v12r00_cn/chassis/getfolder.php")]
[ApiController]
public class GetFolderController : BaseController<GetFolderController>
{

View File

@ -0,0 +1,24 @@
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r00_cn/chassis/getgenericmaster.php")]
public class GetGenericMasterController : BaseController<GetGenericMasterController>
{
[HttpPost]
[Produces("application/protobuf")]
public IActionResult GetGenericMaster([FromBody] GetGenericMasterRequest request)
{
Logger.LogInformation("GetGenericMasterRequest: {Request}", request.Stringify());
var response = new GetGenericMasterResponse
{
Result = 1,
VerupNo = 2,
EnableIdBit = FlagCalculator.GetBitArrayTrue(5000)
};
return Ok(response);
}
}

View File

@ -3,7 +3,7 @@ using TaikoLocalServer.Settings;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getscorerank.php")]
[Route("/v12r00_cn/chassis/getscorerank.php")]
[ApiController]
public class GetScoreRankController : BaseController<GetScoreRankController>
{

View File

@ -1,27 +1,34 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getshopfolder.php")]
[Route("/v12r00_cn/chassis/getshopfolder.php")]
[ApiController]
public class GetShopFolderController : BaseController<GetShopFolderController>
{
private readonly IGameDataService gameDataService;
public GetShopFolderController(IGameDataService gameDataService)
{
this.gameDataService = gameDataService;
}
[HttpPost]
[Produces("application/protobuf")]
public IActionResult GetShopFolder([FromBody] GetShopFolderRequest request)
{
Logger.LogInformation("GetShopFolder request : {Request}", request.Stringify());
gameDataService.GetTokenDataDictionary().TryGetValue("shopTokenId", out var shopTokenId);
var shopFolderList = gameDataService.GetShopFolderList();
var response = new GetShopFolderResponse
{
Result = 1,
TokenId = 1,
TokenId = shopTokenId > 0 ? (uint)shopTokenId : 1,
VerupNo = 2
};
response.AryShopFolderDatas.Add(new GetShopFolderResponse.ShopFolderData
{
Price = 1,
SongNo = 2
});
response.AryShopFolderDatas.AddRange(shopFolderList);
return Ok(response);
}

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/getsongintroduction.php")]
[Route("/v12r00_cn/chassis/getsongintroduction.php")]
[ApiController]
public class GetSongIntroductionController : BaseController<GetSongIntroductionController>
{

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/gettelop.php")]
[Route("/v12r00_cn/chassis/gettelop.php")]
[ApiController]
public class GetTelopController : BaseController<GetTelopController>
{

View File

@ -1,25 +1,101 @@
namespace TaikoLocalServer.Controllers.Game;
using System.Text.Json;
using Throw;
[Route("/v12r03/chassis/gettokencount.php")]
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r00_cn/chassis/gettokencount.php")]
[ApiController]
public class GetTokenCountController : BaseController<GetTokenCountController>
{
private readonly IGameDataService gameDataService;
private readonly IUserDatumService userDatumService;
public GetTokenCountController(IUserDatumService userDatumService, IGameDataService gameDataService)
{
this.userDatumService = userDatumService;
this.gameDataService = gameDataService;
}
[HttpPost]
[Produces("application/protobuf")]
public IActionResult GetTokenCount([FromBody] GetTokenCountRequest request)
public async Task<IActionResult> GetTokenCount([FromBody] GetTokenCountRequest request)
{
Logger.LogInformation("GetTokenCount request : {Request}", request.Stringify());
var user = await userDatumService.GetFirstUserDatumOrNull(request.Baid);
var tokenDataDictionary = gameDataService.GetTokenDataDictionary();
tokenDataDictionary.TryGetValue("shopTokenId", out var shopTokenId);
tokenDataDictionary.TryGetValue("kaTokenId", out var kaTokenId);
tokenDataDictionary.TryGetValue("onePieceTokenId", out var onePieceTokenId);
tokenDataDictionary.TryGetValue("soshinaTokenId", out var soshinaTokenId);
user.ThrowIfNull($"User with baid {request.Baid} does not exist!");
var tokenCountDict = new Dictionary<uint, int>();
try
{
tokenCountDict = !string.IsNullOrEmpty(user.TokenCountDict)
? JsonSerializer.Deserialize<Dictionary<uint, int>>(user.TokenCountDict)
: new Dictionary<uint, int>();
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing TokenCountDict data for user with baid {Request} failed!", request.Baid);
}
tokenCountDict.ThrowIfNull("TokenCountDict should never be null");
var response = new GetTokenCountResponse
{
Result = 1
};
if (tokenCountDict.Count == 0) tokenCountDict.Add(1, 0);
if (shopTokenId > 0)
{
var castedShopTokenId = (uint)shopTokenId;
tokenCountDict.TryAdd(castedShopTokenId, 0);
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
{
TokenCount = 10,
TokenId = 1
TokenCount = tokenCountDict[castedShopTokenId],
TokenId = castedShopTokenId
});
}
if (kaTokenId > 0)
{
var castedKaTokenId = (uint)kaTokenId;
tokenCountDict.TryAdd(castedKaTokenId, 0);
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
{
TokenCount = tokenCountDict[castedKaTokenId],
TokenId = castedKaTokenId
});
}
if (onePieceTokenId > 0)
{
var castedOnePieceTokenId = (uint)onePieceTokenId;
tokenCountDict.TryAdd(castedOnePieceTokenId, 0);
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
{
TokenCount = tokenCountDict[castedOnePieceTokenId],
TokenId = castedOnePieceTokenId
});
}
if (soshinaTokenId > 0)
{
var castedSoshinaTokenId = (uint)soshinaTokenId;
tokenCountDict.TryAdd(castedSoshinaTokenId, 0);
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
{
TokenCount = tokenCountDict[castedSoshinaTokenId],
TokenId = castedSoshinaTokenId
});
}
user.TokenCountDict = JsonSerializer.Serialize(tokenCountDict);
await userDatumService.UpdateUserDatum(user);
return Ok(response);
}

View File

@ -0,0 +1,39 @@
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r00_cn/chassis/headclerk2.php")]
public class Headclerk2Controller : BaseController<Headclerk2Controller>
{
[HttpPost]
[Produces("application/protobuf")]
public IActionResult Headclerk2([FromBody] HeadClerk2Request request)
{
Logger.LogInformation("Headclerk2 request: {Request}", request.Stringify());
var chassisId = request.ChassisId;
var shopId = request.ShopId;
foreach (var playInfo in request.AryPlayInfoes)
{
var baid = playInfo.Baid;
var playedAt = playInfo.PlayedAt;
var isRight = playInfo.IsRight;
var type = playInfo.Type;
var amount = playInfo.Amount;
Logger.LogInformation("CSV WRITE: \n" +
"ChassisId:{ChassisId},\n" +
"ShopId:{ShopId},\n" +
"Baid:{Baid},\n" +
"PlayedAt{PlayedAt},\n" +
"IsRight:{IsRight},\n" +
"Type:{Type},\n" +
"Amount{Amount}", chassisId, shopId, baid, playedAt, isRight, type, amount);
}
var response = new HeadClerk2Response
{
Result = 1
};
return Ok(response);
}
}

View File

@ -1,7 +1,7 @@
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r03/chassis/heartbeat.php")]
[Route("/v12r00_cn/chassis/heartbeat.php")]
public class HeartbeatController : BaseController<HeartbeatController>
{
[HttpPost]
@ -12,7 +12,6 @@ public class HeartbeatController : BaseController<HeartbeatController>
var response = new HeartBeatResponse
{
Result = 1,
ComSvrStat = 1,
GameSvrStat = 1
};

View File

@ -4,7 +4,7 @@ using TaikoLocalServer.Settings;
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r03/chassis/initialdatacheck.php")]
[Route("/v12r00_cn/chassis/initialdatacheck.php")]
public class InitialDataCheckController : BaseController<InitialDataCheckController>
{
private readonly IGameDataService gameDataService;
@ -24,93 +24,117 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
Logger.LogInformation("Initial data check request: {Request}", request.Stringify());
var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX;
var musicList = gameDataService.GetMusicList();
var lockedSongsList = gameDataService.GetLockedSongsList();
var enabledArray =
FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicList(), songIdMax, Logger);
FlagCalculator.GetBitArrayFromIds(musicList, songIdMax, Logger);
var danData = new List<InitialdatacheckResponse.InformationData>();
for (var danId = Constants.MIN_DAN_ID; danId <= Constants.MAX_DAN_ID; danId++)
{
danData.Add(new InitialdatacheckResponse.InformationData
{
InfoId = (uint)danId,
VerupNo = 1
});
}
var defaultSongList = musicList.Except(lockedSongsList);
var defaultSongFlg =
FlagCalculator.GetBitArrayFromIds(defaultSongList, songIdMax, Logger);
var introData = new List<InitialdatacheckResponse.InformationData>();
for (var setId = 1; setId <= gameDataService.GetSongIntroDictionary().Count; setId++)
{
introData.Add(new InitialdatacheckResponse.InformationData
{
InfoId = (uint)setId,
VerupNo = 1
});
}
var eventFolderData = new List<InitialdatacheckResponse.InformationData>();
foreach (var folderId in Constants.EVENT_FOLDER_IDS)
{
eventFolderData.Add(new InitialdatacheckResponse.InformationData
{
InfoId = (uint)folderId,
VerupNo = 0
});
}
var defaultSongWithUraList = gameDataService.GetMusicWithUraList();
var uraReleaseBit =
FlagCalculator.GetBitArrayFromIds(defaultSongWithUraList, songIdMax, Logger);
var response = new InitialdatacheckResponse
{
Result = 1,
IsDanplay = true,
IsAibattle = true,
IsClose = false,
DefaultSongFlg = enabledArray,
DefaultSongFlg = defaultSongFlg,
AchievementSongBit = enabledArray,
UraReleaseBit = uraReleaseBit,
SongIntroductionEndDatetime = DateTime.Now.AddYears(10).ToString(Constants.DATE_TIME_FORMAT),
AryShopFolderDatas =
{
new InitialdatacheckResponse.InformationData
{
InfoId = 1,
VerupNo = 2
}
},
/*AryTelopDatas =
{
new InitialdatacheckResponse.InformationData
{
InfoId = 1,
VerupNo = 1
}
},
AryDanextraOdaiDatas =
{
new InitialdatacheckResponse.InformationData
{
InfoId = 1,
VerupNo = 1
}
},
AryAiEventDatas =
{
new InitialdatacheckResponse.AiEventData
{
AiEventId = 1,
TokenId = 1
}
},
AryMovieInfos =
{
new InitialdatacheckResponse.MovieData
{
MovieId = 2,
EnableDays = 9999
}
}*/
};
response.AryDanOdaiDatas.AddRange(danData);
response.ArySongIntroductionDatas.AddRange(introData);
response.AryEventfolderDatas.AddRange(eventFolderData);
var movieDataDictionary = gameDataService.GetMovieDataDictionary();
foreach (var movieData in movieDataDictionary) response.AryMovieInfoes.Add(movieData.Value);
var verupNo1 = new uint[] { 2, 3, 4, 5, 6, 7, 8, 13, 15, 24, 25, 26, 27, 28, 29, 30, 31, 104 };
var aryVerUp = verupNo1.Select(i => new InitialdatacheckResponse.VerupNoData1
{
MasterType = i,
VerupNo = 1
})
.ToList();
response.AryVerupNoData1s.AddRange(aryVerUp);
var danData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
var danDataDictionary = gameDataService.GetDanDataDictionary();
foreach (var danId in danDataDictionary.Keys)
{
gameDataService.GetDanDataDictionary().TryGetValue(danId, out var odaiData);
danData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData
{
InfoId = danId,
VerupNo = odaiData?.VerupNo ?? 1
});
}
var verUp2Type101 = new InitialdatacheckResponse.VerupNoData2
{
MasterType = 101,
};
verUp2Type101.AryInformationDatas.AddRange(danData);
response.AryVerupNoData2s.Add(verUp2Type101);
var gaidenData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
var gaidenDataDictionary = gameDataService.GetGaidenDataDictionary();
foreach (var gaidenId in gaidenDataDictionary.Keys)
{
gaidenDataDictionary.TryGetValue(gaidenId, out var odaiData);
gaidenData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData
{
InfoId = gaidenId,
VerupNo = odaiData?.VerupNo ?? 1
});
}
var verUp2Type102 = new InitialdatacheckResponse.VerupNoData2
{
MasterType = 102,
};
verUp2Type102.AryInformationDatas.AddRange(gaidenData);
response.AryVerupNoData2s.Add(verUp2Type102);
var eventFolderData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
var eventFolderDictionary = gameDataService.GetFolderDictionary();
foreach (var folderId in eventFolderDictionary.Keys)
{
eventFolderDictionary.TryGetValue(folderId, out var folderData);
eventFolderData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData
{
InfoId = folderId,
VerupNo = folderData?.VerupNo ?? 1
});
}
var verUp2Type103 = new InitialdatacheckResponse.VerupNoData2
{
MasterType = 103,
};
verUp2Type103.AryInformationDatas.AddRange(eventFolderData);
response.AryVerupNoData2s.Add(verUp2Type103);
var songIntroData = new List<InitialdatacheckResponse.VerupNoData2.InformationData>();
var songIntroDictionary = gameDataService.GetSongIntroDictionary();
foreach (var setId in songIntroDictionary.Select(item => item.Value.SetId))
{
songIntroDictionary.TryGetValue(setId, out var introData);
songIntroData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData
{
InfoId = setId,
VerupNo = introData?.VerupNo ?? 1
});
}
var verUp2Type105 = new InitialdatacheckResponse.VerupNoData2
{
MasterType = 105,
};
verUp2Type105.AryInformationDatas.AddRange(songIntroData);
response.AryVerupNoData2s.Add(verUp2Type105);
response.AryChassisFunctionIds = new uint[] { 1, 2, 3 };
return Ok(response);
}

View File

@ -2,7 +2,7 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/mydonentry.php")]
[Route("/v12r00_cn/chassis/mydonentry.php")]
[ApiController]
public class MyDonEntryController : BaseController<MyDonEntryController>
{
@ -25,14 +25,17 @@ public class MyDonEntryController : BaseController<MyDonEntryController>
var newId = cardService.GetNextBaid();
await cardService.AddCard(new Card
{
AccessCode = request.AccessCode,
Baid = newId
AccessCode = request.WechatQrStr,
Baid = newId,
Password = "",
Salt = ""
});
var newUser = new UserDatum
{
Baid = newId,
MyDonName = request.MydonName,
MyDonNameLanguage = 0,
DisplayDan = true,
DisplayAchievement = true,
AchievementDisplayDifficulty = Difficulty.None,
@ -40,10 +43,12 @@ public class MyDonEntryController : BaseController<MyDonEntryController>
ColorBody = 1,
ColorLimb = 3,
FavoriteSongsArray = "[]",
ToneFlgArray = "[]",
ToneFlgArray = "[0]",
TitleFlgArray = "[]",
CostumeFlgArray = "[[],[],[],[],[]]",
GenericInfoFlgArray = "[]"
GenericInfoFlgArray = "[]",
TokenCountDict = "{}",
UnlockedSongIdList = "[]"
};
await userDatumService.InsertUserDatum(newUser);
@ -51,17 +56,9 @@ public class MyDonEntryController : BaseController<MyDonEntryController>
var response = new MydonEntryResponse
{
Result = 1,
ComSvrResult = 1,
AccessCode = request.AccessCode,
Accesstoken = "12345",
Baid = newId,
MbId = 1,
MydonName = request.MydonName,
CardOwnNum = 1,
IsPublish = true,
RegCountryId = request.CountryId,
PurposeId = 1,
RegionId = 1
MydonNameLanguage = 0
};
return Ok(response);

View File

@ -8,7 +8,7 @@ namespace TaikoLocalServer.Controllers.Game;
using StageData = PlayResultDataRequest.StageData;
[Route("/v12r03/chassis/playresult.php")]
[Route("/v12r00_cn/chassis/playresult.php")]
[ApiController]
public class PlayResultController : BaseController<PlayResultController>
{
@ -22,14 +22,18 @@ public class PlayResultController : BaseController<PlayResultController>
private readonly IAiDatumService aiDatumService;
private readonly IGameDataService gameDataService;
public PlayResultController(IUserDatumService userDatumService, ISongPlayDatumService songPlayDatumService,
ISongBestDatumService songBestDatumService, IDanScoreDatumService danScoreDatumService, IAiDatumService aiDatumService)
ISongBestDatumService songBestDatumService, IDanScoreDatumService danScoreDatumService, IAiDatumService aiDatumService,
IGameDataService gameDataService)
{
this.userDatumService = userDatumService;
this.songPlayDatumService = songPlayDatumService;
this.songBestDatumService = songBestDatumService;
this.danScoreDatumService = danScoreDatumService;
this.aiDatumService = aiDatumService;
this.gameDataService = gameDataService;
}
[HttpPost]
@ -67,17 +71,32 @@ public class PlayResultController : BaseController<PlayResultController>
var playMode = (PlayMode)playResultData.PlayMode;
if (playMode == PlayMode.DanMode)
if (playMode is PlayMode.DanMode or PlayMode.GaidenMode)
{
await UpdateDanPlayData(request, playResultData);
return Ok(response);
}
var bestData = await songBestDatumService.GetAllSongBestData(request.BaidConf);
gameDataService.GetFolderDictionary().TryGetValue(9, out var folder9Data);
var folder9Songs = new List<uint>();
if (folder9Data is not null)
{
folder9Songs.AddRange(folder9Data.SongNoes);
}
for (var songNumber = 0; songNumber < playResultData.AryStageInfoes.Count; songNumber++)
{
var stageData = playResultData.AryStageInfoes[songNumber];
if (folder9Songs.Contains(stageData.SongNo))
{
continue;
}
if (stageData.IsSkipUse)
{
await UpdatePlayData(request, songNumber, stageData, lastPlayDatetime);
@ -203,16 +222,17 @@ public class PlayResultController : BaseController<PlayResultController>
};
userdata.CostumeData = JsonSerializer.Serialize(costumeData);
// Skip user setting altogether following official logic
// Skip user setting saving when in dan mode as dan mode uses its own default setting
if (playMode != PlayMode.DanMode)
{
var lastStage = playResultData.AryStageInfoes.Last();
var option = BinaryPrimitives.ReadInt16LittleEndian(lastStage.OptionFlg);
userdata.OptionSetting = option;
userdata.IsSkipOn = lastStage.IsSkipOn;
userdata.IsVoiceOn = !lastStage.IsVoiceOn;
userdata.NotesPosition = lastStage.NotesPosition;
}
// if (playMode != PlayMode.DanMode)
// {
// var lastStage = playResultData.AryStageInfoes.Last();
// var option = BinaryPrimitives.ReadInt16LittleEndian(lastStage.OptionFlg);
// userdata.OptionSetting = option;
// userdata.IsSkipOn = lastStage.IsSkipOn;
// userdata.IsVoiceOn = !lastStage.IsVoiceOn;
// userdata.NotesPosition = lastStage.NotesPosition;
// }
userdata.LastPlayDatetime = lastPlayDatetime;
userdata.LastPlayMode = playResultData.PlayMode;
@ -236,6 +256,14 @@ public class PlayResultController : BaseController<PlayResultController>
userdata.GenericInfoFlgArray =
UpdateJsonUintFlagArray(userdata.GenericInfoFlgArray, playResultData.GetGenericInfoNoes, nameof(userdata.GenericInfoFlgArray));
var difficultyPlayedArray = new List<uint>
{
playResultData.DifficultyPlayedCourse,
playResultData.DifficultyPlayedStar,
playResultData.DifficultyPlayedSort
};
userdata.DifficultyPlayedArray = JsonSerializer.Serialize(difficultyPlayedArray);
userdata.AiWinCount += playResultData.AryStageInfoes.Count(data => data.IsWin);
await userDatumService.UpdateUserDatum(userdata);
}

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/rewarditem.php")]
[Route("/v12r00_cn/chassis/rewarditem.php")]
[ApiController]
public class RewardItemController : BaseController<RewardItemController>
{

View File

@ -3,7 +3,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/selfbest.php")]
[Route("/v12r00_cn/chassis/selfbest.php")]
[ApiController]
public class SelfBestController : BaseController<SelfBestController>
{
@ -39,7 +39,7 @@ public class SelfBestController : BaseController<SelfBestController>
.ToList();
foreach (var songNo in request.ArySongNoes)
{
if (!gameDataService.GetMusicAttributes().ContainsKey(songNo))
if (!gameDataService.GetMusicList().Contains(songNo))
{
Logger.LogWarning("Music no {No} is missing!", songNo);
continue;

View File

@ -0,0 +1,20 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r00_cn/chassis/setanystring.php")]
[ApiController]
public class SetAnyStringController : BaseController<SetAnyStringController>
{
[HttpPost]
[Produces("application/protobuf")]
public IActionResult SetAnyString([FromBody] SetAnyStringRequest request)
{
Logger.LogInformation("SetAnyString request : {Request}", request.Stringify());
var response = new SetAnyStringResponse
{
Result = 1,
};
return Ok(response);
}
}

View File

@ -1,19 +1,73 @@
namespace TaikoLocalServer.Controllers.Game;
using System.Text.Json;
using Throw;
[Route("/v12r03/chassis/songpurchase.php")]
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r00_cn/chassis/songpurchase.php")]
[ApiController]
public class SongPurchaseController : BaseController<SongPurchaseController>
{
private readonly IUserDatumService userDatumService;
public SongPurchaseController(IUserDatumService userDatumService)
{
this.userDatumService = userDatumService;
}
[HttpPost]
[Produces("application/protobuf")]
public IActionResult SongPurchase([FromBody] SongPurchaseRequest request)
public async Task<IActionResult> SongPurchase([FromBody] SongPurchaseRequest request)
{
Logger.LogInformation("SongPurchase request : {Request}", request.Stringify());
var user = await userDatumService.GetFirstUserDatumOrNull(request.Baid);
user.ThrowIfNull($"User with baid {request.Baid} does not exist!");
var tokenCountDict = new Dictionary<uint, int>();
try
{
tokenCountDict = !string.IsNullOrEmpty(user.TokenCountDict)
? JsonSerializer.Deserialize<Dictionary<uint, int>>(user.TokenCountDict)
: new Dictionary<uint, int>();
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing TokenCountDict data for user with baid {Request} failed!", request.Baid);
}
tokenCountDict.ThrowIfNull("TokenCountDict should never be null");
Logger.LogInformation("Original UnlockedSongIdList: {UnlockedSongIdList}", user.UnlockedSongIdList);
var unlockedSongIdList = new List<uint>();
try
{
unlockedSongIdList = !string.IsNullOrEmpty(user.UnlockedSongIdList)
? JsonSerializer.Deserialize<List<uint>>(user.UnlockedSongIdList)
: new List<uint>();
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing UnlockedSongIdList data for user with baid {Request} failed!", request.Baid);
}
unlockedSongIdList.ThrowIfNull("UnlockedSongIdList should never be null");
if (tokenCountDict.ContainsKey(request.TokenId)) tokenCountDict[request.TokenId] -= (int)request.Price;
if (!unlockedSongIdList.Contains(request.SongNo)) unlockedSongIdList.Add(request.SongNo);
user.TokenCountDict = JsonSerializer.Serialize(tokenCountDict);
user.UnlockedSongIdList = JsonSerializer.Serialize(unlockedSongIdList);
Logger.LogInformation("Updated UnlockedSongIdList: {UnlockedSongIdList}", user.UnlockedSongIdList);
await userDatumService.UpdateUserDatum(user);
var response = new SongPurchaseResponse
{
Result = 1,
TokenCount = (int)(10 - request.Price)
TokenCount = tokenCountDict[request.TokenId]
};
return Ok(response);

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/tournamentcheck.php")]
[Route("/v12r00_cn/chassis/tournamentcheck.php")]
[ApiController]
public class TournamentCheckController : BaseController<TournamentCheckController>
{

View File

@ -1,12 +1,12 @@
using System.Buffers.Binary;
using Microsoft.Extensions.Options;
using System.Buffers.Binary;
using System.Text.Json;
using Microsoft.Extensions.Options;
using TaikoLocalServer.Settings;
using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/userdata.php")]
[Route("/v12r00_cn/chassis/userdata.php")]
[ApiController]
public class UserDataController : BaseController<UserDataController>
{
@ -34,14 +34,35 @@ public class UserDataController : BaseController<UserDataController>
Logger.LogInformation("UserData request : {Request}", request.Stringify());
var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX;
var releaseSongArray =
FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicList(), songIdMax, Logger);
var uraSongArray =
FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicWithUraList(), songIdMax, Logger);
var userData = await userDatumService.GetFirstUserDatumOrDefault(request.Baid);
var unlockedSongIdList = new List<uint>();
try
{
unlockedSongIdList = !string.IsNullOrEmpty(userData.UnlockedSongIdList)
? JsonSerializer.Deserialize<List<uint>>(userData.UnlockedSongIdList)
: new List<uint>();
}
catch (JsonException e)
{
Logger.LogError(e, "Parsing UnlockedSongIdList data for user with baid {Request} failed!", request.Baid);
}
unlockedSongIdList.ThrowIfNull("UnlockedSongIdList should never be null");
var musicList = gameDataService.GetMusicList();
var lockedSongsList = gameDataService.GetLockedSongsList();
lockedSongsList = lockedSongsList.Except(unlockedSongIdList).ToList();
var enabledMusicList = musicList.Except(lockedSongsList);
var releaseSongArray =
FlagCalculator.GetBitArrayFromIds(enabledMusicList, songIdMax, Logger);
var defaultSongWithUraList = gameDataService.GetMusicWithUraList();
var enabledUraMusicList = defaultSongWithUraList.Except(lockedSongsList);
var uraSongArray =
FlagCalculator.GetBitArrayFromIds(enabledUraMusicList, songIdMax, Logger);
var toneFlg = Array.Empty<uint>();
try
{
@ -56,7 +77,15 @@ public class UserDataController : BaseController<UserDataController>
// which means database content need to be fixed, so better throw
toneFlg.ThrowIfNull("Tone flg should never be null!");
var toneArray = FlagCalculator.GetBitArrayFromIds(toneFlg, Constants.TONE_UID_MAX, Logger);
// If toneFlg is empty, add 0 to it
if (toneFlg.Length == 0)
{
toneFlg = new uint[] { 0 };
userData.ToneFlgArray = JsonSerializer.Serialize(toneFlg);
await userDatumService.UpdateUserDatum(userData);
}
var toneArray = FlagCalculator.GetBitArrayFromIds(toneFlg, gameDataService.GetToneFlagArraySize(), Logger);
var titleFlg = Array.Empty<uint>();
try
@ -72,7 +101,7 @@ public class UserDataController : BaseController<UserDataController>
// which means database content need to be fixed, so better throw
titleFlg.ThrowIfNull("Title flg should never be null!");
var titleArray = FlagCalculator.GetBitArrayFromIds(titleFlg, Constants.TITLE_UID_MAX, Logger);
var titleArray = FlagCalculator.GetBitArrayFromIds(titleFlg, gameDataService.GetTitleFlagArraySize(), Logger);
var recentSongs = (await songPlayDatumService.GetSongPlayDatumByBaid(request.Baid))
.AsEnumerable()
@ -111,6 +140,17 @@ public class UserDataController : BaseController<UserDataController>
var defaultOptions = new byte[2];
BinaryPrimitives.WriteInt16LittleEndian(defaultOptions, userData.OptionSetting);
var difficultySettingArray = JsonHelper.GetUIntArrayFromJson(userData.DifficultySettingArray, 3, Logger, nameof(userData.DifficultySettingArray));
for (int i = 0; i < 3; i++)
{
if (difficultySettingArray[i] >= 2)
{
difficultySettingArray[i] -= 1;
}
}
var difficultyPlayedArray = JsonHelper.GetUIntArrayFromJson(userData.DifficultyPlayedArray, 3, Logger, nameof(userData.DifficultyPlayedArray));
var response = new UserDataResponse
{
Result = 1,
@ -118,14 +158,20 @@ public class UserDataController : BaseController<UserDataController>
TitleFlg = titleArray,
ReleaseSongFlg = releaseSongArray,
UraReleaseSongFlg = uraSongArray,
DefaultOptionSetting = defaultOptions,
IsVoiceOn = userData.IsVoiceOn,
IsSkipOn = userData.IsSkipOn,
IsChallengecompe = false,
SongRecentCnt = (uint)recentSongs.Length,
AryFavoriteSongNoes = favoriteSongs,
AryRecentSongNoes = recentSongs,
NotesPosition = userData.NotesPosition
DefaultOptionSetting = defaultOptions,
NotesPosition = userData.NotesPosition,
IsVoiceOn = userData.IsVoiceOn,
IsSkipOn = userData.IsSkipOn,
DifficultySettingCourse = difficultySettingArray[0],
DifficultySettingStar = difficultySettingArray[1],
DifficultySettingSort = difficultySettingArray[2],
DifficultyPlayedCourse = difficultyPlayedArray[0],
DifficultyPlayedStar = difficultyPlayedArray[1],
DifficultyPlayedSort = difficultyPlayedArray[2],
IsChallengecompe = false,
SongRecentCnt = (uint)recentSongs.Length
};
return Ok(response);

View File

@ -1,19 +1,35 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r03/chassis/verifyqrcode.php")]
[Route("/v12r00_cn/chassis/verifyqrcode.php")]
[ApiController]
public class VerifyQrCodeController : BaseController<VerifyQrCodeController>
{
private readonly IGameDataService gameDataService;
public VerifyQrCodeController(IGameDataService gameDataService)
{
this.gameDataService = gameDataService;
}
[HttpPost]
[Produces("application/protobuf")]
public IActionResult VerifyQrCode([FromBody] VerifyQrcodeRequest request)
{
Logger.LogInformation("VerifyQrCode request : {Request}", request.Stringify());
var qrCodeDataDictionary = gameDataService.GetQRCodeDataDictionary();
qrCodeDataDictionary.TryGetValue(request.QrcodeSerial, out var qrCodeId);
if (qrCodeId == 0)
{
Logger.LogWarning("Requested QR code serial {Serial} does not exist!", request.QrcodeSerial);
}
var response = new VerifyQrcodeResponse
{
Result = 1,
QrcodeId = 1
QrcodeId = qrCodeId
};
return Ok(response);

View File

@ -0,0 +1,35 @@
using Serilog.Events;
using Serilog.Formatting;
namespace TaikoLocalServer.Logging;
public class CsvFormatter: ITextFormatter
{
public void Format(LogEvent logEvent, TextWriter output)
{
logEvent.Properties.TryGetValue("ChassisId", out var chassisId);
logEvent.Properties.TryGetValue("ShopId", out var shopId);
logEvent.Properties.TryGetValue("Baid", out var baid);
logEvent.Properties.TryGetValue("PlayedAt", out var playedAt);
logEvent.Properties.TryGetValue("IsRight", out var isRight);
logEvent.Properties.TryGetValue("Type", out var type);
logEvent.Properties.TryGetValue("Amount", out var amount);
output.Write(logEvent.Timestamp.ToString("yyyy-MM-dd"));
output.Write(",");
output.Write(chassisId);
output.Write(",");
output.Write(shopId);
output.Write(",");
output.Write(baid);
output.Write(",");
output.Write(playedAt);
output.Write(",");
output.Write(isRight);
output.Write(",");
output.Write(type);
output.Write(",");
output.Write(amount);
output.WriteLine();
}
}

View File

@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class DonCosRewardEntry
{
[JsonPropertyName("cosType")]
public string cosType { get; set; } = null!;
[JsonPropertyName("uniqueId")]
public uint uniqueId { get; set; }
}

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class DonCosRewards
{
[JsonPropertyName("items")]
public List<DonCosRewardEntry> DonCosRewardEntries { get; set; } = new();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class MusicAttributeEntry
{
[JsonPropertyName("uniqueId")]
public uint MusicId { get; set; }
[JsonPropertyName("canPlayUra")]
public bool HasUra { get; set; }
}

View File

@ -1,9 +0,0 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class MusicAttributes
{
[JsonPropertyName("items")]
public List<MusicAttributeEntry> MusicAttributeEntries { get; set; } = new();
}

View File

@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class MusicInfoEntry
{
[JsonPropertyName("uniqueId")]
public uint MusicId { get; set; }
[JsonPropertyName("starUra")]
public uint starUra { get; set; }
}

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class MusicInfoes
{
[JsonPropertyName("items")]
public List<MusicInfoEntry> MusicInfoEntries { get; set; } = new();
}

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class NeiroEntry
{
[JsonPropertyName("uniqueId")]
public uint uniqueId { get; set; }
}

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class Neiros
{
[JsonPropertyName("items")]
public List<NeiroEntry> NeiroEntries { get; set; } = new();
}

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class ShougouEntry
{
[JsonPropertyName("uniqueId")]
public uint uniqueId { get; set; }
}

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace TaikoLocalServer.Models;
public class Shougous
{
[JsonPropertyName("items")]
public List<ShougouEntry> ShougouEntries { get; set; } = new();
}

View File

@ -8,7 +8,6 @@
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
namespace taiko.vsinterface
{
[global::ProtoBuf.ProtoContract()]
public partial class StartupAuthRequest : global::ProtoBuf.IExtensible
{

View File

@ -1,6 +1,9 @@
using System.Reflection;
using System.Security.Authentication;
using Serilog.Sinks.File.Header;
using TaikoLocalServer.Logging;
using GameDatabase.Context;
using Microsoft.AspNetCore.HttpLogging;
using Microsoft.AspNetCore.HttpOverrides;
using TaikoLocalServer.Middlewares;
using TaikoLocalServer.Services.Extentions;
@ -23,26 +26,32 @@ try
{
var builder = WebApplication.CreateBuilder(args);
builder.Host.ConfigureAppConfiguration((hostingContext, config) =>
builder.Services.AddHttpLogging(options =>
{
const string configurationsDirectory = "Configurations";
config.AddJsonFile($"{configurationsDirectory}/Kestrel.json", optional: true, reloadOnChange: false);
config.AddJsonFile($"{configurationsDirectory}/Logging.json", optional: false, reloadOnChange: false);
config.AddJsonFile($"{configurationsDirectory}/Database.json", optional: false, reloadOnChange: false);
config.AddJsonFile($"{configurationsDirectory}/ServerSettings.json", optional: false, reloadOnChange: false);
config.AddJsonFile($"{configurationsDirectory}/DataSettings.json", optional: true, reloadOnChange: false);
options.LoggingFields = HttpLoggingFields.All;
options.RequestBodyLogLimit = 32768;
options.ResponseBodyLogLimit = 32768;
});
// Manually enable tls 1.0
builder.WebHost.UseKestrel(kestrelOptions =>
{
kestrelOptions.ConfigureHttpsDefaults(options =>
options.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13);
});
const string configurationsDirectory = "Configurations";
builder.Configuration.AddJsonFile($"{configurationsDirectory}/Kestrel.json", optional: true, reloadOnChange: false);
builder.Configuration.AddJsonFile($"{configurationsDirectory}/Logging.json", optional: false, reloadOnChange: false);
builder.Configuration.AddJsonFile($"{configurationsDirectory}/Database.json", optional: false, reloadOnChange: false);
builder.Configuration.AddJsonFile($"{configurationsDirectory}/ServerSettings.json", optional: false, reloadOnChange: false);
builder.Configuration.AddJsonFile($"{configurationsDirectory}/DataSettings.json", optional: true, reloadOnChange: false);
builder.Host.UseSerilog((context, configuration) =>
{
configuration.WriteTo.Console().ReadFrom.Configuration(context.Configuration);
configuration
.WriteTo.Console().ReadFrom.Configuration(context.Configuration)
.WriteTo.Logger(x =>
{
x.WriteTo.File(new CsvFormatter(),
path: "./Logs/HeadClerkLog-.csv",
hooks: new HeaderWriter("Date,ChassisId,ShopId,Baid,PlayedAt,IsRight,Type,Amount"),
rollingInterval: RollingInterval.Day);
x.Filter.ByIncludingOnly("StartsWith(@m, 'CSV WRITE:')");
});
});
if (builder.Configuration.GetValue<bool>("ServerSettings:EnableMoreSongs"))
@ -117,6 +126,16 @@ try
app.UseHttpLogging();
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode >= 400)
{
Log.Error("Unknown request from: {RemoteIpAddress} {Method} {Path} {StatusCode}",
context.Connection.RemoteIpAddress, context.Request.Method, context.Request.Path, context.Response.StatusCode);
}
});
app.MapControllers();
app.MapFallbackToFile("index.html");

View File

@ -12,7 +12,7 @@
"TaikoLocalServer": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchBrowser": false,
"launchUrl": "",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
@ -21,7 +21,7 @@
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchBrowser": false,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"

View File

@ -13,14 +13,14 @@ public class AiDatumService : IAiDatumService
this.context = context;
}
public async Task<List<AiScoreDatum>> GetAllAiScoreById(uint baid)
public async Task<List<AiScoreDatum>> GetAllAiScoreById(ulong baid)
{
return await context.AiScoreData.Where(datum => datum.Baid == baid)
.Include(datum => datum.AiSectionScoreData)
.ToListAsync();
}
public async Task<AiScoreDatum?> GetSongAiScore(uint baid, uint songId, Difficulty difficulty)
public async Task<AiScoreDatum?> GetSongAiScore(ulong baid, uint songId, Difficulty difficulty)
{
return await context.AiScoreData.Where(datum => datum.Baid == baid &&
datum.SongId == songId &&

View File

@ -19,9 +19,9 @@ public class CardService : ICardService
return await context.Cards.FindAsync(accessCode);
}
public uint GetNextBaid()
public ulong GetNextBaid()
{
return context.Cards.Any() ? context.Cards.Max(card => card.Baid) + 1 : 1;
return context.Cards.Any() ? context.Cards.ToList().Max(card => card.Baid) + 1 : 1;
}
public async Task<List<User>> GetUsersFromCards()
@ -49,4 +49,17 @@ public class CardService : ICardService
return true;
}
public async Task<bool> UpdatePassword(string accessCode, string password, string salt)
{
var card = await context.Cards.FindAsync(accessCode);
if (card is null) return false;
card.Password = password;
card.Salt = salt;
await context.SaveChangesAsync();
return true;
}
}

View File

@ -12,14 +12,14 @@ public class DanScoreDatumService : IDanScoreDatumService
this.context = context;
}
public async Task<List<DanScoreDatum>> GetDanScoreDatumByBaid(uint baid)
public async Task<List<DanScoreDatum>> GetDanScoreDatumByBaid(ulong baid)
{
return await context.DanScoreData.Where(datum => datum.Baid == baid)
.Include(datum => datum.DanStageScoreData)
.ToListAsync();
}
public async Task<DanScoreDatum?> GetSingleDanScoreDatum(uint baid, uint danId)
public async Task<DanScoreDatum?> GetSingleDanScoreDatum(ulong baid, uint danId)
{
return await context.DanScoreData.Include(datum => datum.DanStageScoreData)
.FirstOrDefaultAsync(datum => datum.Baid == baid &&

View File

@ -1,10 +1,12 @@
using System.Collections.Immutable;
using System.Text.Json;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.GZip;
using Microsoft.Extensions.Options;
using SharedProject.Models;
using SharedProject.Utils;
using Swan.Mapping;
using System.Collections.Immutable;
using System.IO.Compression;
using System.Security.Cryptography;
using System.Text.Json;
using TaikoLocalServer.Settings;
using Throw;
@ -12,22 +14,42 @@ namespace TaikoLocalServer.Services;
public class GameDataService : IGameDataService
{
private ImmutableDictionary<uint, MusicInfoEntry> musicInfoes =
ImmutableDictionary<uint, MusicInfoEntry>.Empty;
private ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> danDataDictionary =
ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData>.Empty;
private ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> gaidenDataDictionary =
ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData>.Empty;
private ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> introDataDictionary =
ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData>.Empty;
private ImmutableDictionary<uint, MusicAttributeEntry> musicAttributes =
ImmutableDictionary<uint, MusicAttributeEntry>.Empty;
private ImmutableDictionary<uint, InitialdatacheckResponse.MovieData> movieDataDictionary =
ImmutableDictionary<uint, InitialdatacheckResponse.MovieData>.Empty;
private ImmutableDictionary<uint, GetfolderResponse.EventfolderData> folderDictionary =
ImmutableDictionary<uint, GetfolderResponse.EventfolderData>.Empty;
private ImmutableDictionary<string, uint> qrCodeDataDictionary = ImmutableDictionary<string, uint>.Empty;
private List<GetShopFolderResponse.ShopFolderData> shopFolderList = new();
private List<uint> musics = new();
private List<uint> musicsWithUra = new();
private List<uint> lockedSongsList = new();
private List<int> costumeFlagArraySizes = new();
private int titleFlagArraySize;
private int toneFlagArraySize;
private Dictionary<string, int> tokenDataDictionary = new();
private readonly DataSettings settings;
public GameDataService(IOptions<DataSettings> settings)
@ -45,9 +67,9 @@ public class GameDataService : IGameDataService
return musicsWithUra;
}
public ImmutableDictionary<uint, MusicAttributeEntry> GetMusicAttributes()
public ImmutableDictionary<uint, MusicInfoEntry> GetMusicInfoes()
{
return musicAttributes;
return musicInfoes;
}
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetDanDataDictionary()
@ -55,58 +77,217 @@ public class GameDataService : IGameDataService
return danDataDictionary;
}
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetGaidenDataDictionary()
{
return gaidenDataDictionary;
}
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary()
{
return introDataDictionary;
}
public ImmutableDictionary<uint, InitialdatacheckResponse.MovieData> GetMovieDataDictionary()
{
return movieDataDictionary;
}
public ImmutableDictionary<uint, GetfolderResponse.EventfolderData> GetFolderDictionary()
{
return folderDictionary;
}
public List<GetShopFolderResponse.ShopFolderData> GetShopFolderList()
{
return shopFolderList;
}
public Dictionary<string, int> GetTokenDataDictionary()
{
return tokenDataDictionary;
}
public List<uint> GetLockedSongsList()
{
return lockedSongsList;
}
public List<int> GetCostumeFlagArraySizes()
{
return costumeFlagArraySizes;
}
public int GetTitleFlagArraySize()
{
return titleFlagArraySize;
}
public int GetToneFlagArraySize()
{
return toneFlagArraySize;
}
public ImmutableDictionary<string, uint> GetQRCodeDataDictionary()
{
return qrCodeDataDictionary;
}
public async Task InitializeAsync()
{
var dataPath = PathHelper.GetDataPath();
var musicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_FILE_NAME);
var compressedMusicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_COMPRESSED_FILE_NAME);
var musicInfoPath = Path.Combine(dataPath, $"{Constants.MUSIC_INFO_BASE_NAME}.json");
var encryptedInfo = Path.Combine(dataPath, $"{Constants.MUSIC_INFO_BASE_NAME}.bin");
var wordlistPath = Path.Combine(dataPath, $"{Constants.WORDLIST_BASE_NAME}.json");
var encryptedWordlist = Path.Combine(dataPath, $"{Constants.WORDLIST_BASE_NAME}.bin");
var musicOrderPath = Path.Combine(dataPath, $"{Constants.MUSIC_ORDER_BASE_NAME}.json");
var encryptedMusicOrder = Path.Combine(dataPath, $"{Constants.MUSIC_ORDER_BASE_NAME}.bin");
var donCosRewardPath = Path.Combine(dataPath, $"{Constants.DON_COS_REWARD_BASE_NAME}.json");
var encryptedDonCosReward = Path.Combine(dataPath, $"{Constants.DON_COS_REWARD_BASE_NAME}.bin");
var shougouPath = Path.Combine(dataPath, $"{Constants.SHOUGOU_BASE_NAME}.json");
var encryptedShougou = Path.Combine(dataPath, $"{Constants.SHOUGOU_BASE_NAME}.bin");
var neiroPath = Path.Combine(dataPath, $"{Constants.NEIRO_BASE_NAME}.json");
var encryptedNeiro = Path.Combine(dataPath, $"{Constants.NEIRO_BASE_NAME}.bin");
var danDataPath = Path.Combine(dataPath, settings.DanDataFileName);
var gaidenDataPath = Path.Combine(dataPath, settings.GaidenDataFileName);
var songIntroDataPath = Path.Combine(dataPath, settings.IntroDataFileName);
var movieDataPath = Path.Combine(dataPath, settings.MovieDataFileName);
var eventFolderDataPath = Path.Combine(dataPath, settings.EventFolderDataFileName);
var shopFolderDataPath = Path.Combine(dataPath, settings.ShopFolderDataFileName);
var tokenDataPath = Path.Combine(dataPath, settings.TokenDataFileName);
var lockedSongsDataPath = Path.Combine(dataPath, settings.LockedSongsDataFileName);
var qrCodeDataPath = Path.Combine(dataPath, settings.QRCodeDataFileName);
if (File.Exists(compressedMusicAttributePath))
if (File.Exists(encryptedInfo))
{
TryDecompressMusicAttribute();
DecryptDataTable(encryptedInfo, musicInfoPath);
}
await using var musicAttributeFile = File.OpenRead(musicAttributePath);
if (File.Exists(encryptedWordlist))
{
DecryptDataTable(encryptedWordlist, wordlistPath);
}
if (File.Exists(encryptedMusicOrder))
{
DecryptDataTable(encryptedMusicOrder, musicOrderPath);
}
if (File.Exists(encryptedDonCosReward))
{
DecryptDataTable(encryptedDonCosReward, donCosRewardPath);
}
if (File.Exists(encryptedShougou))
{
DecryptDataTable(encryptedShougou, shougouPath);
}
if (File.Exists(encryptedNeiro))
{
DecryptDataTable(encryptedNeiro, neiroPath);
}
if (!File.Exists(musicInfoPath))
{
throw new FileNotFoundException("Music info file not found!");
}
if (!File.Exists(wordlistPath))
{
throw new FileNotFoundException("Wordlist file not found!");
}
if (!File.Exists(musicOrderPath))
{
throw new FileNotFoundException("Music order file not found!");
}
if (!File.Exists(donCosRewardPath))
{
throw new FileNotFoundException("Don cos reward file not found!");
}
if (!File.Exists(shougouPath))
{
throw new FileNotFoundException("Shougou file not found!");
}
if (!File.Exists(neiroPath))
{
throw new FileNotFoundException("Neiro file not found!");
}
await using var musicInfoFile = File.OpenRead(musicInfoPath);
await using var danDataFile = File.OpenRead(danDataPath);
await using var gaidenDataFile = File.OpenRead(gaidenDataPath);
await using var songIntroDataFile = File.OpenRead(songIntroDataPath);
await using var movieDataFile = File.OpenRead(movieDataPath);
await using var eventFolderDataFile = File.OpenRead(eventFolderDataPath);
await using var shopFolderDataFile = File.OpenRead(shopFolderDataPath);
await using var tokenDataFile = File.OpenRead(tokenDataPath);
await using var lockedSongsDataFile = File.OpenRead(lockedSongsDataPath);
await using var donCosRewardFile = File.OpenRead(donCosRewardPath);
await using var shougouFile = File.OpenRead(shougouPath);
await using var neiroFile = File.OpenRead(neiroPath);
await using var qrCodeDataFile = File.OpenRead(qrCodeDataPath);
var attributesData = await JsonSerializer.DeserializeAsync<MusicAttributes>(musicAttributeFile);
var infoesData = await JsonSerializer.DeserializeAsync<MusicInfoes>(musicInfoFile);
var danData = await JsonSerializer.DeserializeAsync<List<DanData>>(danDataFile);
var gaidenData = await JsonSerializer.DeserializeAsync<List<DanData>>(gaidenDataFile);
var introData = await JsonSerializer.DeserializeAsync<List<SongIntroductionData>>(songIntroDataFile);
var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile);
var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile);
var shopFolderData = await JsonSerializer.DeserializeAsync<List<ShopFolderData>>(shopFolderDataFile);
var tokenData = await JsonSerializer.DeserializeAsync<Dictionary<string, int>>(tokenDataFile);
var lockedSongsData = await JsonSerializer.DeserializeAsync<Dictionary<string, uint[]>>(lockedSongsDataFile);
var donCosRewardData = await JsonSerializer.DeserializeAsync<DonCosRewards>(donCosRewardFile);
var shougouData = await JsonSerializer.DeserializeAsync<Shougous>(shougouFile);
var neiroData = await JsonSerializer.DeserializeAsync<Neiros>(neiroFile);
var qrCodeData = await JsonSerializer.DeserializeAsync<List<QRCodeData>>(qrCodeDataFile);
InitializeMusicAttributes(attributesData);
InitializeMusicInfoes(infoesData);
InitializeDanData(danData);
InitializeGaidenData(gaidenData);
InitializeIntroData(introData);
InitializeMovieData(movieData);
InitializeEventFolderData(eventFolderData);
InitializeShopFolderData(shopFolderData);
InitializeTokenData(tokenData);
InitializeLockedSongsData(lockedSongsData);
InitializeCostumeFlagArraySizes(donCosRewardData);
InitializeTitleFlagArraySize(shougouData);
InitializeToneFlagArraySize(neiroData);
InitializeQrCodeData(qrCodeData);
}
private static void TryDecompressMusicAttribute()
private static void DecryptDataTable(string inputFileName, string outputFileName)
{
var dataPath = PathHelper.GetDataPath();
var musicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_FILE_NAME);
var compressedMusicAttributePath = Path.Combine(dataPath, Constants.MUSIC_ATTRIBUTE_COMPRESSED_FILE_NAME);
using var compressed = File.Open(compressedMusicAttributePath, FileMode.Open);
using var output = File.Create(musicAttributePath);
GZip.Decompress(compressed, output, true);
var aes = Aes.Create();
aes.Mode = CipherMode.CBC;
aes.KeySize = 256;
aes.Padding = PaddingMode.PKCS7;
aes.Key = Convert.FromHexString("3530304242323633353537423431384139353134383346433246464231354534");
var iv = new byte[16];
using var fs = File.OpenRead(inputFileName);
var count = fs.Read(iv, 0, 16);
count.Throw("Read IV for datatable failed!").IfNotEquals(16);
aes.IV = iv;
using var cs = new CryptoStream(fs, aes.CreateDecryptor(), CryptoStreamMode.Read);
using var ms = new MemoryStream();
cs.CopyTo(ms);
ms.Position = 0;
using var gz = new GZipStream(ms, CompressionMode.Decompress);
using var output = File.Create(outputFileName);
gz.CopyTo(output);
}
private void InitializeIntroData(List<SongIntroductionData>? introData)
@ -115,34 +296,114 @@ public class GameDataService : IGameDataService
introDataDictionary = introData.ToImmutableDictionary(data => data.SetId, ToResponseIntroData);
}
private void InitializeMovieData(List<MovieData>? movieData)
{
movieData.ThrowIfNull("Shouldn't happen!");
movieDataDictionary = movieData.ToImmutableDictionary(data => data.MovieId, ToResponseMovieData);
}
private void InitializeDanData(List<DanData>? danData)
{
danData.ThrowIfNull("Shouldn't happen!");
danDataDictionary = danData.ToImmutableDictionary(data => data.DanId, ToResponseOdaiData);
}
private void InitializeGaidenData(List<DanData>? gaidenData)
{
gaidenData.ThrowIfNull("Shouldn't happen!");
gaidenDataDictionary = gaidenData.ToImmutableDictionary(data => data.DanId, ToResponseOdaiData);
}
private void InitializeEventFolderData(List<EventFolderData>? eventFolderData)
{
eventFolderData.ThrowIfNull("Shouldn't happen!");
folderDictionary = eventFolderData.ToImmutableDictionary(data => data.FolderId, ToResponseEventFolderData);
}
private void InitializeMusicAttributes(MusicAttributes? attributesData)
private void InitializeMusicInfoes(MusicInfoes? infoesData)
{
attributesData.ThrowIfNull("Shouldn't happen!");
infoesData.ThrowIfNull("Shouldn't happen!");
musicAttributes = attributesData.MusicAttributeEntries.ToImmutableDictionary(attribute => attribute.MusicId);
musicInfoes = infoesData.MusicInfoEntries.ToImmutableDictionary(info => info.MusicId);
musics = musicAttributes.Select(pair => pair.Key)
musics = musicInfoes.Select(pair => pair.Key)
.ToList();
musics.Sort();
musicsWithUra = musicAttributes.Where(attribute => attribute.Value.HasUra)
musicsWithUra = musicInfoes.Where(info => info.Value.starUra > 0)
.Select(pair => pair.Key)
.ToList();
musicsWithUra.Sort();
}
private void InitializeShopFolderData(List<ShopFolderData>? shopFolderData)
{
shopFolderData.ThrowIfNull("Shouldn't happen!");
foreach (var folderData in shopFolderData)
{
shopFolderList.Add(ToResponseShopFolderData(folderData));
}
}
private void InitializeTokenData(Dictionary<string, int>? tokenData)
{
tokenData.ThrowIfNull("Shouldn't happen!");
tokenDataDictionary = tokenData;
}
private void InitializeLockedSongsData(Dictionary<string, uint[]>? lockedSongsData)
{
lockedSongsData.ThrowIfNull("Shouldn't happen!");
lockedSongsList = lockedSongsData["songNo"].ToList();
}
private void InitializeCostumeFlagArraySizes(DonCosRewards? donCosRewardData)
{
donCosRewardData.ThrowIfNull("Shouldn't happen!");
var kigurumiUniqueIdList = donCosRewardData.DonCosRewardEntries
.Where(entry => entry.cosType == "kigurumi")
.Select(entry => entry.uniqueId);
var headUniqueIdList = donCosRewardData.DonCosRewardEntries
.Where(entry => entry.cosType == "head")
.Select(entry => entry.uniqueId);
var bodyUniqueIdList = donCosRewardData.DonCosRewardEntries
.Where(entry => entry.cosType == "body")
.Select(entry => entry.uniqueId);
var faceUniqueIdList = donCosRewardData.DonCosRewardEntries
.Where(entry => entry.cosType == "face")
.Select(entry => entry.uniqueId);
var puchiUniqueIdList = donCosRewardData.DonCosRewardEntries
.Where(entry => entry.cosType == "puchi")
.Select(entry => entry.uniqueId);
costumeFlagArraySizes = new List<int>
{
(int)kigurumiUniqueIdList.Max() + 1,
(int)headUniqueIdList.Max() + 1,
(int)bodyUniqueIdList.Max() + 1,
(int)faceUniqueIdList.Max() + 1,
(int)puchiUniqueIdList.Max() + 1
};
}
private void InitializeTitleFlagArraySize(Shougous? shougouData)
{
shougouData.ThrowIfNull("Shouldn't happen!");
titleFlagArraySize = (int)shougouData.ShougouEntries.Max(entry => entry.uniqueId) + 1;
}
private void InitializeToneFlagArraySize(Neiros? neiroData)
{
neiroData.ThrowIfNull("Shouldn't happen!");
toneFlagArraySize = (int)neiroData.NeiroEntries.Max(entry => entry.uniqueId) + 1;
}
private void InitializeQrCodeData(List<QRCodeData>? qrCodeData)
{
qrCodeData.ThrowIfNull("Shouldn't happen!");
qrCodeDataDictionary = qrCodeData.ToImmutableDictionary(data => data.Serial, data => data.Id);
}
private static GetDanOdaiResponse.OdaiData ToResponseOdaiData(DanData data)
{
var responseOdaiData = new GetDanOdaiResponse.OdaiData
@ -163,7 +424,7 @@ public class GameDataService : IGameDataService
private static GetSongIntroductionResponse.SongIntroductionData ToResponseIntroData(SongIntroductionData data)
{
var responseOdaiData = new GetSongIntroductionResponse.SongIntroductionData
var responseIntroData = new GetSongIntroductionResponse.SongIntroductionData
{
SetId = data.SetId,
VerupNo = data.VerupNo,
@ -171,7 +432,18 @@ public class GameDataService : IGameDataService
SubSongNoes = data.SubSongNo
};
return responseOdaiData;
return responseIntroData;
}
private static InitialdatacheckResponse.MovieData ToResponseMovieData(MovieData data)
{
var responseMovieData = new InitialdatacheckResponse.MovieData
{
MovieId = data.MovieId,
EnableDays = data.EnableDays
};
return responseMovieData;
}
private static GetfolderResponse.EventfolderData ToResponseEventFolderData(EventFolderData data)
@ -181,9 +453,21 @@ public class GameDataService : IGameDataService
FolderId = data.FolderId,
VerupNo = data.VerupNo,
Priority = data.Priority,
SongNoes = data.SongNo
SongNoes = data.SongNo,
ParentFolderId = data.ParentFolderId
};
return responseEventFolderData;
}
private static GetShopFolderResponse.ShopFolderData ToResponseShopFolderData(ShopFolderData data)
{
var responseShopFolderData = new GetShopFolderResponse.ShopFolderData
{
SongNo = data.SongNo,
Price = data.Price
};
return responseShopFolderData;
}
}

View File

@ -4,9 +4,9 @@ namespace TaikoLocalServer.Services.Interfaces;
public interface IAiDatumService
{
public Task<List<AiScoreDatum>> GetAllAiScoreById(uint baid);
public Task<List<AiScoreDatum>> GetAllAiScoreById(ulong baid);
public Task<AiScoreDatum?> GetSongAiScore(uint baid, uint songId, Difficulty difficulty);
public Task<AiScoreDatum?> GetSongAiScore(ulong baid, uint songId, Difficulty difficulty);
public Task UpdateSongAiScore(AiScoreDatum datum);

View File

@ -7,11 +7,13 @@ public interface ICardService
{
public Task<Card?> GetCardByAccessCode(string accessCode);
public uint GetNextBaid();
public ulong GetNextBaid();
public Task<List<User>> GetUsersFromCards();
public Task AddCard(Card card);
public Task<bool> DeleteCard(string accessCode);
public Task<bool> UpdatePassword(string accessCode, string password, string salt);
}

View File

@ -4,9 +4,9 @@ namespace TaikoLocalServer.Services.Interfaces;
public interface IDanScoreDatumService
{
public Task<List<DanScoreDatum>> GetDanScoreDatumByBaid(uint baid);
public Task<List<DanScoreDatum>> GetDanScoreDatumByBaid(ulong baid);
public Task<DanScoreDatum?> GetSingleDanScoreDatum(uint baid, uint danId);
public Task<DanScoreDatum?> GetSingleDanScoreDatum(ulong baid, uint danId);
public Task InsertOrUpdateDanScoreDatum(DanScoreDatum datum);
}

View File

@ -1,4 +1,5 @@
using System.Collections.Immutable;
using SharedProject.Models;
namespace TaikoLocalServer.Services.Interfaces;
@ -10,12 +11,30 @@ public interface IGameDataService
public List<uint> GetMusicWithUraList();
public ImmutableDictionary<uint, MusicAttributeEntry> GetMusicAttributes();
public ImmutableDictionary<uint, MusicInfoEntry> GetMusicInfoes();
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetDanDataDictionary();
public ImmutableDictionary<uint, GetDanOdaiResponse.OdaiData> GetGaidenDataDictionary();
public ImmutableDictionary<uint, GetSongIntroductionResponse.SongIntroductionData> GetSongIntroDictionary();
public ImmutableDictionary<uint, InitialdatacheckResponse.MovieData> GetMovieDataDictionary();
public ImmutableDictionary<uint, GetfolderResponse.EventfolderData> GetFolderDictionary();
public List<GetShopFolderResponse.ShopFolderData> GetShopFolderList();
public Dictionary<string, int> GetTokenDataDictionary();
public List<uint> GetLockedSongsList();
public List<int> GetCostumeFlagArraySizes();
public int GetTitleFlagArraySize();
public int GetToneFlagArraySize();
public ImmutableDictionary<string, uint> GetQRCodeDataDictionary();
}

View File

@ -5,9 +5,9 @@ namespace TaikoLocalServer.Services.Interfaces;
public interface ISongBestDatumService
{
public Task<List<SongBestDatum>> GetAllSongBestData(uint baid);
public Task<List<SongBestDatum>> GetAllSongBestData(ulong baid);
public Task UpdateOrInsertSongBestDatum(SongBestDatum datum);
public Task<List<SongBestData>> GetAllSongBestAsModel(uint baid);
public Task<List<SongBestData>> GetAllSongBestAsModel(ulong baid);
}

View File

@ -4,7 +4,7 @@ namespace TaikoLocalServer.Services.Interfaces;
public interface ISongPlayDatumService
{
public Task<List<SongPlayDatum>> GetSongPlayDatumByBaid(uint baid);
public Task<List<SongPlayDatum>> GetSongPlayDatumByBaid(ulong baid);
public Task AddSongPlayDatum(SongPlayDatum datum);
}

View File

@ -4,9 +4,9 @@ namespace TaikoLocalServer.Services.Interfaces;
public interface IUserDatumService
{
public Task<UserDatum?> GetFirstUserDatumOrNull(uint baid);
public Task<UserDatum?> GetFirstUserDatumOrNull(ulong baid);
public Task<UserDatum> GetFirstUserDatumOrDefault(uint baid);
public Task<UserDatum> GetFirstUserDatumOrDefault(ulong baid);
public Task<List<UserDatum>> GetAllUserData();
@ -16,9 +16,9 @@ public interface IUserDatumService
public Task UpdateUserDatum(UserDatum userDatum);
public Task<List<uint>> GetFavoriteSongIds(uint baid);
public Task<List<uint>> GetFavoriteSongIds(ulong baid);
public Task UpdateFavoriteSong(uint baid, uint songId, bool isFavorite);
public Task UpdateFavoriteSong(ulong baid, uint songId, bool isFavorite);
}

View File

@ -15,7 +15,7 @@ public class SongBestDatumService : ISongBestDatumService
this.context = context;
}
public async Task<List<SongBestDatum>> GetAllSongBestData(uint baid)
public async Task<List<SongBestDatum>> GetAllSongBestData(ulong baid)
{
return await context.SongBestData.Where(datum => datum.Baid == baid).ToListAsync();
}
@ -37,7 +37,7 @@ public class SongBestDatumService : ISongBestDatumService
await context.SaveChangesAsync();
}
public async Task<List<SongBestData>> GetAllSongBestAsModel(uint baid)
public async Task<List<SongBestData>> GetAllSongBestAsModel(ulong baid)
{
var songbestDbData = await context.SongBestData.Where(datum => datum.Baid == baid)
.ToListAsync();

View File

@ -12,7 +12,7 @@ class SongPlayDatumService : ISongPlayDatumService
this.context = context;
}
public async Task<List<SongPlayDatum>> GetSongPlayDatumByBaid(uint baid)
public async Task<List<SongPlayDatum>> GetSongPlayDatumByBaid(ulong baid)
{
return await context.SongPlayData.Where(datum => datum.Baid == baid).ToListAsync();
}

View File

@ -17,12 +17,12 @@ public class UserDatumService : IUserDatumService
this.logger = logger;
}
public async Task<UserDatum?> GetFirstUserDatumOrNull(uint baid)
public async Task<UserDatum?> GetFirstUserDatumOrNull(ulong baid)
{
return await context.UserData.FindAsync(baid);
}
public async Task<UserDatum> GetFirstUserDatumOrDefault(uint baid)
public async Task<UserDatum> GetFirstUserDatumOrDefault(ulong baid)
{
return await context.UserData.FindAsync(baid) ?? new UserDatum();
}
@ -57,7 +57,7 @@ public class UserDatumService : IUserDatumService
await context.SaveChangesAsync();
}
public async Task<List<uint>> GetFavoriteSongIds(uint baid)
public async Task<List<uint>> GetFavoriteSongIds(ulong baid)
{
var userDatum = await context.UserData.FindAsync(baid);
userDatum.ThrowIfNull($"User with baid: {baid} not found!");
@ -77,7 +77,7 @@ public class UserDatumService : IUserDatumService
return result;
}
public async Task UpdateFavoriteSong(uint baid, uint songId, bool isFavorite)
public async Task UpdateFavoriteSong(ulong baid, uint songId, bool isFavorite)
{
var userDatum = await context.UserData.FindAsync(baid);
userDatum.ThrowIfNull($"User with baid: {baid} not found!");

Some files were not shown because too many files have changed in this diff Show More