mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-03 18:48:40 +00:00
Remove 7 player mode and show your playlists in LBP3
This commit is contained in:
parent
8d034db465
commit
2949e83e01
4 changed files with 41 additions and 6 deletions
|
@ -102,7 +102,7 @@ public class ActivityController : ControllerBase
|
|||
|
||||
predicate = predicate.Or(dto => includedUserIds.Contains(dto.Activity.UserId));
|
||||
|
||||
if (!excludeMyPlaylists)
|
||||
if (!excludeMyPlaylists && !excludeMyself && token.GameVersion == GameVersion.LittleBigPlanet3)
|
||||
{
|
||||
List<int> creatorPlaylists = await this.database.Playlists.Where(p => p.CreatorId == token.UserId)
|
||||
.Select(p => p.PlaylistId)
|
||||
|
|
|
@ -1,6 +1,39 @@
|
|||
namespace ProjectLighthouse.Tests.GameApiTests.Unit.Controllers;
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers;
|
||||
using LBPUnion.ProjectLighthouse.Tests.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization.Activity;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Xunit;
|
||||
|
||||
namespace ProjectLighthouse.Tests.GameApiTests.Unit.Controllers;
|
||||
|
||||
[Trait("Category", "Unit")]
|
||||
public class ActivityControllerTests
|
||||
{
|
||||
private static void SetupToken(ControllerBase controller, GameVersion version)
|
||||
{
|
||||
GameTokenEntity token = MockHelper.GetUnitTestToken();
|
||||
token.GameVersion = version;
|
||||
controller.SetupTestController(token);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LBP2GlobalActivity_ShouldReturnNothing_WhenEmpty()
|
||||
{
|
||||
DatabaseContext database = await MockHelper.GetTestDatabase();
|
||||
ActivityController activityController = new(database);
|
||||
SetupToken(activityController, GameVersion.LittleBigPlanet2);
|
||||
|
||||
long timestamp = TimeHelper.TimestampMillis;
|
||||
|
||||
IActionResult response = await activityController.GlobalActivity(timestamp, 0, false, false, false, false, false);
|
||||
GameStream stream = response.CastTo<OkObjectResult, GameStream>();
|
||||
Assert.Null(stream.Groups);
|
||||
Assert.Equal(timestamp, stream.StartTimestamp);
|
||||
}
|
||||
//TODO write activity controller tests
|
||||
}
|
|
@ -140,8 +140,6 @@ public class ActivityEntityEventHandler : IEntityEventHandler
|
|||
{
|
||||
if (origEntity is not VisitedLevelEntity oldVisitedLevel) break;
|
||||
|
||||
int Plays(VisitedLevelEntity entity) => entity.PlaysLBP1 + entity.PlaysLBP2 + entity.PlaysLBP3;
|
||||
|
||||
if (Plays(oldVisitedLevel) >= Plays(visitedLevel)) break;
|
||||
|
||||
activity = new LevelActivityEntity
|
||||
|
@ -151,6 +149,8 @@ public class ActivityEntityEventHandler : IEntityEventHandler
|
|||
UserId = visitedLevel.UserId,
|
||||
};
|
||||
break;
|
||||
|
||||
int Plays(VisitedLevelEntity entity) => entity.PlaysLBP1 + entity.PlaysLBP2 + entity.PlaysLBP3;
|
||||
}
|
||||
case SlotEntity slotEntity:
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
@ -17,6 +18,7 @@ public class GameScoreEvent : GameEvent
|
|||
[XmlElement("score")]
|
||||
public int Score { get; set; }
|
||||
|
||||
[DefaultValue(0)]
|
||||
[XmlElement("user_count")]
|
||||
public int UserCount { get; set; }
|
||||
|
||||
|
@ -32,7 +34,7 @@ public class GameScoreEvent : GameEvent
|
|||
|
||||
this.Score = score.Points;
|
||||
//TODO is this correct?
|
||||
this.UserCount = score.Type;
|
||||
this.UserCount = score.Type == 7 ? 0 : score.Type;
|
||||
|
||||
this.Slot = ReviewSlot.CreateFromEntity(slot);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue