mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-16 06:32:28 +00:00
* Player count shows per game * Fixed LBP3 categories lagigng & StatisticsHelper Co-authored-by: koko <sudokoko@users.noreply.github.com> * Fixed "planetStats" mmPicksCount * Hopefully the final update to this PR! (Bug fixes) * Update ProjectLighthouse/Types/Entities/Level/Slot.cs Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com> * Update ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs I'm trusting you that nothing breaks here lol Co-authored-by: Josh <josh@slendy.pw> * Update ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs bad slendy >:( Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com> --------- Co-authored-by: koko <sudokoko@users.noreply.github.com> Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com> Co-authored-by: Josh <josh@slendy.pw>
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using LBPUnion.ProjectLighthouse.Database;
|
|
using LBPUnion.ProjectLighthouse.Helpers;
|
|
using LBPUnion.ProjectLighthouse.Serialization;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using LBPUnion.ProjectLighthouse.Extensions;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers;
|
|
|
|
[ApiController]
|
|
[Authorize]
|
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
|
[Produces("text/plain")]
|
|
public class StatisticsController : ControllerBase
|
|
{
|
|
|
|
private readonly DatabaseContext database;
|
|
|
|
public StatisticsController(DatabaseContext database)
|
|
{
|
|
this.database = database;
|
|
}
|
|
|
|
[HttpGet("playersInPodCount")]
|
|
public IActionResult PlayersInPodCount() => this.Ok((StatisticsHelper.UserCountInPod(this.database)).ToString());
|
|
|
|
[HttpGet("totalPlayerCount")]
|
|
public async Task<IActionResult> TotalPlayerCount() => this.Ok((await StatisticsHelper.RecentMatchesForGame(this.database, this.GetToken().GameVersion)).ToString());
|
|
|
|
[HttpGet("planetStats")]
|
|
public async Task<IActionResult> PlanetStats()
|
|
{
|
|
int totalSlotCount = await StatisticsHelper.SlotCountForGame(this.database, this.GetToken().GameVersion);
|
|
int mmPicksCount = await StatisticsHelper.TeamPickCountForGame(this.database, this.GetToken().GameVersion);
|
|
|
|
return this.Ok
|
|
(
|
|
LbpSerializer.StringElement
|
|
("planetStats", LbpSerializer.StringElement("totalSlotCount", totalSlotCount) + LbpSerializer.StringElement("mmPicksCount", mmPicksCount))
|
|
);
|
|
}
|
|
|
|
[HttpGet("planetStats/totalLevelCount")]
|
|
public async Task<IActionResult> TotalLevelCount() => this.Ok((await StatisticsHelper.SlotCountForGame(this.database, this.GetToken().GameVersion)).ToString());
|
|
}
|