mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-31 17:28:39 +00:00
Added three new categories to LBP3 (#567)
* Added three new categories to LBP3 * removed my comment in most hearted
This commit is contained in:
parent
e1f4eacde4
commit
67cfc29699
4 changed files with 86 additions and 0 deletions
|
@ -9,7 +9,10 @@ public static class CategoryHelper
|
|||
static CategoryHelper()
|
||||
{
|
||||
Categories.Add(new TeamPicksCategory());
|
||||
Categories.Add(new MostHeartedCategory());
|
||||
Categories.Add(new NewestLevelsCategory());
|
||||
Categories.Add(new MostPlayedCategory());
|
||||
Categories.Add(new HighestRatedCategory());
|
||||
Categories.Add(new QueueCategory());
|
||||
Categories.Add(new HeartedCategory());
|
||||
Categories.Add(new LuckyDipCategory());
|
||||
|
|
28
ProjectLighthouse/Levels/Categories/HighestRatedCategory.cs
Normal file
28
ProjectLighthouse/Levels/Categories/HighestRatedCategory.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Levels.Categories;
|
||||
|
||||
public class HighestRatedCategory : Category
|
||||
{
|
||||
Random rand = new();
|
||||
public override string Name { get; set; } = "Highest Rated";
|
||||
public override string Description { get; set; } = "Community Highest Rated content";
|
||||
public override string IconHash { get; set; } = "g820603";
|
||||
public override string Endpoint { get; set; } = "thumbs";
|
||||
public override Slot? GetPreviewSlot(Database database) => database.Slots.Where(s => s.Type == SlotType.User).AsEnumerable().OrderByDescending(s => s.Thumbsup).FirstOrDefault();
|
||||
public override IEnumerable<Slot> GetSlots
|
||||
(Database database, int pageStart, int pageSize)
|
||||
=> database.Slots.ByGameVersion(GameVersion.LittleBigPlanet3, false, true)
|
||||
.AsEnumerable()
|
||||
.OrderByDescending(s => s.Thumbsup)
|
||||
.ThenBy(_ => rand.Next())
|
||||
.Skip(Math.Max(0, pageStart - 1))
|
||||
.Take(Math.Min(pageSize, 20));
|
||||
public override int GetTotalSlots(Database database) => database.Slots.Count(s => s.Type == SlotType.User);
|
||||
}
|
27
ProjectLighthouse/Levels/Categories/MostHeartedCategory.cs
Normal file
27
ProjectLighthouse/Levels/Categories/MostHeartedCategory.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Levels.Categories;
|
||||
|
||||
public class MostHeartedCategory : Category
|
||||
{
|
||||
Random rand = new();
|
||||
public override string Name { get; set; } = "Most Hearted";
|
||||
public override string Description { get; set; } = "The Most Hearted Content";
|
||||
public override string IconHash { get; set; } = "g820607";
|
||||
public override string Endpoint { get; set; } = "mostHearted";
|
||||
public override Slot? GetPreviewSlot(Database database) => database.Slots.Where(s => s.Type == SlotType.User).AsEnumerable().OrderByDescending(s => s.Hearts).FirstOrDefault();
|
||||
public override IEnumerable<Slot> GetSlots
|
||||
(Database database, int pageStart, int pageSize)
|
||||
=> database.Slots.ByGameVersion(GameVersion.LittleBigPlanet3, false, true)
|
||||
.AsEnumerable()
|
||||
.OrderByDescending(s => s.Hearts)
|
||||
.ThenBy(_ => rand.Next())
|
||||
.Skip(Math.Max(0, pageStart - 1))
|
||||
.Take(Math.Min(pageSize, 20));
|
||||
public override int GetTotalSlots(Database database) => database.Slots.Count(s => s.Type == SlotType.User);
|
||||
}
|
28
ProjectLighthouse/Levels/Categories/MostPlayedCategory.cs
Normal file
28
ProjectLighthouse/Levels/Categories/MostPlayedCategory.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Levels.Categories;
|
||||
|
||||
public class MostPlayedCategory : Category
|
||||
{
|
||||
Random rand = new();
|
||||
public override string Name { get; set; } = "Most Played";
|
||||
public override string Description { get; set; } = "The most played content";
|
||||
public override string IconHash { get; set; } = "g820608";
|
||||
public override string Endpoint { get; set; } = "mostUniquePlays";
|
||||
public override Slot? GetPreviewSlot(Database database) => database.Slots.Where(s => s.Type == SlotType.User).AsEnumerable().OrderByDescending(s => s.PlaysUnique).FirstOrDefault();
|
||||
public override IEnumerable<Slot> GetSlots
|
||||
(Database database, int pageStart, int pageSize)
|
||||
=> database.Slots.ByGameVersion(GameVersion.LittleBigPlanet3, false, true)
|
||||
.AsEnumerable()
|
||||
.OrderByDescending(s => s.PlaysUnique)
|
||||
.ThenBy(_ => rand.Next())
|
||||
.Skip(Math.Max(0, pageStart - 1))
|
||||
.Take(Math.Min(pageSize, 20));
|
||||
public override int GetTotalSlots(Database database) => database.Slots.Count(s => s.Type == SlotType.User);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue