fix(audit léger): stats carrière, présence amis, AddGenericId
Build & Deploy / build (push) Successful in 43s
Build & Deploy / build (push) Successful in 43s
- 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>
This commit is contained in:
@@ -47,9 +47,28 @@ public class GetFriendList : ICloudScriptFunction<FYBaseSocialRequest, object?>
|
||||
if (steamIds.Count > 0)
|
||||
{
|
||||
var players = await _userService.FindManyAsync(PlayFabUserAuthType.Steam, steamIds);
|
||||
var nowUtc = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
foreach (var player in players)
|
||||
{
|
||||
if (player.Id == userId) continue; // never list yourself
|
||||
|
||||
// Presence persisted by UpdatePlayerPresenceState: online if seen in the last
|
||||
// 3 minutes. EYUserState best-effort: 0 = offline, 1 = online, 2 = in match.
|
||||
var onlineState = 0;
|
||||
var presenceData = await _userDataService.FindAsync(player.Id, player.Id, new List<string> { "PresenceState" });
|
||||
if (presenceData.TryGetValue("PresenceState", out var presenceRec) && !string.IsNullOrWhiteSpace(presenceRec.Value))
|
||||
{
|
||||
try
|
||||
{
|
||||
var presence = JsonSerializer.Deserialize<PlayerPresenceState>(presenceRec.Value);
|
||||
if (presence != null && nowUtc - presence.LastSeenUtc <= 180)
|
||||
{
|
||||
onlineState = presence.InMatch ? 2 : 1;
|
||||
}
|
||||
}
|
||||
catch { /* ignore malformed presence */ }
|
||||
}
|
||||
|
||||
friends.Add(new
|
||||
{
|
||||
profile = new
|
||||
@@ -58,7 +77,7 @@ public class GetFriendList : ICloudScriptFunction<FYBaseSocialRequest, object?>
|
||||
displayName = player.DisplayName,
|
||||
avatarUrl = "",
|
||||
},
|
||||
onlineState = 0, // EYUserState — real presence tracking is a later phase
|
||||
onlineState,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user