mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 10:08:39 +00:00
parent
087958155d
commit
1bbff41196
2 changed files with 39 additions and 0 deletions
|
@ -117,6 +117,12 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
|
||||
slot.GameVersion = gameToken.GameVersion;
|
||||
|
||||
if (slot.MinimumPlayers == 0 || slot.MaximumPlayers == 0)
|
||||
{
|
||||
slot.MinimumPlayers = 1;
|
||||
slot.MaximumPlayers = 4;
|
||||
}
|
||||
|
||||
this.database.Entry(oldSlot).CurrentValues.SetValues(slot);
|
||||
await this.database.SaveChangesAsync();
|
||||
return this.Ok(oldSlot.Serialize());
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
||||
{
|
||||
public class FixAllBrokenPlayerRequirementsMaintenanceJob : IMaintenanceJob
|
||||
{
|
||||
private readonly Database database = new();
|
||||
|
||||
public string Name() => "Fix All Broken Player Requirements";
|
||||
public string Description() => "Some LBP1 levels may report that they are designed for 0 players. This job will fix that.";
|
||||
public async Task Run()
|
||||
{
|
||||
int count = 0;
|
||||
await foreach (Slot slot in this.database.Slots)
|
||||
{
|
||||
if (slot.MinimumPlayers == 0 || slot.MaximumPlayers == 0)
|
||||
{
|
||||
slot.MinimumPlayers = 1;
|
||||
slot.MaximumPlayers = 4;
|
||||
|
||||
Console.WriteLine($"Fixed slotId {slot.SlotId}");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
Console.WriteLine($"Fixed {count} broken player requirements.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue