Files
the-cycle/src/Prospect.Server.Api/Services/CloudScript/Functions/GetPlayerStatisticsRequestsClient.cs
T
neckfireandClaude Opus 4.8 0a68a97291
Build & Deploy / build (push) Successful in 43s
fix(audit léger): stats carrière, présence amis, AddGenericId
- GetPlayerStatisticsRequestsClient: renvoyait vide -> renvoie les stats demandées
  (0 pour l'instant, raid client-hosted non traçable) pour que l'écran carrière s'affiche.
- UpdatePlayerPresenceState: persiste {inMatch,lastSeenUtc}; GetFriendList lit la présence
  et calcule onlineState (online si vu <3min, 2=en raid) au lieu de 0 en dur.
- AddGenericId: persiste l'id de service lié (était un no-op).
(Free-loadout non touché: S3 only, pas de free-loadout en S2.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 09:02:45 +02:00

41 lines
2.0 KiB
C#

using System.Text.Json.Serialization;
using Prospect.Server.Api.Services.CloudScript;
// ["DropsTotal","DeathsTotal","DeathsPlayerTotal","DeathsCreaturesTotal","DeathsOthersTotal","EvacsTotal","DeathsConsecutive","EvacsConsecutive","KillsPlayersTotal","KillsPlayersMax","KillsCreaturesTotal","KillsCreaturesMax","DamagePlayersTotal","DamagePlayersMax","DamageCreaturesTotal","DamageCreaturesMax","ContractsCompletedKorolevTotal","ContractsCompletedOsirisTotal","ContractsCompletedICATotal","ContractsCompletedTotal","MatchDurationMax","MatchDurationAvg","KMarksMatchMax","KMarksMatchTotal","KMarksTotal"]
public class GetPlayerStatisticsRequestsClientRequest
{
[JsonPropertyName("statistics")]
public string[] Statistics { get; set; }
}
[CloudScriptFunction("GetPlayerStatisticsRequestsClient")]
public class GetPlayerStatisticsRequestsClientFunction : ICloudScriptFunction<GetPlayerStatisticsRequestsClientRequest, object>
{
private readonly IHttpContextAccessor _httpContextAccessor;
public GetPlayerStatisticsRequestsClientFunction(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
public Task<object> ExecuteAsync(GetPlayerStatisticsRequestsClientRequest request)
{
var context = _httpContextAccessor.HttpContext;
if (context == null)
{
throw new CloudScriptException("CloudScript was not called within a http request");
}
// Return each requested statistic with a value so the career screen renders instead
// of staying blank. Raid stats (kills/deaths/evacs/damage/…) come from the
// client-hosted raid and aren't tracked server-side, so they report 0 for now.
var stats = new List<object>();
foreach (var name in request.Statistics ?? Array.Empty<string>())
{
stats.Add(new { statisticName = name, value = 0 });
}
return Task.FromResult<object>(new { statistics = stats });
}
}