mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-23 01:42:24 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
48 lines
No EOL
1.6 KiB
C#
Executable file
48 lines
No EOL
1.6 KiB
C#
Executable file
using FSO.Common.Utils;
|
|
using FSO.Server.Api.Core.Utils;
|
|
using FSO.Server.Protocol.CitySelector;
|
|
using Microsoft.AspNetCore.Cors;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Net;
|
|
|
|
namespace FSO.Server.Api.Core.Controllers
|
|
{
|
|
[EnableCors]
|
|
[Route("cityselector/app/AvatarDataServlet")]
|
|
[ApiController]
|
|
public class AvatarDataController : ControllerBase
|
|
{
|
|
public IActionResult Get()
|
|
{
|
|
var api = Api.INSTANCE;
|
|
var user = api.RequireAuthentication(Request);
|
|
|
|
var result = new XMLList<AvatarData>("The-Sims-Online");
|
|
|
|
using (var db = api.DAFactory.Get())
|
|
{
|
|
var avatars = db.Avatars.GetSummaryByUserId(user.UserID);
|
|
|
|
foreach (var avatar in avatars)
|
|
{
|
|
result.Add(new AvatarData
|
|
{
|
|
ID = avatar.avatar_id,
|
|
Name = avatar.name,
|
|
ShardName = api.Shards.GetById(avatar.shard_id).Name,
|
|
HeadOutfitID = avatar.head,
|
|
BodyOutfitID = avatar.body,
|
|
AppearanceType = (AvatarAppearanceType)Enum.Parse(typeof(AvatarAppearanceType), avatar.skin_tone.ToString()),
|
|
Description = avatar.description,
|
|
LotId = avatar.lot_id,
|
|
LotName = avatar.lot_name,
|
|
LotLocation = avatar.lot_location
|
|
});
|
|
}
|
|
}
|
|
|
|
return ApiResponse.Xml(HttpStatusCode.OK, result);
|
|
}
|
|
}
|
|
} |