Radicade Public Code

This commit is contained in:
JogmansonReal
2026-10-16 23:33:13 -07:00
commit 55175acdf6
832 changed files with 363261 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using RadicadeServer.DB;
using RadicadeServer.Extensions;
using RadicadeServer.RecNet.Enums.Store;
using RadicadeServer.RecNet.Responses;
using RadicadeServer.Utils;
namespace RadicadeServer.API.Storefront.V4;
[Route("api/storefronts/v4")]
[Route("econ/api/storefronts/v4")]
public class StorefrontsV4(RecDBContext db) : Controller
{
[HttpGet("balance/{type}"), Authorize]
public async Task<List<BalanceResponse>?> GetBalance(CurrencyType type)
{
var userId = User.GetUserId(); var data = await db.Currency.FirstOrDefaultAsync(x => x.AccountId == userId);
long balance;
if (type == CurrencyType.RecRoyale_Season1)
{
var progression = await db.Progression.FirstOrDefaultAsync(x => x.PlayerId == userId);
balance = progression == null ? 0 : LevelUpGiftService.XpIntoCurrentLevel(progression);
}
else
{
if (data == null) return [];
balance = type switch
{
CurrencyType.RecCenterTokens => data.RecTokens,
CurrencyType.LaserTagTickets => data.LaserTagTickets,
CurrencyType.LostSkullsGold => data.Gold,
CurrencyType.DraculaSilver => data.DraculaSilver,
_ => 0
};
}
return new List<BalanceResponse> { new() { CurrencyType = type, Balance = balance } };
}
}