mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-22 17:29:10 +00:00
Support playcount migration and fix unexpected null reference for creator name
This commit is contained in:
parent
9dad2bce4d
commit
81befb4cd8
1 changed files with 49 additions and 3 deletions
|
@ -52,6 +52,12 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
||||||
[ForeignKey(nameof(CreatorId))]
|
[ForeignKey(nameof(CreatorId))]
|
||||||
public User Creator { get; set; }
|
public User Creator { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public string CreatorName
|
||||||
|
{
|
||||||
|
get => this.Creator?.Username;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location of the level on the creator's earth
|
/// The location of the level on the creator's earth
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -109,7 +115,36 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int Plays { get; set; }
|
[NotMapped]
|
||||||
|
public int Plays { get => this.PlaysLBP1 + this.PlaysLBP2 + this.PlaysLBP3; }
|
||||||
|
[XmlIgnore]
|
||||||
|
[NotMapped]
|
||||||
|
public int PlaysUnique { get => this.PlaysLBP1Unique + this.PlaysLBP2Unique + this.PlaysLBP3Unique; }
|
||||||
|
[XmlIgnore]
|
||||||
|
[NotMapped]
|
||||||
|
public int PlaysComplete { get => this.PlaysLBP1Complete + this.PlaysLBP2Complete + this.PlaysLBP3Complete; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP1 { get; set; }
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP1Complete { get; set; }
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP1Unique { get; set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP2 { get; set; }
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP2Complete { get; set; }
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP2Unique { get; set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP3 { get; set; }
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP3Complete { get; set; }
|
||||||
|
[XmlIgnore]
|
||||||
|
public int PlaysLBP3Unique { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string SerializeResources()
|
public string SerializeResources()
|
||||||
{
|
{
|
||||||
|
@ -121,7 +156,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
||||||
string slotData = LbpSerializer.StringElement("name", this.Name) +
|
string slotData = LbpSerializer.StringElement("name", this.Name) +
|
||||||
LbpSerializer.StringElement("id", this.SlotId) +
|
LbpSerializer.StringElement("id", this.SlotId) +
|
||||||
LbpSerializer.StringElement("game", (int)this.GameVersion) +
|
LbpSerializer.StringElement("game", (int)this.GameVersion) +
|
||||||
LbpSerializer.StringElement("npHandle", this.Creator.Username) +
|
LbpSerializer.StringElement("npHandle", this.CreatorName) +
|
||||||
LbpSerializer.StringElement("description", this.Description) +
|
LbpSerializer.StringElement("description", this.Description) +
|
||||||
LbpSerializer.StringElement("icon", this.IconHash) +
|
LbpSerializer.StringElement("icon", this.IconHash) +
|
||||||
LbpSerializer.StringElement("rootLevel", this.RootLevel) +
|
LbpSerializer.StringElement("rootLevel", this.RootLevel) +
|
||||||
|
@ -139,7 +174,18 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
||||||
LbpSerializer.StringElement("lastUpdated", this.LastUpdated) +
|
LbpSerializer.StringElement("lastUpdated", this.LastUpdated) +
|
||||||
LbpSerializer.StringElement("mmpick", this.TeamPick) +
|
LbpSerializer.StringElement("mmpick", this.TeamPick) +
|
||||||
LbpSerializer.StringElement("heartCount", this.Hearts) +
|
LbpSerializer.StringElement("heartCount", this.Hearts) +
|
||||||
LbpSerializer.StringElement("playCount", this.Plays);
|
LbpSerializer.StringElement("playCount", this.Plays) +
|
||||||
|
LbpSerializer.StringElement("uniquePlayCount", this.PlaysLBP2Unique) + // ??? good naming scheme lol
|
||||||
|
LbpSerializer.StringElement("completionCount", this.PlaysComplete) +
|
||||||
|
LbpSerializer.StringElement("lbp1PlayCount", this.PlaysLBP1) +
|
||||||
|
LbpSerializer.StringElement("lbp1CompletionCount", this.PlaysLBP1Complete) +
|
||||||
|
LbpSerializer.StringElement("lbp1UniquePlayCount", this.PlaysLBP1Unique) +
|
||||||
|
LbpSerializer.StringElement("lbp2PlayCount", this.PlaysLBP2) +
|
||||||
|
LbpSerializer.StringElement("lbp2CompletionCount", this.PlaysLBP2Complete) +
|
||||||
|
LbpSerializer.StringElement("lbp2UniquePlayCount", this.PlaysLBP2Unique) + // not actually used ingame, as per above comment
|
||||||
|
LbpSerializer.StringElement("lbp3PlayCount", this.PlaysLBP3) +
|
||||||
|
LbpSerializer.StringElement("lbp3CompletionCount", this.PlaysLBP3Complete) +
|
||||||
|
LbpSerializer.StringElement("lbp3UniquePlayCount", this.PlaysLBP3Unique);
|
||||||
|
|
||||||
return LbpSerializer.TaggedStringElement("slot", slotData, "type", "user");
|
return LbpSerializer.TaggedStringElement("slot", slotData, "type", "user");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue