2018-02-07 00:19:06 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
using SharedLibrary.Database.Models;
|
|
|
|
|
|
|
|
|
|
namespace StatsPlugin.Models
|
|
|
|
|
{
|
|
|
|
|
public class EFClientStatistics : SharedEntity
|
|
|
|
|
{
|
|
|
|
|
[Key, Column(Order = 0)]
|
|
|
|
|
public int ClientId { get; set; }
|
|
|
|
|
[ForeignKey("ClientId")]
|
|
|
|
|
public virtual EFClient Client { get; set; }
|
|
|
|
|
[Key, Column(Order = 1)]
|
|
|
|
|
public int ServerId { get; set; }
|
|
|
|
|
[ForeignKey("ServerId")]
|
|
|
|
|
public virtual EFServer Server { get; set; }
|
|
|
|
|
[Required]
|
|
|
|
|
public int Kills { get; set; }
|
|
|
|
|
[Required]
|
|
|
|
|
public int Deaths { get; set; }
|
2018-03-06 02:22:19 -05:00
|
|
|
|
|
|
|
|
|
public virtual ICollection<EFHitLocationCount> HitLocations { get; set; }
|
|
|
|
|
|
2018-02-07 00:19:06 -05:00
|
|
|
|
[NotMapped]
|
|
|
|
|
public double KDR
|
|
|
|
|
{
|
2018-02-10 23:33:42 -05:00
|
|
|
|
get => Deaths == 0 ? Kills : Math.Round(Kills / (double)Deaths, 2);
|
2018-02-07 00:19:06 -05:00
|
|
|
|
}
|
|
|
|
|
[Required]
|
|
|
|
|
public double SPM { get; set; }
|
|
|
|
|
[Required]
|
|
|
|
|
public double Skill { get; set; }
|
2018-02-10 23:33:42 -05:00
|
|
|
|
[Required]
|
|
|
|
|
public int TimePlayed { get; set; }
|
2018-03-27 20:27:01 -04:00
|
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public float AverageHitOffset
|
|
|
|
|
{
|
2018-03-28 23:01:09 -04:00
|
|
|
|
get => (float)Math.Round(HitLocations.Sum(c => c.HitOffsetAverage) / Math.Max(1, HitLocations.Where(c => c.HitOffsetAverage > 0).Count()), 4);
|
2018-03-27 20:27:01 -04:00
|
|
|
|
}
|
2018-02-08 02:23:45 -05:00
|
|
|
|
[NotMapped]
|
|
|
|
|
public int SessionKills { get; set; }
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public int SessionDeaths { get; set; }
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public int KillStreak { get; set; }
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public int DeathStreak { get; set; }
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public DateTime LastStatCalculation { get; set; }
|
2018-02-09 02:21:25 -05:00
|
|
|
|
[NotMapped]
|
|
|
|
|
public int LastScore { get; set; }
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public DateTime LastActive { get; set; }
|
2018-03-06 02:22:19 -05:00
|
|
|
|
[NotMapped]
|
|
|
|
|
public int SessionScore { get; set; }
|
2018-02-07 00:19:06 -05:00
|
|
|
|
}
|
|
|
|
|
}
|