mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-26 15:39:01 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RadicadeServer.API.Avatars.V2;
|
||||
using RadicadeServer.DB;
|
||||
using RadicadeServer.Extensions;
|
||||
|
||||
namespace RadicadeServer.API.Avatars;
|
||||
|
||||
[Route("outfits")]
|
||||
[Authorize]
|
||||
public class OutfitsAPI(RecDBContext db) : Controller
|
||||
{
|
||||
[HttpGet("me")]
|
||||
public async Task<IActionResult> GetCurrentOutfit()
|
||||
{
|
||||
if (User.GetUserId() == null) return Unauthorized();
|
||||
|
||||
var avatarApi = new AvatarV2(db) { ControllerContext = ControllerContext };
|
||||
var avatar = await avatarApi.GetLocalAvatar();
|
||||
if (avatar == null) return NotFound();
|
||||
|
||||
return Ok(new CurrentOutfitResponse
|
||||
{
|
||||
LegacyData = new LegacyOutfitData
|
||||
{
|
||||
SelectionsV1 = avatar.OutfitSelections,
|
||||
HairColor = avatar.HairColor,
|
||||
SkinColor = avatar.SkinColor,
|
||||
FaceFeatures = avatar.FaceFeatures
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CurrentOutfitResponse
|
||||
{
|
||||
public long DataVersion { get; init; }
|
||||
public LegacyOutfitData LegacyData { get; init; } = new();
|
||||
public string? CustomizationSettings { get; init; }
|
||||
public object[] Selections { get; init; } = [];
|
||||
public int Slot { get; init; }
|
||||
public string? Name { get; init; }
|
||||
public int Accessibility { get; init; }
|
||||
public string? ThumbnailFileName { get; init; }
|
||||
}
|
||||
|
||||
public sealed class LegacyOutfitData
|
||||
{
|
||||
public string? SelectionsV1 { get; init; }
|
||||
public string? SelectionsV2 { get; init; }
|
||||
public string? FaceFeatures { get; init; }
|
||||
public string? SkinColor { get; init; }
|
||||
public string? HairColor { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user