1
0
mirror of synced 2024-11-24 06:50:15 +01:00

Update route

This commit is contained in:
esuo1198 2024-03-07 22:44:19 +09:00
parent a3cff10634
commit ae885e546f
15 changed files with 49 additions and 50 deletions

View File

@ -3,7 +3,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/addtokencount.php")]
[Route("/v12r08_ww/chassis/addtokencount_7547j3o4.php")]
[ApiController]
public class AddTokenCountController : BaseController<AddTokenCountController>
{

View File

@ -5,7 +5,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[ApiController]
[Route("/v12r08_ww/chassis/baidcheck.php")]
[Route("/v12r08_ww/chassis/baidcheck_dcfxit1u.php")]
public class BaidController : BaseController<BaidController>
{
private readonly IUserDatumService userDatumService;

View File

@ -3,7 +3,7 @@ using TaikoLocalServer.Settings;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/crownsdata.php")]
[Route("/v12r08_ww/chassis/crownsdata_oqgqy90s.php")]
[ApiController]
public class CrownsDataController : BaseController<CrownsDataController>
{
@ -24,7 +24,7 @@ public class CrownsDataController : BaseController<CrownsDataController>
Logger.LogInformation("CrownsData request : {Request}", request.Stringify());
var songBestData = await songBestDatumService.GetAllSongBestData(request.Baid);
var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX;
var crown = new ushort[songIdMax + 1];
var dondafulCrown = new byte[songIdMax + 1];
@ -38,7 +38,7 @@ public class CrownsDataController : BaseController<CrownsDataController>
datum.BestCrown == CrownType.Dondaful)
// Calculate flag according to difficulty
.Aggregate((byte)0, (flag, datum) => FlagCalculator.ComputeDondafulCrownFlag(flag, datum.Difficulty));
crown[songId] = songBestData
// Select song of this song id with clear or fc crown
.Where(datum => datum.SongId == id &&

View File

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

View File

@ -2,7 +2,7 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/getaidata.php")]
[Route("/v12r08_ww/chassis/getaidata_6x30b9nr.php")]
[ApiController]
public class GetAiDataController : BaseController<GetAiDataController>
{
@ -23,7 +23,7 @@ public class GetAiDataController : BaseController<GetAiDataController>
user.ThrowIfNull($"User with baid {request.Baid} does not exist!");
var response = new GetAiDataResponse
{
Result = 1,
Result = 1,
TotalWinnings = (uint)user.AiWinCount,
InputMedian = "1000",
InputVariance = "2000"

View File

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

View File

@ -3,7 +3,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/getdanscore.php")]
[Route("/v12r08_ww/chassis/getdanscore_frqhg7q6.php")]
[ApiController]
public class GetDanScoreController : BaseController<GetDanScoreController>
{
@ -44,7 +44,7 @@ public class GetDanScoreController : BaseController<GetDanScoreController>
{
responseData.AryDanScoreDataStages.Add(ObjectMappers.DanStageDbToResponseMap.Apply(stageScoreDatum));
}
response.AryDanScoreDatas.Add(responseData);
}

View File

@ -3,14 +3,14 @@ using TaikoLocalServer.Settings;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/getscorerank.php")]
[Route("/v12r08_ww/chassis/getscorerank_1c8l7y61.php")]
[ApiController]
public class GetScoreRankController : BaseController<GetScoreRankController>
{
private readonly ISongBestDatumService songBestDatumService;
private readonly ServerSettings settings;
public GetScoreRankController(ISongBestDatumService songBestDatumService, IOptions<ServerSettings> settings)
{
this.songBestDatumService = songBestDatumService;
@ -27,7 +27,7 @@ public class GetScoreRankController : BaseController<GetScoreRankController>
var miyabiScores = new ushort[songIdMax + 1];
var ikiScores = new ushort[songIdMax + 1];
var songBestData = await songBestDatumService.GetAllSongBestData(request.Baid);
for (var songId = 0; songId < songIdMax; songId++)
{
var id = songId;
@ -35,12 +35,12 @@ public class GetScoreRankController : BaseController<GetScoreRankController>
.Where(datum => datum.SongId == id &&
datum.BestScoreRank == ScoreRank.Dondaful)
.Aggregate((byte)0, (flag, datum) => FlagCalculator.ComputeKiwamiScoreRankFlag(flag, datum.Difficulty));
ikiScores[songId] = songBestData
.Where(datum => datum.SongId == id &&
datum.BestScoreRank is ScoreRank.White or ScoreRank.Bronze or ScoreRank.Silver)
.Aggregate((ushort)0, (flag, datum) => FlagCalculator.ComputeMiyabiOrIkiScoreRank(flag, datum.BestScoreRank, datum.Difficulty));
miyabiScores[songId] = songBestData
.Where(datum => datum.SongId == id &&
datum.BestScoreRank is ScoreRank.Gold or ScoreRank.Purple or ScoreRank.Sakura)
@ -53,7 +53,7 @@ public class GetScoreRankController : BaseController<GetScoreRankController>
KiwamiScoreRankFlg = GZipBytesUtil.GetGZipBytes(kiwamiScores),
MiyabiScoreRankFlg = GZipBytesUtil.GetGZipBytes(miyabiScores)
};
return Ok(response);
}
}

View File

@ -1,6 +1,6 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/gettelop.php")]
[Route("/v12r08_ww/chassis/gettelop_o0cb2z3e.php")]
[ApiController]
public class GetTelopController : BaseController<GetTelopController>
{
@ -12,7 +12,7 @@ public class GetTelopController : BaseController<GetTelopController>
var startDateTime = DateTime.Now - TimeSpan.FromDays(999.0);
var endDateTime = DateTime.Now + TimeSpan.FromDays(999.0);
var response = new GettelopResponse
{
Result = 1,

View File

@ -3,7 +3,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/gettokencount.php")]
[Route("/v12r08_ww/chassis/gettokencount_iut9g23g.php")]
[ApiController]
public class GetTokenCountController : BaseController<GetTokenCountController>
{
@ -15,7 +15,7 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
this.userDatumService = userDatumService;
this.gameDataService = gameDataService;
}
[HttpPost]
[Produces("application/protobuf")]
public async Task<IActionResult> GetTokenCount([FromBody] GetTokenCountRequest request)
@ -43,12 +43,12 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
}
tokenCountDict.ThrowIfNull("TokenCountDict should never be null");
var response = new GetTokenCountResponse
{
Result = 1
};
if (tokenCountDict.Count == 0) tokenCountDict.Add(1, 0);
if (shopTokenId > 0)
{
@ -71,7 +71,7 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
TokenId = castedKaTokenId
});
}
if (onePieceTokenId > 0)
{
var castedOnePieceTokenId = (uint)onePieceTokenId;
@ -82,7 +82,7 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
TokenId = castedOnePieceTokenId
});
}
if (soshinaTokenId > 0)
{
var castedSoshinaTokenId = (uint)soshinaTokenId;
@ -96,7 +96,7 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
user.TokenCountDict = JsonSerializer.Serialize(tokenCountDict);
await userDatumService.UpdateUserDatum(user);
return Ok(response);
}
}

View File

@ -2,7 +2,7 @@
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/mydonentry.php")]
[Route("/v12r08_ww/chassis/mydonentry_3nrd7kwk.php")]
[ApiController]
public class MyDonEntryController : BaseController<MyDonEntryController>
{

View File

@ -1,14 +1,13 @@
using System.Buffers.Binary;
using GameDatabase.Entities;
using System.Globalization;
using System.Text.Json;
using GameDatabase.Entities;
using Throw;
namespace TaikoLocalServer.Controllers.Game;
using StageData = PlayResultDataRequest.StageData;
[Route("/v12r08_ww/chassis/playresult.php")]
[Route("/v12r08_ww/chassis/playresult_r3ky4a4z.php")]
[ApiController]
public class PlayResultController : BaseController<PlayResultController>
{
@ -73,11 +72,11 @@ public class PlayResultController : BaseController<PlayResultController>
await UpdateDanPlayData(request, playResultData, danType);
return Ok(response);
}
for (var songNumber = 0; songNumber < playResultData.AryStageInfoes.Count; songNumber++)
{
var stageData = playResultData.AryStageInfoes[songNumber];
if (stageData.IsSkipUse)
{
await UpdatePlayData(request, songNumber, stageData, lastPlayDatetime);
@ -192,7 +191,7 @@ public class PlayResultController : BaseController<PlayResultController>
userdata.ThrowIfNull($"User data is null! Baid: {request.BaidConf}");
var playMode = (PlayMode)playResultData.PlayMode;
userdata.Title = playResultData.Title;
userdata.TitlePlateId = playResultData.TitleplateId;
var costumeData = new List<uint>
@ -246,7 +245,7 @@ public class PlayResultController : BaseController<PlayResultController>
playResultData.DifficultyPlayedSort
};
userdata.DifficultyPlayedArray = JsonSerializer.Serialize(difficultyPlayedArray);
userdata.AiWinCount += playResultData.AryStageInfoes.Count(data => data.IsWin);
await userDatumService.UpdateUserDatum(userdata);
}
@ -335,12 +334,12 @@ public class PlayResultController : BaseController<PlayResultController>
await songBestDatumService.UpdateSongBestData(existing);
}
private async Task UpdateAiBattleData(PlayResultRequest request, StageData stageData)
{
var difficulty = (Difficulty)stageData.Level;
difficulty.Throw().IfOutOfRange();
var existing = await aiDatumService.GetSongAiScore(request.BaidConf,
var existing = await aiDatumService.GetSongAiScore(request.BaidConf,
stageData.SongNo, difficulty);
if (existing is null)
@ -370,7 +369,7 @@ public class PlayResultController : BaseController<PlayResultController>
}
else
{
AddNewAiSectionScore(request,stageData,index,difficulty,existing);
AddNewAiSectionScore(request, stageData, index, difficulty, existing);
}
}

View File

@ -3,14 +3,14 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/selfbest.php")]
[Route("/v12r08_ww/chassis/selfbest_5nz47auu.php")]
[ApiController]
public class SelfBestController : BaseController<SelfBestController>
{
private readonly ISongBestDatumService songBestDatumService;
private readonly IGameDataService gameDataService;
public SelfBestController(ISongBestDatumService songBestDatumService, IGameDataService gameDataService)
{
this.songBestDatumService = songBestDatumService;
@ -28,10 +28,10 @@ public class SelfBestController : BaseController<SelfBestController>
Result = 1,
Level = request.Level
};
var requestDifficulty = (Difficulty)request.Level;
requestDifficulty.Throw().IfOutOfRange();
var playerBestData = await songBestDatumService.GetAllSongBestData(request.Baid);
playerBestData = playerBestData
.Where(datum => datum.Difficulty == requestDifficulty ||
@ -50,7 +50,7 @@ public class SelfBestController : BaseController<SelfBestController>
response.ArySelfbestScores.Add(selfBestData);
}
response.ArySelfbestScores.Sort((data, otherData) => data.SongNo.CompareTo(otherData.SongNo));
return Ok(response);
}

View File

@ -3,7 +3,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/songpurchase.php")]
[Route("/v12r08_ww/chassis/songpurchase_wm2fh5bl.php")]
[ApiController]
public class SongPurchaseController : BaseController<SongPurchaseController>
{
@ -36,7 +36,7 @@ public class SongPurchaseController : BaseController<SongPurchaseController>
}
tokenCountDict.ThrowIfNull("TokenCountDict should never be null");
Logger.LogInformation("Original UnlockedSongIdList: {UnlockedSongIdList}", user.UnlockedSongIdList);
var unlockedSongIdList = new List<uint>();
@ -59,9 +59,9 @@ public class SongPurchaseController : BaseController<SongPurchaseController>
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

View File

@ -6,7 +6,7 @@ using Throw;
namespace TaikoLocalServer.Controllers.Game;
[Route("/v12r08_ww/chassis/userdata.php")]
[Route("/v12r08_ww/chassis/userdata_gc6x17o8.php")]
[ApiController]
public class UserDataController : BaseController<UserDataController>
{
@ -36,7 +36,7 @@ public class UserDataController : BaseController<UserDataController>
var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX;
var userData = await userDatumService.GetFirstUserDatumOrDefault(request.Baid);
var unlockedSongIdList = new List<uint>();
try
{
@ -50,7 +50,7 @@ public class UserDataController : BaseController<UserDataController>
}
unlockedSongIdList.ThrowIfNull("UnlockedSongIdList should never be null");
var musicList = gameDataService.GetMusicList();
var lockedSongsList = gameDataService.GetLockedSongsList();
lockedSongsList = lockedSongsList.Except(unlockedSongIdList).ToList();
@ -76,7 +76,7 @@ public class UserDataController : BaseController<UserDataController>
// The only way to get a null is provide string "null" as input,
// which means database content need to be fixed, so better throw
toneFlg.ThrowIfNull("Tone flg should never be null!");
// If toneFlg is empty, add 0 to it
if (toneFlg.Length == 0)
{