Stuff works

This commit is contained in:
gamer147
2024-09-08 10:27:12 -04:00
parent 7e4bce9ac5
commit ac3b002d74
14 changed files with 157 additions and 87 deletions

View File

@@ -6,6 +6,9 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using SVSim.Database.Models;
using SVSim.Database.Repositories.Viewer;
using SVSim.EmulatedEntrypoint.Extensions;
using SVSim.EmulatedEntrypoint.Models.Dtos;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses;
@@ -16,79 +19,57 @@ namespace SVSim.EmulatedEntrypoint.Controllers
[ApiController]
public class CheckController : SVSimController
{
private ILogger _logger;
private readonly ILogger _logger;
private readonly IViewerRepository _viewerRepository;
public CheckController(ILogger<CheckController> logger)
public CheckController(ILogger<CheckController> logger, IViewerRepository viewerRepository)
{
_logger = logger;
_viewerRepository = viewerRepository;
}
[AllowAnonymous]
[HttpPost("special_title")]
public async Task<DataWrapper<SpecialTitleCheckResponse>> SpecialTitleCheck(SpecialTitleCheckRequest request)
public async Task<SpecialTitleCheckResponse> SpecialTitleCheck(SpecialTitleCheckRequest request)
{
int titleId = Random.Shared.Next(8, 33);
var res = new DataWrapper<SpecialTitleCheckResponse>
var res = new SpecialTitleCheckResponse
{
Data = new SpecialTitleCheckResponse
{
TitleImageId = titleId,
TitleSoundId = titleId
},
DataHeaders = new DataHeaders
{
ShortUdid = 411054851,
ViewerId = 906243102,
Sid = string.Empty,
Servertime = DateTime.UtcNow.Ticks,
ResultCode = 1
}
TitleImageId = titleId,
TitleSoundId = titleId
};
return res;
}
[HttpPost("game_start")]
public async Task<DataWrapper<GameStartResponse>> GameStart(GameStartRequest request)
public async Task<GameStartResponse> GameStart(GameStartRequest request)
{
return new DataWrapper<GameStartResponse>()
Viewer? viewer = await _viewerRepository.GetViewerWithSocials(HttpContext.GetViewer().Id);
return new GameStartResponse()
{
DataHeaders = new DataHeaders
IsSetTransitionPassword = true,
KorAuthorityId = default,
KorAuthorityState = default,
NowRank = new Dictionary<string, string>()
{
ShortUdid = 411054851,
ViewerId = 906243102,
Sid = string.Empty,
Servertime = DateTime.UtcNow.Ticks,
ResultCode = 1
{ "1", "RankName_010" },
{ "2", "RankName_010" },
{ "4", "RankName_017" }
},
Data = new GameStartResponse()
NowName = viewer.DisplayName,
PolicyState = default,
PolicyId = default,
NowTutorialStep = "100",
NowViewerId = viewer.Id,
TosId = default,
TosState = default,
TransitionAccountData = viewer.SocialAccountConnections.Select(sac => new TransitionAccountData
{
IsSetTransitionPassword = true,
KorAuthorityId = default,
KorAuthorityState = default,
NowRank = new Dictionary<string, string>()
{
{"1", "RankName_010"},
{"2", "RankName_010"},
{"4", "RankName_017"}
},
NowName = "combusty7",
PolicyState = default,
PolicyId = default,
NowTutorialStep = "100",
NowViewerId = 906243102,
TosId = default,
TosState = default,
TransitionAccountData = new List<TransitionAccountData>()
{
new TransitionAccountData()
{
ConnectedViewerId = "906243102",
SocialAccountType = "5",
SocialAccountId = "76561197970830305"
}
}
}
ConnectedViewerId = viewer.Id.ToString(),
SocialAccountId = sac.AccountId.ToString(),
SocialAccountType = ((int)sac.AccountType).ToString()
}).ToList()
};
}
}