From c98094cf38e34dfd98cc1d40f4d2dbb325e3e8b0 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 7 Nov 2021 22:00:34 -0500 Subject: [PATCH] Implement user heart count --- ProjectLighthouse/Types/User.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 5984b3d7..dec3dc2c 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -62,6 +62,14 @@ namespace LBPUnion.ProjectLighthouse.Types public string PlanetHash { get; set; } = ""; + public int Hearts { + get { + using Database database = new(); + + return database.HeartedProfiles.Count(s => s.HeartedUserId == this.UserId); + } + } + public string Serialize() { string user = LbpSerializer.TaggedStringElement("npHandle", this.Username, "icon", this.IconHash) + @@ -88,7 +96,8 @@ namespace LBPUnion.ProjectLighthouse.Types LbpSerializer.StringElement("staffChallengeBronzeCount", this.StaffChallengeBronzeCount) + LbpSerializer.StringElement("planets", this.PlanetHash) + LbpSerializer.BlankElement("photos") + - this.ClientsConnected.Serialize(); + LbpSerializer.StringElement("heartCount", Hearts); + this.ClientsConnected.Serialize(); return LbpSerializer.TaggedStringElement("user", user, "type", "user"); }