Build & Deploy / build (push) Successful in 39s
Audit of the emulator surface + 4 fixes:
- Fortuna pass level was frozen: nothing ever granted season XP. ClaimActiveContract
now grants + persists FortunaPass{2,3}_SeasonXp (scaled to the contract's reputation)
and returns the new total, so the pass level moves as you complete contracts.
- UpdateUserTitleDisplayName never persisted the rename (echoed back, lost on relog).
Added DbUserService.UpdateDisplayNameAsync and call it.
- GetPlayerSets returned a blank loadout; now reads the persisted LOADOUT key.
- GetCraftingInProgressData was a stub; now returns the persisted CraftingTimer so an
in-progress craft + remaining time survive a menu reopen/relog.
Remaining known gaps documented in Plane (need client data / multiplayer / out of scope).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
2.0 KiB
C#
46 lines
2.0 KiB
C#
using System.Text.Json;
|
|
using Prospect.Server.Api.Services.Auth.Extensions;
|
|
using Prospect.Server.Api.Services.CloudScript.Models;
|
|
using Prospect.Server.Api.Services.CloudScript.Models.Data;
|
|
using Prospect.Server.Api.Services.UserData;
|
|
|
|
namespace Prospect.Server.Api.Services.CloudScript.Functions;
|
|
|
|
[CloudScriptFunction("GetCraftingInProgressData")]
|
|
public class GetCraftingInProgressData : ICloudScriptFunction<FYGetCraftingInProgressDataRequest, FYGetCraftingInProgressDataResult>
|
|
{
|
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
|
private readonly UserDataService _userDataService;
|
|
|
|
public GetCraftingInProgressData(IHttpContextAccessor httpContextAccessor, UserDataService userDataService)
|
|
{
|
|
_httpContextAccessor = httpContextAccessor;
|
|
_userDataService = userDataService;
|
|
}
|
|
|
|
public async Task<FYGetCraftingInProgressDataResult> ExecuteAsync(FYGetCraftingInProgressDataRequest request)
|
|
{
|
|
var context = _httpContextAccessor.HttpContext;
|
|
if (context == null)
|
|
{
|
|
throw new CloudScriptException("CloudScript was not called within a http request");
|
|
}
|
|
|
|
var userId = context.User.FindAuthUserId();
|
|
|
|
// Return the persisted in-progress craft (written by StartItemCraftingClient)
|
|
// instead of an empty stub, so the crafting timer survives a menu reopen / relog.
|
|
var userData = await _userDataService.FindAsync(userId, userId, new List<string> { "CraftingTimer__2022_05_12" });
|
|
// Fully qualified: a different FYItemCurrentlyBeingCrafted also exists in this namespace.
|
|
var craft = JsonSerializer.Deserialize<Models.Data.FYItemCurrentlyBeingCrafted>(userData["CraftingTimer__2022_05_12"].Value)
|
|
?? new Models.Data.FYItemCurrentlyBeingCrafted();
|
|
|
|
return new FYGetCraftingInProgressDataResult
|
|
{
|
|
UserId = userId,
|
|
Error = string.Empty,
|
|
ItemCurrentlyBeingCrafted = craft,
|
|
};
|
|
}
|
|
}
|