Update UserStatistics.cs

This commit is contained in:
yeziuku 2023-10-24 16:48:03 +08:00 committed by GitHub
parent e013baced6
commit ce16437321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,22 +4,114 @@ namespace Milimoe.FunGame.Core.Entity
{
public class UserStatistics
{
/**
* Key为赛季(long)key代表第key赛季key = 0
*/
public int Id { get; set; }
public User? User { get; set; } = null;
public Hashtable? DamageStats { get; set; } = new Hashtable();
public Hashtable? PhysicalDamageStats { get; set; } = new Hashtable();
public Hashtable? MagicDamageStats { get; set; } = new Hashtable();
public Hashtable? RealDamageStats { get; set; } = new Hashtable();
public Hashtable? AvgDamageStats { get; set; } = new Hashtable();
public Hashtable? KillStats { get; set; } = new Hashtable();
public Hashtable? DeathStats { get; set; } = new Hashtable();
public Hashtable? AssistStats { get; set; } = new Hashtable();
public Hashtable? Plays { get; set; } = new Hashtable();
public Hashtable? Wins { get; set; } = new Hashtable();
public Hashtable? Loses { get; set; } = new Hashtable();
public Hashtable? Winrates { get; set; } = new Hashtable();
public Hashtable? RatingStats { get; set; } = new Hashtable();
public Hashtable? EloStats { get; set; } = new Hashtable();
public Hashtable? RankStats { get; set; } = new Hashtable();
public User User { get; set; } = new User();
public Dictionary<long, decimal> DamageStats { get; set; } = new Dictionary<long, decimal>();
public Dictionary<long, decimal> PhysicalDamageStats { get; set; } = new Dictionary<long, decimal>();
public Dictionary<long, decimal> MagicDamageStats { get; set; } = new Dictionary<long, decimal>();
public Dictionary<long, decimal> RealDamageStats { get; set; } = new Dictionary<long, decimal>();
public Dictionary<long, decimal> AvgDamageStats
{
get
{
Dictionary<long, decimal> avgdamage = new Dictionary<long, decimal>();
foreach (long key in Plays.Keys)
{
long plays = Plays[key];
decimal total = 0;
if (DamageStats.ContainsKey(key))
{
total = DamageStats.Values.Sum();
}
avgdamage.Add(key, total / plays);
}
return avgdamage;
}
}
public Dictionary<long, decimal> AvgPhysicalDamageStats
{
get
{
Dictionary<long, decimal> avgdamage = new Dictionary<long, decimal>();
foreach (long key in Plays.Keys)
{
long plays = Plays[key];
decimal total = 0;
if (PhysicalDamageStats.ContainsKey(key))
{
total = PhysicalDamageStats.Values.Sum();
}
avgdamage.Add(key, total / plays);
}
return avgdamage;
}
}
public Dictionary<long, decimal> AvgMagicDamageStats
{
get
{
Dictionary<long, decimal> avgdamage = new Dictionary<long, decimal>();
foreach (long key in Plays.Keys)
{
long plays = Plays[key];
decimal total = 0;
if (MagicDamageStats.ContainsKey(key))
{
total = MagicDamageStats.Values.Sum();
}
avgdamage.Add(key, total / plays);
}
return avgdamage;
}
}
public Dictionary<long, decimal> AvgRealDamageStats
{
get
{
Dictionary<long, decimal> avgdamage = new Dictionary<long, decimal>();
foreach (long key in Plays.Keys)
{
long plays = Plays[key];
decimal total = 0;
if (RealDamageStats.ContainsKey(key))
{
total = RealDamageStats.Values.Sum();
}
avgdamage.Add(key, total / plays);
}
return avgdamage;
}
}
public Dictionary<long, long> Kills { get; set; } = new Dictionary<long, long>();
public Dictionary<long, long> Deaths { get; set; } = new Dictionary<long, long>();
public Dictionary<long, long> Assists { get; set; } = new Dictionary<long, long>();
public Dictionary<long, long> Plays { get; set; } = new Dictionary<long, long>();
public Dictionary<long, long> Wins { get; set; } = new Dictionary<long, long>();
public Dictionary<long, long> Loses { get; set; } = new Dictionary<long, long>();
public Dictionary<long, decimal> Winrates
{
get
{
Dictionary<long, decimal> winrates = new Dictionary<long, decimal>();
foreach (long key in Plays.Keys)
{
long plays = Plays[key];
long wins = 0;
if (Wins.ContainsKey(key))
{
wins = Wins[key];
}
winrates.Add(key, wins / plays * 0.01M);
}
return winrates;
}
}
public Dictionary<string, decimal> RatingStats { get; set; } = new Dictionary<string, decimal>();
public Dictionary<string, decimal> EloStats { get; set; } = new Dictionary<string, decimal>();
public Dictionary<string, string> RankStats { get; set; } = new Dictionary<string, string>();
}
}