Added Lucky Dip to LBP3 & changed category desc (#551)

* Added Lucky Dip to LBP3 & changed category desc

* Changed "lbp2luckydip" to "luckydip"

* Fixed the tab

* Fixed the thing Slendy wanted me to fix lol

* Removed "Most Hearted" as i havent made it yet

Co-authored-by: Dagg <32235163+daggintosh@users.noreply.github.com>
This commit is contained in:
W0lf4llo 2022-11-06 16:01:06 -05:00 committed by GitHub
commit 505b5eb03b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 5 deletions

View file

@ -12,6 +12,7 @@ public static class CategoryHelper
Categories.Add(new NewestLevelsCategory());
Categories.Add(new QueueCategory());
Categories.Add(new HeartedCategory());
Categories.Add(new LuckyDipCategory());
using Database database = new();
foreach (DatabaseCategory category in database.CustomCategories) Categories.Add(new CustomCategory(category));

View file

@ -12,8 +12,8 @@ namespace LBPUnion.ProjectLighthouse.Levels.Categories;
public class HeartedCategory : CategoryWithUser
{
public override string Name { get; set; } = "My Hearted Levels";
public override string Description { get; set; } = "Levels you've hearted in the past";
public override string IconHash { get; set; } = "g820607";
public override string Description { get; set; } = "Content you've hearted";
public override string IconHash { get; set; } = "g820611";
public override string Endpoint { get; set; } = "hearted";
public override Slot? GetPreviewSlot(Database database, User user) // note: developer slots act up in LBP3 when listed here, so I omitted it
=> database.HeartedLevels.Where(h => h.UserId == user.UserId)

View file

@ -0,0 +1,25 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using LBPUnion.ProjectLighthouse.Extensions;
using LBPUnion.ProjectLighthouse.PlayerData;
using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Levels.Categories;
public class LuckyDipCategory : Category
{
public override string Name { get; set; } = "Lucky Dip";
public override string Description { get; set; } = "Randomized uploaded content";
public override string IconHash { get; set; } = "g820605";
public override string Endpoint { get; set; } = "lbp2luckydip";
public override Slot? GetPreviewSlot(Database database) => database.Slots.Where(s => s.Type == SlotType.User).OrderByDescending(_ => EF.Functions.Random()).FirstOrDefault();
public override IEnumerable<Slot> GetSlots
(Database database, int pageStart, int pageSize)
=> database.Slots.ByGameVersion(GameVersion.LittleBigPlanet3, false, true)
.OrderByDescending(_ => EF.Functions.Random())
.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);
}

View file

@ -10,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Levels.Categories;
public class NewestLevelsCategory : Category
{
public override string Name { get; set; } = "Newest Levels";
public override string Description { get; set; } = "Levels recently published";
public override string Description { get; set; } = "The most recently published content";
public override string IconHash { get; set; } = "g820623";
public override string Endpoint { get; set; } = "newest";
public override Slot? GetPreviewSlot(Database database) => database.Slots.Where(s => s.Type == SlotType.User).OrderByDescending(s => s.FirstUploaded).FirstOrDefault();

View file

@ -12,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Levels.Categories;
public class QueueCategory : CategoryWithUser
{
public override string Name { get; set; } = "My Queue";
public override string Description { get; set; } = "Your queued levels";
public override string Description { get; set; } = "Your queued content";
public override string IconHash { get; set; } = "g820614";
public override string Endpoint { get; set; } = "queue";
public override Slot? GetPreviewSlot(Database database, User user)

View file

@ -10,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Levels.Categories;
public class TeamPicksCategory : Category
{
public override string Name { get; set; } = "Team Picks";
public override string Description { get; set; } = "Levels given awards by your instance admin";
public override string Description { get; set; } = "Community Team Picks";
public override string IconHash { get; set; } = "g820626";
public override string Endpoint { get; set; } = "team_picks";
public override Slot? GetPreviewSlot(Database database) => database.Slots.OrderByDescending(s => s.FirstUploaded).FirstOrDefault(s => s.TeamPick);