Implement user heart count

This commit is contained in:
jvyden 2021-11-07 22:00:34 -05:00
commit c98094cf38
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -62,6 +62,14 @@ namespace LBPUnion.ProjectLighthouse.Types
public string PlanetHash { get; set; } = ""; 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() public string Serialize()
{ {
string user = LbpSerializer.TaggedStringElement("npHandle", this.Username, "icon", this.IconHash) + string user = LbpSerializer.TaggedStringElement("npHandle", this.Username, "icon", this.IconHash) +
@ -88,6 +96,7 @@ namespace LBPUnion.ProjectLighthouse.Types
LbpSerializer.StringElement("staffChallengeBronzeCount", this.StaffChallengeBronzeCount) + LbpSerializer.StringElement("staffChallengeBronzeCount", this.StaffChallengeBronzeCount) +
LbpSerializer.StringElement("planets", this.PlanetHash) + LbpSerializer.StringElement("planets", this.PlanetHash) +
LbpSerializer.BlankElement("photos") + LbpSerializer.BlankElement("photos") +
LbpSerializer.StringElement("heartCount", Hearts);
this.ClientsConnected.Serialize(); this.ClientsConnected.Serialize();
return LbpSerializer.TaggedStringElement("user", user, "type", "user"); return LbpSerializer.TaggedStringElement("user", user, "type", "user");